Re: A86: Re: inputting real #'s


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

Re: A86: Re: inputting real #'s



i've made an early beta assembly trig program.  however, it only works when
u input positive, whole numbers.  other wise u get an "Error 02--divide by
zero."  i have a feeling this is either due to the niput routine im using
(the same on that Zreduce uses) or the 86 math routines.  does anyone know
anything about this?  im attaching it, so maybe someone can help me.
thankx much for any help
#include asm86.h
#include ti86asm.inc
#include ti86ops.inc
#include ti86math.inc
_formReal                        equ            5191h
_asap_ind                 equ         0D623h
_exec_pg3                        equ            5714h
_convop1                         equ            5577h	
_SetXXOP1                        equ            4613h
_SetXXOP2                        equ            4617h
_SetXXXXOP2                      equ            461Bh
.org _asm_exec_ram

init:
	call _clrLCD
	ld hl,title
	call _puts
	ld hl,x
	call _puts
     ld      a,0Dh
     ld      (_asap_ind),a
     call    _exec_pg3
	call _CONVOP1
	ld (data1),de
	ld hl,y
	call _puts
     ld      a,0Dh
     ld      (_asap_ind),a
     call    _exec_pg3	
	call _CONVOP1
	ld (data2),de
	ex de,hl
	call _SetXXXXOP2
	call _OP2TOOP1
	call _clrLCD
	ld hl,$0001
	ld (_penRow),hl
	ld hl,$0020
	ld (_penCol),hl
	call _dispop1a
	ld hl,$0000
	ld (_curRow),hl
	ld hl,$0000
	ld (_curCol),hl
	ld hl,sin
	call _puts
	call _FPRECIP
	ld hl,$0020
	ld (_penCol),hl
	ld hl,$0008
	ld (_penRow),hl
	call _dispop1a
	ld hl,$0001
	ld (_curRow),hl
	ld hl,$0000
	ld (_curCol),hl
	ld hl,csc
	call _puts
	ld hl,(data1)
	call _SetXXXXOP2
	call _OP2TOOP1
	ld hl,$0020
	ld (_penCol),hl
	ld hl,$0010
	ld (_penRow),hl
	call _dispop1a
	ld hl,$0002
	ld (_curRow),hl
	ld hl,$0000
	ld (_curCol),hl
	ld hl,cos
	call _puts
	call _FPRECIP
	ld hl,$0020
	ld (_penCol),hl
	ld hl,$0018
	ld (_penRow),hl
	call _dispop1a
	ld hl,$0003
	ld (_curRow),hl
	ld hl,$0000
	ld (_curCol),hl
	ld hl,sec
	call _puts
	ld hl,(data1)
	call _SetXXXXOP2
	call _OP2TOOP1
	ld hl,(data2)
	call _SetXXXXOP2
	call _FPDIV
	ld hl,$0020
	ld (_penCol),hl
	ld hl,$0020
	ld (_penRow),hl
	call _dispop1a
	ld hl,$0004
	ld (_curRow),hl
	ld hl,$0000
	ld (_curCol),hl
	ld hl,tan
	call _puts
	call _FPRECIP
	ld hl,$0020
	ld (_penCol),hl
	ld hl,$0028
	ld (_penRow),hl
	call _dispop1a
	ld hl,$0005
	ld (_curRow),hl
	ld hl,$0000
	ld (_curCol),hl
	ld hl,cot
	call _puts
	ret
sin:	
	.db "sinÁ=",0
cos:
	.db "cosÁ=",0
tan:
	.db "tanÁ=",0
sec:
	.db "secÁ=",0
csc:
	.db "cscÁ=",0
cot:
	.db "cotÁ=",0
title:
	.db "ZTrig                ",0
x:
	.db "X=?",0
y:
	.db "Y=?",0
_dispop1a:
    ld      a,48
    call    _formReal
    ld      hl,_OP3
    call    _vputs
    ret
data1:
	.db 0,0
data2:
	.db 0,0
.end


Robby Gutmann
gutmann@planet-connect.com
ICQ UIN: 724927      Agonostis on IRC

"Let's just say that if complete and utter chaos was lightning,
he'd be the sort to stand on a hilltop in a thunderstorm wearing
wet copper armour and shouting 'All gods are bastards'."
	-- Rincewind discussing Twoflower
	   (Terry Pratchett, The Colour of Magic)

References: