Re: A83: Re: First program
[Prev][Next][Index][Thread]
Re: A83: Re: First program
I haven't been able to get my program working yet, any help anyone could give would be greatly appreciated.
> Here is the BASIC Code of the program I'm trying to convert:
>
> Repeat D>=1 and D<360
> ClrHome
> Input "COMPASS DEG:",D
> End
> If D÷90
> Then
> abs(D-90)->E
> Else
> abs(D-450)->E
> End
> Output(3,1,"ENG DEG:")
> Output(3,10,E)
> Disp
>
> Here's the readme for this program, basically it converts compass degree readings to engineering degree readings.
> http://www.ticalc.org/cgi-bin/zipview?83/basic/programs/compass.zip;Readme.txt
And here is the ASM
;Degree Convertor v2.0
;---------------= header =--------------
.nolist
#include "ion.inc"
pgmio_exec .equ 50B2h
ASM_IND_CALL .equ 80C8h
.list
#ifdef TI83P
.org progstart-2
.db $BB,$6D
#else
.org progstart
#endif
ret
jr nc,start
.db "Degree Convertor v2.0",0
;---------------= define =--------------
;---------------= get user input =--------------
start:
ld de,821ch
ld hl,prompt
ld bc,16
ldir
ld a,1
ld (ASM_IND_CALL),a
bcall(pgmio_exec)
ld bc,90b ;store 90 to bc
bcall(_convop1)
ld hl,(de)
ld a,(hl) ;load op1 to accumulator
cp bc \ jr nc,small ;jump to "small" if b(90)>a
inc b
cp bc \ jr nc,big ;jump to "big" if b(90)<a
ret
small:
sub c ;subtract b(90) from a
ld a,hl ;load a to hl
jp &display ;jump to display
big:
ld bc,450d ;load 450 into bc
ld d,195d
sub b ;subtract b(450) from a
sub c
ld a,hl ;load a to hl
jp &display ;jump to display
display:
bcall(_newline)
bcall(_disphl)
ret
prompt: .db "Compass Deg: ",0
.end
.end
Questions:
1) Does everything look in order in regards to have I done all the commands
right?
2) When I try to compile it TASM thinks my registers are labels and complains
about not being able to find them..What have I done wrong?
3) Are my < > opperands right? They don't look right to me, I got them off
a tutorial and they compile fine..
4) I'm trying to keep my program 100% ION compatible, but am I allowed to
define and use pgmio_exec and ASM_IND_CALL?
5) Have I dont my input routine correct?
The formatting didn't quite copy right, I think I have all of the tab spacing
correct in my source.
I'm new to this so be critical!
>
>
> Thanks
>
> Andrew
>
References: