A83: A problem with matrices


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

A83: A problem with matrices




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
 inc bc
 inc bc
 call _puttomat
 inc bc
 call _puttomat
 ld bc,$0201
 call _puttomat
 inc bc
 call _puttomat
 inc bc
 inc bc
 call _puttomat
 inc bc
 call _puttomat
 ld bc,$0301
 call _puttomat
 inc bc
 inc bc
 inc bc
 inc bc
 call _puttomat
 ld bc,$0401
 call _puttomat
 inc bc
 call _puttomat
 inc bc
 inc bc
 call _puttomat
 inc bc
 call _puttomat
 ld bc,$0501
 call _puttomat
 inc bc
 call _puttomat
 inc bc
 inc bc
 call _puttomat
 inc bc
 call _puttomat
 push de
 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/