OK, I have encountered a slight problem. Whenever I want to draw something I have to bring the graphscreen up. I know how to do this in basic and it works...but not entirely. Whenever I code a small BASIC prgm that changes the X value of the sprite so that it should move I get a blank graph screen until I break the program and goto the graphscreen manually, then I see everything...
Now I did copy a sprite routine from the net so I do not really know where this problem hides...Also I know there are some optimizations possible but this works and that is what counts for me, after it works the way i WANT it to work i'll optimize...
Code: Select all
crz1spriteroutine:
;| Input: c is operator (1=and, 2=or, 3=xor) |
;| d is x-position (min. -7, max. 95) |
;| e is y-position (min. -7, max. 63) |
;| ix is sprite-address |
;| Destroys: a, bc, de, hl, ix, (currow), (curcol) |
;+--------------------------------------------------------------------+
.nolist
#include "ti83plus.inc"
#define ProgStart 9D95h
.list
.org ProgStart -2
.db t2ByteTok, tAsmCmp
getvars:
LD IY, flags
res plotLoc, (IY+plotFlags)
B_CALL(_BufClr)
B_CALL(_ZeroOP1)
LD A, 'D' ;DIRECTIE variabele
LD (OP1+1), A
B_CALL(_RclVarSym)
B_CALL(_ConvOP1)
PUSH AF
B_CALL(_ZeroOP1)
LD A, 'T'
LD (OP1+1), A
B_CALL(_RclVarSym)
B_CALL(_ConvOP1)
PUSH AF
B_CALL(_ZeroOP1)
LD A, 'X'
LD (OP1+1), A
B_CALL(_RclVarSym)
B_CALL(_ConvOP1)
PUSH AF
B_CALL(_ZeroOP1)
LD A, 'Y'
LD (OP1+1), A
B_CALL(_RclVarSym)
B_CALL(_ConvOP1)
LD E, A ;getting the Y var
POP AF
LD D, A
LD C, 2 ;choosing the OR
POP AF
OR A
JP Z, TANKS
CP 1
JP Z, DROIDS
CP 2
JP Z, TREE
;HIER CP's TOEVOEGEN VOOR MUREN, PLANES EN MEER!
RET
TANKS:
POP AF
OR A
JP Z, IXtankU
CP 1
JP Z, IXtankR
CP 2
JP Z, IXtankD
CP 3
JP Z, IXtankL
RET
DROIDS:
POP AF
OR A
JP Z, IXdroidU
CP 1
JP Z, IXdroidR
CP 2
JP Z, IXdroidD
CP 3
JP Z, IXdroidL
RET
TREE:
POP AF
OR A
JP Z, IXTree_1
CP 1
JP Z, IXTree_2
RET
GRASS:
POP AF
OR A
JP Z, IXGrass_1
CP 1
JP Z, IXGrass_2
IXtankD:
LD IX, tankD
JP begindraw
IXtankL:
LD IX, tankL
JP begindraw
IXtankU:
LD IX, tankU
JP begindraw
IXtankR:
LD IX, tankR
JP begindraw
IXdroidU:
LD IX, droidU
JP begindraw
IXdroidR:
LD IX, droidR
JP begindraw
IXdroidD:
LD IX, droidD
JP begindraw
IXdroidL:
LD IX, droidL
JP begindraw
IXTree_1:
LD IX, Tree_1
JP begindraw
IXTree_2:
LD IX, Tree_2
JP begindraw
IXGrass_1:
LD IX, Grass_1
JP begindraw
IXGrass_2:
LD IX, Grass_2
;ONDERSTE HOEFT GEEN JP
;| DRAWING ROUTINE |
;| (programmed by Pelle Kersaan a.k.a. Cerzus, ©2003) |
;| (cerzus69@hotmail.com) |
begindraw:
ld b, 8
push bc
ld hl, 0
ld (CurRow), hl
ld a,e
ld b,7
crz1topoffcheck:
inc a
jr z,crz1topoff
djnz crz1topoffcheck
ld c,e
add hl,bc
add hl,bc
add hl,bc
add hl,hl
add hl,hl
ld a,e
sub 56
ld b,7
crz1bottomoffcheck:
dec a
jr z,crz1bottomoff
djnz crz1bottomoffcheck
jr crz1checkxpos
crz1topoff:
push bc
ld a,8
sub b
ld c,a
ld b,0
add ix,bc
pop bc
crz1bottomoff:
ld a,b
pop bc
ld b,a
push bc
crz1checkxpos:
ld a,d
ld b,7
crz1leftoffcheck:
inc a
jr z,crz1leftoff
djnz crz1leftoffcheck
ld c,d
srl c
srl c
srl c
add hl,bc
ld a,d
sub 88
ld b,7
crz1rightoffcheck:
dec a
jr z,crz1rightoff
djnz crz1rightoffcheck
jr crz1finishscreenpos
crz1leftoff:
ld a,10b
ld (currow),a
dec hl
jr crz1finishscreenpos
crz1rightoff:
ld a,01b
ld (currow),a
crz1finishscreenpos:
ld bc,plotsscreen
add hl,bc
ld a,d
pop de
and 00000111b
jr z,crz1aligned
ld (curcol),a
crz1nonaligned:
ld b,(ix+0)
ld a,e
cp 1
jr nz,crz1orxorshift
ld c,11111111b
ld a,(curcol)
crz1andshiftloop:
srl b
rr c
ex af,af'
ld a,b
add a,10000000b
ld b,a
ex af,af'
dec a
jr nz,crz1andshiftloop
jr crz1endshiftloop
crz1orxorshift:
ld c,00000000b
ld a,(curcol)
crz1orxorshiftloop:
srl b
rr c
dec a
jr nz,crz1orxorshiftloop
crz1endshiftloop:
ld a,(currow)
and 10b
call z,crz1putsprite
ld b,c
inc hl
ld a,(currow)
and 01b
call z,crz1putsprite
inc ix
ld bc,11
add hl,bc
dec d
jr nz,crz1nonaligned
ret
crz1aligned:
ld b,(ix+0)
call crz1putsprite
inc ix
ld bc,12
add hl,bc
dec d
jr nz,crz1aligned
ret
crz1putsprite:
ld a,e
dec a
call z,crz1putand
ld a,e
cp 2
call z,crz1putor
ld a,e
cp 3
call z,crz1putxor
ret
crz1putand:
ld a,(hl)
and b
ld (hl),a
ret
crz1putor:
ld a,(hl)
or b
ld (hl),a
ret
crz1putxor:
ld a,(hl)
xor b
ld (hl),a
ret
tankD:
.db %01111110
.db %10111101
.db %10100101
.db %10100101
.db %10111101
.db %10011001
.db %10111101
.db %01011010
RET
tankL:
.db %01111110
.db %10000001
.db %01011111
.db %11110011
.db %11110011
.db %01011111
.db %10000001
.db %01111110
RET
tankU:
.db %01011010
.db %10111101
.db %10011001
.db %10111101
.db %10100101
.db %10100101
.db %10111101
.db %01111110
RET
tankR:
.db %01111110
.db %10000001
.db %11111010
.db %11001111
.db %11001111
.db %11111010
.db %10000001
.db %01111110
RET
droidU:
.db %00000000
.db %00011100
.db %00100010
.db %00101010
.db %00110110
.db %00110110
.db %00101010
.db %00011100
droidR:
.db %00000000
.db %00000000
.db %01111100
.db %10110010
.db %11001010
.db %10110010
.db %01111100
.db %00000000
droidD:
.db %00111000
.db %01010100
.db %01101100
.db %01101100
.db %01010100
.db %01000100
.db %00111000
.db %00000000
droidL:
.db %00000000
.db %00111110
.db %01001101
.db %01010011
.db %01001101
.db %00111110
.db %00000000
.db %00000000
Tree_1:
.db %00011000
.db %01100110
.db %01001010
.db %10100001
.db %10001001
.db %01000010
.db %01100110
.db %00011000
Tree_2:
.db %00011000
.db %01100110
.db %01010010
.db %10000001
.db %10100001
.db %01001010
.db %01100110
.db %00011000
Grass_1:
.db %00001000
.db %01000110
.db %01000000
.db %10001000
.db %00000001
.db %01001010
.db %01100110
.db %00101000
Grass_2:
.db %00011000
.db %01001010
.db %01010010
.db %00000001
.db %10001001
.db %01001010
.db %01000000
.db %00001000
.end
.end
And here is the BASIC code I use.
I know this ^ code is not that good but It is just a test...and it does not do the trick...
Anyone any suggestions? (should this be posted under prograamming help? because on the other hand this is related to the original topic, my project.)