Re: A86: Need Help! Level Maps!


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

Re: A86: Need Help! Level Maps!




You need not fear any longer!!!!

Ok, here it is... (and it works too!!!!!!)

A routine that reads a 16x8 bitmap and puts a block on
the screen for each bit on the map

-- 
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
	ld hl, Level1
	ld b, 0
	ld c, a
	add hl, bc
	ld a, (hl)
	ld b, 8
	or a
ShiftLoop:
	srl a
	call c, DispBlock
	djnz ShiftLoop
	ld a, d
	dec a
	ret m
	jp Loop
	
DispBlock:
	push af
	push bc
	push de
	push hl
	ld hl, $0000
	dec b
	ld h, b
	ld a, d
	and $01
	cp 0
	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
	pop af
	ret


.end


References: