A83: First program


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

A83: First program




I've been quietly surfing the lists and reading all the ASM tutorials I could
get my hands on for about the last 3 months and decided I finally knew enough
to try converting one of my BASIC programs over.  I have written the
re-written the basic function of the program in ASM, but I have a few problems
and questions.

Code:
;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,90d ;store 90 to b
 bcall(_convop1)
 ld a,de ;load op1 to accumulator
 cp bc \ jr nc,small ;jump to "small" if b(90)>a
 cp bc+1 \ jr nc,big ;jump to "big" if b(90)<a
 ret

small:
 sub bc  ;subtract bc(90) from a
 ld a,hl  ;load a to hl
 jp &display ;jump to display

big:
 ld bc,450D  ;load 450 into bc
 sub bc ;subtract bc(450) from a
 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
aoliver@techplus.com



Follow-Ups: References: