A82: Help ?
[Prev][Next][Index][Thread]
A82: Help ?
Hey Guys,
I attempted a port of Squarez, was a total bomb, it quit right when it
started, and crashed :P Anyway, I'll take a look at that later... I tried
to port Dasher 83, but i ran into a few problems with the drawing and
keyloop.. on the 83, when you drew the screen and edited the map, you
wouldn't have the problem of losing the original map.. now you do .. and
the keyloop [which was a _getK] doesn't work with GET_KEY, because Andy did
that part and had it set up in a particular way.. anyway, here are the 82
source [*.asm file] and the 83 source [*.z80 file]. Please do not release
either source, and Bryan, please don't put it up on ticalc, since you
sometimes have a tendency to do that :P Anyone who can help, please do.
Thanks.
-Ahmed
map1:
.db 32
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 1,2,3,3,3,2,2,2,3,3,3,1
.db 1,2,2,2,2,2,1,3,3,3,3,1
.db 1,2,3,3,3,4,3,3,1,1,1,1
.db 1,2,1,1,1,1,2,3,3,3,3,1
.db 1,2,1,1,1,1,1,1,1,1,1,1
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 0,0,0,0,0,0,0,0,0,0,0,0
map2:
.db 44
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 1,3,2,2,2,2,2,3,3,2,3,1
.db 1,2,2,2,2,2,1,1,3,3,2,1
.db 1,3,3,3,3,4,2,3,3,3,2,1
.db 1,2,3,2,3,1,2,3,2,3,2,1
.db 1,2,3,2,3,1,2,3,1,3,2,1
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 0,0,0,0,0,0,0,0,0,0,0,0
map3:
.db 39
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 1,3,1,1,1,2,3,2,3,2,2,1
.db 1,2,2,3,2,2,3,2,2,3,2,1
.db 1,1,1,3,1,4,2,3,2,3,1,1
.db 1,2,3,1,3,1,2,3,2,3,2,1
.db 1,2,2,2,2,3,2,3,3,1,2,1
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 0,0,0,0,0,0,0,0,0,0,0,0
map4:
.db 36
.db 1,1,1,1,1,1,1,1,1,1,1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1,1,3,1,3,2,1
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 0,0,0,0,0,0,0,0,0,0,0,0
map9:
.db 36
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 1,1,2,3,2,2,1,3,3,2,3,1
.db 1,1,1,1,1,2,1,3,3,3,2,1
.db 1,1,1,3,3,4,2,3,2,3,2,1
.db 1,2,3,2,3,1,2,3,1,3,2,1
.db 1,2,2,2,2,1,2,3,1,3,2,1
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 0,0,0,0,0,0,0,0,0,0,0,0
map10:
.db 33
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 1,3,3,1,3,3,3,3,3,2,3,1
.db 1,3,1,1,1,2,2,1,1,1,1,1
.db 1,3,2,3,3,4,2,3,2,3,2,1
.db 1,3,1,1,1,2,2,1,1,1,1,1
.db 1,3,1,3,3,3,3,3,3,2,3,1
.db 1,1,1,1,1,1,1,1,1,1,1,1
.db 0,0,0,0,0,0,0,0,0,0,0,0
dasher:
.db 00011000b
.db 00110100b
.db 00110100b
.db 00110100b
.db 01111110b
.db 01011010b
.db 01000010b
.db 00000000b
crystal:
.db 00111000b
.db 01010100b
.db 10111010b
.db 11111110b
.db 10111010b
.db 01010100b
.db 00111000b
.db 00000000b
rock:
.db 00000001b
.db 01111101b
.db 01000001b
.db 01000001b
.db 01000001b
.db 01000001b
.db 00000001b
.db 11111111b
blank:
.db 00000000b
.db 00000000b
.db 00000000b
.db 00000000b
.db 00000000b
.db 00000000b
.db 00000000b
.db 00000000b
gem:
.db 00000000b
.db 00000000b
.db 00011000b
.db 00111100b
.db 00111100b
.db 00011000b
.db 00000000b
.db 00000000b
#INCLUDE "CRASH82.INC"
.DB "Dasher by Ahmed E",0
time = TEXT_MEM+1
linkpos = TEXT_MEM+2
mappos = TEXT_MEM+4
mapcount = TEXT_MEM+6
poscount = TEXT_MEM+7
maphl = TEXT_MEM+8
gemcount = TEXT_MEM+10
totalgems = TEXT_MEM+11
level = TEXT_MEM+12
speed = TEXT_MEM+13
string = TEXT_MEM+15
init:
ROM_CALL(CLEARLCD)
call title
ld a,0
ld (level),a
ld hl,map1
ld a,(hl)
ld (totalgems),a
ld a,0
ld (gemcount),a
push hl
ld hl,0300h
ld (speed),hl
pop hl
levelsloop:
push hl
call startgame
pop hl
cp 45
ret z
ld a,(time)
cp 0
jp z,timeup
ld de,97
add hl,de
ld a,(hl)
ld (totalgems),a
ld a,0
ld (gemcount),a
push hl
ld bc,-63
ld hl,(speed)
add hl,bc
ld (speed),hl
pop hl
ld a,(level)
inc a
ld (level),a
cp 10
jp nz,levelsloop
ld a,(time)
or a
jp z,theend
ROM_CALL(CLEARLCD)
ld hl,0202h
ld (CURSOR_POS),hl
ld hl,winstr
ROM_CALL(D_ZT_STR)
call Pause
theend:
ret
timeup:
ROM_CALL(CLEARLCD)
ld hl,0202h
ld (CURSOR_POS),hl
ld hl,timestr
ROM_CALL(D_ZT_STR)
call Pause
ret
startgame:
call map
ld a,54
ld (poscount),a
push hl
SET 7,(IY+$14)
ld hl,57*256+0
ld (CURSOR_X),hl
ld hl,timestring
ROM_CALL(D_ZM_STR)
ld hl,57*256+50
ld (CURSOR_X),hl
ld hl,levelstring
ROM_CALL(D_ZM_STR)
RES 7,(IY+$14)
call writelevel
pop hl
call CR_GRBCopy
ld a,70
ld (time),a
ld hl,57*256+25
ld (CURSOR_X),hl
call DispA
ld bc,(speed)
;------MOVE LOOP SHOULD GO HERE--------
writelevel:
push hl
ld a,(level)
inc a
ld hl,57*256+80
ld (CURSOR_X),hl
SET 7,(IY+$14)
call DispA
pop hl
call Pause
ret
right:
call nchl
ld a,(hl)
cp 1
jr nz,r2
ld a,(hl)
cp 0
call nz,lchl
ret nz
r2:
ld a,(poscount)
inc a
ld (poscount),a
ld (mappos),hl
ld a,(hl)
cp 2
call z,add2pts
cp 3
call z,add5pts
ld a,0
ld (hl),a
call drawblock
call drawdash
ret
up:
call lrhl
ld a,(hl)
cp 1
call z,nrhl
ret z
ld a,(poscount)
sub 12
ld (poscount),a
ld (mappos),hl
ld a,(hl)
cp 2
call z,add2pts
cp 3
call z,add5pts
ld a,0
ld (hl),a
call drawblock
call lastcol
call lastrow
call dec12
call drawdash
ret
down:
call nrhl
ld a,(hl)
cp 1
call z,lrhl
ret z
ld a,(poscount)
add a,12
ld (poscount),a
ld (mappos),hl
ld a,(hl)
cp 2
call z,add2pts
cp 3
call z,add5pts
ld a,0
ld (hl),a
call drawblock
call lastcol
call nextrow
call inc12
call drawdash
ret
left:
call lchl
ld a,(hl)
cp 1
call z,nchl
ret z
ld a,(poscount)
dec a
ld (poscount),a
ld (mappos),hl
ld a,(hl)
cp 2
call z,add2pts
cp 3
call z,add5pts
ld a,0
ld (hl),a
call drawblock
call lastcol
call lastcol
call drawdash
ret
;---------KEY LOOP SHOULD GO HERE-------
dectime:
ld a,(time)
dec a
ld (time),a
ld hl,57*256+25
ld (CURSOR_X),hl
SET 7,(IY+$14)
call DispA
RES 7,(IY+$14)
ld bc,(speed)
ret
add2pts:
push af
ld a,(gemcount)
inc a
ld (gemcount),a
pop af
ret
add5pts:
push af
ld a,(gemcount)
inc a
ld (gemcount),a
pop af
ret
nchl:
inc hl
ret
nrhl:
ld b,12
nrhlop:
inc hl
djnz nrhlop
ret
lchl:
dec hl
ret
lrhl:
ld b,12
lrhlop:
dec hl
djnz lrhlop
ret
dec12:
ld b,12
dec12lop:
dec de
djnz dec12lop
ret
inc12:
ld b,12
inc12lop:
inc de
djnz inc12lop
ret
nextcol:
inc de
ret
nextrow:
call inc12
call inc12
call inc12
call inc12
call inc12
call inc12
call inc12
ret
lastcol:
dec de
ret
lastrow:
call dec12
call dec12
call dec12
call dec12
call dec12
call dec12
call dec12
ret
title:
ROM_CALL(CLEARLCD)
SET 3,(IY+$05)
ld hl,0
ld (CURSOR_POS),hl
ld hl,gamestr
ROM_CALL(D_ZT_STR)
RES 3,(IY+$05)
ld hl,9*256+0
ld (CURSOR_X),hl
ld hl,authors
ROM_CALL(D_ZM_STR)
ld hl,16*256+0
ld (CURSOR_X),hl
ld hl,icq
ROM_CALL(D_ZM_STR)
ld hl,23*256+0
ld (CURSOR_X),hl
ld hl,website
ROM_CALL(D_ZM_STR)
ld hl,57*256+29
ld (CURSOR_X),hl
ld hl,pressenter
ROM_CALL(D_ZM_STR)
call Pause
ret
map:
inc hl
ld de,GRAPH_MEM
ld b,8
maploop:
push bc
ld b,12
maploop2:
push bc
ld a,(hl)
call drawblock
pop bc
inc hl
djnz maploop2
call nextrow
pop bc
djnz maploop
ret
drawblock:
ld a,(hl)
cp 0
call z,drawblank
cp 1
call z,drawrock
cp 2
call z,drawgems
cp 3
call z,drawcrystal
cp 4
call z,drawdash
ret
drawblank:
push hl
ld hl,blank
call drawpic
inc de
pop hl
ret
drawdash:
ld (mappos),hl
ld (linkpos),de
push hl
ld hl,dasher
call drawpic
inc de
pop hl
ld (hl),0
ret
drawrock:
push hl
ld hl,rock
call drawpic
inc de
pop hl
ret
drawgems:
push hl
ld hl,gem
call drawpic
inc de
pop hl
ret
drawcrystal:
push hl
ld hl,crystal
call drawpic
inc de
pop hl
ret
drawnone:
inc de
ret
drawpic:
push de
ld b,8
drawloop:
push bc
ldi
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
pop bc
djnz drawloop
pop de
ret
Pause:
call GET_KEY
or a
jr z,Pause
ret
DispA:
ld h,0
ld l,a
DispHL:
push de
push hl
ld de,string+5
xor a
ld (de),a
Repeat:
call UNPACK_HL
add a,'0'
dec de
ld (de),a
ld a,h
or l
jr nz,Repeat
ex de,hl
ROM_CALL(D_ZM_STR)
pop hl
pop de
ret
gamestr: .db " Dasher ",0
authors: .db " By: Ahmed_E & Andy_S",0
website: .db "http://asm8x.home.ml.org",0
icq: .db " ICQ : 3350394 / 1242320",0
pressenter: .db "Press Enter",0
timestring: .db "Time:",0
levelstring:.db "Level:",0
winstr: .db "You win!!",0
timestr: .db "Times up!!",0
#include "grphx.asm"
.end
END
.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#include "ti83asm.inc"
#include "tokens.inc"
.LIST
time = SAVESSCREEN+1
linkpos = SAVESSCREEN+2
mappos = SAVESSCREEN+4
mapcount = SAVESSCREEN+6
poscount = SAVESSCREEN+7
maphl = SAVESSCREEN+8
gemcount = SAVESSCREEN+10
totalgems = SAVESSCREEN+11
level = SAVESSCREEN+12
speed = SAVESSCREEN+13
.org 9327h
init:
call _runIndicOff
call _clrLCDFull
call _grbufclr
call title
ld a,0
ld (level),a
ld hl,map1
ld a,(hl)
ld (totalgems),a
ld a,0
ld (gemcount),a
push hl
ld hl,0300h
ld (speed),hl
pop hl
levelsloop:
push hl
call startgame
pop hl
cp 45
ret z
ld a,(time)
cp 0
jp z,timeup
ld de,97
add hl,de
ld a,(hl)
ld (totalgems),a
ld a,0
ld (gemcount),a
push hl
ld bc,-63
ld hl,(speed)
add hl,bc
ld (speed),hl
pop hl
ld a,(level)
inc a
ld (level),a
cp 10
jp nz,levelsloop
ld a,(time)
cp 0
jp z,theend
call _clrlcdfull
ld hl,0202h
ld (currow),hl
ld hl,winstr
call _puts
call _getkey
theend:
ret
timeup:
call _clrlcdfull
ld hl,0202h
ld (currow),hl
ld hl,timestr
call _puts
call _getkey
ret
startgame:
call map
ld a,54
ld (poscount),a
push hl
set textwrite,(iy+sgrflags)
ld hl,57*256+0
ld (pencol),hl
ld hl,timestring
call _vputs
ld hl,57*256+50
ld (pencol),hl
ld hl,levelstring
call _vputs
res textwrite,(iy+sgrflags)
call writelevel
pop hl
call _grbufcpy_v
ld a,70
ld (time),a
call _setxxop1
ld hl,57*256+25
ld (pencol),hl
ld a,3
call _dispop1a
ld bc,(speed)
moveloop:
call keyloop
push bc
ld de,(linkpos)
ld hl,(mappos)
cp 26
call z,right
cp 25
call z,up
cp 24
call z,left
cp 34
call z,down
pop bc
cp 45
ret z
ld a,(time)
cp 0
ret z
push bc
ld a,(gemcount)
ld b,a
ld a,(totalgems)
cp b
pop bc
ret z
push bc
call _grbufcpy_v
pop bc
jp moveloop
writelevel:
push hl
ld a,(level)
inc a
call _setxxop1
ld hl,57*256+80
ld (pencol),hl
ld a,10
set textwrite,(iy+sgrflags)
call _dispop1a
pop hl
ret
right:
call nchl
ld a,(hl)
cp 1
jr nz,r2
ld a,(hl)
cp 0
call nz,lchl
ret nz
r2:
ld a,(poscount)
inc a
ld (poscount),a
ld (mappos),hl
ld a,(hl)
cp 2
call z,add2pts
cp 3
call z,add5pts
ld a,0
ld (hl),a
call drawblock
call drawdash
ret
up:
call lrhl
ld a,(hl)
cp 1
call z,nrhl
ret z
ld a,(poscount)
sub 12
ld (poscount),a
ld (mappos),hl
ld a,(hl)
cp 2
call z,add2pts
cp 3
call z,add5pts
ld a,0
ld (hl),a
call drawblock
call lastcol
call lastrow
call dec12
call drawdash
ret
down:
call nrhl
ld a,(hl)
cp 1
call z,lrhl
ret z
ld a,(poscount)
add a,12
ld (poscount),a
ld (mappos),hl
ld a,(hl)
cp 2
call z,add2pts
cp 3
call z,add5pts
ld a,0
ld (hl),a
call drawblock
call lastcol
call nextrow
call inc12
call drawdash
ret
left:
call lchl
ld a,(hl)
cp 1
call z,nchl
ret z
ld a,(poscount)
dec a
ld (poscount),a
ld (mappos),hl
ld a,(hl)
cp 2
call z,add2pts
cp 3
call z,add5pts
ld a,0
ld (hl),a
call drawblock
call lastcol
call lastcol
call drawdash
ret
keyloop:
push hl
push bc
call _getk
call _op2toop1
call _convop1
pop bc
pop hl
push af
dec bc
ld a,b
or c
call z,dectime
ld a,(time)
cp 0
ret z
pop af
or a
jr z,keyloop
ret
dectime:
ld a,(time)
dec a
ld (time),a
call _setxxop1
ld hl,57*256+25
ld (pencol),hl
ld a,3
set textwrite,(iy+sgrflags)
call _dispop1a
res textwrite,(iy+sgrflags)
ld hl,57*256+25
ld (pencol),hl
ld a,3
call _dispop1a
ld bc,(speed)
ret
add2pts:
push af
ld a,(gemcount)
inc a
ld (gemcount),a
pop af
ret
add5pts:
push af
ld a,(gemcount)
inc a
ld (gemcount),a
pop af
ret
nchl:
inc hl
ret
nrhl:
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
ret
lchl:
dec hl
ret
lrhl:
dec hl
dec hl
dec hl
dec hl
dec hl
dec hl
dec hl
dec hl
dec hl
dec hl
dec hl
dec hl
ret
dec12:
dec de
dec de
dec de
dec de
dec de
dec de
dec de
dec de
dec de
dec de
dec de
dec de
ret
inc12:
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
ret
nextcol:
inc de
ret
nextrow:
call inc12
call inc12
call inc12
call inc12
call inc12
call inc12
call inc12
ret
lastcol:
dec de
ret
lastrow:
call dec12
call dec12
call dec12
call dec12
call dec12
call dec12
call dec12
ret
title:
call _clrLCDFull
SET textinverse, (iy+textflags)
call _homeup
ld hl,gamestr
call _puts
RES textinverse, (iy+textflags)
ld hl,9*256+0
ld (pencol),hl
ld hl,authors
call _vputs
ld hl,16*256+0
ld (pencol),hl
ld hl,icq
call _vputs
ld hl,23*256+0
ld (pencol),hl
ld hl,website
call _vputs
ld hl,57*256+29
ld (pencol),hl
ld hl,pressenter
call _vputs
call pause
ret
pause:
call _getkey
cp 05
jp nz,pause
call _clrlcdfull
ret
map:
inc hl
ld de,8e29h
ld b,8
maploop:
push bc
ld b,12
maploop2:
push bc
ld a,(hl)
call drawblock
pop bc
inc hl
djnz maploop2
call nextrow
pop bc
djnz maploop
ret
drawblock:
ld a,(hl)
cp 0
call z,drawblank
cp 1
call z,drawrock
cp 2
call z,drawgems
cp 3
call z,drawcrystal
cp 4
call z,drawdash
ret
drawblank:
push hl
ld hl,blank
call drawpic
inc de
pop hl
ret
drawdash:
ld (mappos),hl
ld (linkpos),de
push hl
ld hl,dasher
call drawpic
inc de
pop hl
ld (hl),0
ret
drawrock:
push hl
ld hl,rock
call drawpic
inc de
pop hl
ret
drawgems:
push hl
ld hl,gem
call drawpic
inc de
pop hl
ret
drawcrystal:
push hl
ld hl,crystal
call drawpic
inc de
pop hl
ret
drawnone:
inc de
ret
drawpic:
push de
ld b,8
drawloop:
push bc
ldi
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
inc de
pop bc
djnz drawloop
pop de
ret
gamestr:
.db " Dasher ",0
authors:
.db " By: Ahmed_E & Andy_S",0
website:
.db "http://asm8x.home.ml.org",0
icq:
.db " ICQ : 3350394 / 1242320",0
pressenter:
.db "Press Enter",0
timestring:
.db "Time:",0
levelstring:
.db "Level:",0
winstr:
.db "You win!!",0
timestr:
.db "Times up!!",0
#include "grphx.asm"
.end
END
Ahmed El-Helw
ahmedre@worldnet.att.net
http://asm86.home.ml.org
http://asm8x.home.ml.org
Ahmed_ on IRC
ICQ UIN: 3350394
References: