Re: A86: Re: New Asm programmer Needs Help


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

Re: A86: Re: New Asm programmer Needs Help






On Thu, 10 Dec 1998 18:31:00 -0600 "David Phillips" <electrum@tfs.net>
writes:
>>
>> Helo my name is JT. I am new to this mailing list and to asm 
>programming
>in
>>general.
>>Below is a program I made i was trying to put a 24X24 sprite on the 
>screen
>can
>>someone please tell me where I went wrong? It doesn't work very well 
>at all
>:)
>>
>>>
>>> Sprite:
>>>         ld b,(hl) ;
>>>         inc hl

this is where you'd push bc

>>>         ld c, (hl)

and make this into ld b,(hl).  this makes it height,width below

you want an inc hl here to get to the image data

>>>         push hl
>>>         pop ix
>>>         ld hl,$fc00
>>>         ld de,$18
>>>
you need to load hl with where the sprite needs to start and you need to
do that before you load b.
i'm not sure if this is best, but load de right after the second ld
b,(hl) like this:
 ld a,$10	;offset to next line in video ram
 sub b		;number of bytes that will have already been added
 ld e,a	;de=$10-b
 ld d,0

>>> Next_Row:
>>>         add hl,de
>>>         ld b,24
>
>
>All of this won't work.  You need to push/pop bc at the top of your 
>loop,
>and load b with c, since this is a nested loop.

yeah, replace ld b,24 with pop bc

>>>         jp Pixel_Put

make that djnz Pixel_Put.  jp will loop forever

>>>         ret
>>>
>>> PIC1:
>>>
>>>    .db 24, 24
>
>
>The width data needs to be 3, not 24, because you only want to draw 3 
>bytes
>(8 pixels a byte), not 24.

width is the second byte

-josh


___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]