Re: A86: Need Help! Level Maps!


[Prev][Next][Index][Thread]

Re: A86: Need Help! Level Maps!




Actually, you used a bit per block, not a byte.  Our routine did use a
byte, for a game with multiple sprites, like Mario or Sqrxz.

At 11:46 PM 8/5/98 -0700, you wrote:
>
>Ok, I failed again.  However I know I came close. Here's the
>source I came up with.  I'd appeciate it if someone would
>show me my mistake.  What I did in my game is the same thing
>Matt and David did. (Use a byte per block).
>
>-- 
>Tercero	 --  Email: mailto:tercero@busprod.com
>
>"The stone the builders rejected has become the capstone;"
>			--Psalms 118:22
>"Everyone who falls on that stone will be broken to pieces,
>but he on whom it falls will be crushed."
>			--Luke 20:18
>
>#include "asm86.h"
>#include "ti86asm.inc"
>
>.org _asm_exec_ram
>
>Start:
>	call _clrLCD
>	ld a, 15
>Loop:
>	ld d, a                 ;save a for later
>	ld hl, Level1           ;point to data
>	ld b, 0                 ;\
>	ld c, a                 ; > do an easy addition
>	add hl, bc              ;/
>	ld a, (hl)              ;get the first byte of data
>	ld b, 8
>	or a
>ShiftLoop:
>	sra a
>	call nz, DispBlock
>	djnz ShiftLoop
>	ld a, d
>	dec a
>	jp nz, Loop
>	ret
>
>DispBlock:
>	push af
>	push bc
>	push de
>	push hl
>	ld hl, $0000
>	dec b
>	ld h, b
>	ld a, d
>	and $01
>	cp 1
>	jp z, Padone
>	ld a, 8
>	add a, h
>	ld h, a
>Padone:
>	ld l, d
>	srl l
>	ld de, Block
>	call AlignSprite
>	pop hl
>	pop de
>	pop bc
>	pop af
>	ret
>
>;Data______________________________________________
>Level1:
>	.db %11111111,%11111111
>	.db %10000000,%00000001
>	.db %10001100,%00110001
>	.db %10000000,%00000001
>	.db %10010000,%00001001
>	.db %10001111,%11110001
>	.db %10000000,%00000001
>	.db %11111111,%11111111
>
>Block:  .db %11111111,%10000001,%10111101,%10100101
>	.db %10100101,%10111101,%10000001,%11111111
>
>;AlignSprite_____________________
>;Input: DE = Sprite Address     |
>;       H = X-Coord (0-15)      |
>;       L = Y-Coord (0-7)       |
>;Output: Sprite drawn to screen |
>;Destroyed: none                |
>;--------------------------------
>AlignSprite:
>	push af
>	push bc
>	push de
>	push hl
>	ld a, h
>	ld h, l        
>	ld l, a
>	sla l
>	srl h
>	rr l
>	ld bc, $FC00
>	add hl, bc
>	ld b, 8
>ASpriteLoop:
>	ld a, (de)
>	ld (hl), a
>	inc de
>	ld a, 16
>	add a, l
>	ld l, a
>	jp nc, ASNoinc
>	inc h
>ASNoinc:
>	djnz ASpriteLoop
>	pop hl                  ;\
>	pop de                  ; \
>	pop bc                  ;  > cleanup and goodbye
>	pop af                  ; /
>	ret                     ;/
>
>.end
>

--
David Phillips
mailto:electrum@tfs.net
ICQ: 13811951
AOL/AIM: electrum32


Follow-Ups: References: