Re: A83: Re: First program
[Prev][Next][Index][Thread]
Re: A83: Re: First program
Could someone please explain how this not being able to use 16-bit registers in instructions that use an 8-bit register
thing works. How do I load my number that was inputted from OP1 to a for my other ops?
Also are my < > opperand correct if I use a inc b instead of the +1 thing?
Thanks
Andrew
Kouri wrote:
> You can't use the 16-bit registers in instructions that use an 8-bit register, unless you are trying to dereference a
> 16-bit pointer [ like ld a,(hl) ]. Also, you cannot do instructions like cp b+1. First you would have to inc b, then you
> could cp it.
>
> ----- Original Message -----
> From: "Andrew Oliver" <aoliver@techplus.com>
> To: <assembly-83@lists.ticalc.org>
> Sent: Monday, February 07, 2000 14:27
> Subject: 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: