Hi all,
da ich mal ein wenig mit TommyGun (<!-- m --><a class="postlink" href="http://www.users.on.net/~tonyt73/TommyGun/">http://www.users.on.net/~tonyt73/TommyGun/</a><!-- m -->) beschaeftigt habe und das Tool nicht schlecht finde, hab ich mal versucht Sprites aus dem Programm heraus darzustellen. Da es bisher keine Beispielroutinen gibt sind dabei folgende zwei kleinen Routinen zur Spritedarstellung herausgekommen.
Die beiden Routinen habe ich "in a hurry" geschrieben, man kann also sicherlich noch Geschwindigkeit rausholen. Jegliche Vorschlaege werden gerne angenommen.
Die Routinen habe ich bisher nur in Mode 0 benutzt. Die anderen Modes habe ich damit nicht getestet.
Vielleicht hat ja noch jemand Lust, TommyGun ein wenig zu testen und baut z.B. die Map-Routinen, denn die gibts bisher auch nicht. Was meint ihr?
;*************************************
; SPRITE ROUTINE WITHOUT TRANSPARENCY
;
; DE = source address of the sprite
; HL = destination address
; B = width
; C = height
;*************************************
writesprite:
ex de, hl
ld a, (hl) ;width
ld (schl1+1), a ;self modification -> schl1->b
;calculate width for sprite
dec a
neg
add a, &FF
ld (width1+1), a
inc hl
ld c, (hl) ;height
inc hl
ex de, hl
schl1: ld b, 0
schl2: ld a, (de)
ld (hl), a
inc de
inc hl
djnz schl2
ld a, l
width1: add a, &FB
ld l, a
ld a, h
adc a, 7
ld h, a
jr nc, schl3
ld a, l
add a, &50
ld l, a
ld a, h
adc a, &C0
ld h, a
schl3: dec c
jp nz, schl1
ret
Alles anzeigen
;*************************************
; SPRITE ROUTINE WITH TRANSPARENCY
;
; DE = source address of the sprite
; HL = destination address
; B = width
; C = height
;*************************************
writetransparency:
ex de, hl
ld a, (hl) ;width
ld (again2+1), a ;self modification -> again2->b
;calculate width for sprite
dec a
neg
add a, &FF
ld (width+1), a
inc hl
ld c, (hl) ;height
inc hl
ex de, hl
again2: ld b, 0
again1: push bc
ld a, (de)
and &aa
jp nz, com1
ld a, (hl)
and &aa
com1: ld c, a
ld a, (de)
and &55
jp nz, com2
ld a, (hl)
and &55
com2: or c
ld (hl), a
inc de
inc hl
pop bc
djnz again1
ld a, l
width: add a, &F4
ld l, a
ld a, h
adc a, 7
ld h, a
jp nc, again3
ld a, l
add a, &50
ld l, a
ld a, h
adc a, &C0
ld h, a
again3: dec c
jp nz, again2
ret
Alles anzeigen