Now I have some free time again, I've decided to start making 8-bits once more; as I don't do much assembly, z88dk is obviously the best choice.
The current idea that I'm developing is a Sunday League Football Management Simulator for the Sinclair ZX80 with 4K ROM and 16K RAM.
When I previously used z88dk for the Sinclair ZX81, I could include my own header file with my own pre-processor symbols defined. This was circa 2013 so things will have changed since then.
When I do on the latest build, I am unable to use anything that I've defined, for instance, say my zx80.h file has this:
Code: Select all
#define SCRLOC(X,Y) ((Y<<5)+X)
#define INVERSE(A) (0x80 | A)
#define EOL 0x76
#define EOF 0xff
However, let's say I have something like this:
Code: Select all
#include <stdio.h>
#define SCRLOC(X,Y) ((Y<<5)+X)
int main();
int printAt(unsigned char xy);
int main()
{
unsigned char cursorPos = SCRLOC(8,8);
printAt(cursorPos);
gets();
return 0;
}
printAt(unsigned char xy)
{
#asm
push hl
push bc
ld bc, $0000
ld hl, $0004
add hl, sp ;; HL should now be pointing at my unsigned char
ld (BUFFER), hl ;; Store the value of our unsigned char in the BUFFER
ld hl, ($400c) ;; Get the screen pointer
inc hl ;; We don't care about the first screen location as this
;; should always be a NEW LINE in ZX80 terms
ld bc, (BUFFER) ;; Write the value of the unsigned char to the BC register
add hl, bc
ld (hl), $26 ;; Should now show an A on the screen roughly at xy chars
jp OUT
BUFFER:
nop
nop
OUT:
pop bc
pop hl
#endasm
return 0;
}
I know the logic of the printAt function is fine because when I hard-code a value into BC, I get the letter A at approximately the correct place.
Thanks in advance,
Shaun