News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

cpctelera memory problems

Started by luckpro, 10:45, 31 July 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

luckpro


Hi, I'm trying to make my first cpc game with a cpctelera. Everything was going very well until I encountered this problem and I have no idea what is happening.

The project has grown and there has come a point when starting the game fails.

I detected that the moment has been going from memory address 8000

Binary file start = 00004000
Records start = 00004000
Highest address = 0000809B
Pad Byte = 0

When testing with winape I detected that from 8000 I have code and debugger only show zeros from that address. I even have symbols of methods pointing to those zeros.

I have tried to configure so that it begins to write from 0040 as show some example but the result is similar.

It seems the cpc not load complete bin file.



Any ideas?

Can not use memory from 8000 to C000?

Do we have to do something special to use this memory?


Another question I have is why does the bin file in my operating system have 17 kb but in the amstrad it occupies 44 kb?


according to my map file I have this ...

00007F6A _cpct_drawSolidBox cpct_sprites
     00008022 _cpct_mode_rom_status cpct_firmware
     00008023 _cpct_getScreenPtr cpct_video
     00008043 _cpct_scanKeyboard cpct_keyboard
ASxxxx Linker V03.00 + NoICE + sdld, page 4.
Hexadecimal [32-Bits]

Area Addr Size Decimal Bytes (Attributes)
-------------------------------- ---- ---- ------- --- - ------------
_CODE 00004000 0000409C = 16540. bytes (REL, CON)

      Value Global Global Defined In Module
      ----- -------------------------------- ------------- -----------
     00008043 cpct_scanKeyboard_asm cpct_keyboard
     00008074 _cpct_setInterruptHandler cpct_firmware
     00008074 cpct_setInterruptHandler_asm cpct_firmware
     00008085 cpct_safeInterruptHandlerHook cpct_firmware

and in the winape I look for those symbols and _cpct_drawSolidBox seems to be fine but from then on I only have zeros.

Thanks in advance.

ervin

Hi luckpro.

That sounds very odd.
Please zip up the entire project folder and upload it, and I'll take a look.

Arnaud

Hi @luckpro,
try the following command :

make cleanall all

It can solves the wrong binary size.

luckpro

omg...  :picard:  noob fail, sorry.


cleanall works like a charm, thanks a lot Arnaud and ervin.


Now the bin file size is the same at windows and cpc and run perfect.


Another cuestion that scracth me is, programing guide tells...


http://www.cpcwiki.eu/index.php/Source_Codes


Memory range for programs is &0040-&a700. This avoids firmware and memory allocated by AMSDOS disc ROM.

is posible use that memory range with cpctelera without problems? i need adjust my scene arrays to size avaiable.

ronaldo

Quote from: luckpro on 10:45, 31 July 18
I have tried to configure so that it begins to write from 0040 as show some example but the result is similar.

It seems the cpc not load complete bin file.

If you want to configure the default loading address, just edit cfg/build_config.mk. There you will found Z80CODELOC. Set it to 0040 and your binary will be produced and loaded into that address. Remember that you will have to completely rebuild the project after any change to your mk files. Proceed then with "make cleanall && make" to perform a complete clean rebuild.



Quote from: luckpro on 10:45, 31 July 18
Can not use memory from 8000 to C000?

Do we have to do something special to use this memory?

Another question I have is why does the bin file in my operating system have 17 kb but in the amstrad it occupies 44 kb?


CPCtelera is not a resident software nor anything of the like. It only helps you produce your own binary. The only restrictions you will find are from the way the CPC works (video memory, stack, interrupt vector, firmware, ROM) or from your own program. Nothing else prevents you from using any part of the memory. Particularly, there is nothing special at 0x8000 on a standard configuration, unless you set the stack to be there or use it as screen backbuffer, but those things have to be made on purpose.

If you are experimenting problems like the one you describe, there are 2 main possibilities :

1. Some mistake you made that drives part of your code into overwriting memory you didn't want to. You may think this is not the case, but I can assure you this is horribly common. It happens many many times and 99.99% is a programmer's mistake.

2. If you are using CPCtelera 1.4.2, idsk version included has a known bug that happens erratically. Idsk is used to produce the DSK file and include binary in it. On consecutive uses of make, same binary is included in the DSK file, overwriting previous version. It seems that the DSK gets corrupted after several overwrites, producing erratic behaviour. That could be the reason for your 44k file. Solution is simple: use "make cleanall && make" to produce a complete clean rebuild that will create a new DSK file. Otherwise, you could simply delete DSK file and it will be recreated (this second option is better for projects that take long to compile and is done automatically by new versions of CPCtelera). If this is happening, it is also easy to spot: load from the CDT and see if it works. If CDT works, you have a corrupted DSK.


Hope this helps you better understand how things work.

Arnaud

Quote from: luckpro on 16:17, 31 July 18
omg...  :picard:  noob fail, sorry.
No problem, and it's not obvious  ;)
if you encounter other problems or have questions do not hesitate.

luckpro

Cleared up. Thank you all, I hope can show you something good soon.

Powered by SMFPacks Menu Editor Mod