Re: A89: HELP!!!


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

Re: A89: HELP!!!




Aha, I got it now =P.  There were 2 separate errors, why is why I couldn't
find it -- one was in the spaces in the LevelData, the other was conflicting
routine outputs (d0 was being changed by userlib::idle_loop, which was
interfering with my x coordinate in putsprite =)

        -Scott

>Date: Thu, 7 Jan 1999 18:36:28 -0500
>From: "Scott Noveck" <noveck@pluto.njcc.com>
>Subject: Re: A89: HELP!!!
>
>I tried both suggestions, still doesn't work - and furthermore, they caused
>an unrecoverable error when run from tios [loderun()], although it still
>runs from DoorsOS.  I'm hoping it's just some odd fluke, and I'm going to
>try re-writing the routine to see if it makes a difference.  Thanks
>anyways - anyone else who has any clue why it won't work, I'm open to
>suggestions =)
>
>        -Scott
>
>>Date: Wed, 06 Jan 1999 21:09:37 -0600
>>From: Mark Zavislak <felix@megsinet.net>
>>Subject: Re: A89: HELP!!!
>>
>>>I've started working on Lode Runner for the 89/92plus, but I'm stuck on
>this
>>>one routine.  It's supposed to read a byte from LevelData, draw the
>>>appropriate sprite, and loop back to draw the next sprite.  The problem
is
>>>that it's drawing the first sprite correctly, then drawing all Bricks
(#1)
>>>afterwards (It's doing something like 21111111111... when it SHOULD do
>>>210210210210210...)!  There's one line which I think may be causing the
>>>problem, but I'm not really sure where it is -- and I've been working at
>>>this for a few days.  Can someone try to find why the routine won't work?
>>>Thanks!
>>>
>>>
>>>--------------------START OF PROGRAM------------
>>> include "..\doors\tios.h"
>>> include "..\doors\graphlib.h"
>>> include "..\doors\userlib.h"
>>> xdef _ti89
>>> xdef  _main
>>>      xdef  _comment
>>>
>>>_main:
>>>
>>>DrawLevel:
>>> jsr graphlib::clr_scr          ;Clear Screen
>>> move.l #LevelData,a5           ;Point a5 to Level Data
>>
>>I would use lea LevelData(pc),a5  (I don't exactly know what yours does)
>>
>>- -Normally you would use move.l Leveldata, d0 to put a byte into a data
>>register, using a relative address to tell the processor where to locate
>>it.  In this case you want to load the absolute address, which is
>>accomplished by adding the relative address to LevelData to the program
>>counter.  I think this will solve the problem
>>
>>> move.w #0,d0                   ;PutSprite starting X (0)
>>> move.w #0,d1                   ;PutSprite starting Y (0)
>>> move.b #%11111111,d3           ;PutSprite Constant Mask (%11111111)
>>> move.b #19,d4                  ;Number of times to loop (20-1)
>>>DrawLevel_Row:                  ;Begin Row
>>> move.b (a5),d6                 ;Move byte from location in a5 to d6
>>
>>move.b (a5)+,d6    ->  I would use this to automatically increase a5
>>
>>> cmp #0,d6                      ;If 0, Draw Space
>>> beq DrawLevel_Space            ;
>>> cmp #1,d6                      ;If 1, Draw Brick
>>> beq DrawLevel_Brick            ;
>>> cmp #2,d6                      ;If 2, Draw Player
>>> beq DrawLevel_Player           ;
>>> move.l #Space,a0               ;If Other (??) Draw Space
>>>DrawLevel_Continue:             ;Return Here
>>> jsr graphlib::put_sprite_mask  ;Draw Sprite
>>> add.b #10,d0                   ;Increase X coord with 10
>>> add.b #10,d1                   ;Increase Y coord with 10
>>> add.l #1,a5     *              ;Point a5 to next byte (PROBLEM LINE???)
>>
>>- --> Instead of using this, look up above right after Draw Level
>>
>>> dbra d4,DrawLevel_Row          ;Decrease d4, loop until -1
>>> jsr userlib::idle_loop         ;Wait for Keypress
>>> rts                            ;Exit
>>>
>>>DrawLevel_Space:
>>> move.l #Space,a0
>>> jmp DrawLevel_Continue
>>>
>>>DrawLevel_Brick:
>>> move.l #Brick,a0
>>> jmp DrawLevel_Continue
>>>
>>>DrawLevel_Player:
>>> move.l #Player,a0
>>> jmp DrawLevel_Continue
>>>
>>>Space:
>>> dc.w 8,1
>>> dc.b %00000000
>>> dc.b %00000000
>>> dc.b %00000000
>>> dc.b %00000000
>>> dc.b %00000000
>>> dc.b %00000000
>>> dc.b %00000000
>>> dc.b %00000000
>>>
>>>Brick:
>>> dc.w 8,1
>>> dc.b %11111111
>>> dc.b %01010101
>>> dc.b %11111111
>>> dc.b %10101010
>>> dc.b %11111111
>>> dc.b %01010101
>>> dc.b %11111111
>>> dc.b %10101010
>>>
>>>Player:
>>> dc.w 8,1
>>> dc.b %00111100
>>> dc.b %01011010
>>> dc.b %00111100
>>> dc.b %00011000
>>> dc.b %01111110
>>> dc.b %00011000
>>> dc.b %00100100
>>> dc.b %01100110
>>>
>>>LevelData:
>>>;----------------------------------------------------------------+
>>>;Col: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20|
>>>;----------------------------------------------------------------+ Row:
>>> dc.b  2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1| ;01
>>> dc.b  1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1| ;02
>>> dc.b  1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1| ;03
>>> dc.b  1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1| ;04
>>> dc.b  1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1| ;05
>>> dc.b  1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1| ;06
>>> dc.b  1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1| ;07
>>> dc.b  1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1| ;08
>>> dc.b  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1| ;09
>>> dc.b  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1| ;10
>>>;----------------------------------------------------------------+
>>>
>>>_comment:
>>> dc.b "Lode Runner v0.x",0
>>>
>>> end
>>>---------------------END OF PROGRAM-------------