• Please review our updated Terms and Rules here

Cromemco dazzler replica project

Strange...

You could try and run snake.com under DEBUG.

DEBUG snake.com

I would then have to look in the manual for ASMB for the commands for DEBUG. Most of the commands are the same as RDOS - but with the addition of Trace so you can step through the program and examine registers.

Dave
 
The 'END SNAKE' directive may not have been seen by the assembler if the line does not finish with a <newline>.

I see the END statement on the gdemo listing but not the snake listing.

Dave
 
The 'END SNAKE' directive may not have been seen by the assembler if the line does not finish with a <newline>.

I see the END statement on the gdemo listing but not the snake listing.

Dave

I had the END SNAKE call in my code, I made sure to put it on it's own new line but still no change. I have no idea what I'm doing in the DEBUG application.

I may just start over by starting with GDEMO again removing bit by bit until I have a known working "shell" application.
 
I made a square! LOL

Not entirely sure what I did differently but I guess going slow and not removing huge chunks of code on a whim helps. :)

Capture.PNG
 

Attachments

  • snakez80.txt
    3.3 KB · Views: 2
Last edited:
Excellent.

If you look at that source file it has one extra blank line (after the END SNAKE) than the previous one did...

These are the little things that trip people up...

Dave
 
Excellent.

If you look at that source file it has one extra blank line (after the END SNAKE) than the previous one did...

These are the little things that trip people up...

Dave
hah yep, crazy - this is gonna take some getting used to.

Z80 assembler question..

I want to loop, incremeting A, compare to a number and break out when I hit a certain number - that part I got

inside the loop, I want to pause - but doing so means I need to load the duration into A before calling PAUSE. In this scenario, I want to push A to the stack, then pop A after the PAUSE, correct? but it looks like PUSH/POP only works with the whole 16-bit register so I have to PUSH AF/POP AF? Is there any downside to doing this, or is this just the way things work on a Z80?
 
No downside - only way to PUSH/POP A onto/from the stack.

You can always exchange AF and AF' and then exchange them back again using the "EX AF,AF'" instruction. This only takes 4 clock cycles.

The Z80 has a complete set of shadow registers that you can switch to.

You can also preserve A into an unused 8-bit register and load it back again.

EXX exchanges HL,DE and BC with the shadow set HL',DE' and BC' - and still only takes 4 clock cycles. It doesn't (of course) exchange the values of the registers, it just sets (or clears) a flag to determine which set of internal registers are actually used.

Dave
 
Interesting, thanks - so I'm assuming this approach is a lot faster than using the stack? Thanks for the tip. To exchange back to the original value I just call EX AF,AF' again?
 
Last edited:
Yes and yes.

This only really works if you know that the software library you are calling doesn't do the same trick!

It also depends upon interrupt handlers not using the shadow registers.

Using the stack is foolproof, with the exception of the slight complexity if the function you are calling returns a status in the flag register!

In this case, you have to test the flags first and then make sure you POP AF or adjust the stack pointer in all of the paths after the call instruction. The source of many a bug!

I always avoid storing anything in A (other than temporary work).

Dave
 
Incidentally, I tend to use register B for counting, and count down to 0.

The Z80 has a DJNZ (decrement B and jump if not zero) instruction to make this easy. However, the branch target has to be within +127 to -128 bytes away.

You can use the assembler's arithmetic if the loop counter is a static value.

Dave
 
This is a better approach for sure, just with what I was testing (drawing a moving line) I wanted to use the incrementing value directly in the line operation. I'll clean it up once I have this down..

Also it seems like with the library's PAUSE function the slowest I can pause seems like 1/10th of a second. Should I implement my own loop counter for delaying shorter amounts of time? I'm sure I can find examples.. I just wanted to make sure I wasn't missing anything with that existing PAUSE function.
 
Correct. 1/10th second is the slowest for this library function.

I can post the source code for this function tomorrow if you like so you can butcher it for your own use...

Dave
 
You can count down (using B) and increment (or decrement) H or L (depending upon whether you want to adjust the X or Y coordinate).

Dave
 
Wow I'm so spoiled and not at all used to coding without a live debugger. After spending seemingly hours on getting the input check code right and banging my head against the wall over why it's not working, I finally discovered I'm checking for upper-case letters and my terminal was set to lower-case. UGH!
 
Back
Top