#include "asm86.h" #include "ti86asm.inc" #include "ti86ops.inc" #include "ti86math.inc" #define PutCursor(x,y) ld hl,256*y+x \ ld (_curRow),hl #define PutChar(n) ld a,n \ call _putc #define PutReal(n) ld hl,n \ call _MOV10TOOP1 \ call _DisplayOP1 _DisplayOP1 .equ $515B _MOV10FROP1 .equ $42E3 _CPOP1OP2 .equ $41FB _newLine .equ $4A5F _flushallmenus .equ $49DC .org _asm_exec_ram Start: di call _flushallmenus call _clrLCD ld hl,Title ;Display title screen call PutText ld hl,Subtitle call PutVWidth ld hl,Computing1 call PutVWidth ld hl,Computing2 call PutVWidth ld hl,Computing3 call PutVWidth StartSearch: SetD: call _OP1SET1 ld de,_d call _MOV10FROP1 SetC: call _OP1SET0 ld de,_c call _MOV10FROP1 SetB: call _RCLY ld hl,_neg1 call _MOV10TOOP2 call _FPMULT ld de,_b call _MOV10FROP1 SetA: call _RCLY ld hl,_neg1 call _MOV10TOOP2 call _FPMULT ld de,_a call _MOV10FROP1 Loop: CheckKey: ld a,%00111111 out (1),a nop nop in a,(1) bit 6,a jr nz, NotQuit ei ret NotQuit: CheckRad: ld hl,_c call _MOV10TOOP1 call _SQROOT ld hl,_b call _MOV10TOOP2 call _FPMULT ld hl,_a call _MOV10TOOP2 call _FPADD ld hl,_d call _MOV10TOOP2 call _FPDIV ld de,_rad call _MOV10FROP1 call _RCLX ld hl,_rad call _MOV10TOOP2 call _FPSUB ld hl,_OP1 res 7,(hl) ld hl,_tol call _MOV10TOOP2 call _CPOP1OP2 jr nc,IncA DisplayResult: call _clrLCD call _clrScrn PutCursor(0,0) PutReal(_a) PutCursor(4,0) PutChar('+') PutCursor(6,0) PutReal(_b) PutCursor(10,0) PutChar(Lroot) PutCursor(12,0) PutReal(_c) ld hl,FractionBar call PutText PutCursor(6,2) PutReal(_d) PutCursor(0,3) ei ret IncA: call _RCLY ;get max->op2 call _OP1TOOP2 ld hl,_a call _MOV10TOOP1 ;curA->op1 call _CPOP1OP2 jr nc,IncB call _PLUS1 ;inc ld de,_a call _MOV10FROP1 ;D+1->D jp Loop ;Loop IncB: call _RCLY call _OP1TOOP2 ld hl,_b call _MOV10TOOP1 call _CPOP1OP2 jr nc,IncC call _PLUS1 ld de,_b call _MOV10FROP1 jp SetA IncC: call _RCLY call _OP1TOOP2 ld hl,_c call _MOV10TOOP1 call _CPOP1OP2 jr nc,IncD call _PLUS1 ld de,_c call _MOV10FROP1 jp SetB IncD: call _RCLY call _OP1TOOP2 ld hl,_d call _MOV10TOOP1 call _CPOP1OP2 jr nc,NotFound call _PLUS1 ; call _OP2SET0 ; call _CPOP1OP2 ; call z,_PLUS1 ld de,_d call _MOV10FROP1 jp SetC NotFound: call _clrLCD ld hl,NotFoundMsg call PutText ei ret ;(a+brootc)/d _a: .db 0,0,0,0,0,0,0,0,0,0 _b: .db 0,0,0,0,0,0,0,0,0,0 _c: .db 0,0,0,0,0,0,0,0,0,0 _d: .db 0,0,0,0,0,0,0,0,0,0 _neg1: .db $80,$00,$FC,$10,0,0,0,0,0,0 _tol: .db $00,$FB,$FB,$10,0,0,0,0,0,0 _rad: .db 0,0,0,0,0,0,0,0,0,0 Title: .db 1,4,"EXACT RADICAL",0 Subtitle: .db 15,28,"v1.0",Lbeta," by Stephen Hicks",0 Computing1: .db 30,35,"Exacting value of",0 Computing2: .db 36,33,"radical stored in x",0 Computing3: .db 45,44,"Please wait...",0 NotFound1: .db 3,5,"EXACT VALUE",0 NotFound2: .db 4,6,"NOT FOUND",0 Syntax: .db 0,0,"(A+B",Lroot,"C)/D",0 NotFoundMsg: .db 0,0,"Not Found",0 FractionBar: .db 1,0,"--------------" _PLUS1: call _OP2SET1 call _FPADD ret ;***********************Display Text Routines********************** ;Description: Draws text on the screen. ;Parameters: hl -> Text struct (Row,Col,String,0) ;Output: to screen only ;Destroys: none ;Notes: PutText -> Normal (big) Font ; PutVWidth -> Variable Width (small/graph) Font PutText: push bc ;Save bc ld c,(hl) ;Load Row -> c inc hl ;(hl) -> Column ld b,(hl) ;Load Column -> b inc hl ;Point (hl) -> Text ld (_curRow),bc ;Load bc -> Cursor register call _puts ;Put string pop bc ;Restore bc ret ;Done PutVWidth: push bc ;Save bc ld b,(hl) ;Load Row -> b inc hl ;(hl) -> Col ld c,(hl) ;Load Col -> c inc hl ;Point (hl) -> Text ld (_penCol),bc ;Load bc -> Pen register call _vputs ;Put V-width string pop bc ;Restore bc ret ;Done .end