A86: Re: New Asm programmer Needs Help


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

A86: Re: New Asm programmer Needs Help






>
> 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
:)
>
>> .org _asm_exec_ram
>>         call _clrLCD
>>         ld hl, PIC1
>>     call Sprite


You need a <ret> here, or it will "fall through" into your sprite routine
again after it returns from it.  If this is all you have in your program,
you can just do a <jp Sprite>, and the <ret> at the end if it will return to
the TI-OS.  But it's probably best to just use a call/ret in case you add
more to it later.

>>
>> Sprite:
>>         ld b,(hl) ;
>>         inc hl
>>         ld c, (hl)

>>         push hl
>>         pop ix
>>         ld hl,$fc00
>>         ld de,$18
>>
>> Pixel_Put:
>>         ld a,(ix)
>>         ld (hl),a
>>         inc ix


You need a <inc hl> here to move to the next byte in video memory.

>>         djnz Pixel_Put
>>         jp Next_Row


You can eliminate this jump, because the code will fall through to Next_Row
by itself.  A label is just an address that you can use in your program that
is automatically calculated by the assembler, so you don't have to calculate
all the absolute and relative jumps yourself (wouldn't that be a
pain--that's how they used to have to do it!).

>> 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.

>>         jp Pixel_Put
>>         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.

>>
>>  .db (the sprite data in here)
>>
>



Follow-Ups: