Оберон-клуб «ВЄДАsoft» https://zx.oberon.org/forum/ |
|
pointers on spectrum https://zx.oberon.org/forum/viewtopic.php?f=10&t=121 |
Страница 1 из 2 |
Автор: | slenkar [ 16 июн 2013, 02:16 ] |
Заголовок сообщения: | pointers on spectrum |
this doesnt seem to compile It gets translated but then SDCC complains Obj/hi.c:26: error 101: too many parameters which is: __NEW(myptr, gamesquare__2); Код: "OBERON"
|
Автор: | Zorko [ 16 июн 2013, 17:32 ] |
Заголовок сообщения: | Re: pointers on spectrum |
Yes, the tagged Oberon pointers and a garbage collector is not implemented for Z80 CPU. If you have an idea how to do it, please tell me. ![]() Instead of this just try to use manual memory allocating/deallocating and untagged pointers: Код: "OBERON"
Код: "OBERON"
To implement NEW we need to write SYSTEM_NEWREC and SYSTEM_NEWARR that use low-level procedure SYSTEM_NEWBLK that can be implemented, for example, so: Код: "C" /*--------------------------------- Cut here ---------------------------------*/ |
Автор: | slenkar [ 16 июн 2013, 21:08 ] |
Заголовок сообщения: | Re: pointers on spectrum |
aha ok thanks to allocate a record I do NEW(ptr,sizeof(record)) ? Just out of curiosity.... How does OFRONT know not to put garbage collection into the spectrum? does Oberon use the garbage collection of the system? (system.h?) |
Автор: | Zorko [ 16 июн 2013, 21:50 ] |
Заголовок сообщения: | Re: pointers on spectrum |
slenkar писал(а): to allocate a record I do NEW(ptr,sizeof(record)) ? Код: "OBERON"
slenkar писал(а): How does OFRONT know not to put garbage collection into the spectrum? Ofront collects the garbage not in each moment, and only if you allocate memory, the runtime search for free blocks and try to re-use its.does Oberon use the garbage collection of the system? (system.h?) If you don't use NEW and pointers at all in your Spectrum program, or use only untagged pointers (Ptr = POINTER [1] TO ...) with manual allocating, garbage collection do not invoked. Perhaps we would be able to implement a simple garbage collection for Z80 and ZX Spectrum 48K too, and maybe even a dynamic modularity with loading/unloading packed modules from tape, TR DOS disk or 128K memory pages, but we need to think seriously about develop the Oberon-runtime kernel for Z80. |
Автор: | slenkar [ 05 июл 2013, 21:59 ] |
Заголовок сообщения: | Re: pointers on spectrum |
so records cannot be created and arrays cant be resized? I would like to keep track of what square is in what room to create corridors. But after the map is created I dont need this information anymore so I can free the memory to hold other information like monsters. |
Автор: | Zorko [ 05 июл 2013, 22:07 ] |
Заголовок сообщения: | Re: pointers on spectrum |
slenkar писал(а): so records cannot be created? You can declare and use non-dynamic records:Код: "OBERON"
But it is a non-Oberon pointer, and internal, for system usage. slenkar писал(а): but arrays can be resized? Non-dynamic arrays cannot be resized. Only dynamic.Yes, I know - we need to have a simple way to use dynamic records and arrays. Do you know how SDCC's memory manager works with malloc/free? |
Автор: | slenkar [ 06 июл 2013, 01:23 ] |
Заголовок сообщения: | Re: pointers on spectrum |
no, I dont know much about C or C++ sorry |
Автор: | Zorko [ 06 июл 2013, 09:19 ] |
Заголовок сообщения: | Re: pointers on spectrum |
I think everyone who uses Linux knows all about C/C++ ![]() Well, give me a few days, I'll try to develop this work line. |
Автор: | slenkar [ 06 июл 2013, 17:39 ] |
Заголовок сообщения: | Re: pointers on spectrum |
ok I know a tiny amount ![]() just how to compile C and some logic |
Автор: | Zorko [ 14 июл 2013, 22:41 ] | ||
Заголовок сообщения: | Re: pointers on spectrum | ||
Probably the best C coder for us is Ofront. ![]() slenkar, I remember my promise, and this code must work for Speccy too, but I have some problems with malloc under ZX: Код: "C" #include <malloc.h>
|
Страница 1 из 2 | Часовой пояс: UTC + 2 часа |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |