Re: LZ: Problem with programming...


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

Re: LZ: Problem with programming...



Still has the same problem...  It doesn't work.  Just freezes up.

Jim Reardon
jim.reardon@juno.com
Viva La Mexico
http://pages.prodigy.net/eviljim/
We all come into the world the same way - naked, screaming, covered in
blood.  But if you live your life right, that kind of thing doesn't have
to end there.

>change ".include "usgard.h" and the other includes to.....
>"#include usgard.h" etc.
>
>I didn't look at the rest. try that.
>
>On Tue, 17 Jun 1997, Jim Reardon wrote:
>>
>> Okay, I've tinkered and have no idea as to why the following doesn't
>> work.  PLEASE HELP!  It's a Usgard program.
>> 
>> ; REQUIRED LIBRARIES: SPRITLIB (11)
>> 
>> .include "usgard.h"
>> .include "spritlib.h"
>> 
>> Current         = TEXT_MEM
>> DrawMapX        = TEXT_MEM+1
>> DrawMapY        = TEXT_MEM+2
>> TempMapX        = TEXT_MEM+3
>> 
>> .org 0
>> .db "Map Example",0
>> 
>>         ld      hl, VIDEO_MEM
>>         LIB_CALL_(SPRITLIB, SET_DEST)   ; set Sprite Destination to
Video
> Mem
> 
>         call    CLEARLCD
> 
>         ld      a, 128
>         ld      (Current), a            ; we need to loop 16x8 = 128
> times
>         ld      a, 0
>         ld      (DrawMapX), a           ; we currently are on 0, 0
>         ld      (DrawMapY), a
> 
> DrawMapLoop:
> 
> ; the following code determines at what screen position to draw the
> sprite
> ; and stores it into BC
>         ld      a, (DrawMapX)
>         ld      h, 8
>         ld      l, a
>         call    MUL_HL
>         ld      b, l
>         ld      a, b
>         ld      (TempMapX), a
>         ld      a, (DrawMapY)
>         ld      h, 8
>         ld      l, a
>         call    MUL_HL
>         ld      a, 64
>         sub     l
>         ld      c, a
>         ld      a, (TempMapX)
>         ld      b, a
> 
> ; the following loads the sprite coordinates into HL so it can be
> displayed
> 
>         ld      hl, &MapA
>         ld      a, (Current)
>         ld      d, a
>         ld      a, 128
>         sub     d
>         ld      d, 0
>         ld      e, a
>         add     hl, de
>         ld      a, (hl)         ; get what the map says the value is
(0,
> 1, 2)
> 
>         ld      hl, &SpriteTable
>         add     a, a
>         ld      d, 0
>         ld      e, a
>         add     hl, de          ; get from the sprite table where
exactly
>         call    LD_HL_MHL       ; the sprite is in our program
>         ld      de, (PROGRAM_ADDR)      ; add PROGRAM_ADDR
>         add     hl, de
>         ld      a, 1                    ; set mode to DISPLAY
>         LIB_CALL_(SPRITLIB,NASRWARP)    ; draw the sprite
> 
>         ld      a, (DrawMapX)
>         inc     a
>         cp      16
>         call    z, &UpdateMapY          ; increase Y pointer if
necessary
>         ld      (DrawMapX), a           ; increase X pointer
> 
>         ld      a, (Current)
>         ld      b, a
>         dec     a
>         ld      (Current), a            ; do what is necessary.
>         djnz    DrawMapLoop
> 
> Endit:
>         call    OTH_PAUSE
>         ret
> 
> UpdateMapY:
>         ld      a, (DrawMapY)
>         inc     a
>         ld      (DrawMapY), a
>         ld      a, 0
>         ret
> 
> SpriteTable:
>         .dw SpriteA, SpriteB, SpriteC
> 
> SpriteA:
> .db 1,1,8
> .db %00000000
> .db %00000000
> .db %00000000
> .db %00000000
> .db %00000000
> .db %00000000
> .db %00000000
> .db %00000000
> 
> SpriteB:                        ; brick type 1
> .db 1,1,8
> .db %11111111
> .db %10000001
> .db %11111111
> .db %00010000
> .db %11111111
> .db %10000001
> .db %11111111
> .db %00010000
> 
> SpriteC:                        ; closed chest
> .db 1,1,8
> .db %00000000
> .db %00000000
> .db %00000000                 
> .db %01111100
> .db %10001010
> .db %11111110
> .db %10001010
> .db %11111110
> 
> MapA:
> .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1     ; blocks $00 - $0F
> .db 1,0,0,0,0,1,0,0,0,0,2,0,0,0,0,1     ; blocks $10 - $1F
> .db 1,0,0,2,0,1,0,0,0,0,0,0,0,0,0,1     ; blocks $20 - $2F
> .db 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1     ; blocks $30 - $3F
> .db 1,0,0,0,0,1,0,0,0,0,0,0,2,0,0,1     ; blocks $40 - $4F
> .db 1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1     ; blocks $50 - $5F
> .db 1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,1     ; blocks $60 - $6F
> .db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1     ; blocks $70 - $7F
> 
> .end
> 


Follow-Ups: