I posted about this a bit on Outside the Box Programming, but I thought that I'd post the code here. Note that this is my first ASM game and I have changed a few parts of this code:
Code:
I changed the routine that clears the buffer (twice, actually), but I was still wondering how the rest is (I have not added the music part yet; it will be in place of the HALTs, most likely).
Thanks for any advice!
Sorry for the lack of comments, but I programmed this oncalc, where space is limited.
All coding and tables ©2004-2007 Kerm Martian
Code:
:DEFHDR.HDR
:LD HL,0
:LD (9872H),HL
:BCALL RUNINDICOFF
:RES 5,(IY)
:BCALL CLRLCDFULL
:LD A,0
:LD DE,PLOTSSCREEN
:CLR:
:LD BC,12
:LD H,D
:LD L,E
:ADD HL,BC
:LD D,H
:LD E,L
:LD HL,CL
:PUSH AF
:PUSH DE
:LDIR
:BCALL GRBUFCPY
:POP DE
:POP AF
:INC A
:CP 63
:JP NZ,CLR
:MOVE:
:HALT
:HALT
:HALT
:LD A,(9873H)
:INC A
:LD (9873H),A
:CP 0
:CALL Z,MO2
:LD A,(DIR)
:OR A
:JP Z,MUP
:CP 1
:JP Z,MLEFT
:CP 2
:JP Z,MDOWN
:LD A,(XPOS)
:CP 94
:JP Z,END
:INC A
:LD (XPOS),A
:JP DRAW
:MO2:
:LD A,(9872H)
:INC A
:LD (9872H),A
:RET
:MUP:
:LD A,(YPOS)
:OR 0
:JP Z,END
:DEC A
:LD (YPOS),A
:JP DRAW
:MLEFT:
:LD A,(XPOS)
:OR A
:JP Z,END
:DEC A
:LD (XPOS),A
:JP DRAW
:MDOWN:
:LD A,(YPOS)
:CP 62
:JP Z,END
:INC A
:LD (YPOS),A
:DRAW:
:LD A,(XPOS)
:LD B,A
:LD A,(YPOS)
:LD C,A
:LD D,3
:BCALL IPOINT
:JR NZ,END
:LD A,(XPOS)
:LD B,A
:LD A,(YPOS)
:LD C,A
:LD D,1
:BCALL IPOINT
:KEY:
:LD A,FFH
:OUT (1),A
:LD A,11111110B
:OUT (1),A
:IN A,(1)
:BIT 0,A
:JP Z,UP
:BIT 1,A
:JP Z,LEFT
:BIT 2,A
:JP Z,RIGHT
:BIT 3,A
:JP Z,DOWN
:JP MOVE
:DOWN:
:LD A,2
:LD (DIR),A
:JP MOVE
:LEFT:
:LD A,1
:LD (DIR),A
:JP MOVE
:RIGHT:
:LD A,3
:LD (DIR),A
:JP MOVE
:UP:
:LD A,0
:LD (DIR),A
:JP MOVE
:END:
:BCALL CLRSCRNFULL
:BCALL HOMEUP
:LD HL,TXT
:BCALL PUTS
:LD A,(9872H)
:LD H,A
:LD A,(9873H)
:LD L,A
:BCALL DISPHL
:END2:
:BCALL GETKEY
:CP 5
:JP NZ,END2
:BCALL CLRSCRNFULL
:BCALL HOMEUP
:RET
:DIR:
:.DB 0
:XPOS:
:.DB 48
:YPOS:
:.DB 32
:TXT:
:.DB "Your Score: ",0
:CL:
:.DB 0,0,0,0,0,0,0,0,0,0,0,0
I changed the routine that clears the buffer (twice, actually), but I was still wondering how the rest is (I have not added the music part yet; it will be in place of the HALTs, most likely).
Thanks for any advice!
Sorry for the lack of comments, but I programmed this oncalc, where space is limited.
All coding and tables ©2004-2007 Kerm Martian