Would trying to use isprite and fastcopy erase the previous contents of the screen like a stat sprite would?
Don't think so? Unless the screen buffer got erased then you isprited, then you copied to the actual screen?
Maybe it's something that BZC does to the code. I also noticed that if you press clear it takes you to the information screen for some reason. Maybe I used the wrong scan codes. I remember I said I would have this ready a few weeks ago. It's more complicated than that.
something1990 wrote:
I remember I said I would have this ready a few weeks ago. It's more complicated than that.
Programming always is (a good rule of thumb is 90% of your time is spent debugging...)
Snave2000 wrote:
something1990 wrote:
I remember I said I would have this ready a few weeks ago. It's more complicated than that.
Programming always is (a good rule of thumb is 90% of your time is spent debugging...)
yep, probably why I haven't completed a project in the past half year. So much debugging to do.
Snave2000 wrote:
something1990 wrote:
I remember I said I would have this ready a few weeks ago. It's more complicated than that.
Programming always is (a good rule of thumb is 90% of your time is spent debugging...)
Snave2000 wrote:
something1990 wrote:
I remember I said I would have this ready a few weeks ago. It's more complicated than that.
Programming always is (a good rule of thumb is 90% of your time is spent debugging...)
thats why i love python, its the reverse then (90% time coding, 10% debugging) - of course, runtime errors generating the line number and rough location on the line the error occured is extremely helpful, lolz
@Kerm: that is totally your fault tho. YOU didn't bother to read the manual
Are we going to continue work on developping BZC? Has anyone here been working on BZC on their own? Do you still come around here Snave? This topic hasn't seen that much activity recently so I thought I should restart talk on it.
Yeah, I'm still here. I've been checking back almost every day actually, but no one else was posting anything, and I had nothing to say myself; hence the silence. Currently, I'm working on some basic drawing routines in ASM: lines and rectangles. The ultimate aim here is to end up with form and control drawing routines such that Windows-like forms could be created and moved around with an arrow keys-controlled mouse cursor. I will keep everyone posted on the progress of this.
Great minds think alike! I still don't understand why my test program wouldn't work. I revised the BZC code and realized that I was writing C++ code in a few places. I fixed those, compiled it, did the standard changes to the Asm code, recompiled it, and it still didn't work. I'll look around and try to find an alternative to using the Mirage libs.
Didn't I send you the code? Which code do you want me to post, BZC or Assembly? Also the old problem I had before with the text is present again. The opening credits do not appear, only a bunch of garbage. I suspect it may have something to do with the parameters I pass to the drawing function and will investigate that soon. Tell me which code you want, BZC and Asm, and I'll post it.
Code:
#include <asmlib.h>
#include <mirage.h>
ROMCALL wait = $4972
ROMCALL turnoff = $5008
ROMCALL clrgraph = $4540
FUNCTION getval ARG 0
FUNCTION randomno ARG 1
FUNCTION printgraph ARG 3
FUNCTION printcenter ARG 2
FUNCTION graphlines ARG 6
FUNCTION drawsprite ARG 3
FUNCTION clrsprite ARG 2
FUNCTION initsprite ARG 0
MEM cursor 8
MEM dodger 8
MEM dodged 8
BYTE spritey
BYTE spritex
BYTE obstacle1
BYTE obstacle2
BYTE obstacle3
BYTE obstacle4
BYTE obstacle5
BYTE obstacle6
BYTE obstacle7
BYTE loopval
BYTE keyval
BYTE result
BYTE norandom
STRING title = "Dodgem TI BZC"
STRING author = "By Roberto Sanchez"
STRING startgame = "Start Game"
STRING instructions = "Instructions"
STRING thisgame = "This game was made by"
STRING about = "About"
STRING quit = "Quit"
STRING pause = "Pause"
STRING continue = "Continue"
STRING joshfrisby = "Josh Frisby for BASIC"
STRING useleft = "Use left and right arrows"
STRING move = "to move."
STRING use2nd = "Use 2nd to pause."
STRING presskey = "Press a key to continue."
STRING adapted = "Adapted to BZC"
STRING cemetech = "Go to cemetech.net"
STRING thanks = "Thank Your for Playing"
STRING gameover = "Game Over"
START
initsprite
clrgraph
graphlines 7 7 89 57 1 2
printcenter 27 title
sleep 10
FOR loopval = 26 TO 34
graphlines 8 loopval 88 loopval 0 1
NEXT
printcenter 27 author
FOR loopval = 26 TO 34
graphlines 8 loopval 88 loopval 0 1
NEXT
sleep 10
LOOP UNTIL result == 5 AND spritey == 95
clrgraph
graphlines 0 8 96 8 1 1
printcenter 0 title
printgraph 24 29 startgame
printgraph 32 29 instructions
printgraph 40 29 about
printgraph 48 29 quit
spritey = 25
LOOP UNTIL result ==5 OR result == 15
drawsprite 20 spritey cursor
result = getval
IF result == 4 AND spritey > 25 THEN
spritey = spritey - 8
ENDIF
IF result == 1 AND spritey < 49 THEN
spritey = spritey + 8
ENDIF
clrsprite 20 spritey
ENDLOOP
clrgraph
IF result == 5 AND spritey == 25 THEN
obstacle1 = 20
obstacle2 = 20
obstacle3 = 20
obstacle4 = 20
obstacle5 = 20
obstacle6 = 20
obstacle7 = 20
spritex = 52
LOOP UNTIL loopval == spritex
result = getval
IF result == 55 THEN
turnoff
ENDIF
IF result == 2 THEN
spritex = spritex - 8
ENDIF
IF result == 3 THEN
spritex = spritex + 8
ENDIF
IF spritex < 20 THEN
spritex = 84
ENDIF
IF spritex > 84 THEN
spritex = 20
ENDIF
clrsprite spritex 56
drawsprite spritex 56 dodger
clrsprite 0 obstacle1
clrsprite 8 obstacle2
clrsprite 16 obstacle3
clrsprite 24 obstacle4
clrsprite 32 obstacle5
clrsprite 40 obstacle6
clrsprite 48 obstacle7
loopval = obstacle7
obstacle6 = obstacle7
obstacle5 = obstacle6
obstacle4 = obstacle5
obstacle3 = obstacle4
obstacle2 = obstacle3
obstacle1 = obstacle2
obstacle7 = randomno 8
IF obstacle7 < 2 THEN
obstacle7 = 2
ENDIF
obstacle7 = obstacle7 * 8
obstacle7 = obstacle7 + 20
drawsprite 0 obstacle1 dodged
drawsprite 8 obstacle2 dodged
drawsprite 16 obstacle3 dodged
drawsprite 24 obstacle4 dodged
drawsprite 32 obstacle5 dodged
drawsprite 40 obstacle6 dodged
drawsprite 48 obstacle7 dodged
IF result == 5 THEN
clrgraph
printcenter 0 pause
graphlines 0 8 96 8 1 1
printgraph 24 29 continue
printgraph 32 29 quit
spritey = 25
LOOP UNTIL result == 5
drawsprite 20 spritey cursor
result = getval
IF result == 4 AND spritey > 25 THEN
spritey = spritey - 8
ENDIF
IF result == 1 AND spritey < 33 THEN
spritey = spritey + 8
ENDIF
clrsprite 20 spritey
ENDLOOP
IF spritey == 33 THEN
loopval = spritex
ENDIF
ENDIF
ENDLOOP
result = 0
printcenter 27 gameover
sleep 10
ENDIF
IF result == 5 AND spritey == 33 THEN
graphlines 0 8 96 8 1 1
printcenter 0 instructions
printcenter 27 useleft
printcenter 35 move
printcenter 43 use2nd
printcenter 51 presskey
wait
clrgraph
result = 0
ENDIF
IF result == 5 AND spritey == 41 THEN
graphlines 0 8 96 8 1 1
printcenter 0 about
printcenter 8 thisgame
printcenter 16 joshfrisby
printcenter 24 adapted
printcenter 32 author
printcenter 40 cemetech
printcenter 48 presskey
wait
clrgraph
result = 0
ENDIF
ENDLOOP
clrgraph
graphlines 7 7 89 57 1 2
printcenter 27 thanks
sleep 10
FOR loopval = 26 TO 34
graphlines 8 loopval 88 loopval 0 1
NEXT
printcenter 27 title
sleep 10
clrgraph
END
FSTART getval
ASM
rst 28h
.dw $4018
ld (keyval),a
ENDASM
RETURN keyval
FEND
FSTART randomno upper
ASM
ld b, (randomno_upper)
call irandom
ld (norandom), a
ENDASM
RETURN norandom
FEND
FSTART printgraph x y printstring
ASM
ld a, (printgraph_x)
ld ($86D7), a
ld a, (printgraph_y)
ld ($86D7), a
ld hl, printgraph_printstring
rst 28h
.dw $4561
ENDASM
FEND
FSTART printcenter y printstring
ASM
ld a, (printcenter_y)
ld hl, printcenter_printstring
call centertext
ENDASM
FEND
FSTART graphlines x1 y1 x2 y2 style type
ASM
ld h, (graphlines_x1)
ld l, (graphlines_y1)
ld d, (graphlines_x2)
ld e, (graphlines_y2)
ld a, (graphlines_style)
cp 2
jp z, drawthegraph
ld a, (graphlines_type)
call fastlined
jp copytograph
drawthegraph:
ld a, (graphlines_type)
call fastrectangle_save
copytograph:
call fastcopys
ENDASM
FEND
FSTART drawsprite x y spritename
ASM
ld b, 8
ld a, (drawsprite_x)
ld l, (drawsprite_y)
ld ix, (drawsprite_spritename)
call isprite
call fastcopys
ENDASM
FEND
FSTART clrsprite y x
ASM
ld b, 8
ld a, (clrsprite_y)
ld l, (clrsprite_x)
ld ix, blanksprite
call isprite
call fastcopys
ENDASM
FEND
FSTART initsprite
ASM
jp endsprite
dodged:
.db %00000000
.db %00111100
.db %01001110
.db %01001110
.db %01111110
.db %01111110
.db %00111100
.db %00000000
cursor:
.db %00001000
.db %00000100
.db %00000010
.db %11111111
.db %11111111
.db %00000010
.db %00000100
.db %00001000
dodger:
.db %00011001
.db %00011001
.db %00010001
.db %11111111
.db %10111000
.db %10111000
.db %10101000
.db %01101100
blanksprite:
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
.db %00000000
endsprite:
ENDASM
FEND
I cut all the equates BZC generated in the Asm code because the majority of the code consists of equates that you don't need.
Code:
.org $9D93
.db $BB,$6D
ret
.db 1
.db %11111111,%11111111
.db %11000000,%00000011
.db %11000000,%00000011
.db %11000000,%00000011
.db %11000000,%00000011
.db %11000000,%00000011
.db %11111111,%11111110
.db %11111111,%11111100
.db %11000000,%00000110
.db %11000000,%00000111
.db %11000000,%00000011
.db %11000000,%00000011
.db %11000000,%00000011
.db %11000000,%00000011
.db %11000000,%00000011
.db "Dodgem TI BZC",0
Start:
LD (__RETPointer), SP
CALL initsprite
RST $28
.DW $4540
LD HL, 7
PUSH HL
LD HL, 7
PUSH HL
LD HL, 89
PUSH HL
LD HL, 57
PUSH HL
LD HL, 1
PUSH HL
LD HL, 2
PUSH HL
CALL graphlines
LD HL, 27
PUSH HL
LD HL, title
PUSH HL
CALL printcenter
LD HL, 10
PUSH HL
CALL sleep
LD HL, 26
LD A, L
LD (loopval), A
LD HL, 34
INC HL
PUSH HL
__FORNEXT__A__BEGIN__:
LD HL, 8
PUSH HL
LD H, 0
LD A, (loopval)
LD L, A
PUSH HL
LD HL, 88
PUSH HL
LD H, 0
LD A, (loopval)
LD L, A
PUSH HL
LD HL, 0
PUSH HL
LD HL, 1
PUSH HL
CALL graphlines
LD H, 0
LD A, (loopval)
LD L, A
INC HL
LD A, L
LD (loopval), A
POP DE
DEC SP
DEC SP
LD A, D
CP H
JP NZ, __FORNEXT__A__BEGIN__
LD A, E
CP L
JP NZ, __FORNEXT__A__BEGIN__
POP HL
LD HL, 27
PUSH HL
LD HL, author
PUSH HL
CALL printcenter
LD HL, 26
LD A, L
LD (loopval), A
LD HL, 34
INC HL
PUSH HL
__FORNEXT__B__BEGIN__:
LD HL, 8
PUSH HL
LD H, 0
LD A, (loopval)
LD L, A
PUSH HL
LD HL, 88
PUSH HL
LD H, 0
LD A, (loopval)
LD L, A
PUSH HL
LD HL, 0
PUSH HL
LD HL, 1
PUSH HL
CALL graphlines
LD H, 0
LD A, (loopval)
LD L, A
INC HL
LD A, L
LD (loopval), A
POP DE
DEC SP
DEC SP
LD A, D
CP H
JP NZ, __FORNEXT__B__BEGIN__
LD A, E
CP L
JP NZ, __FORNEXT__B__BEGIN__
POP HL
LD HL, 10
PUSH HL
CALL sleep
__LOOP__C__BEGIN__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 5
POP DE
LD A, H
CP D
JP NZ, __LOOP__C____D__NEXT__
LD A, L
CP E
JP NZ, __LOOP__C____D__NEXT__
__LOOP__C____D__NEXT__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 95
POP DE
LD A, H
CP D
JP NZ, __LOOP__C__TEMP__
LD A, L
CP E
JP NZ, __LOOP__C__TEMP__
JP __LOOP__C__TEST__
__LOOP__C__TEMP__:
RST $28
.DW $4540
LD HL, 0
PUSH HL
LD HL, 8
PUSH HL
LD HL, 96
PUSH HL
LD HL, 8
PUSH HL
LD HL, 1
PUSH HL
LD HL, 1
PUSH HL
CALL graphlines
LD HL, 0
PUSH HL
LD HL, title
PUSH HL
CALL printcenter
LD HL, 24
PUSH HL
LD HL, 29
PUSH HL
LD HL, startgame
PUSH HL
CALL printgraph
LD HL, 32
PUSH HL
LD HL, 29
PUSH HL
LD HL, instructions
PUSH HL
CALL printgraph
LD HL, 40
PUSH HL
LD HL, 29
PUSH HL
LD HL, about
PUSH HL
CALL printgraph
LD HL, 48
PUSH HL
LD HL, 29
PUSH HL
LD HL, quit
PUSH HL
CALL printgraph
LD HL, 25
LD A, L
LD (spritey), A
__LOOP__E__BEGIN__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 5
POP DE
LD A, H
CP D
JP NZ, __LOOP__E____F__NEXT__
LD A, L
CP E
JP NZ, __LOOP__E____F__NEXT__
__LOOP__E____F__NEXT__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 15
POP DE
LD A, H
CP D
JP NZ, __LOOP__E__TEMP__
LD A, L
CP E
JP NZ, __LOOP__E__TEMP__
JP __LOOP__E__TEST__
__LOOP__E__TEMP__:
LD HL, 20
PUSH HL
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, cursor
PUSH HL
CALL drawsprite
CALL getval
LD A, L
LD (result), A
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 4
POP DE
LD A, H
CP D
JP NZ, __IF__G____H__NEXT__
LD A, L
CP E
JP NZ, __IF__G____H__NEXT__
__IF__G____H__NEXT__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 25
POP DE
LD A, H
CP D
JP C, __IF__G__TEMP__
CP D
JP NZ, __IF__G__TEST__
LD A, L
CP E
JP NC, __IF__G__TEST__
__IF__G__TEMP__:
LD H, 0
LD A, (spritey)
LD L, A
EX DE, HL
LD HL, 8
EX DE, HL
SCF
CCF
SBC HL, DE
LD A, L
LD (spritey), A
__IF__G__TEST__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 1
POP DE
LD A, H
CP D
JP NZ, __IF__I____J__NEXT__
LD A, L
CP E
JP NZ, __IF__I____J__NEXT__
__IF__I____J__NEXT__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 49
POP DE
EX DE, HL
LD A, H
CP D
JP C, __IF__I__TEMP__
CP D
JP NZ, __IF__I__TEST__
LD A, L
CP E
JP NC, __IF__I__TEST__
__IF__I__TEMP__:
LD H, 0
LD A, (spritey)
LD L, A
EX DE, HL
LD HL, 8
ADD HL, DE
LD A, L
LD (spritey), A
__IF__I__TEST__:
LD HL, 20
PUSH HL
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
CALL clrsprite
JP __LOOP__E__BEGIN__
__LOOP__E__TEST__:
RST $28
.DW $4540
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 5
POP DE
LD A, H
CP D
JP NZ, __IF__K____L__NEXT__
LD A, L
CP E
JP NZ, __IF__K____L__NEXT__
__IF__K____L__NEXT__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 25
POP DE
LD A, H
CP D
JP NZ, __IF__K__TEST__
LD A, L
CP E
JP NZ, __IF__K__TEST__
__IF__K__TEMP__:
LD HL, 20
LD A, L
LD (obstacle1), A
LD HL, 20
LD A, L
LD (obstacle2), A
LD HL, 20
LD A, L
LD (obstacle3), A
LD HL, 20
LD A, L
LD (obstacle4), A
LD HL, 20
LD A, L
LD (obstacle5), A
LD HL, 20
LD A, L
LD (obstacle6), A
LD HL, 20
LD A, L
LD (obstacle7), A
LD HL, 52
LD A, L
LD (spritex), A
__LOOP__M__BEGIN__:
LD H, 0
LD A, (loopval)
LD L, A
PUSH HL
LD H, 0
LD A, (spritex)
LD L, A
POP DE
LD A, H
CP D
JP NZ, __LOOP__M__TEMP__
LD A, L
CP E
JP NZ, __LOOP__M__TEMP__
JP __LOOP__M__TEST__
__LOOP__M__TEMP__:
CALL getval
LD A, L
LD (result), A
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 55
POP DE
LD A, H
CP D
JP NZ, __IF__N__TEST__
LD A, L
CP E
JP NZ, __IF__N__TEST__
__IF__N__TEMP__:
RST $28
.DW $5008
__IF__N__TEST__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 2
POP DE
LD A, H
CP D
JP NZ, __IF__O__TEST__
LD A, L
CP E
JP NZ, __IF__O__TEST__
__IF__O__TEMP__:
LD H, 0
LD A, (spritex)
LD L, A
EX DE, HL
LD HL, 8
EX DE, HL
SCF
CCF
SBC HL, DE
LD A, L
LD (spritex), A
__IF__O__TEST__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 3
POP DE
LD A, H
CP D
JP NZ, __IF__P__TEST__
LD A, L
CP E
JP NZ, __IF__P__TEST__
__IF__P__TEMP__:
LD H, 0
LD A, (spritex)
LD L, A
EX DE, HL
LD HL, 8
ADD HL, DE
LD A, L
LD (spritex), A
__IF__P__TEST__:
LD H, 0
LD A, (spritex)
LD L, A
PUSH HL
LD HL, 20
POP DE
EX DE, HL
LD A, H
CP D
JP C, __IF__Q__TEMP__
CP D
JP NZ, __IF__Q__TEST__
LD A, L
CP E
JP NC, __IF__Q__TEST__
__IF__Q__TEMP__:
LD HL, 84
LD A, L
LD (spritex), A
__IF__Q__TEST__:
LD H, 0
LD A, (spritex)
LD L, A
PUSH HL
LD HL, 84
POP DE
LD A, H
CP D
JP C, __IF__R__TEMP__
CP D
JP NZ, __IF__R__TEST__
LD A, L
CP E
JP NC, __IF__R__TEST__
__IF__R__TEMP__:
LD HL, 20
LD A, L
LD (spritex), A
__IF__R__TEST__:
LD H, 0
LD A, (spritex)
LD L, A
PUSH HL
LD HL, 56
PUSH HL
CALL clrsprite
LD H, 0
LD A, (spritex)
LD L, A
PUSH HL
LD HL, 56
PUSH HL
LD HL, dodger
PUSH HL
CALL drawsprite
LD HL, 0
PUSH HL
LD H, 0
LD A, (obstacle1)
LD L, A
PUSH HL
CALL clrsprite
LD HL, 8
PUSH HL
LD H, 0
LD A, (obstacle2)
LD L, A
PUSH HL
CALL clrsprite
LD HL, 16
PUSH HL
LD H, 0
LD A, (obstacle3)
LD L, A
PUSH HL
CALL clrsprite
LD HL, 24
PUSH HL
LD H, 0
LD A, (obstacle4)
LD L, A
PUSH HL
CALL clrsprite
LD HL, 32
PUSH HL
LD H, 0
LD A, (obstacle5)
LD L, A
PUSH HL
CALL clrsprite
LD HL, 40
PUSH HL
LD H, 0
LD A, (obstacle6)
LD L, A
PUSH HL
CALL clrsprite
LD HL, 48
PUSH HL
LD H, 0
LD A, (obstacle7)
LD L, A
PUSH HL
CALL clrsprite
LD H, 0
LD A, (obstacle7)
LD L, A
LD A, L
LD (loopval), A
LD H, 0
LD A, (obstacle7)
LD L, A
LD A, L
LD (obstacle6), A
LD H, 0
LD A, (obstacle6)
LD L, A
LD A, L
LD (obstacle5), A
LD H, 0
LD A, (obstacle5)
LD L, A
LD A, L
LD (obstacle4), A
LD H, 0
LD A, (obstacle4)
LD L, A
LD A, L
LD (obstacle3), A
LD H, 0
LD A, (obstacle3)
LD L, A
LD A, L
LD (obstacle2), A
LD H, 0
LD A, (obstacle2)
LD L, A
LD A, L
LD (obstacle1), A
LD HL, 8
PUSH HL
CALL randomno
LD A, L
LD (obstacle7), A
LD H, 0
LD A, (obstacle7)
LD L, A
PUSH HL
LD HL, 2
POP DE
EX DE, HL
LD A, H
CP D
JP C, __IF__S__TEMP__
CP D
JP NZ, __IF__S__TEST__
LD A, L
CP E
JP NC, __IF__S__TEST__
__IF__S__TEMP__:
LD HL, 2
LD A, L
LD (obstacle7), A
__IF__S__TEST__:
LD H, 0
LD A, (obstacle7)
LD L, A
EX DE, HL
LD HL, 8
CALL __multiply__
LD A, L
LD (obstacle7), A
LD H, 0
LD A, (obstacle7)
LD L, A
EX DE, HL
LD HL, 20
ADD HL, DE
LD A, L
LD (obstacle7), A
LD HL, 0
PUSH HL
LD H, 0
LD A, (obstacle1)
LD L, A
PUSH HL
LD HL, dodged
PUSH HL
CALL drawsprite
LD HL, 8
PUSH HL
LD H, 0
LD A, (obstacle2)
LD L, A
PUSH HL
LD HL, dodged
PUSH HL
CALL drawsprite
LD HL, 16
PUSH HL
LD H, 0
LD A, (obstacle3)
LD L, A
PUSH HL
LD HL, dodged
PUSH HL
CALL drawsprite
LD HL, 24
PUSH HL
LD H, 0
LD A, (obstacle4)
LD L, A
PUSH HL
LD HL, dodged
PUSH HL
CALL drawsprite
LD HL, 32
PUSH HL
LD H, 0
LD A, (obstacle5)
LD L, A
PUSH HL
LD HL, dodged
PUSH HL
CALL drawsprite
LD HL, 40
PUSH HL
LD H, 0
LD A, (obstacle6)
LD L, A
PUSH HL
LD HL, dodged
PUSH HL
CALL drawsprite
LD HL, 48
PUSH HL
LD H, 0
LD A, (obstacle7)
LD L, A
PUSH HL
LD HL, dodged
PUSH HL
CALL drawsprite
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 5
POP DE
LD A, H
CP D
JP NZ, __IF__T__TEST__
LD A, L
CP E
JP NZ, __IF__T__TEST__
__IF__T__TEMP__:
RST $28
.DW $4540
LD HL, 0
PUSH HL
LD HL, pause
PUSH HL
CALL printcenter
LD HL, 0
PUSH HL
LD HL, 8
PUSH HL
LD HL, 96
PUSH HL
LD HL, 8
PUSH HL
LD HL, 1
PUSH HL
LD HL, 1
PUSH HL
CALL graphlines
LD HL, 24
PUSH HL
LD HL, 29
PUSH HL
LD HL, continue
PUSH HL
CALL printgraph
LD HL, 32
PUSH HL
LD HL, 29
PUSH HL
LD HL, quit
PUSH HL
CALL printgraph
LD HL, 25
LD A, L
LD (spritey), A
__LOOP__U__BEGIN__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 5
POP DE
LD A, H
CP D
JP NZ, __LOOP__U__TEMP__
LD A, L
CP E
JP NZ, __LOOP__U__TEMP__
JP __LOOP__U__TEST__
__LOOP__U__TEMP__:
LD HL, 20
PUSH HL
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, cursor
PUSH HL
CALL drawsprite
CALL getval
LD A, L
LD (result), A
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 4
POP DE
LD A, H
CP D
JP NZ, __IF__V____W__NEXT__
LD A, L
CP E
JP NZ, __IF__V____W__NEXT__
__IF__V____W__NEXT__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 25
POP DE
LD A, H
CP D
JP C, __IF__V__TEMP__
CP D
JP NZ, __IF__V__TEST__
LD A, L
CP E
JP NC, __IF__V__TEST__
__IF__V__TEMP__:
LD H, 0
LD A, (spritey)
LD L, A
EX DE, HL
LD HL, 8
EX DE, HL
SCF
CCF
SBC HL, DE
LD A, L
LD (spritey), A
__IF__V__TEST__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 1
POP DE
LD A, H
CP D
JP NZ, __IF__X____Y__NEXT__
LD A, L
CP E
JP NZ, __IF__X____Y__NEXT__
__IF__X____Y__NEXT__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 33
POP DE
EX DE, HL
LD A, H
CP D
JP C, __IF__X__TEMP__
CP D
JP NZ, __IF__X__TEST__
LD A, L
CP E
JP NC, __IF__X__TEST__
__IF__X__TEMP__:
LD H, 0
LD A, (spritey)
LD L, A
EX DE, HL
LD HL, 8
ADD HL, DE
LD A, L
LD (spritey), A
__IF__X__TEST__:
LD HL, 20
PUSH HL
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
CALL clrsprite
JP __LOOP__U__BEGIN__
__LOOP__U__TEST__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 33
POP DE
LD A, H
CP D
JP NZ, __IF__Z__TEST__
LD A, L
CP E
JP NZ, __IF__Z__TEST__
__IF__Z__TEMP__:
LD H, 0
LD A, (spritex)
LD L, A
LD A, L
LD (loopval), A
__IF__Z__TEST__:
__IF__T__TEST__:
JP __LOOP__M__BEGIN__
__LOOP__M__TEST__:
LD HL, 0
LD A, L
LD (result), A
LD HL, 27
PUSH HL
LD HL, gameover
PUSH HL
CALL printcenter
LD HL, 10
PUSH HL
CALL sleep
__IF__K__TEST__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 5
POP DE
LD A, H
CP D
JP NZ, __IF__ZA____ZB__NEXT__
LD A, L
CP E
JP NZ, __IF__ZA____ZB__NEXT__
__IF__ZA____ZB__NEXT__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 33
POP DE
LD A, H
CP D
JP NZ, __IF__ZA__TEST__
LD A, L
CP E
JP NZ, __IF__ZA__TEST__
__IF__ZA__TEMP__:
LD HL, 0
PUSH HL
LD HL, 8
PUSH HL
LD HL, 96
PUSH HL
LD HL, 8
PUSH HL
LD HL, 1
PUSH HL
LD HL, 1
PUSH HL
CALL graphlines
LD HL, 0
PUSH HL
LD HL, instructions
PUSH HL
CALL printcenter
LD HL, 27
PUSH HL
LD HL, useleft
PUSH HL
CALL printcenter
LD HL, 35
PUSH HL
LD HL, move
PUSH HL
CALL printcenter
LD HL, 43
PUSH HL
LD HL, use2nd
PUSH HL
CALL printcenter
LD HL, 51
PUSH HL
LD HL, presskey
PUSH HL
CALL printcenter
RST $28
.DW $4972
RST $28
.DW $4540
LD HL, 0
LD A, L
LD (result), A
__IF__ZA__TEST__:
LD H, 0
LD A, (result)
LD L, A
PUSH HL
LD HL, 5
POP DE
LD A, H
CP D
JP NZ, __IF__ZC____ZD__NEXT__
LD A, L
CP E
JP NZ, __IF__ZC____ZD__NEXT__
__IF__ZC____ZD__NEXT__:
LD H, 0
LD A, (spritey)
LD L, A
PUSH HL
LD HL, 41
POP DE
LD A, H
CP D
JP NZ, __IF__ZC__TEST__
LD A, L
CP E
JP NZ, __IF__ZC__TEST__
__IF__ZC__TEMP__:
LD HL, 0
PUSH HL
LD HL, 8
PUSH HL
LD HL, 96
PUSH HL
LD HL, 8
PUSH HL
LD HL, 1
PUSH HL
LD HL, 1
PUSH HL
CALL graphlines
LD HL, 0
PUSH HL
LD HL, about
PUSH HL
CALL printcenter
LD HL, 8
PUSH HL
LD HL, thisgame
PUSH HL
CALL printcenter
LD HL, 16
PUSH HL
LD HL, joshfrisby
PUSH HL
CALL printcenter
LD HL, 24
PUSH HL
LD HL, adapted
PUSH HL
CALL printcenter
LD HL, 32
PUSH HL
LD HL, author
PUSH HL
CALL printcenter
LD HL, 40
PUSH HL
LD HL, cemetech
PUSH HL
CALL printcenter
LD HL, 48
PUSH HL
LD HL, presskey
PUSH HL
CALL printcenter
RST $28
.DW $4972
RST $28
.DW $4540
LD HL, 0
LD A, L
LD (result), A
__IF__ZC__TEST__:
JP __LOOP__C__BEGIN__
__LOOP__C__TEST__:
RST $28
.DW $4540
LD HL, 7
PUSH HL
LD HL, 7
PUSH HL
LD HL, 89
PUSH HL
LD HL, 57
PUSH HL
LD HL, 1
PUSH HL
LD HL, 2
PUSH HL
CALL graphlines
LD HL, 27
PUSH HL
LD HL, thanks
PUSH HL
CALL printcenter
LD HL, 10
PUSH HL
CALL sleep
LD HL, 26
LD A, L
LD (loopval), A
LD HL, 34
INC HL
PUSH HL
__FORNEXT__ZE__BEGIN__:
LD HL, 8
PUSH HL
LD H, 0
LD A, (loopval)
LD L, A
PUSH HL
LD HL, 88
PUSH HL
LD H, 0
LD A, (loopval)
LD L, A
PUSH HL
LD HL, 0
PUSH HL
LD HL, 1
PUSH HL
CALL graphlines
LD H, 0
LD A, (loopval)
LD L, A
INC HL
LD A, L
LD (loopval), A
POP DE
DEC SP
DEC SP
LD A, D
CP H
JP NZ, __FORNEXT__ZE__BEGIN__
LD A, E
CP L
JP NZ, __FORNEXT__ZE__BEGIN__
POP HL
LD HL, 27
PUSH HL
LD HL, title
PUSH HL
CALL printcenter
LD HL, 10
PUSH HL
CALL sleep
RST $28
.DW $4540
RET
__multiply__:
LD B, H
LD C, L
LD HL, 0
__multiply___again:
LD A, B
OR C
RET Z
ADD HL, DE
DEC BC
JP __multiply___again
RET
sleep:
POP BC
POP HL
LD D, L
PUSH BC
DEC D
LD E, $FF
sleep_loop1:
LD B, $9F
sleep_loop2:
DJNZ sleep_loop2
DEC DE
LD A, D
OR E
JP NZ, sleep_loop1
RET
getval:
rst 28h
.dw $4018
ld (keyval),a
LD H, 0
LD A, (keyval)
LD L, A
RET
RET
randomno:
POP BC
POP HL
LD A, L
LD ($917F), A
PUSH BC
ld b, ($917F)
call irandom
ld (norandom), a
LD H, 0
LD A, (norandom)
LD L, A
RET
RET
printgraph:
POP BC
POP HL
LD (printgraph_printstring), HL
POP HL
LD (printgraph_y), HL
POP HL
LD (printgraph_x), HL
PUSH BC
ld a, (printgraph_x)
ld ($86D7), a
ld a, (printgraph_y)
ld ($86D7), a
ld hl, printgraph_printstring
rst 28h
.dw $4561
RET
printcenter:
POP BC
POP HL
LD (printcenter_printstring), HL
POP HL
LD (printcenter_y), HL
PUSH BC
ld a, (printcenter_y)
ld hl, printcenter_printstring
call centertext
RET
graphlines:
POP BC
POP HL
LD (graphlines_type), HL
POP HL
LD (graphlines_style), HL
POP HL
LD (graphlines_y2), HL
POP HL
LD (graphlines_x2), HL
POP HL
LD (graphlines_y1), HL
POP HL
LD (graphlines_x1), HL
PUSH BC
ld h, (graphlines_x1)
ld l, (graphlines_y1)
ld d, (graphlines_x2)
ld e, (graphlines_y2)
ld a, (graphlines_style)
cp 2
jp z, drawthegraph
ld a, (graphlines_type)
call fastlined
jp copytograph
drawthegraph:
ld a, (graphlines_type)
call fastrectangle_save
copytograph:
call fastcopys
RET
drawsprite:
POP BC
POP HL
LD (drawsprite_spritename), HL
POP HL
LD (drawsprite_y), HL
POP HL
LD (drawsprite_x), HL
PUSH BC
ld b, 8
ld a, (drawsprite_x)
ld l, (drawsprite_y)
ld ix, (drawsprite_spritename)
call isprite
call fastcopys
RET
clrsprite:
POP BC
POP HL
LD (clrsprite_x), HL
POP HL
LD (clrsprite_y), HL
PUSH BC
ld b, 8
ld a, (clrsprite_y)
ld l, (clrsprite_x)
ld ix, blanksprite
call isprite
call fastcopys
RET
initsprite:
jp endsprite
dodged:
.db % 00000000
.db % 00111100
.db % 01001110
.db % 01001110
.db % 01111110
.db % 01111110
.db % 00111100
.db % 00000000
cursor:
.db % 00001000
.db % 00000100
.db % 00000010
.db % 11111111
.db % 11111111
.db % 00000010
.db % 00000100
.db % 00001000
dodger:
.db % 00011001
.db % 00011001
.db % 00010001
.db % 11111111
.db % 10111000
.db % 10111000
.db % 10101000
.db % 01101100
blanksprite:
.db % 00000000
.db % 00000000
.db % 00000000
.db % 00000000
.db % 00000000
.db % 00000000
.db % 00000000
.db % 00000000
endsprite:
RET
__RETPointer:
.DW 0
menu_display__entry_num:
.DB 0
mlinebitmap:
.DW 65535
timer1:
.DW 35386
timer1max:
.DW 35387
timer2:
.DW 35388
timer2max:
.DW 35389
timer3:
.DW 35390
custintaddr:
.DW 38511
saferam1:
.DW 34540
saferam2:
.DW 39026
saferam3:
.DW 33445
mirflags:
.DB 33
rightalign:
.DB 7
numscrollpixels:
.DW 38510
scrollbarcoords:
.DW 38510
old_element:
.DW 38510
cur_element:
.DW 38510
old_max_elem:
.DW 38510
max_elements:
.DW 38510
gbuf:
.DW 37696
spritey:
.DB 0
spritex:
.DB 0
obstacle1:
.DB 0
obstacle2:
.DB 0
obstacle3:
.DB 0
obstacle4:
.DB 0
obstacle5:
.DB 0
obstacle6:
.DB 0
obstacle7:
.DB 0
loopval:
.DB 0
keyval:
.DB 0
result:
.DB 0
norandom:
.DB 0
title:
.DB 68
.DB 111
.DB 100
.DB 103
.DB 101
.DB 109
.DB 32
.DB 84
.DB 73
.DB 32
.DB 66
.DB 90
.DB 67
.DB 0
author:
.DB 66
.DB 121
.DB 32
.DB 82
.DB 111
.DB 98
.DB 101
.DB 114
.DB 116
.DB 111
.DB 32
.DB 83
.DB 97
.DB 110
.DB 99
.DB 104
.DB 101
.DB 122
.DB 0
startgame:
.DB 83
.DB 116
.DB 97
.DB 114
.DB 116
.DB 32
.DB 71
.DB 97
.DB 109
.DB 101
.DB 0
instructions:
.DB 73
.DB 110
.DB 115
.DB 116
.DB 114
.DB 117
.DB 99
.DB 116
.DB 105
.DB 111
.DB 110
.DB 115
.DB 0
thisgame:
.DB 84
.DB 104
.DB 105
.DB 115
.DB 32
.DB 103
.DB 97
.DB 109
.DB 101
.DB 32
.DB 119
.DB 97
.DB 115
.DB 32
.DB 109
.DB 97
.DB 100
.DB 101
.DB 32
.DB 98
.DB 121
.DB 0
about:
.DB 65
.DB 98
.DB 111
.DB 117
.DB 116
.DB 0
quit:
.DB 81
.DB 117
.DB 105
.DB 116
.DB 0
pause:
.DB 80
.DB 97
.DB 117
.DB 115
.DB 101
.DB 0
continue:
.DB 67
.DB 111
.DB 110
.DB 116
.DB 105
.DB 110
.DB 117
.DB 101
.DB 0
joshfrisby:
.DB 74
.DB 111
.DB 115
.DB 104
.DB 32
.DB 70
.DB 114
.DB 105
.DB 115
.DB 98
.DB 121
.DB 32
.DB 102
.DB 111
.DB 114
.DB 32
.DB 66
.DB 65
.DB 83
.DB 73
.DB 67
.DB 0
useleft:
.DB 85
.DB 115
.DB 101
.DB 32
.DB 108
.DB 101
.DB 102
.DB 116
.DB 32
.DB 97
.DB 110
.DB 100
.DB 32
.DB 114
.DB 105
.DB 103
.DB 104
.DB 116
.DB 32
.DB 97
.DB 114
.DB 114
.DB 111
.DB 119
.DB 115
.DB 0
move:
.DB 116
.DB 111
.DB 32
.DB 109
.DB 111
.DB 118
.DB 101
.DB 46
.DB 0
use2nd:
.DB 85
.DB 115
.DB 101
.DB 32
.DB 50
.DB 110
.DB 100
.DB 32
.DB 116
.DB 111
.DB 32
.DB 112
.DB 97
.DB 117
.DB 115
.DB 101
.DB 46
.DB 0
presskey:
.DB 80
.DB 114
.DB 101
.DB 115
.DB 115
.DB 32
.DB 97
.DB 32
.DB 107
.DB 101
.DB 121
.DB 32
.DB 116
.DB 111
.DB 32
.DB 99
.DB 111
.DB 110
.DB 116
.DB 105
.DB 110
.DB 117
.DB 101
.DB 46
.DB 0
adapted:
.DB 65
.DB 100
.DB 97
.DB 112
.DB 116
.DB 101
.DB 100
.DB 32
.DB 116
.DB 111
.DB 32
.DB 66
.DB 90
.DB 67
.DB 0
cemetech:
.DB 71
.DB 111
.DB 32
.DB 116
.DB 111
.DB 32
.DB 99
.DB 101
.DB 109
.DB 101
.DB 116
.DB 101
.DB 99
.DB 104
.DB 46
.DB 110
.DB 101
.DB 116
.DB 0
thanks:
.DB 84
.DB 104
.DB 97
.DB 110
.DB 107
.DB 32
.DB 89
.DB 111
.DB 117
.DB 114
.DB 32
.DB 102
.DB 111
.DB 114
.DB 32
.DB 80
.DB 108
.DB 97
.DB 121
.DB 105
.DB 110
.DB 103
.DB 0
gameover:
.DB 71
.DB 97
.DB 109
.DB 101
.DB 32
.DB 79
.DB 118
.DB 101
.DB 114
.DB 0
printgraph_printstring:
.DW 0
printgraph_y:
.DW 0
printgraph_x:
.DW 0
printcenter_printstring:
.DW 0
printcenter_y:
.DW 0
graphlines_type:
.DW 0
graphlines_style:
.DW 0
graphlines_y2:
.DW 0
graphlines_x2:
.DW 0
graphlines_y1:
.DW 0
graphlines_x1:
.DW 0
drawsprite_spritename:
.DW 0
drawsprite_y:
.DW 0
drawsprite_x:
.DW 0
clrsprite_x:
.DW 0
clrsprite_y:
.DW 0
I added the Mirage header. I think I just found some possible places that are giving me trouble. Things like this:
Code:
drawsprite_spritename:
.DW 0
drawsprite_y:
.DW 0
It didn't give enough space between the memory of the sprite name and the y location, so some of the data must have been corrupted. The y location could have been overwritten or characters in the string were overwritten by the y location and other stuff. I have to remember to get that fixed soon. Also note that I had to add the MEM declarations because the compiler would give me an error with sprite names. Snave is making some of these functions without Rom Calls but I'm doing my best with my limited Asm knowledge.
/me looks at the ASM code
I love this:
Code:
Does it not trust the processor to maintain the values of the registers? There are so many Pushes and Pops, it's hard to read. At least the stack is getting a good workout. I'd advise the tried and tested method of debugging: put b_call(_getkey) after each instruction. You'll find the misbehaving one.
That said, I think I found your problem. If I am reading this correctly, you passed 7,7,89,57,1,2 to the graphlines function. As it put them into it's variables, 89 was stored to (graphlines_y2). The calculator doesn't have 89 vertical pixels if he uses the same Y axis that I'm thinking of. I tried to follow what happens after that, but I get lost in a slew of computer generated code.
Edit: Snave, why did you use a word of storage to store the graphline inputs, and then proceed to load them into single byte registers? I think that might be a HUGE problem given that the processor is little endian!
Edit2: Upon further review, it loads 89 into the correct spot. All the pushes and pops had me a little confused. I still believe the source of the error is in the storage with different data types. Let me demonstrate. Let's load HL into (x) and back into h.
Assume HL = $0015 (21 decimal for all you anti hex people)
Code:
Okay, I withdraw all of my complaints. I can find no error, but I do not have the strength to look through all of that for errors. Sorry, I can't be of any help. I think I'll leave the contents of my failure in this post so people can see both what moron I am, and how hard it is to understand computer generated code.
I love this:
Code:
LD H, 0
LD A, (obstacle7)
LD L, A
LD A, L
LD (loopval), A
LD H, 0
LD A, (obstacle7)
LD L, A
LD A, L
LD (obstacle6), A
LD H, 0
LD A, (obstacle6)
LD L, A
LD A, L
LD (obstacle5), A
LD H, 0
LD A, (obstacle5)
LD L, A
LD A, L
LD (obstacle4), A
LD H, 0
LD A, (obstacle4)
LD L, A
LD A, L
LD (obstacle3), A
LD H, 0
LD A, (obstacle3)
LD L, A
LD A, L
LD (obstacle2), A
LD H, 0
LD A, (obstacle2)
LD L, A
LD A, L
LD (obstacle1), A
Does it not trust the processor to maintain the values of the registers? There are so many Pushes and Pops, it's hard to read. At least the stack is getting a good workout. I'd advise the tried and tested method of debugging: put b_call(_getkey) after each instruction. You'll find the misbehaving one.
That said, I think I found your problem. If I am reading this correctly, you passed 7,7,89,57,1,2 to the graphlines function. As it put them into it's variables, 89 was stored to (graphlines_y2). The calculator doesn't have 89 vertical pixels if he uses the same Y axis that I'm thinking of. I tried to follow what happens after that, but I get lost in a slew of computer generated code.
Edit: Snave, why did you use a word of storage to store the graphline inputs, and then proceed to load them into single byte registers? I think that might be a HUGE problem given that the processor is little endian!
Edit2: Upon further review, it loads 89 into the correct spot. All the pushes and pops had me a little confused. I still believe the source of the error is in the storage with different data types. Let me demonstrate. Let's load HL into (x) and back into h.
Assume HL = $0015 (21 decimal for all you anti hex people)
Code:
ld (X),HL ;X and X+1 are now = $1500 (remember, little endian)
ld h,(x) ;I just realized this would work fine. never mind.
X:
.DW 0
Okay, I withdraw all of my complaints. I can find no error, but I do not have the strength to look through all of that for errors. Sorry, I can't be of any help. I think I'll leave the contents of my failure in this post so people can see both what moron I am, and how hard it is to understand computer generated code.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
» Go to Registration page
» Goto page Previous 1, 2, 3 ... 9, 10, 11, 12 Next
» View previous topic :: View next topic
» View previous topic :: View next topic
Page 10 of 12
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Advertisement