Re: A83: A problem with matrices


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

Re: A83: A problem with matrices




I think you're still better off to do them in a .db format....
The simple code of the calls to _puttomat and the inc take more space.
I tried using the matrices for a different prog a while ago and let me tell 
you that it is really not worth it if you are working with integers ( N| )..

what you are trying to do would look like this...


level_one:
.db 0,0,2,0,0
.db 0,0,2,0,0
.db 0,2,2,2,0
.db 0,0,2,0,0
.db 0,0,1,0,0   ; all of this is 25 bytes !


You can then acces the matrice in the following manner...

#DEFINE row2 5       ;those don't go in to the 83p file
#DEFINE row3 10     ;they are just aids....
#DEFINE row4 15
#DEFINE row5 20

#DEFINE el2 1
#DEFINE el3 2
#DEFINE el4 3
#DEFINE el5 4


to acces level_one[2,3]

you have to do (if it is a number beween 0 and 255)
                         (it it is larger you have to use .dw)

ld a,5
ld (level_one+row2+el3),a
          and
ld a,(level_one+row2+el3)

if later on you don't know which level you are in ...it will happen.. you 
can use the ix register and do the offsets with it)


glad I could help...

An advice from me.... stay away fro ROM calls as much as possible.

homonerdicus

>From: Pizza of Hut <pizzaofhut@geocities.com>
>Reply-To: assembly-83@lists.ticalc.org
>To: assembly-83@lists.ticalc.org
>Subject: Re: A83: A problem with matrices
>Date: Wed, 28 Jul 1999 21:55:34 -0500
>
>
>
>
>James Vernon wrote:
>
> > On Wed, 28 Jul 1999 20:55:17 -0500, Pizza of Hut wrote:
> > >
> > >Hello everyone. I am attempting to program a 3-D shooter using matrices
> > >to generate the maps. The data used to create the matrix used for a
> > >certain level is stored in an external file and is called by the main
> > >program as follows:
> > >
> > >load_level_1:
> > >  call _clrscrnFull
> > >  ld a,4
> > >  ld (currow),a
> > >  ld a,3
> > >  ld (curcol),a
> > >  ld hl,get_psyched
> > >  call _puts
> > >  call _zerooop1
> > >  ld hl,lev_1
> > >  ld de,op1
> > >  ld bc,8
> > >  ldir
> > >  call _chkfindsym
> > >  jr c,error_dat
> > >  call _exec_assembly
> > >  ret
> > >
> > >lev_1:
> > >  .db PROGOBJ,"ISMDAT1",0
> > >
> > >In the the file "ISMDAT1" which holds the data for the first level, I 
>am
> > >attempting to create a 5x5 matrix and store numbers to them using the
> > >following code:
> > >
> > >  call _zerooop1
> > >  ld hl,op1
> > >  ld (hl),matobj    ;Value of token = 02h
> > >  inc hl
> > >  ld (hl),tvarmat
> > >  inc hl
> > >  ld (hl),tmata
> > >  call _chkfindsym
> > >  ld hl,$0505
> > >  call _creatermat    ;Calls ROM addr. 446Ah
> > >  push de
> > >  ld hl,0    ;Value to store to matrix element
> > >  call _setxxxxop2
> > >  call _op1exop2
> > >  pop de    ;Address of Matrix A
> > >  ld bc,$0101    ; Address of element (1,1)
> > >  call _puttomat    ;Stores 0 to (1,1)
> > >  inc bc    ;Move on to next element
> > >  call _puttomat

; ...

> > >  ld hl,1
> > >  call _setxxxxop2
> > >  call _op1exop2
> > >  pop de
> > >  ld bc,$0503
> > >  call _puttomat
> > >  push de


> > >  ld hl,2
> > >  call _setxxxxop2
> > >  call _op1exop2
> > >  pop de
> > >  ld bc,$0302
> > >  call _puttomat

> > >  inc bc
> > >  call _puttomat

> > >  inc bc
> > >  call _puttomat

> > >  ld bc,$0103
> > >  call _puttomat
> > >  ld bc,$0203
> > >  call _puttomat
> > >  ld bc,$0403
> > >  call _puttomat
> > >  ret
> > >.end
> > >END
> > >
> > >If anyone could help me with this problem of mine, I would be most
> > >appreciative.
> > >
> > >--
> > >Pizza of Hut
> > >http://www.antishrine.sacone.com/
> >
> >   Couldn't you extract the data to a temp program of something in a 
>series
> > of .db statements??
> >
> > James Vernon
> > jimbob_v@hotmail.com
> >
> > ______________________________________________________
> > Get Your Private, Free Email at http://www.hotmail.com
>
>I would, however, the data files would be huge, and with the TI-83's tiny
>memory, I could only have a couple of levels. I'm hoping to find a way to 
>fix
>the program I'm currently using. BTW, if it helps, when the program is 
>called,
>I get an ERR: DATA TYPE msg, then the calc crashes.
>
>--
>Pizza of Hut
>http://www.antishrine.sacone.com/
>
>
>


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Follow-Ups: