;ZReduce Copyright (C) 1997 Bill Nagel ;Do not redistribute any modified form of this program .NOLIST #define equ .equ #define EQU .equ #define end .end _clrWindow equ 4A86h _clrLCD equ 4A7Eh _homeUp equ 4A95h _CPOP1OP2 equ 41FBh _vputs equ 4AA5h _ZEROOP1 equ 436Bh _PUSHREALO1 equ 4813h _vputmap equ 4AA1h _puts equ 4A37h _CONVOP1 equ 5577h _FPMULT equ 548Ch _SetXXOP1 equ 4613h _SetXXOP2 equ 4617h _SetXXXXOP2 equ 461Bh _FPADD equ 5478h _PLUS1 equ 45EBh _OP1SET0 equ 435Fh _OP1TOOP6 equ 4263h _OP4SET1 equ 42E7h _OP2SET2 equ 4323h _OP2TOOP5 equ 4257h _OP6TOOP1 equ 423Fh _SQROOT equ 54ACh _OP5TOOP1 equ 4247h _FPSQUARE equ 5488h _OP1TOOP2 equ 4233h _FPDIV equ 54A8h _INTOP1 equ 4C2Fh _INTGR equ 5468h _OP1TOOP5 equ 426Bh _OP4TOOP1 equ 4243h _ROUND equ 54C0h _OP5TOOP2 equ 4227h _OP1TOOP4 equ 4207h _runIndicOff equ 4AB1h _formReal equ 5191h _exec_pg4 equ 5718h _exec_pg3 equ 5714h _getkey equ 55AAh _ROUND equ 54C0h _penCol equ 0C37Ch _penRow equ 0C37Dh _OP1 equ 0C089h _OP3 equ 0C09Fh _asm_exec_ram equ 0D748h _ASAP_IND equ 0D623h .LIST .org _asm_exec_ram call _CLRLCD call _clrWindow call _homeUp ld hl,str_title call _puts ld hl,str_enter call _puts ld a,0Dh ld (_asap_ind),a call _exec_pg3 call _OP1TOOP6 call _OP4SET1 call _OP2SET2 call _OP2TOOP5 FixTarget: call _OP6TOOP1 call _SQROOT call _PLUS1 call _PLUS1 call _CONVOP1 ld (data),de Main: call _OP5TOOP1 ;D call _FPSQUARE ;D*D call _OP1TOOP2 call _OP6TOOP1 call _FPDIV ;A/(D*D) call _OP1TOOP2 ld d,0 call _ROUND ;int(A/(D*D)) call _CPOP1OP2 jp Z,Reduce ;if A/(D*D)=int(A/(D*D)) call _OP5TOOP1 call _PLUS1 call _OP1TOOP5 ;D+1->D ld hl,(data) call _SETXXXXOP2 call _CPOP1OP2 jp C,Main ;if DB call _OP5TOOP1 call _FPSQUARE ;D*D call _OP1TOOP2 call _OP6TOOP1 call _FPDIV ;A/(D*D) call _OP1TOOP6 jp FixTarget _dispop1a: ld a,48 call _formReal ld hl,_OP3 call _vputs ret data: .db 0,0 str_title: .db "ZReduce by Bill Nagel",0 str_enter: .db 16,"X X=",0 .END