Re: A83: _convop1 prime


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

Re: A83: _convop1 prime




One quick optimization.  When you have a call and then a ret directly
after that.  Use jp instead of call.  The ret in the routine will serve
the same purpose of the ret after the call.  For instance, do a jp
_formDisp.
	- Matt

Ted21@aol.com wrote:
> 
> Thanks for your help.  You put me on the right path.  I decided that what I
> wanted to do was create my own floating point variable which I can just copy
> in and out of op1.  This is the code, and it works.  It inputs a number
> (automatically placed in op1) saves op1 in the program, makes and displays
> the square root of op1, moves the number back to op1 and displays it.
> 
> .NOLIST
> #define EQU .equ
> #define equ .equ
> #define end .end
> #define END .end
> #include "ti83asm.inc"
> #include "tokens.inc"
> .LIST
> PGMIO_EXEC equ 50B2h
> _formDisp equ 4D0Eh
> .org $9327
>     call _clrScrnFull
>     call _homeup
>     ld de,821ch                   ;************************
>     ld hl,prompt                   ;**  System Input
>     ld bc,16                        ;**
>     ldir                               ;** Stores result in op1
>     ld a,1                           ;**
>     ld (ASM_IND_CALL),a   ;**
>     call PGMIO_EXEC        ;**************************
>     call op_to_num             ;move op1 to variable num
>     call _sqroot                  ;square root of op1 -> op1
>     call _formDisp              ;Display op1
>     call num_to_op            ;move variable num to op1
>     call _formDisp              ;display op1
>     ret
> op_to_num:
>     ld hl,op1              ;load the addr. of op1 into hl
>     ld de,num            ;load the addr. of num into de
>     ld bc,9                ;there are 9 bytes to copy
>     ldir                      ;copy op1 into num
>     ret
> num_to_op:
>     ld hl,num           ;load the addr. of num into hl
>     ld de,op1           ;load the addr. of op1 into de
>     ld bc,9              ;there are 9 bytes to copy
>     ldir                   ;copy num into op1
>     ret
> prompt:                  ;message for input
>     .db "Number= ",0
> num:                      ;floating point variable
>     .db 00,00,00,00,00,00,00,00,00
> end
> .END
> 
> Thanks for your help,
>     Ted


References: