A86: PutSprite


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

A86: PutSprite




I am trying to make the 8x8 sprite routine work for a 16x16 sprite routine, 
what am I doing wrong, this is the code I am using:

#include "ti86asm.inc"
#include "asm86.h"

.org _asm_exec_ram

	
	call _clrLCD
	call _flushallmenus
	ld ix, Smile
	ld b, 63
	ld c, 23
	call PutSprite
	ld a, c
	add a, 17
	ld c, a
	call PutSprite
	ret

Smile:
	.db 16, 16
	.db %11111100, %00111111
	.db %10000100, %00100001
	.db %10110100, %00101101
	.db %10110100, %00101101
	.db %10000100, %00100001
	.db %11111100, %00111111
	.db %00000001, %00000000
	.db %00000011, %10000000
	.db %00000011, %10000000
	.db %00000001, %00000000
	.db %00110000, %00011000
	.db %00011000, %00110000
	.db %00001111, %11100000
	.db %00000001, %00000000
	.db %00000000, %00000000
	.db %00000000, %00000000

Smile2:
	.db 16, 16
	.db %11111100, %00111111
	.db %10000100, %00100001
	.db %10110100, %00101101
	.db %10110100, %00101101
	.db %10000100, %00100001
	.db %11111100, %00111111
	.db %00000001, %00000000
	.db %00000011, %10000000
	.db %00000011, %10000000
	.db %00000001, %00000000
	.db %00110000, %00011000
	.db %00011000, %00110000
	.db %00001111, %11100000
	.db %00000001, %00000000
	.db %00000000, %00000000
	.db %00000000, %00000000

	
PutSprite:
	ld h, 63
	ld a, c
	add a, a
	add a, a
	ld l, a
	add hl, hl
	add hl, hl
	ld a, b
	rra
	rra
	rra
	or l
	ld l, a
	ld a, 7
	and b
	ld d, a
	ld e, 16
	push bc

ps_loop:
	ld b, d
	ld a, (ix)
	inc ix
	ld c, 0
	call bit_shift
	xor (hl)
	ld (hl), a
	inc l
	ld a,(hl)
	xor c
	ld (hl), a
	ld a, 15
	call add_hl_a
	dec e
	jr nz, ps_loop
	pop bc
	ret

add_hl_a:
	add a, l
	ld l, a
	ret nc
	inc h
	ret

bit_shift:
	dec b
	ret m
	srl a
	rr c
	jr bit_shift

.end
.end


Follow-Ups: