Re: A85: Problems
[Prev][Next][Index][Thread]
Re: A85: Problems
Well, I did all of those things, but it doesn't work at all, and weird
characters are displayed in zshell. Any suggestions?
Here is the source now:
#include "TI-85.H"
.org 0
.db "Move Dot",0
ld a,4
out (5),a
init:
ld a,10
ld ($800C),a
ld ($800D),a
draw:
ROM_CALL(CLEARLCD)
ld a,($800C)
ld b,a
ld hl,($800D)
ld c,a
CALL_(PlotPixel)
key:
call GET_KEY
cp $04
jr z,up
cp $01
jr z,down
cp $02
jr z,left
cp $03
jr z,right
cp $37
ret z
jr nz,key
up:
ld a,($800D)
inc a
ld ($800D),a
jr draw
down:
ld a,($800D)
dec a
ld ($800D),a
jr draw
left:
ld a,($800C)
dec a
ld ($800C),a
jr draw
right:
ld a,($800C)
inc a
ld ($800C),a
jr draw
PlotPixel:
ROM_CALL(FIND_PIXEL)
ld de,$FC00
add hl,de
or (HL)
ld (HL),a
ret
end:
.end
At 12:22 AM 11/9/97 -0500, you wrote:
>At 09:30 PM 11/8/97 -0700, Chris James wrote:
>
>There are several things wrong:
>
>>Well, I was trying to write my first zshell program, but it didn't seem to
>>work right. In fact, it doesn't work at all. I was trying to display one
>>pixel, and by pressing the arrow keys it would move around. But instead, a
>>bunch of boxes keep getting displayed, and the only way I can stop it is by
>>pressing 'on' twice. The first press turns off the calculator, and the
>>second press turns it back on with all the weird characters on the screen
>>(but still operational). Please help me correct my problem. Here is the
>>asm file:
>>
>>#include "TI-85.H"
>>
>> .org
>> .db "Move around",0
>>
>>init:
>>
>> ld a,4
>> ld (5),a
>
>** This should be out (5),a (Right now, you're actually trying to write 04
>to the ROM :) ).
>
>> ld a,10
>> ld ($800C),a
>> ld ($800D),a
>
>** This will work, but in the future you should probably use different RAM
>locations. $800C and $800D are the text cursor positions. And if you want
>to write a value to two adjacent locations in ROM, it's more size efficient
>to do:
>
> ld hl,$0A0A ;0Ah = 10d
> ld ($800C),hl
>
>>
>>draw:
>> ROM_CALL(CLEARLCD)
>> ld a,($800C)
>> ld b,a
>> ld a,($800D)
>> ld c,a
>> CALL_(PlotPixel)
>>
>>key:
>>
>> call GET_KEY
>> cp $04
>> jp z,up
>> cp $01
>> jp z,down
>> cp $02
>> jp z,left
>> cp $03
>> jp z,right
>> cp $37
>> ret z
>> jp nz,key
>
>** Every one of these should be jr's instead of jp's. (i.e. jr z,up and jr
>nz,key). Quick optimization:
>
>key:
> call GET_KEY
> cp $37
> ret z
> cp $01
> jr z,down
> cp $02
> jr z,left
> cp $03
> jr z,right
> cp $04
> jr nz,key
>
>up: ;continue from here
>
>>
>>up:
>> ld a,($800D)
>> inc a
>> ld ($800D),a
>> jr draw
>>
>>down:
>> ld a,($800D)
>> dec a
>> ld ($800D),a
>> jr draw
>>
>>left:
>>
>> ld a,($800C)
>> dec a
>> ld ($800C),a
>> jr draw
>>
>>right:
>> ld a,($800C)
>> inc a
>> ld ($800C),a
>> jr draw
>>
>>end:
>> .end
>
>** The .end should be at the VERY end of your program, after PlotPixel.
>Right now, PlotPixel probably isn't making it into the string.
>
>>
>>PlotPixel:
>> ROM_CALL(FIND_PIXEL)
>> ld de,$FC00
>> add hl,de
>> or (HL)
>> ld (HL),a
>> ret
>>
>>
>--
>Brian Leech
>butvis@mindspring.com
>ICQ UIN: 1355611
>
>
>
>