Re: A89: Matrices


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

Re: A89: Matrices




In a message dated 1/16/00 9:35:29 PM Eastern Standard Time, Lilpjd@aol.com 
writes:

> How could I put a 8x8 matrix into a program?  It would be a temporary one, 
so 
> 
>  it can't be an actual MAT file.  Here's why:  I'm trying to build a board 
>  game, but i need a way to find store and access this matrix so that I can 
>  check what pieces are where.  Thanks


board:
 .db 0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0
 .db 0,0,0,0,0,0,0,0


This should work for getting an element in hl (though I haven't tested at all)

get_element:
 ;b=row, c=column
 ld hl,board
 ld a,b
 rla
 rla
 rla
 and %00111000
 or c
 ld c,a
 ld b,0
 add hl,bc
 ret


----
Jonah Cohen
<ComAsYuAre@aol.com>
http://linux.hypnotic.org/~jonah/ (down)


Follow-Ups: