Re: A86: Array


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

Re: A86: Array





On Sat, 03 Oct 1998 22:23:53 -0700 Dave VanEe <dvanee@dowco.com> writes:
>
>How would I make an array of 40x24 where each cell is only a 1 or 0? 

use 960 bits!

>Also,
>how could I access this?

kinda like you access the screen, i guess (find one of the findpixel
experts, they'll give you something better)

;d = x address (0-39)
;e = y address (0-23)
;hl= start of array
;return:
;hl= byte
;c = bit mask

;UNTESTED!
findbit:
	ld a,d
	and $07		;a=bit # in byte
	ld c,a
	ld a,d
	srl a
	srl a
	srl a		;a=byte number across
	add e		;a=byte number
	ld d,0
	add hl,de	;get byte offset
	ld de,bittable
	ld a,c
	add e,a
	jr nc,there
	inc d
there:	ld c,(de)	;c=mask
	ret

bittable: .db $80,$40,$20,$10,$08,$04,$02,$01

-josh

>Thanx,
>Dave
>
>

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]


References: