#include "ti86asm.inc" .org _asm_exec_ram Start: call _runIndicOff ; turn the run indicator off call _clrLCD ; clear the screen xor a ; clear a ld (sprX),a ; zero out x coord ld (sprY),a ; clear y choord ld de,map ; map you want to use call FastMap ; call the FastMap routine call _pause ; pause so we can see the map :) call _clrLCD ; clear the screen when exiting ret ; return ;<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>> ;< FastMap routine by erroneus404 > ;< This routine was coded to be > ;< compatible with almost any > ;< sprite routine available on > ;< the internet. It was also > ;< coded for speed, as you can > ;< tell from the name of the > ;< routine :) If you need help > ;< with the routine or you are > ;< having problems with it please > ;< email me at erroneus404@usa.net > ;<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>> FastMap: push de ; save de for later ld hl,sprites ; load sprites into hl ld a,(de) ; load de into a add a,a ; adding de to it's self ld d,0 ; make the upper byte 0 ld e,a ; load what we came up with to e add hl,de ; add de to hl for the right sprite ld a,(hl) ; loads hl into a inc hl ; increase hl ld h,(hl) ; load hl to h ld l,a ; load a to l call draw ; draw it! pop de ; restor de inc de ; increase the map pointer ld a,(sprX) ; load x coord to a add a,8 ; add 8 to it cp 128 ; see if its 128 jr z,wrap ; if so, move a column ld (sprX),a ; save the x coord jr FastMap ; do a fast jump back to the beginning wrap: xor a ; makes a zero ld (sprX),a ; clear x coord ld a,(sprY) ; load y coord into the a register add a,8 ; add a to it cp 64 ; see if we are at the end of the screen ret z ; if so, quit the routine ld (sprY),a ; save the y coord jr FastMap ; go back to the beginning for another sprite draw: ld a,(sprX) ; load sprX into a ld b,a ; load sprX from a to c ld a,(sprY) ; load sprY into a ld c,a ; load sprY from a to c call FastSprite ; use your favorite sprite routine ret map: ; the map .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 .db 1,0,0,0,0,2,2,2,2,2,2,0,0,0,0,1 .db 1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1 .db 1,0,0,0,0,2,3,3,3,3,3,0,0,0,0,1 .db 1,0,0,0,0,2,4,4,4,4,4,0,0,0,0,1 .db 1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1 .db 1,0,0,0,0,2,2,2,2,2,2,0,0,0,0,1 .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 sprites: ; pointers to the sprites .dw sprite0,sprite1,sprite2,sprite3,sprite4 sprite0: .db %00000000 .db %00000000 .db %00000000 .db %00000000 .db %00000000 .db %00000000 .db %00000000 .db %00000000 sprite1: .db %11111111 .db %10000001 .db %10000001 .db %10000001 .db %10000001 .db %10000001 .db %10000001 .db %11111111 sprite2: .db %11111111 .db %11111111 .db %11111111 .db %11111111 .db %11111111 .db %11111111 .db %11111111 .db %11111111 sprite3: .db %00000000 .db %00000000 .db %00000000 .db %00000000 .db %11111111 .db %11111111 .db %11111111 .db %11111111 sprite4: .db %11111111 .db %11111111 .db %11111111 .db %11111111 .db %00000000 .db %00000000 .db %00000000 .db %00000000 sprX: .db 0 sprY: .db 0 ;(delete if you want to use a different sprite routine) ;FastSprite_______________________________ ;Input: Sprite in (HL), (b,c) | ;Output: Sprite xor'ed onto the screen | ;Destroyed: none | ;----------------------------------------- FastSprite: push af push bc push de push ix push hl push hl ;\ pop ix ; > hl -> ix ld hl, FSByte ;> point to Tempbyte ld (hl), c ;> put c into Byte for later use ld a, b rrca ;\ rrca ; > divide x by 8 in accumulator rrca ;/ rld ;> Rotate left 4 bytes or $FC ;> add a and $FC ld l, (hl) ;\ ld h, a ; > buncha loading going on ld a, b ;/ and 7 ;> mask out the shift number ld d, a ;> save the shift number ld e, 8 FSLoop: ld a, (ix) ;> get sprite data ld b, a inc ix ;> point to new sprite data byte ld c, 0 ;> clear c for shift use ld a, d ;> restore shift # for use cp 0 jp z, NoShift ld a, b ld b, d FSShift: srl a ;\ rr c ; \ dec b ; > shift until b < 0 jp z, Shiftend ; / jp FSShift ;/ NoShift: ld a, b Shiftend: xor (hl) ;> mix the shifted sprite w/screen ld (hl), a ;> and draw it to the screen inc hl ;> hl points to next screen byte ld a, c ;> accumulate the remaining shifted data xor (hl) ;> mix 'em ld (hl), a ;> draw it ld a, 15 ;\ add a, l ; \ ld l, a ; > Inc the 1 y value. jp nc, FSNoinc ; / inc h ;/ FSNoinc: dec e ; >check if loop is finished jp nz, FSLoop ;/ pop hl ;\ pop ix ; \ pop de ; > mmmpop boop be doop mmmpop pop bc ; / pop af ;/ ret FSByte: .db $00 .end