A82: Re: Another Question


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

A82: Re: Another Question




I have made some corrections to the code below, but I have not tested it
on a calc. 

Maybe you should concider using a loop to draw the sprites, instead of
repeating the same code 8 times. You could use the instruction DJNZ
(Decrease Jump if Not Zero), to make the loop. If you loaded RowVar1 into
a register, you could then use shift instructions to check if a bit is
set.

Dines
>;----------------------------------------------------
>Selected:
> xor a
> ld (Screen),a        ;Starting at 0
> ld a,47 ;47 -> A
> ld (Row1VarY),a ;Y-Coord of Row 1
> ld hl,RowVar1
> ld (hl),$FF ;I tried a bunch of things for this, including 255 into a ->
hl
> jr DrawLoop ;Draw the Enemies
>
>DrawLoop:
> ld hl,(RowVar1) ;Load RowVar into hl
> bit 0,a ;Check the first digit
This will check the first digit of A, but the var is in HL. Try something
like thid instead :
  LD HL,RowVar1
  BIT 0,(HL)
> call nz,RowOneSpr ;if 1, then draw ...
> ld a,(Screen)
> add a,12
> ld (Screen),a
> ld hl,(RowVar1)
> bit 1,a
Same problem
> call nz,RowOneSpr
> ld a,(Screen)
> add a,12
> ld (Screen),a
> ld hl,(RowVar1)
> bit 2,a
Same problem
> call nz,RowOneSpr
> ld a,(Screen)
> add a,12
> ld (Screen),a
> ld hl,(RowVar1)
> bit 3,a
Same problem
> call nz,RowOneSpr
> ld a,(Screen)
> add a,12
> ld (Screen),a
> ld hl,(RowVar1)
> bit 4,a
Same problem
> call nz,RowOneSpr
> ld a,(Screen)
> add a,12
> ld (Screen),a
> ld hl,(RowVar1)
> bit 5,a
Same problem
> call nz,RowOneSpr
> ld a,(Screen)
> add a,12
> ld (Screen),a
> ld hl,(RowVar1)
> bit 6,a
Same problem
> call nz,RowOneSpr
> ld a,(Screen)
> add a,12
> ld (Screen),a
> ld hl,(RowVar1)
> bit 7,a
Same problem
> call nz,RowOneSpr
> xor a
> ld (Screen),a
> ROM_CALL(DISP_GRAPH) 
> call Pause
> ret
>
>Pause:
> call GET_KEY
> or a
> ret nz
> jr z,Pause
>
>RowOneSpr:
> ld a,(Screen)
> add a,4
> ld (Screen),a
> ld bc,Row1Spr 
> ld a,(Row1VarY)
> ld e,a
> ld a,(Screen)
> call SPRXOR ;sprite routine [from DuckHunt 82 or whatever..]
> ld a,(Screen)
> sub 4
> ld (Screen),a
> ret
>
>Row1Spr:
>.db %11111111
>.db %11111111
>.db %11111111
>.db %11111111
>.db %11111111
>.db %11111111
>.db %11111111
>.db %11111111
>
>;-------------------------------
>
>Any help is appreciated.
> -Ahmed
>
>Ahmed El-Helw
>ahmedre@worldnet.att.net
>http://asm86.home.ml.org
>http://asm8x.home.ml.org
>Ahmed_ on IRC
>ICQ UIN: 3350394
>

_______________________________________

Dines Justesen
Email: dines@post1.com or
       c958362@student.dtu.dk
WWW  : http://www.gbar.dtu.dk/~c958362/
_______________________________________