News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_jonesypeter

Digger By Paul Benedict

Started by jonesypeter, 17:58, 10 January 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jonesypeter

Hi,


I'm looking at a program called Digger by Paul Benedict from the second edition of Computing With the Amstrad.


It contains a small machine code routine which I have dissembled.


I'm not a machine code expert (I can do a little, and my experience is on the Spectrum).  I'm assuming the CALL #AB2D is calling a ROM route at that address?


I'm happy to do my own digging, but could anyone point me in the right direction please?


The magazine is here, and the listing starts on page 34.


Many thanks


Peter







m_dr_m

Nope AB2D is a sub-routine in this exact program (see addresses on left column).


The used zone overwrite BASIC work area. Not an issue if you're not using BASIC anymore.



jonesypeter

#2
Thanks @m_dr_m


I should have noticed that!





So the parameters from the call instruction (Which I imagine are the position of the characters) are being placed into B & E Registers via the indexed addressing, then something is happening (yet to be determined, but just found c000 is the start of the video memory) at #AB2D. Its interesting, I'm used to using a $ to indicate a hex number.







pelrun

#3
I'd recommend getting the version off CPC Power, it's been patched so it'll actually run on a disk machine.  :laugh:
https://www.cpc-power.com/index.php?page=detail&num=2947
This is a slightly odd sprite routine - basically all the sprites are drawn directly into the video memory at their initial positions, and then whenever the man or a bug moves, it uses the machine code routine to copy whatever is drawn at the old position to the new one, and then clears the old position. The subroutine at &AB2D is calculating the video memory position of the top line of a character cell: &c000+&50*y+4*x.
Also, the CPC video memory is really weirdly laid out, so the next line on the screen is actually &800 below the first one (which is why you see that number at &AB14)... which only works for 8 lines before you run off the end of memory and have to wrap around, but for this game which only uses character cells it's not a problem.

jonesypeter

Thank you @pelrun


I appreciate the very explanation of the screen memory layout.  The ZX Spectrum screen is similar, but more complex as it splits the display into 3 sections.


May I ask what the advantage using machine code for this rather that the locate command and printing that way.  Is it much quicker?


Many thanks

pelrun

Using the text routines would limit you to monochrome graphics; the sprites here are full colour.

jonesypeter

I found a great set of articles by R.A.Waddilove in Computing With The Amstrad which started in issue 8 (He went on to write for the UK magazine Web User until it shut before Christmas) and he explains multi-colour graphics very well.  This is one of the listings:





I'm happy to share the listing as a DSK file if anyone wants it.

Powered by SMFPacks Menu Editor Mod