At the end of your main loop, you're jumping back to the help printing text every time. Instead:
Code: Select all
MAINLOOP:
CALL GAMELOOP
;CALL KEYBOARDINPUT
JP MAINLOOP
Code: Select all
MAINLOOP:
CALL GAMELOOP
;CALL KEYBOARDINPUT
JP MAINLOOP
The ROM print routine at 8252 takes the address of the first byte of the data in de, and the number of bytes to print (length) in bc.
Code: Select all
; Screen
PixelAddress equ $4000
AttributeAddress equ $5800 ; Start of the attributes in the Spectrum display file
AttributeLength equ $300 ; There are 768 bytes of attributes
BS equ 8
CR equ 13
Ink equ 16
Paper equ 17
Flash equ 18
Dim equ %00000000 ; These two constants are the
Bright equ %01000000 ; attribute mask for the bright flag
PrBright equ 19 ; This is the print code for BRIGHT for ROM routines
Inverse equ 20
Over equ 21
At equ 22 ; FZX understands this one as well as the ROM routines
Tab equ 23
Black equ 0
Blue equ 1
Red equ 2
Magenta equ 3
Green equ 4
Cyan equ 5
Yellow equ 6
White equ 7
BlackP equ 8*Black
BlueP equ 8*Blue
RedP equ 8*Red
MagentaP equ 8*Magenta
GreenP equ 8*Green
CyanP equ 8*Cyan
YellowP equ 8*Yellow
WhiteP equ 8*White
DimBlack equ Black
DimBlue equ Blue
DimRed equ Red
DimMagenta equ Magenta
DimGreen equ Green
DimCyan equ Cyan
DimYellow equ Yellow
DimWhite equ White
BrightBlack equ Black+Bright
BrightBlue equ Blue+Bright
BrightRed equ Red+Bright
BrightMagenta equ Magenta+Bright
BrightGreen equ Green+Bright
BrightCyan equ Cyan+Bright
BrightYellow equ Yellow+Bright
BrightWhite equ White+Bright
DimBlackBlackP equ DimBlack+BlackP
DimBlueBlackP equ DimBlue+BlackP
DimRedBlackP equ DimRed+BlackP
DimMagentaBlackP equ DimMagenta+BlackP
DimGreenBlackP equ DimGreen+BlackP
DimCyanBlackP equ DimCyan+BlackP
DimYellowBlackP equ DimYellow+BlackP
DimWhiteBlackP equ DimWhite+BlackP
BrightBlackBlackP equ BrightBlack+BlackP
BrightBlueBlackP equ BrightBlue+BlackP
BrightRedBlackP equ BrightRed+BlackP
BrightMagentaBlackP equ BrightMagenta+BlackP
BrightGreenBlackP equ BrightGreen+BlackP
BrightCyanBlackP equ BrightCyan+BlackP
BrightYellowBlackP equ BrightYellow+BlackP
BrightWhiteBlackP equ BrightWhite+BlackP
DimBlackBlueP equ DimBlack+BlueP
DimBlueBlueP equ DimBlue+BlueP
DimRedBlueP equ DimRed+BlueP
DimMagentaBlueP equ DimMagenta+BlueP
DimGreenBlueP equ DimGreen+BlueP
DimCyanBlueP equ DimCyan+BlueP
DimYellowBlueP equ DimYellow+BlueP
DimWhiteBlueP equ DimWhite+BlueP
BrightBlackBlueP equ BrightBlack+BlueP
BrightBlueBlueP equ BrightBlue+BlueP
BrightRedBlueP equ BrightRed+BlueP
BrightMagentaBlueP equ BrightMagenta+BlueP
BrightGreenBlueP equ BrightGreen+BlueP
BrightCyanBlueP equ BrightCyan+BlueP
BrightYellowBlueP equ BrightYellow+BlueP
BrightWhiteBlueP equ BrightWhite+BlueP
DimBlackRedP equ DimBlack+RedP
DimBlueRedP equ DimBlue+RedP
DimRedRedP equ DimRed+RedP
DimMagentaRedP equ DimMagenta+RedP
DimGreenRedP equ DimGreen+RedP
DimCyanRedP equ DimCyan+RedP
DimYellowRedP equ DimYellow+RedP
DimWhiteRedP equ DimWhite+RedP
BrightBlackRedP equ BrightBlack+RedP
BrightBlueRedP equ BrightBlue+RedP
BrightRedRedP equ BrightRed+RedP
BrightMagentaRedP equ BrightMagenta+RedP
BrightGreenRedP equ BrightGreen+RedP
BrightCyanRedP equ BrightCyan+RedP
BrightYellowRedP equ BrightYellow+RedP
BrightWhiteRedP equ BrightWhite+RedP
DimBlackMagentaP equ DimBlack+MagentaP
DimBlueMagentaP equ DimBlue+MagentaP
DimRedMagentaP equ DimRed+MagentaP
DimMagentaMagentaP equ DimMagenta+MagentaP
DimGreenMagentaP equ DimGreen+MagentaP
DimCyanMagentaP equ DimCyan+MagentaP
DimYellowMagentaP equ DimYellow+MagentaP
DimWhiteMagentaP equ DimWhite+MagentaP
BrightBlackMagentaP equ BrightBlack+MagentaP
BrightBlueMagentaP equ BrightBlue+MagentaP
BrightRedMagentaP equ BrightRed+MagentaP
BrightMagentaMagentaP equ BrightMagenta+MagentaP
BrightGreenMagentaP equ BrightGreen+MagentaP
BrightCyanMagentaP equ BrightCyan+MagentaP
BrightYellowMagentaP equ BrightYellow+MagentaP
BrightWhiteMagentaP equ BrightWhite+MagentaP
DimBlackGreenP equ DimBlack+GreenP
DimBlueGreenP equ DimBlue+GreenP
DimRedGreenP equ DimRed+GreenP
DimMagentaGreenP equ DimMagenta+GreenP
DimGreenGreenP equ DimGreen+GreenP
DimCyanGreenP equ DimCyan+GreenP
DimYellowGreenP equ DimYellow+GreenP
DimWhiteGreenP equ DimWhite+GreenP
BrightBlackGreenP equ BrightBlack+GreenP
BrightBlueGreenP equ BrightBlue+GreenP
BrightRedGreenP equ BrightRed+GreenP
BrightMagentaGreenP equ BrightMagenta+GreenP
BrightGreenGreenP equ BrightGreen+GreenP
BrightCyanGreenP equ BrightCyan+GreenP
BrightYellowGreenP equ BrightYellow+GreenP
BrightWhiteGreenP equ BrightWhite+GreenP
DimBlackCyanP equ DimBlack+CyanP
DimBlueCyanP equ DimBlue+CyanP
DimRedCyanP equ DimRed+CyanP
DimMagentaCyanP equ DimMagenta+CyanP
DimGreenCyanP equ DimGreen+CyanP
DimCyanCyanP equ DimCyan+CyanP
DimYellowCyanP equ DimYellow+CyanP
DimWhiteCyanP equ DimWhite+CyanP
BrightBlackCyanP equ BrightBlack+CyanP
BrightBlueCyanP equ BrightBlue+CyanP
BrightRedCyanP equ BrightRed+CyanP
BrightMagentaCyanP equ BrightMagenta+CyanP
BrightGreenCyanP equ BrightGreen+CyanP
BrightCyanCyanP equ BrightCyan+CyanP
BrightYellowCyanP equ BrightYellow+CyanP
BrightWhiteCyanP equ BrightWhite+CyanP
DimBlackYellowP equ DimBlack+YellowP
DimBlueYellowP equ DimBlue+YellowP
DimRedYellowP equ DimRed+YellowP
DimMagentaYellowP equ DimMagenta+YellowP
DimGreenYellowP equ DimGreen+YellowP
DimCyanYellowP equ DimCyan+YellowP
DimYellowYellowP equ DimYellow+YellowP
DimWhiteYellowP equ DimWhite+YellowP
BrightBlackYellowP equ BrightBlack+YellowP
BrightBlueYellowP equ BrightBlue+YellowP
BrightRedYellowP equ BrightRed+YellowP
BrightMagentaYellowP equ BrightMagenta+YellowP
BrightGreenYellowP equ BrightGreen+YellowP
BrightCyanYellowP equ BrightCyan+YellowP
BrightYellowYellowP equ BrightYellow+YellowP
BrightWhiteYellowP equ BrightWhite+YellowP
DimBlackWhiteP equ DimBlack+WhiteP
DimBlueWhiteP equ DimBlue+WhiteP
DimRedWhiteP equ DimRed+WhiteP
DimMagentaWhiteP equ DimMagenta+WhiteP
DimGreenWhiteP equ DimGreen+WhiteP
DimCyanWhiteP equ DimCyan+WhiteP
DimYellowWhiteP equ DimYellow+WhiteP
DimWhiteWhiteP equ DimWhite+WhiteP
BrightBlackWhiteP equ BrightBlack+WhiteP
BrightBlueWhiteP equ BrightBlue+WhiteP
BrightRedWhiteP equ BrightRed+WhiteP
BrightMagentaWhiteP equ BrightMagenta+WhiteP
BrightGreenWhiteP equ BrightGreen+WhiteP
BrightCyanWhiteP equ BrightCyan+WhiteP
BrightYellowWhiteP equ BrightYellow+WhiteP
BrightWhiteWhiteP equ BrightWhite+WhiteP
Code: Select all
ORG 33000
; Screen
PixelAddress equ $4000
AttributeAddress equ $5800 ; Start of the attributes in the Spectrum display file
AttributeLength equ $300 ; There are 768 bytes of attributes
BS equ 8
CR equ 13
Ink equ 16
Paper equ 17
Flash equ 18
Dim equ %00000000 ; These two constants are the
Bright equ %01000000 ; attribute mask for the bright flag
PrBright equ 19 ; This is the print code for BRIGHT for ROM routines
Inverse equ 20
Over equ 21
At equ 22 ; FZX understands this one as well as the ROM routines
Tab equ 23
Black equ 0
Blue equ 1
Red equ 2
Magenta equ 3
Green equ 4
Cyan equ 5
Yellow equ 6
White equ 7
BlackP equ 8*Black
BlueP equ 8*Blue
RedP equ 8*Red
MagentaP equ 8*Magenta
GreenP equ 8*Green
CyanP equ 8*Cyan
YellowP equ 8*Yellow
WhiteP equ 8*White
DimBlack equ Black
DimBlue equ Blue
DimRed equ Red
DimMagenta equ Magenta
DimGreen equ Green
DimCyan equ Cyan
DimYellow equ Yellow
DimWhite equ White
BrightBlack equ Black+Bright
BrightBlue equ Blue+Bright
BrightRed equ Red+Bright
BrightMagenta equ Magenta+Bright
BrightGreen equ Green+Bright
BrightCyan equ Cyan+Bright
BrightYellow equ Yellow+Bright
BrightWhite equ White+Bright
DimBlackBlackP equ DimBlack+BlackP
DimBlueBlackP equ DimBlue+BlackP
DimRedBlackP equ DimRed+BlackP
DimMagentaBlackP equ DimMagenta+BlackP
DimGreenBlackP equ DimGreen+BlackP
DimCyanBlackP equ DimCyan+BlackP
DimYellowBlackP equ DimYellow+BlackP
DimWhiteBlackP equ DimWhite+BlackP
BrightBlackBlackP equ BrightBlack+BlackP
BrightBlueBlackP equ BrightBlue+BlackP
BrightRedBlackP equ BrightRed+BlackP
BrightMagentaBlackP equ BrightMagenta+BlackP
BrightGreenBlackP equ BrightGreen+BlackP
BrightCyanBlackP equ BrightCyan+BlackP
BrightYellowBlackP equ BrightYellow+BlackP
BrightWhiteBlackP equ BrightWhite+BlackP
DimBlackBlueP equ DimBlack+BlueP
DimBlueBlueP equ DimBlue+BlueP
DimRedBlueP equ DimRed+BlueP
DimMagentaBlueP equ DimMagenta+BlueP
DimGreenBlueP equ DimGreen+BlueP
DimCyanBlueP equ DimCyan+BlueP
DimYellowBlueP equ DimYellow+BlueP
DimWhiteBlueP equ DimWhite+BlueP
BrightBlackBlueP equ BrightBlack+BlueP
BrightBlueBlueP equ BrightBlue+BlueP
BrightRedBlueP equ BrightRed+BlueP
BrightMagentaBlueP equ BrightMagenta+BlueP
BrightGreenBlueP equ BrightGreen+BlueP
BrightCyanBlueP equ BrightCyan+BlueP
BrightYellowBlueP equ BrightYellow+BlueP
BrightWhiteBlueP equ BrightWhite+BlueP
DimBlackRedP equ DimBlack+RedP
DimBlueRedP equ DimBlue+RedP
DimRedRedP equ DimRed+RedP
DimMagentaRedP equ DimMagenta+RedP
DimGreenRedP equ DimGreen+RedP
DimCyanRedP equ DimCyan+RedP
DimYellowRedP equ DimYellow+RedP
DimWhiteRedP equ DimWhite+RedP
BrightBlackRedP equ BrightBlack+RedP
BrightBlueRedP equ BrightBlue+RedP
BrightRedRedP equ BrightRed+RedP
BrightMagentaRedP equ BrightMagenta+RedP
BrightGreenRedP equ BrightGreen+RedP
BrightCyanRedP equ BrightCyan+RedP
BrightYellowRedP equ BrightYellow+RedP
BrightWhiteRedP equ BrightWhite+RedP
DimBlackMagentaP equ DimBlack+MagentaP
DimBlueMagentaP equ DimBlue+MagentaP
DimRedMagentaP equ DimRed+MagentaP
DimMagentaMagentaP equ DimMagenta+MagentaP
DimGreenMagentaP equ DimGreen+MagentaP
DimCyanMagentaP equ DimCyan+MagentaP
DimYellowMagentaP equ DimYellow+MagentaP
DimWhiteMagentaP equ DimWhite+MagentaP
BrightBlackMagentaP equ BrightBlack+MagentaP
BrightBlueMagentaP equ BrightBlue+MagentaP
BrightRedMagentaP equ BrightRed+MagentaP
BrightMagentaMagentaP equ BrightMagenta+MagentaP
BrightGreenMagentaP equ BrightGreen+MagentaP
BrightCyanMagentaP equ BrightCyan+MagentaP
BrightYellowMagentaP equ BrightYellow+MagentaP
BrightWhiteMagentaP equ BrightWhite+MagentaP
DimBlackGreenP equ DimBlack+GreenP
DimBlueGreenP equ DimBlue+GreenP
DimRedGreenP equ DimRed+GreenP
DimMagentaGreenP equ DimMagenta+GreenP
DimGreenGreenP equ DimGreen+GreenP
DimCyanGreenP equ DimCyan+GreenP
DimYellowGreenP equ DimYellow+GreenP
DimWhiteGreenP equ DimWhite+GreenP
BrightBlackGreenP equ BrightBlack+GreenP
BrightBlueGreenP equ BrightBlue+GreenP
BrightRedGreenP equ BrightRed+GreenP
BrightMagentaGreenP equ BrightMagenta+GreenP
BrightGreenGreenP equ BrightGreen+GreenP
BrightCyanGreenP equ BrightCyan+GreenP
BrightYellowGreenP equ BrightYellow+GreenP
BrightWhiteGreenP equ BrightWhite+GreenP
DimBlackCyanP equ DimBlack+CyanP
DimBlueCyanP equ DimBlue+CyanP
DimRedCyanP equ DimRed+CyanP
DimMagentaCyanP equ DimMagenta+CyanP
DimGreenCyanP equ DimGreen+CyanP
DimCyanCyanP equ DimCyan+CyanP
DimYellowCyanP equ DimYellow+CyanP
DimWhiteCyanP equ DimWhite+CyanP
BrightBlackCyanP equ BrightBlack+CyanP
BrightBlueCyanP equ BrightBlue+CyanP
BrightRedCyanP equ BrightRed+CyanP
BrightMagentaCyanP equ BrightMagenta+CyanP
BrightGreenCyanP equ BrightGreen+CyanP
BrightCyanCyanP equ BrightCyan+CyanP
BrightYellowCyanP equ BrightYellow+CyanP
BrightWhiteCyanP equ BrightWhite+CyanP
DimBlackYellowP equ DimBlack+YellowP
DimBlueYellowP equ DimBlue+YellowP
DimRedYellowP equ DimRed+YellowP
DimMagentaYellowP equ DimMagenta+YellowP
DimGreenYellowP equ DimGreen+YellowP
DimCyanYellowP equ DimCyan+YellowP
DimYellowYellowP equ DimYellow+YellowP
DimWhiteYellowP equ DimWhite+YellowP
BrightBlackYellowP equ BrightBlack+YellowP
BrightBlueYellowP equ BrightBlue+YellowP
BrightRedYellowP equ BrightRed+YellowP
BrightMagentaYellowP equ BrightMagenta+YellowP
BrightGreenYellowP equ BrightGreen+YellowP
BrightCyanYellowP equ BrightCyan+YellowP
BrightYellowYellowP equ BrightYellow+YellowP
BrightWhiteYellowP equ BrightWhite+YellowP
DimBlackWhiteP equ DimBlack+WhiteP
DimBlueWhiteP equ DimBlue+WhiteP
DimRedWhiteP equ DimRed+WhiteP
DimMagentaWhiteP equ DimMagenta+WhiteP
DimGreenWhiteP equ DimGreen+WhiteP
DimCyanWhiteP equ DimCyan+WhiteP
DimYellowWhiteP equ DimYellow+WhiteP
DimWhiteWhiteP equ DimWhite+WhiteP
BrightBlackWhiteP equ BrightBlack+WhiteP
BrightBlueWhiteP equ BrightBlue+WhiteP
BrightRedWhiteP equ BrightRed+WhiteP
BrightMagentaWhiteP equ BrightMagenta+WhiteP
BrightGreenWhiteP equ BrightGreen+WhiteP
BrightCyanWhiteP equ BrightCyan+WhiteP
BrightYellowWhiteP equ BrightYellow+WhiteP
BrightWhiteWhiteP equ BrightWhite+WhiteP
PR_STRING equ 8252
LAST_K equ 23560
ROM_FONT equ 15616
FAT_FONT equ 60000
SET_BORDER equ 8859
CLEAR_SCR equ 3503
MAIN:
CALL FATFONT
LD A,DimWhiteBlueP ;
LD (23693),A
LD A,1
CALL SET_BORDER ; SET BORDER
CALL CLEAR_SCR ; CLEAR SCREEN & SET PAPER N INK.
CALL HELPSCREEN
MGL: CALL KEYBOARDINPUT
CALL GAMELOOP
CALL KEYBOARDINPUT
JP MGL
HELPSCREEN:
ld a,2 ; upper screen
call 5633 ; open channel
ld de,HELP ; address of string
ld bc,EOSTR1-HELP ; length of string to print
call PR_STRING ; print our string
LD DE,HELPBOARD
LD BC,EOSTR2-HELPBOARD
CALL PR_STRING
RET
FATFONT:
ld hl,ROM_FONT ; ROM font.
ld de,FAT_FONT ; address of our font.
ld bc,768 ; 96 chars * 8 rows to alter.
font1 ld a,(hl) ; get bitmap.
rlca ; rotate it left.
or (hl) ; combine 2 images.
ld (de),a ; write to new font.
inc hl ; next byte of old.
inc de ; next byte of new.
dec bc ; decrement counter.
ld a,b ; high byte.
or c ; combine with low byte.
jr nz,font1 ; repeat until bc=zero.
ld hl,FAT_FONT-256 ; font minus 32*8.
ld (23606),hl ; point to new font.
ret
KEYBOARDINPUT:
ld hl,LAST_K ; LAST K system variable.
ld (hl),0 ; put null value there.
_loop ld a,(hl) ; new value of LAST K.
cp 0 ; is it still zero?
jr z,_loop ; yes, so no key pressed.
RET ; key was pressed.
GAMELOOP:
ld a,2 ; upper screen
call 5633 ; open channel
ld de,HELP ; address of string
ld bc,EOSTR1-HELP ; length of string to print
call PR_STRING
LD DE,BOARD
LD BC,EOSTR3-BOARD
CALL PR_STRING
RET
HELP: DEFB Ink,Black,At,1,6,Paper,9,'*',Paper,Magenta,' ',Paper,Red,'N',Paper,Magenta,'o',Paper,Green,'u',Paper,5,'g',Paper,6,'h',Paper,White,'t',Paper,Red,'s',Paper,5,' ',Paper,Magenta,'&',Paper,Magenta,' ',Paper,Green,'C',Paper,5,'r',Paper,6,'o',Paper,White,'s',Paper,Red,'s',Paper,5,'e',Paper,White,'s',Paper,Magenta,' ',Paper,Green,'*'
DEFB Ink,White,At,4,15,Paper,1,'This is noughts',CR
DEFB At,5,15,'and crosses, for',CR
DEFB At,6,15,'two players.',CR
DEFB At,8,15,'I will tell you',CR
DEFB At,9,15,'when either of',CR
DEFB At,10,15,'you has won.',CR
DEFB At,12,15,'The board is',CR
DEFB At,13,15,'numbered as on',CR
DEFB At,14,15,'the left side',CR
DEFB At,15,15,'of the screen.',CR
DEFB At,21,2,'PRESS ',Flash,1,Ink,Red,'<RETURN>',Flash,0,Ink,White,' TO CONTINUE...'
EOSTR1: equ $
BOARD: DEFB Ink,Red,Paper,Black,At,4,1,$8B,$83,$83,$83,$8B,$83,$83,$83,$87,$83,$83,$83,$87,CR
DEFB At,5,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,6,1,$8A,' ',Ink,Black,$80,Ink,Red,' ',$8A,' ',Ink,Black,$80,Ink,Red,' ',$85,' ',Ink,Black,$80,Ink,Red,' ',$85,CR
DEFB At,7,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,8,1,$8B,$83,$83,$83,$8B,$83,$83,$83,$87,$83,$83,$83,$87,CR
DEFB At,9,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,10,1,$8A,' ',Ink,Black,$80,Ink,Red,' ',$8A,' ',Ink,Black,$80,Ink,Red,' ',$85,' ',Ink,Black,$80,Ink,Red,' ',$85,CR
DEFB At,11,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,12,1,$8B,$83,$83,$83,$8B,$83,$83,$83,$87,$83,$83,$83,$87,CR
DEFB At,13,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,14,1,$8A,' ',Ink,Black,$80,Ink,Red,' ',$8A,' ',Ink,Black,$80,Ink,Red,' ',$85,' ',Ink,Black,$80,Ink,Red,' ',$85,CR
DEFB At,15,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,16,1,$8E,$8C,$8C,$8C,$8E,$8C,$8C,$8C,$8D,$8C,$8C,$8C,$8D,CR,Paper,Blue,Ink,White
EOSTR2: equ $
HELPBOARD:
DEFB Ink,Red,Paper,Black,At,4,1,$8B,$83,$83,$83,$8B,$83,$83,$83,$87,$83,$83,$83,$87,CR
DEFB At,5,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,6,1,$8A,' ',Ink,Magenta,'1',Ink,Red,' ',$8A,' ',Ink,Magenta,'2',Ink,Red,' ',$85,' ',Ink,Magenta,'3',Ink,Red,' ',$85,CR
DEFB At,7,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,8,1,$8B,$83,$83,$83,$8B,$83,$83,$83,$87,$83,$83,$83,$87,CR
DEFB At,9,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,10,1,$8A,' ',Ink,Magenta,'4',Ink,Red,' ',$8A,' ',Ink,Magenta,'5',Ink,Red,' ',$85,' ',Ink,Magenta,'6',Ink,Red,' ',$85,CR
DEFB At,11,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,12,1,$8B,$83,$83,$83,$8B,$83,$83,$83,$87,$83,$83,$83,$87,CR
DEFB At,13,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,14,1,$8A,' ',Ink,Magenta,'7',Ink,Red,' ',$8A,' ',Ink,Magenta,'8',Ink,Red,' ',$85,' ',Ink,Magenta,'9',Ink,Red,' ',$85,CR
DEFB At,15,1,$8A,' ',$8A,' ',$85,' ',$85,CR
DEFB At,16,1,$8E,$8C,$8C,$8C,$8E,$8C,$8C,$8C,$8D,$8C,$8C,$8C,$8D,13,Paper,Blue,Ink,White
EOSTR3: equ $
END MAIN
Code: Select all
KEYBOARDINPUT:
LD HL,LAST_K ; LAST K SYSTEM VARIABLE.
LD (HL),0 ; PUT NULL VALUE THERE.
_LOOP LD A,(HL) ; NEW VALUE OF LAST K.
CP 0 ; IS IT STILL ZERO?
JR Z,_LOOP ; YES, SO NO KEY PRESSED.
RET ; KEY WAS PRESSED.
MULTIKEY:
; WE WANT TO SCAN KEY 1-9, SO THE FOLLOWING WILL BE USED.
;61438 6, 7, 8, 9, 0
;63486 5, 4, 3, 2, 1
LD A,0
LD BC,63438 ; KEYBOARD ROW 6-0/JOYSTICK PORT 2.
IN A,(C) ; SEE WHAT KEYS ARE PRESSED.
RRA ; NEXT BIT ALONG (VALUE 2) = KEY 9.
PUSH AF ; REMEMBER THE VALUE.
CALL NC,MP9 ; BEING PRESSED, SO PUT COUNTER IN MP9.
POP AF ; RESTORE ACCUMULATOR.
RRA ; NEXT BIT (VALUE 4) = KEY 8.
PUSH AF ; REMEMBER THE VALUE.
CALL NC,MP8 ; BEING PRESSED, SO PUT COUNTER IN MP8.
POP AF ; RESTORE ACCUMULATOR.
RRA ; NEXT BIT (VALUE 8) READS KEY 7.
PUSH AF ; REMEMBER THE VALUE.
CALL NC,MP7 ; IT'S BEING PRESSED, SO PUT COUNTER IN MP7.
POP AF ; RESTORE ACCUMULATOR.
RRA ; NEXT BIT (VALUE 16) READS KEY 6.
CALL NC,MP6 ; IT'S BEING PRESSED, SO PUT COUNTER IN MP6.
LD A,0
LD BC,63486 ; KEYBOARD ROW 1-5/JOYSTICK PORT 2.
IN A,(C) ; SEE WHAT KEYS ARE PRESSED.
RRA ; OUTERMOST BIT = KEY 1.
PUSH AF ; REMEMBER THE VALUE.
CALL NC,MP1 ; IT'S BEING PRESSED, SO PUT COUNTER IN MP1.
POP AF ; RESTORE ACCUMULATOR.
RRA ; NEXT BIT ALONG (VALUE 2) = KEY 2.
PUSH AF ; REMEMBER THE VALUE.
CALL NC,MP2 ; BEING PRESSED, SO SO PUT COUNTER IN MP2.
POP AF ; RESTORE ACCUMULATOR.
RRA ; NEXT BIT (VALUE 4) = KEY 3.
PUSH AF ; REMEMBER THE VALUE.
CALL NC,MP3 ; BEING PRESSED, SO PUT COUNTER IN MP3
POP AF ; RESTORE ACCUMULATOR.
RRA ; NEXT BIT (VALUE 8) READS KEY 4.
PUSH AF ; REMEMBER THE VALUE.
CALL NC,MP4 ; IT'S BEING PRESSED, SO PUT COUNTER IN MP4
POP AF ; RESTORE ACCUMULATOR.
RRA ; NEXT BIT (VALUE 16) READS KEY 5.
CALL NC,MP5 ; IT'S BEING PRESSED, SO PUT COUNTER IN MP5
JP Z,MULTIKEY
RET
KEYTEST:
; MR. JONES' KEYBOARD TEST ROUTINE.
KTEST LD C,A ; KEY TO TEST IN C.
AND 7 ; MASK BITS D0-D2 FOR ROW.
INC A ; IN RANGE 1-8.
LD B,A ; PLACE IN B.
SRL C ; DIVIDE C BY 8,
SRL C ; TO FIND POSITION WITHIN ROW.
SRL C
LD A,5 ; ONLY 5 KEYS PER ROW.
SUB C ; SUBTRACT POSITION.
LD C,A ; PUT IN C.
LD A,254 ; HIGH BYTE OF PORT TO READ.
KTEST0 RRCA ; ROTATE INTO POSITION.
DJNZ KTEST0 ; REPEAT UNTIL WE'VE FOUND RELEVANT ROW.
IN A,(254) ; READ PORT (A=HIGH, 254=LOW).
KTEST1 RRA ; ROTATE BIT OUT OF RESULT.
DEC C ; LOOP COUNTER.
JP NZ,KTEST1 ; REPEAT UNTIL BIT FOR POSITION IN CARRY.
CCF
RET
Code: Select all
POTATOK:
LD A,0
LD A,(LAST_K)
CP $31 ; IS 1?
JP Z,MP1 ; JUMP TO MP1
CP $32 ; IS 2?
JP Z,MP2 ; JUMP TO MP2
CP $33 ; IS 3?
JP Z,MP3 ; JUMP TO MP3
CP $34 ; IS 4?
JP Z,MP4 ; JUMP TO MP4
CP $35 ; IS 5?
JP Z,MP5 ; JUMP TO MP5
CP $36 ; IS 6?
JP Z,MP6 ; JUMP TO MP6
CP $37 ; IS 7?
JP Z,MP7 ; JUMP TO MP7
CP $38 ; IS 8?
JP Z,MP8 ; JUMP TO MP8
CP $39 ; IS 9?
JP Z,MP9 ; JUMP TO MP9
RET
openMSX is what I use but I don't really know enough about it to form an opinion there are a bunch of others that you could use.
Code: Select all
: GAMEINTRO STUDIO-BANNER TITLE-SCREEN INTRO-MUSIC ?ANYKEY ;
: STUDIO-BANNER INCBIN-FILE SENDVRAM PLAY-SFX FADE2BLK ;
: TITLE-SCREEN INCBIN-FILE SENDVRAM PLAY-SFX FADE2BLK ;
: INTRO-MUSIC LOAD-PLAYER START-MUSIC ;
: ?ANYKEY ." SHAZAM! I AM A STUB * ;
...
Aren't you just describing a compiler? You express what you want in a higher level language and the generator turns it into assembly language for you?
What platform are you on? Do you have to use Wine?
In a limited way, its not producing machine code though. That said there was no reason why it couldn't do that in the future.
I use arch linux, at the moment I am using a rather old laptop, there is no way it can run windows (well beyond xp I guess.) When I get a new machine I will have it as a dual boot so I can use the windows specific stuff that way. But until then I am stuck with wine.
No need to dual boot. Create a Winders image in VirtualBox. Any modern machine can run a virtual machine these days, and integration is quite nicely handled with modern software so you can copy and paste, save to the Linux file system, etc.
Code: Select all
( MENU SYSTEM - ALL THE PROGRAMS AND TASKS I DO REGULARLY )
( ITS LIKE ITS 1990 AGAIN. )
: EMPTY s" ---marker--- marker ---marker--- " evaluate ;
: EDIT s" subl main.fs " system ;
: RUN s" main.fs " included ;
: ECR EDIT RUN ;
marker ---marker---