# HG changeset patch # User brandonlw # Date 1401685413 14400 # Node ID 78c162ac1d820c389e4f26be81e57c0255d21277 # Parent f4f75ec42b53dae5a9f39466b1b0f8f5ca900830 Basic page 2 cleanup. diff -r f4f75ec42b53 -r 78c162ac1d82 source/page02/initial.asm --- a/source/page02/initial.asm Thu May 22 01:52:19 2014 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11249 +0,0 @@ -AdrMRow: - ld c, 1 -; End of function AdrMRow - - -; =============== S U B R O U T I N E ======================================= - - -AdrMEle: - ; p02sub_404D:p02loc_4051p ... - ld a, b - or a - jr nz, p02loc_400B - -p02loc_4006: - ld a, 78h ; 'x' - jp JError -; --------------------------------------------------------------------------- - -p02loc_400B: - ld a, c - or a - jr z, p02loc_4006 - ld a, (de) - ld l, a - inc de - inc de - xor a - ld h, a - jr p02loc_401B -; --------------------------------------------------------------------------- - -p02loc_4017: - add a, l - jr nc, p02loc_401B - inc h - -p02loc_401B: - djnz p02loc_4017 - dec c - add a, c - jr nc, p02loc_4022 - inc h - -p02loc_4022: - ld l, a - call HLTimes9 - add hl, de - ret -; End of function AdrMEle - -; --------------------------------------------------------------------------- - ld bc, (OP6+8) - -; =============== S U B R O U T I N E ======================================= - - -GETMATOP1A: - ld de, (iMathPtr3) - jr GetMToOP1 -; End of function GETMATOP1A - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4032: - ld bc, (OP6+4) - ld de, (iMathPtr2) - jr GetMToOP1 -; End of function p02sub_4032 - - -; =============== S U B R O U T I N E ======================================= - - -GETM1TOOP1: - ; p02sub_40BA+Fp ... - ld bc, (OP6) - -GETM1TOP1A: - ld de, (iMathPtr1) - -GetMToOP1: - call AdrMEle - rst 20h - ret -; End of function GETM1TOOP1 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4049: - ld bc, (OP6+4) -; End of function p02sub_4049 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_404D: - ld de, (iMathPtr2) - -p02loc_4051: - call AdrMEle - ld de, OP2 - jp mov9B2 -; End of function p02sub_404D - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_405A: - ld bc, (OP6) - -PUTTOM1A: - ; ROWECHELON+78p ... - ld de, (iMathPtr1) - jr PutToMat -; End of function p02sub_405A - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4064: - ; p02sub_44D4+Cp ... - ld bc, (OP6+8) -; End of function p02sub_4064 - - -; =============== S U B R O U T I N E ======================================= - - -PUTTOMA1: - ld de, (iMathPtr3) - -PutToMat: - call AdrMEle - push hl - call CkValidNum - pop de - jp MovFrOP1 -; End of function PUTTOMA1 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4077: - ; p02sub_4102:p02loc_410Dp ... - ld bc, (OP6) - call PUTTOMA1 - -p02loc_407E: - ; BinOPExec2+4B1p - ld hl, OP6 - dec (hl) - ret nz - ld a, (OP6+8) - ld (hl), a - inc hl - dec (hl) - ret -; End of function p02sub_4077 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_408A: - ld a, 1 - jr p02loc_408F -; End of function p02sub_408A - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_408E: - xor a - -p02loc_408F: - or a - -MAT_EL_DIV: - push af - -p02loc_4091: - call GETM1TOOP1 - ld bc, (OP6) - call p02sub_404D - pop af - jr nc, p02loc_40A4 - push af - call fpdiv - jr p02loc_40AD -; --------------------------------------------------------------------------- - -p02loc_40A4: - push af - call z, FPAdd - pop af - push af - call nz, FPSub - -p02loc_40AD: - call p02sub_4077 - ld hl, (OP6) - ld (OP6+4), hl - jr nz, p02loc_4091 - pop af - ret -; End of function p02sub_408E - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_40BA: - ; BinOPExec2+701p ... - ld hl, (OP6+8) - push hl - ld bc, (OP6+4) - push bc - -p02loc_40C3: - call OP1Set0 - -p02loc_40C6: - call OP1ToOP5 - call GETM1TOOP1 - call p02sub_4049 - call FPMult - call OP5ToOP2 - rst 30h - pop bc - push bc - ld hl, OP6 - dec (hl) - push hl - ld hl, 84B4h - dec (hl) - pop de - jr nz, p02loc_40C6 - ld (hl), b - dec hl - dec (hl) - ex de, hl - ld (hl), b - jr nz, p02loc_40EF - inc hl - dec (hl) - ex de, hl - ld (hl), c - -p02loc_40EF: - call p02sub_4064 - ld hl, 84B7h - dec (hl) - jr nz, p02loc_40C3 - pop bc - push bc - ld (hl), c - inc hl - dec (hl) - jr nz, p02loc_40C3 - pop bc - pop bc - ret -; End of function p02sub_40BA - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4102: - ; UnOPExec2+268p - ld bc, (OP6+8) - ld (OP6), bc - call OP1Set1 - -p02loc_410D: - call p02sub_4077 - ret z - ld hl, OP1M - ld (hl), 0 - ld a, (OP6) - ld b, a - ld a, (OP6+1) - cp b - jr nz, p02loc_410D - ld (hl), 10h - jr p02loc_410D -; End of function p02sub_4102 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4124: - ld hl, (OP6) - push hl - -p02loc_4128: - call GETM1TOOP1 - ld hl, (OP6) - ld b, l - ld c, h - call PUTTOMA1 - ld hl, OP6 - dec (hl) - jr nz, p02loc_4128 - pop bc - push bc - ld (hl), c - inc hl - dec (hl) - jr nz, p02loc_4128 - pop hl - ld b, l - ld c, h - ret -; End of function p02sub_4124 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4144: - ld de, (iMathPtr3) -; End of function p02sub_4144 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4148: - ld a, (de) - ld l, a - ld h, 0 - call HLTimes9 - push hl - ld a, (OP6+4) - ld b, a - push de - call AdrMRow - pop de - push hl - ld a, (OP6+4+1) - ld b, a - call AdrMRow - pop de - pop bc - -p02loc_4163: - push bc - ld b, c - call ExLp - pop bc - dec b - ret m - ld c, 0 - jr p02loc_4163 -; End of function p02sub_4148 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_416F: - xor a - jr p02loc_4179 -; End of function p02sub_416F - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4172: - ld a, 1 - -p02loc_4174: - push af - call OP1ToOP5 - pop af - -p02loc_4179: - ld (OP6), a - ld a, (OP6+8) - ld (OP6+6), a - -p02loc_4182: - ld hl, 84B3h - ld b, (hl) - inc hl - inc hl - ld c, (hl) - push bc - call GETMATOP1A - ld a, (OP6) - sub 1 - jr c, p02loc_419E - push af - call OP5ToOP2 - call FPMult - pop af - jr nz, p02loc_41A9 - -p02loc_419E: - rst 8 - pop bc - ld a, (OP6+4+1) - ld b, a - push bc - call GETMATOP1A - rst 30h - -p02loc_41A9: - pop bc - call PUTTOMA1 - ld hl, 84B5h - dec (hl) - jr nz, p02loc_4182 - ret -; End of function p02sub_4172 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_41B4: - ld a, 2 - jr p02loc_4174 -; End of function p02sub_41B4 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_41B8: - ; p02sub_429D+109p - call OP1ToOP3 - call CpyTo2FPST - call AbsO1O2Cp - push af - call OP3ToOP1 - pop af - ret -; End of function p02sub_41B8 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_41C7: - ; ROWECHELON+3Ap - push af - push bc - call GETM1TOOP1 - call ClrOP1S - call OP1ToOP3 - -p02loc_41D2: - ld a, (OP6+1) - pop bc - cp c - jr nz, p02loc_41DB - pop af - ret -; --------------------------------------------------------------------------- - -p02loc_41DB: - push bc - inc a - ld (OP6+1), a - call GETM1TOOP1 - call OP3ToOP2 - call AbsO1O2Cp - jr c, p02loc_41D2 - jr z, p02loc_41D2 - call GETM1TOOP1 - call ClrOP1S - call OP1ToOP3 - pop bc - pop af - xor 1 - push af - push bc - ld c, b - ld b, a - ld a, (OP6+1) - call p02sub_43C3 - jr p02loc_41D2 -; End of function p02sub_41C7 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR p02sub_429D - -p02loc_4206: - ; p02sub_429D+1DDj - push bc - ld hl, (iMathPtr2) - inc hl - inc hl - ld c, b - ld b, 0 - add hl, bc - dec hl - ld b, c - -p02loc_4212: - ld a, (hl) - cp b - jr nz, p02loc_421B - dec hl - djnz p02loc_4212 - pop bc - ret -; --------------------------------------------------------------------------- - -p02loc_421B: - ld a, b - -p02loc_421C: - dec hl - dec b - cp (hl) - jr nz, p02loc_421C - ld c, a - push bc - ld a, b - call p02sub_4250 - pop bc - pop af - push af - -p02loc_422A: - push af - push bc - ld b, a - ld de, (iMathPtr1) - call AdrMEle - pop bc - pop af - push af - push bc - ld c, b - ld b, a - push hl - ld de, (iMathPtr1) - call AdrMEle - pop de - ld b, 9 - call ExLp - pop bc - pop af - dec a - jr nz, p02loc_422A - pop bc - jr p02loc_4206 -; END OF FUNCTION CHUNK FOR p02sub_429D - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4250: - ld d, 0 - ld e, a - ld hl, (iMathPtr2) - inc hl - add hl, de - push hl - sbc hl, de - ld e, c - add hl, de - pop de - ld a, (de) - ld b, (hl) - ld (hl), a - ld a, b - ld (de), a - ret -; End of function p02sub_4250 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4264: - ld a, 1 -; End of function p02sub_4264 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4266: - ld (OP6+4), a - call OP1Set0 -; End of function p02sub_4266 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_426C: - ; p02sub_429D+1C5p - ld hl, 84B3h - -p02loc_426F: - ld c, (hl) - ld a, (OP6+1) - ld b, a - ld a, (OP6+4+1) - cp (hl) - ret c - push bc - call OP1ToOP5 - pop bc - call GETM1TOP1A - ld bc, (OP6) - ld a, (OP6+4) - ld b, a - ld de, (iMathPtr1) - call p02loc_4051 - call FPMult - call OP5ToOP2 - rst 30h - ld hl, 84B3h - inc (hl) - jr p02loc_426F -; End of function p02sub_426C - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_429D: - ; UnOPExec2+152p - - - - - push af - ld hl, (OP6) - ld a, h - cp l - jp nz, ErrDimension - cp 1 - jr nz, p02loc_42B6 - call GETM1TOOP1 - pop af - or a - ret nz - call fprecip - jp p02sub_405A -; --------------------------------------------------------------------------- - -p02loc_42B6: - push hl - ld hl, (OP6) - push hl - call p02sub_4608 - pop hl - ld (OP6), hl - ld (OP6+8), hl - ld h, 0 - call j_SetXXXXOP2 - call FPMult - call OP2Set3 - ld a, 73h ; 's' - ld (OP2+1), a - call FPMult - call PushRealO1 - pop hl - pop af - push hl - push af - or a - jr nz, p02loc_42EF - ld c, h - ld b, 0 - ld hl, (iMathPtr2) - inc hl - add hl, bc - ld b, c - -p02loc_42EB: - ld (hl), b - dec hl - djnz p02loc_42EB - -p02loc_42EF: - ld bc, 0 - ld (OP6), bc - -p02loc_42F6: - pop af - -p02loc_42F7: - ; p02sub_429D+177j - pop hl - push hl - and 6Fh ; 'o' - push af - ld c, b - inc c - ld a, b - ld b, c - ld (OP6+4+1), a - -p02loc_4303: - ; p02sub_429D:p02loc_4370j - ld (OP6), bc - pop af - push af - bit 5, a - jr z, p02loc_4323 - bit 7, a - jr nz, p02loc_431A - call OP1Set1 - pop af - set 7, a - push af - jr p02loc_4346 -; --------------------------------------------------------------------------- - -p02loc_431A: - ld a, c - call p02sub_4266 - call InvOP1S - jr p02loc_4346 -; --------------------------------------------------------------------------- - -p02loc_4323: - call p02sub_4264 - call p02sub_447D - pop af - bit 4, a - jr nz, p02loc_4345 - or a - set 7, a - push af - call p02sub_405A - -p02loc_4335: - pop af - pop hl - push hl - push af - ld l, a - ld bc, (OP6) - ld a, h - cp b - jr z, p02loc_4373 - inc b - jr p02loc_4303 -; --------------------------------------------------------------------------- - -p02loc_4345: - push af - -p02loc_4346: - ld bc, (OP6) - ld c, b - ld de, (iMathPtr1) - call p02loc_4051 - call fpdiv - call p02sub_405A - pop bc - pop hl - push hl - push bc - bit 5, b - jr z, p02loc_4366 - ld hl, 84B4h - inc (hl) - jr p02loc_4335 -; --------------------------------------------------------------------------- - -p02loc_4366: - ld a, h - ld bc, (OP6) - cp c - jp z, p02loc_42F6 - inc c - -p02loc_4370: - jp p02loc_4303 -; --------------------------------------------------------------------------- - -p02loc_4373: - cp c - jr z, p02loc_437F - pop af - bit 5, a - jr z, p02loc_438E - ld b, c - jp p02loc_42F7 -; --------------------------------------------------------------------------- - -p02loc_437F: - pop af - push af - bit 5, a - jp nz, p02loc_43E2 - call p02sub_41B8 - jr c, p02loc_43AB - jp p02loc_43E2 -; --------------------------------------------------------------------------- - -p02loc_438E: - or 10h - push bc - push af - ld a, b - ld b, c - ld (OP6), bc - ld c, a - pop af - call p02sub_41C7 - push af - call OP3ToOP1 - call CkOP1FP0 - jr z, p02loc_43AB - call p02sub_41B8 - jr nc, p02loc_43B9 - -p02loc_43AB: - ; p02sub_429D+107j - pop af - pop bc - bit 6, a - jp z, ErrSingularMat - pop af - call FPOPREAL - jp OP1Set0 -; --------------------------------------------------------------------------- - -p02loc_43B9: - pop af - pop bc - push af - ld b, c - inc c - and 8 - jp p02loc_4370 -; End of function p02sub_429D - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_43C3: - bit 6, b - call z, p02sub_4250 - ld de, (iMathPtr1) - ld a, c - ld (OP6+4), a - ld a, (OP6+4+1) - push af - ld a, (OP6+1) - ld (OP6+4+1), a - call p02sub_4148 - pop af - ld (OP6+4+1), a - ret -; End of function p02sub_43C3 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR p02sub_429D - -p02loc_43E2: - pop af - bit 6, a - jr z, p02loc_4409 - push af - call FPOPREAL - pop af - pop hl - push af - call OP1Set1 - -p02loc_43F1: - rst 8 - call GETM1TOOP1 - call FPMult - ld hl, 84B0h - dec (hl) - jr z, p02loc_4402 - dec hl - dec (hl) - jr p02loc_43F1 -; --------------------------------------------------------------------------- - -p02loc_4402: - pop af - and 1 - jp nz, InvOP1S - ret -; --------------------------------------------------------------------------- - -p02loc_4409: - pop hl - push hl - bit 5, a - jr nz, p02loc_4417 - set 5, a - ld bc, 0 - jp p02loc_42F7 -; --------------------------------------------------------------------------- - -p02loc_4417: - call FPOPREAL - -p02loc_441A: - pop hl - push hl - ld bc, (OP6) - dec b - jr z, p02loc_4446 - ld c, h - -p02loc_4424: - ld (OP6), bc - ld l, b - inc l - ld h, c - dec h - ld (OP6+4), hl - call GETM1TOOP1 - call p02sub_426C - call InvOP1S - call p02sub_405A - ld bc, (OP6) - dec c - ld a, c - cp b - jr z, p02loc_441A - jr p02loc_4424 -; --------------------------------------------------------------------------- - -p02loc_4446: - ld b, 1 - pop af - push af - ld (OP6+4+1), a - -p02loc_444D: - ld c, 1 - -p02loc_444F: - call OP1Set0 - ld (OP6), bc - ld a, c - inc b - cp b - jr nc, p02loc_445C - ld a, b - -p02loc_445C: - ld (OP6+4), a - call c, GETM1TOOP1 - call p02sub_426C - call p02sub_405A - ld bc, (OP6) - ld a, (OP6+4+1) - cp c - jr z, p02loc_4475 - inc c - jr p02loc_444F -; --------------------------------------------------------------------------- - -p02loc_4475: - inc b - cp b - jr nz, p02loc_444D - pop bc - jp p02loc_4206 -; END OF FUNCTION CHUNK FOR p02sub_429D - -; =============== S U B R O U T I N E ======================================= - - -p02sub_447D: - rst 8 - call GETM1TOOP1 - jp FPSub -; End of function p02sub_447D - -; --------------------------------------------------------------------------- - ld a, 0Ah - jr CMATFUN - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4488: - ld (OP6+4+1), a - ld a, 9 - jr CMATFUN -; End of function p02sub_4488 - - -; =============== S U B R O U T I N E ======================================= - - -CMATFUN: - ; UnOPExec2+1B1p - ld (OP6+4), a - -p02loc_4492: - call GETM1TOOP1 - call p02sub_449E - call p02sub_4077 - jr nz, p02loc_4492 - ret -; End of function CMATFUN - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_449E: - ld a, (OP6+4) - cp 4 - jp z, ClrOP1S - cp 6 - jp c, InvOP1S - jp z, Trunc - cp 8 - jp c, frac - jp z, DoInt - cp 0Ah - jp z, FPSquare - ld a, (OP6+4+1) - ld d, a - cp 80h ; '�' - jp nz, Round - call RndGuard - ret -; End of function p02sub_449E - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_44C8: - ; UnOPExec2+334p - ld a, (OP6) - ld (OP6+8), a - -p02loc_44CE: - call p02sub_4077 - jr nz, p02loc_44CE - ret -; End of function p02sub_44C8 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_44D4: - ld a, (OP6+8) - ld b, a - ld a, (OP6+4) - ld c, a - push bc - -p02loc_44DD: - call p02sub_4032 - call p02sub_4064 - ld a, (OP6+8) - dec a - ld (OP6+8), a - ld a, (OP6+4) - dec a - jr z, p02loc_44F5 - ld (OP6+4), a - jr p02loc_44DD -; --------------------------------------------------------------------------- - -p02loc_44F5: - ld bc, (OP6+8) - call GETM1TOP1A - call p02sub_4064 - ld hl, (OP6+8) - dec l - jr z, p02loc_450A - ld (OP6+8), hl - jr p02loc_44F5 -; --------------------------------------------------------------------------- - -p02loc_450A: - pop bc - dec h - ret z - ld l, c - ld (OP6+4), hl - ld l, b - ld (OP6+8), hl - push bc - jr p02loc_44DD -; End of function p02sub_44D4 - -; --------------------------------------------------------------------------- - ld a, 1 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_451A: - ld de, (iMathPtr3) - jr p02loc_452B -; End of function p02sub_451A - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4520: - ld hl, (iMathPtr1) - inc hl - inc hl -; End of function p02sub_4520 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4525: - ; UnOPExec2+182p ... - ld de, (iMathPtr3) -; End of function p02sub_4525 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4529: - ; p02sub_45EE+10p - ld a, 2 - -p02loc_452B: - ; UnOPExec2+21Ep - inc de - inc de - push de - ld hl, (iMathPtr1) - call DataSize - ld b, d - ld c, e - dec bc - dec bc - inc hl - inc hl - pop de - ldir - ret -; End of function p02sub_4529 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_453E: - ; UnOPExec2+431j - call ErrD_OP1NotPosDoInt - call j_ConvOP1 - ld hl, 0FFh - or a - sbc hl, de - jp c, ErrDomain - ld a, e - push af - call OP3ToOP1 - call p02sub_59D5 - push af - ld a, h - cp l - jp nz, ErrDimension - pop af - jr z, p02loc_4566 - call p02sub_5A17 - call p02sub_4525 - jr p02loc_4569 -; --------------------------------------------------------------------------- - -p02loc_4566: - call PushRealO4 - -p02loc_4569: - ld hl, (OP6) - pop af - or a - jr nz, p02loc_4579 - ld (OP6+8), hl - call p02sub_4102 - jp PopRealO1 -; --------------------------------------------------------------------------- - -p02loc_4579: - ld d, a - ld b, 8 - -p02loc_457C: - dec b - rla - jr nc, p02loc_457C - push bc - push de - ld hl, (iMathPtr3) - ld (iMathPtr1), hl - ld (iMathPtr2), hl - ld hl, (OP6) - push hl - call p02sub_5A1D - call p02sub_5936 - ld bc, 100h - -p02loc_4598: - pop hl - pop af - push af - and b - jr nz, p02loc_45A9 - push hl - push bc - call p02sub_45EB - pop bc - inc c - sla b - jr p02loc_4598 -; --------------------------------------------------------------------------- - -p02loc_45A9: - push bc - push hl - call CreateTempRMat - ld (iMathPtr4), de - call p02sub_4529 - call PushRealO4 - -p02loc_45B8: - pop hl - pop bc - -p02loc_45BA: - pop de - pop af - cp c - jr nz, p02loc_45CB - call PopRealO2 - call CpyTo1FPST - call CpyO2ToFPST - jp p02loc_5B6B -; --------------------------------------------------------------------------- - -p02loc_45CB: - push af - push de - push bc - push hl - call p02sub_45EB - pop hl - pop bc - pop af - push af - inc c - sla b - and b - jr z, p02loc_45BA - push bc - push hl - ld de, (iMathPtr4) - ld (iMathPtr1), de - call p02sub_45EE - jr p02loc_45B8 -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_45EB: - ; BinOPExec2-AD4p - call CHKERRBREAK -; End of function p02sub_45EB - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_45EE: - call p02sub_53F1 - call p02sub_40BA - ld hl, (iMathPtr3) - ld de, (iMathPtr1) - ld (iMathPtr1), hl - call p02sub_4529 - ld hl, (iMathPtr2) - ld (iMathPtr1), hl - ret -; End of function p02sub_45EE - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4608: - ld a, (OP6) - ld (OP6+8), a - call OP1Set0 - call PushRealO1 - -p02loc_4614: - rst 8 - call GETM1TOOP1 - call FPAdd_AbsoluteValues - ld a, (OP6) - cp 1 - jr nz, p02loc_4631 - call CpyTo2FPST - call OP1ToOP3 - call cpop1op2 - call nc, CpyO3ToFPST - call OP1Set0 - -p02loc_4631: - call p02loc_407E - jr nz, p02loc_4614 - jp PopRealO1 -; End of function p02sub_4608 - -; --------------------------------------------------------------------------- - -ROWECH_POLY: - push af - ld hl, (OP6) - push hl - ld l, h - ld (OP6), hl - call p02sub_4608 - pop hl - ld (OP6), hl - ld (OP6+8), hl - ld l, h - jr p02loc_4663 - -; =============== S U B R O U T I N E ======================================= - - -ROWECHELON: - push af - ld hl, (OP6) - push hl - call p02sub_4608 - pop hl - ld (OP6), hl - ld (OP6+8), hl - ld a, h - cp l - jr c, p02loc_4663 - ld l, h - -p02loc_4663: - ; ROWECHELON+11j - ld h, 0 - call j_SetXXXXOP2 - call FPMult - call OP2Set3 - ld a, 73h ; 's' - ld (OP2+1), a - call FPMult - rst 18h - ld bc, 101h - -p02loc_467A: - ld (OP6), bc - push bc - ld a, (OP6+1) - ld b, a - ld a, (OP6+8+1) - ld c, a - set 6, a - call p02sub_41C7 - call CpyTo2FPST - call OP3ToOP1 - call cpop1op2 - pop bc - push bc - jr c, p02loc_469B - jr nz, p02loc_46AE - -p02loc_469B: - ; ROWECHELON+59j - push bc - call OP1Set0 - call PUTTOM1A - pop bc - inc b - ld a, (OP6+8+1) - cp b - jr nc, p02loc_469B - pop bc - jp p02loc_470A -; --------------------------------------------------------------------------- - -p02loc_46AE: - ld (OP6), bc - call GETM1TOOP1 - rst 18h - pop bc - -p02loc_46B7: - push bc - ld de, (iMathPtr1) - call GetMToOP1 - call CpyTo2FPST - call fpdiv - pop bc - push bc - call PUTTOM1A - pop bc - inc c - jr z, p02loc_46D4 - ld a, (OP6+8) - cp c - jr nc, p02loc_46B7 - -p02loc_46D4: - call PopRealO1 - pop af - push af - jr c, p02loc_46EC - ld a, 1 - ld hl, 84B4h - ld (hl), a - -p02loc_46E1: - ld a, (OP6+1) - cp (hl) - jr z, p02loc_46EC - call p02sub_4719 - jr p02loc_46E1 -; --------------------------------------------------------------------------- - -p02loc_46EC: - ; ROWECHELON+96j - ld a, (OP6+1) - inc a - ld hl, 84B4h - ld (hl), a - -p02loc_46F4: - ld a, (OP6+8+1) - cp (hl) - jr c, p02loc_46FF - call p02sub_4719 - jr p02loc_46F4 -; --------------------------------------------------------------------------- - -p02loc_46FF: - ld bc, (OP6) - inc b - ld a, (OP6+8+1) - cp b - jr c, p02loc_4714 - -p02loc_470A: - ld a, (OP6+8) - inc c - jr z, p02loc_4714 - cp c - jp nc, p02loc_467A - -p02loc_4714: - ; ROWECHELON+BFj - call FPOPREAL - pop af - ret -; End of function ROWECHELON - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4719: - ; ROWECHELON+ABp - ld a, (OP6+8) - ld (OP6+4), a - -p02loc_471F: - ld bc, (OP6) - ld a, (OP6+4) - ld c, a - call GETM1TOP1A - rst 8 - ld bc, (OP6) - ld a, (OP6+4+1) - ld b, a - call GETM1TOP1A - call FPMult - call InvOP1S - rst 8 - ld bc, (OP6+4) - call GETM1TOP1A - rst 30h - ld bc, (OP6+4) - call PUTTOM1A - ld hl, 84B3h - dec (hl) - ld a, (OP6) - cp (hl) - jr c, p02loc_471F - jr z, p02loc_471F - inc hl - inc (hl) - ret -; End of function p02sub_4719 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_475B: - ld c, 0 - -p02loc_475D: - ld a, (OP6) - cp c - ret z - inc c - ld b, 1 - push bc - call GETM1TOP1A - -p02loc_4769: - pop bc - push bc - call PUTTOMA1 - pop bc - inc b - ld a, (OP6+1) - cp b - jr c, p02loc_475D - push bc - ld de, (iMathPtr1) - call p02loc_4051 - rst 30h - jr p02loc_4769 -; End of function p02sub_475B - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4781: - ld de, (iMathPtr1) -; End of function p02sub_4781 - - -; =============== S U B R O U T I N E ======================================= - - -AdrLEle: - ; GETL1TOP1A:Page02_3B07p ... - inc de - inc de - ld a, (de) - and 0Ch - push af - dec hl - call HLTimes9 - pop af - jr z, p02loc_4793 - add hl, hl - -p02loc_4793: - add hl, de - ret -; End of function AdrLEle - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4795: - ld de, (iMathPtr3) - jr GetLToOP1 -; End of function p02sub_4795 - - -; =============== S U B R O U T I N E ======================================= - - -GETL1TOOP1: - ; BinOPExec2+2CEp ... - ld hl, (OP6) -; End of function GETL1TOOP1 - - -; =============== S U B R O U T I N E ======================================= - - -GETL1TOP1A: - ; MAXMINLST+2Bp ... - ld de, (iMathPtr1) - -GetLToOP1: - ; GETL1TOP1A+26j ... - call AdrLEle - ld de, OP1 - -p02loc_47A8: - ; GETL1TOP1A+35j - or a - jr z, p02loc_47F0 - jp MOVCPLX -; --------------------------------------------------------------------------- - -GETL1TOOP2: - ld hl, (OP6) - -GETL1TOP2A: - ld de, (iMathPtr1) - -Page02_3B07: - call AdrLEle - ld de, OP2 - jr p02loc_47A8 -; --------------------------------------------------------------------------- - -p02loc_47BD: - ld hl, (OP6+4) - -GETL2TOP1A: - ld de, (iMathPtr2) - jr GetLToOP1 -; --------------------------------------------------------------------------- - -p02loc_47C6: - ld hl, (OP6) - ld de, (iMathPtr1) - call AdrLEle - ld de, OP3 - jr p02loc_47A8 -; --------------------------------------------------------------------------- - ld hl, (OP6+8) - -PUTTOLA1: - ; p02sub_49B2:p02loc_49B5p ... - ld de, (iMathPtr3) - -PutToL: - call AdrLEle - push hl - call CkValidNum - pop de - ld hl, OP1 - ld a, (hl) - call mov9B2 - and 0Ch - ret z - inc hl - inc hl - -p02loc_47F0: - jp mov9B2 -; End of function GETL1TOP1A - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_47F3: - ld h, 0 - call HLTimes9 - ex de, hl - ld hl, (FPS) - or a - sbc hl, de - rst 20h - ret -; End of function p02sub_47F3 - -; --------------------------------------------------------------------------- - -Page02_3B1F: - ld b, 2 - jr p02loc_4807 -; --------------------------------------------------------------------------- - -Page02_3B25: - ld b, 0 - -p02loc_4807: - push bc - ld (OP6+4+1), a - rst 18h - ld l, 1 - xor a - ld (OP6+6), a - -p02loc_4812: - push hl - call p02sub_47F3 - call FIND_E_UNDEF - call page0_1641 - jp z, ErrSyntax - cp 5Dh ; ']' - jp nz, ErrDataType - ld a, (OP1M) - inc a - ld b, a - ld a, 1 - jr p02loc_482E -; --------------------------------------------------------------------------- - -p02loc_482D: - add a, a - -p02loc_482E: - djnz p02loc_482D - ld hl, 84B5h - ld b, a - and (hl) - jp nz, ErrSyntax - ld a, b - or (hl) - ld (hl), a - call page0_17E6 - pop hl - inc l - ld a, (OP6+4+1) - cp l - jr nc, p02loc_4812 - call FINDSYM_GET_SIZE - ld (iMathPtr1), de - or h - jp z, ErrDimension - ld (OP6), hl - ld l, 1 - -p02loc_4856: - ld a, (OP6+4+1) - cp l - jr z, p02loc_4879 - push hl - call p02sub_47F3 - push hl - rst 10h - pop hl - dec hl - ld (hl), d - dec hl - ld (hl), e - ex de, hl - call ldHLind - ld de, (OP6) - or a - sbc hl, de - jp nz, ErrDimMismatch - pop hl - inc l - jr p02loc_4856 -; --------------------------------------------------------------------------- - -p02loc_4879: - ld bc, (OP6) - -p02loc_487D: - or a - ld hl, 1 - sbc hl, bc - jr z, p02loc_48CF - add hl, bc - pop af - push af - push bc - cp 2 - ld a, 1 - jr c, p02loc_4890 - dec a - -p02loc_4890: - call MAXMINLST - pop bc - or a - sbc hl, bc - jr z, p02loc_48CC - add hl, bc - push hl - push bc - call p02sub_48DA - ld hl, (iMathPtr1) - ld (iMathPtr2), hl - ld l, 0 - -p02loc_48A7: - inc l - ld a, (OP6+4+1) - cp l - jr z, p02loc_48C4 - push hl - call p02sub_47F3 - ld hl, (OP1+7) - ld (iMathPtr1), hl - pop de - pop bc - pop hl - push hl - push bc - push de - call p02sub_48DA - pop hl - jr p02loc_48A7 -; --------------------------------------------------------------------------- - -p02loc_48C4: - ld hl, (iMathPtr2) - ld (iMathPtr1), hl - pop de - pop de - -p02loc_48CC: - dec bc - jr p02loc_487D -; --------------------------------------------------------------------------- - -p02loc_48CF: - ld a, (OP6+4+1) - ld l, a - ld h, 0 - call DeallocFPS - jr p02loc_48F1 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_48DA: - push bc - call p02sub_4781 - ex de, hl - pop hl - push hl - push de - call p02sub_4781 - pop de - ld b, 9 - bit 3, (hl) - jr z, p02loc_48EE - ld b, 12h - -p02loc_48EE: - call ExLp - -p02loc_48F1: - pop bc - ret -; End of function p02sub_48DA - -; --------------------------------------------------------------------------- - xor a - jr MAXMINLST -; --------------------------------------------------------------------------- - ld a, 1 - -; =============== S U B R O U T I N E ======================================= - - -MAXMINLST: - - ld (OP6+6), a - ld a, (OP6+4+1) - push af - ld (OP6+4), hl - push hl - push bc - call GETL1TOP1A - call CkOP1Cplx - call z, AddSquares - call OP1ToOP5 - -p02loc_4910: - ; MAXMINLST+4Aj ... - pop bc - pop hl - -p02loc_4912: - or a - sbc hl, bc - jr nz, p02loc_491F - ld hl, (OP6+4) - pop af - ld (OP6+4+1), a - ret -; --------------------------------------------------------------------------- - -p02loc_491F: - add hl, bc - inc hl - push hl - push bc - call GETL1TOP1A - call CkOP1Cplx - call z, AddSquares - call OP1ToOP4 - call OP5ToOP2 - ld a, (OP6+6) - or a - jr nz, p02loc_493F - call cpop1op2 - jr nc, p02loc_4910 - jr p02loc_4946 -; --------------------------------------------------------------------------- - -p02loc_493F: - call cpop1op2 - jr c, p02loc_4910 - jr z, p02loc_4910 - -p02loc_4946: - call OP4ToOP5 - pop bc - pop hl - ld (OP6+4), hl - jr p02loc_4912 -; End of function MAXMINLST - -; --------------------------------------------------------------------------- - -LLOW: - xor a - -p02loc_4951: - ld hl, 1 - ld bc, (OP6) - call MAXMINLST - jp GETL1TOP1A -; --------------------------------------------------------------------------- - -LHIGH: - ld a, 1 - jr p02loc_4951 -p02loc_4962: - call OP1Set1 - ld a, 82h ; '�' - jr p02loc_496E -; --------------------------------------------------------------------------- - -LSUM: - call OP1Set0 - ld a, 70h ; 'p' - -p02loc_496E: - push af - -p02loc_496F: - call PushOP1 - call GETL1TOOP1 - pop af - push af - call BinOPExec2 - ld hl, (OP6) - dec hl - ld (OP6), hl - ld de, (OP6M) - call CpHLDE - jr nc, p02loc_496F - pop af - ret - -; =============== S U B R O U T I N E ======================================= - - -CUMSUM: - ld hl, 1 - push hl - call GETL1TOP1A - -p02loc_4993: - pop hl - push hl - call PUTTOLA1 - pop hl - ld de, (OP6) - call CpHLDE - ret z - inc hl - push hl - call PushOP1 - pop hl - push hl - call GETL1TOP1A - ld a, 70h ; 'p' - call BinOPExec2 - jr p02loc_4993 -; End of function CUMSUM - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_49B2: - ; UnOPExec2+348p - ld hl, (OP6) - -p02loc_49B5: - call PUTTOLA1 - call p02sub_49BE - jr nz, p02loc_49B5 - ret -; End of function p02sub_49B2 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_49BE: - ld hl, (OP6) - dec hl - ld a, h - or l - ld (OP6), hl - ret -; End of function p02sub_49BE - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_49C8: - ld de, 0 - call p02sub_49DF - ld de, (iMathPtr2) - ld (iMathPtr1), de - ld de, (OP6+4) - ld (OP6), de - ex de, hl -; End of function p02sub_49C8 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_49DF: - ld hl, 0 - -p02loc_49E2: - inc hl - push hl - inc de - push de - call GETL1TOP1A - call page0_184C - jr z, p02loc_49F4 - call CkOP1Cplx - call nz, page0_104B - -p02loc_49F4: - pop hl - push hl - call PUTTOLA1 - call p02sub_49BE - pop de - pop hl - ret z - jr p02loc_49E2 -; End of function p02sub_49DF - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4A01: - ld hl, 1 - push hl - -p02loc_4A05: - call p02sub_49BE - pop hl - ret z - inc hl - push hl - call GETL1TOP1A - call PushOP1 - pop hl - push hl - dec hl - push hl - call GETL1TOP1A - ld a, 71h ; 'q' - call BinOPExec2 - pop hl - call PUTTOLA1 - jr p02loc_4A05 -; End of function p02sub_4A01 - -; --------------------------------------------------------------------------- - -Page02_3B49: - call j_CKENDLINERR - ld a, 0FFh - call page0_1682 - -p02loc_4A2C: - call j_FindAlphaUp - ret c - rst 10h - ret c - call IsBZero - jr nz, p02loc_4A2C - call DelVar - ld hl, 0 - call CreateRList - call OP4ToOP1 - jr p02loc_4A2C -; --------------------------------------------------------------------------- - -Page02_3B4F: - cp 2 - jp c, ErrArgument - cp 65h ; 'e' - jp nc, ErrArgument - dec a - push af - push af - call Page0Call_241E - jr nc, p02loc_4A60 - ld hl, 101h - call CreateRMat - call OP4ToOP1 - -p02loc_4A60: - call OP1ToOP6 - ld b, 0 - ld hl, (FPS) - pop af - -p02loc_4A69: - push af - push bc - call HLMINUS9 - push hl - rst 20h - call FINDSYM_GET_SIZE - ld a, h - or a - jp nz, ErrDimension - ld a, l - cp 64h ; 'd' - jp nc, ErrDimension - pop hl - pop bc - cp b - jr c, p02loc_4A84 - ld b, a - -p02loc_4A84: - pop af - dec a - jr nz, p02loc_4A69 - pop af - push af - ld c, a - push bc - call OP6ToOP1 - pop hl - push hl - call j_RedimMat - call OP6ToOP1 - call Page0Call_241E - ld (iMathPtr3), de - pop bc - push bc - -p02loc_4AA0: - ld b, 1 - push bc - call PopRealO1 - call markTableDirty - call FINDSYM_GET_SIZE - ld (iMathPtr1), de - pop bc - -p02loc_4AB1: - ld a, l - cp b - push hl - push bc - jr nc, p02loc_4ABC - call OP1Set0 - jr p02loc_4AC0 -; --------------------------------------------------------------------------- - -p02loc_4ABC: - ld l, b - call GETL1TOP1A - -p02loc_4AC0: - pop bc - push bc - call PUTTOMA1 - pop bc - inc b - pop hl - pop af - cp b - push af - jr nc, p02loc_4AB1 - dec c - jr nz, p02loc_4AA0 - pop af - pop af - ret - -; =============== S U B R O U T I N E ======================================= - -p02loc_4AD3: -p02sub_4AD3: - call CKPosDoInt - jr z, p02loc_4ADB - -p02loc_4AD8: - jp ErrDomain -; --------------------------------------------------------------------------- - -p02loc_4ADB: - call ckop2pos - jr nz, p02loc_4AD8 - ld hl, 8484h - call CKDoInt - jr nz, p02loc_4AD8 - call page0_1713 - jr nc, p02loc_4AD8 - ld a, (OP2+1) - sub e - jr nc, p02loc_4AD8 - call CkOP1FP0 - jr nz, p02loc_4AFF - call CkOP2FP0 - ret z - jp OP2ToOP1 -; --------------------------------------------------------------------------- - -p02loc_4AFF: - call CkOP2FP0 - ret z - -p02loc_4B03: - call fpdiv - call frac - call FPMult - call OP2ToOP3 - ld hl, page0_FC3 - call FPAdd_FromHL - call Trunc - rst 8 - call OP3ToOP1 - call CkOP2FP0 - ret z - jr p02loc_4B03 -; End of function p02sub_4AD3 - -p02loc_4B22: - call OP1ToOP4 - call FPMult - call OP1ExOP4 - call p02sub_4AD3 - call CkOP1FP0 - ret z - rst 8 - call OP4ToOP1 - jp fpdiv -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -ToFrac: - call CKOP1DoInt - jr z, p02loc_4B43 - ld a, (OP1+1) - cp 84h ; '�' - -p02loc_4B43: - jp nc, p02loc_4C29 - sub 0Bh - push af - ld de, userMenuSA - call MovFrOP1 - call MovFrOP1 - call OP1Set1 - call OP1ToOP5 - ld de, 8610h - call MovFrOP1 - xor a - ld (OP1M), a - call MovFrOP1 - call OP1ToOP6 - -p02loc_4B68: - ld hl, 8607h - rst 20h - ld hl, page0_FC3 - call Mov9ToOP2 - ld a, (OP1) - ld (OP2), a - rst 30h - call Trunc - call OP1ToOP4 - rst 8 - ld hl, 8607h - rst 20h - call FPSub - ld de, 8607h - call MovFrOP1 - call OP6ToOP1 - call OP4ToOP2 - call FPMult - ld hl, 8610h - call FPAdd_FromHL - ld a, (OP1+1) - cp 84h ; '�' - jr nc, p02loc_4BE6 - call OP1ExOP6 - ld de, 8610h - call MovFrOP1 - call OP5ToOP1 - call OP4ToOP2 - call FPMult - ld hl, 8619h - call FPAdd_FromHL - call OP1ExOP5 - ld de, 8619h - call MovFrOP1 - ld hl, 8607h - rst 20h - call OP2Set1 - ld a, 7Dh ; '}' - ld (OP2+1), a - call AbsO1O2Cp - jr c, p02loc_4BE6 - jr z, p02loc_4BE6 - ld hl, 8607h - rst 20h - call fprecip - ld de, 8607h - call MovFrOP1 - jr p02loc_4B68 -; --------------------------------------------------------------------------- - -p02loc_4BE6: - ; UnOPExec2-E80j ... - call OP6ToOP2 - call CkOP2FP0 - jr z, p02loc_4C24 - call OP5ToOP1 - call fpdiv - call InvOP1S - ld hl, userMenuSA - call FPAdd_FromHL - call OP2Set1 - pop af - ld (OP2+1), a - call AbsO1O2Cp - jr nc, p02loc_4C25 - call OP6ToOP2 - call OP1Set1 - call AbsO1O2Cp - jr z, p02loc_4C25 - call OP5ToOP1 - call OP6ToOP2 - call ClrOP2S - ld hl, OP1 - xor (hl) - ld (hl), a - or a - ret -; --------------------------------------------------------------------------- - -p02loc_4C24: - pop af - -p02loc_4C25: - ; UnOPExec2-E41j - ld hl, userMenuSA - rst 20h - -p02loc_4C29: - scf - ret -; END OF FUNCTION CHUNK FOR UnOPExec2 -p02loc_4C2B: - call CkOP1FP0 - jr nz, p02loc_4C56 - -p02loc_4C30: - call CkOP2FP0 - jr z, p02loc_4C63 - jr p02loc_4C56 -p02loc_4C37: - call CkOP1FP0 - ret z - jr p02loc_4C30 -p02loc_4C3D: - call CkOP1FP0 - jr z, p02loc_4C30 - call CkOP2FP0 -; START OF FUNCTION CHUNK FOR p02sub_4C49 - -p02loc_4C45: - jr z, p02loc_4C56 - jr p02loc_4C63 -; END OF FUNCTION CHUNK FOR p02sub_4C49 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4C49: - - - - - - call CkOP1FP0 - jr p02loc_4C45 -; End of function p02sub_4C49 - -p02loc_4C4E: - call page0_14A7 - call cpop1op2 - jr nc, p02loc_4C63 -; START OF FUNCTION CHUNK FOR p02sub_4C49 - -p02loc_4C56: - jp OP1Set1 -; END OF FUNCTION CHUNK FOR p02sub_4C49 -; --------------------------------------------------------------------------- - -Page02_3AAD: - call page0_14A7 - call cpop1op2 - jr c, p02loc_4C56 - jr z, p02loc_4C56 -; START OF FUNCTION CHUNK FOR p02sub_4C49 - -p02loc_4C63: - jp OP1Set0 -; END OF FUNCTION CHUNK FOR p02sub_4C49 -p02loc_4C66: - call page0_14A7 - call cpop1op2 - jr z, p02loc_4C63 - -p02loc_4C6E: - jr c, p02loc_4C63 - jr p02loc_4C56 -; --------------------------------------------------------------------------- - -Page02_3AB3: - call page0_14A7 - call cpop1op2 - jr p02loc_4C6E -p02loc_4C7A: - ld hl, 11h - push hl - call ErrNotEnoughMem - call FIND_E_UNDEF - ld (unk_9306), de - inc de - inc de - inc de - -p02loc_4C8B: - inc hl - ld (hl), 10h - ex de, hl - ld hl, (unk_9306) - ld c, (hl) - inc hl - ld b, (hl) - ex de, hl - add hl, bc - ex de, hl - push bc - -p02loc_4C99: - ld hl, p02loc_4C7A - ldir - pop bc - pop hl - add hl, bc - ex de, hl - ld hl, (unk_9306) - ld (hl), e - inc hl - ld (hl), d - rst 18h - rst 18h - call XName - rst 18h - call PopRealO1 - call markTableDirty - ret -; --------------------------------------------------------------------------- - ld hl, 4 - call InsertMem - ex de, hl - ld (hl), 25h ; '%' - inc hl - ld (hl), 10h - inc hl - ld (hl), 25h ; '%' - jr p02loc_4C8B -; --------------------------------------------------------------------------- - ld hl, 0Dh - call InsertMem - ld bc, 0Dh - jr p02loc_4C99 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4CD1: - call CMP_NUM_INIT - ld hl, 84E9h - cp (hl) - ret c - ld (hl), a - ret -; End of function p02sub_4CD1 - - -; =============== S U B R O U T I N E ======================================= - - -SEQSET: - rst 18h - xor a - ld (unk_84E9), a - ld hl, 91CEh - bit 0, (hl) - ld hl, u0 - call nz, p02sub_4CD1 - ld hl, 91CEh - bit 1, (hl) - ld hl, v0 - call nz, p02sub_4CD1 - ld hl, 91CEh - bit 2, (hl) - ld hl, w0 - call nz, p02sub_4CD1 - call OP1Set0 - ld de, 91D0h - call MovFrOP1 - ld hl, nMin - rst 20h - call j_StoN - jr p02loc_4D14 -; End of function SEQSET - - -; =============== S U B R O U T I N E ======================================= - - -SEQSOLVE: - rst 18h - -p02loc_4D14: - ld b, 1 - -p02loc_4D16: - push bc - ld a, (unk_91CE) - and b - jp z, p02loc_4DB8 - cp 4 - jr nz, p02loc_4D23 - dec a - -p02loc_4D23: - push af - call j_serrort - bit drawingGraph, (iy+graphFlags) - jr z, p02loc_4D32 - call FIND_E_UNDEF - set 6, (hl) - -p02loc_4D32: - pop af - ld hl, u0 - dec a - jr z, p02loc_4D42 - ld hl, v0 - dec a - jr z, p02loc_4D42 - ld hl, w0 - -p02loc_4D42: - call CMP_NUM_INIT - bit allowCursor, (iy+plotFlags) - jr z, p02loc_4D58 - call IsRecursiveMode - jr z, p02loc_4D58 - bit webMode, (iy+seqFlags) - jr z, p02loc_4D58 - ld a, 1 - -p02loc_4D58: - ld (unk_91CF), a - push de - push hl - push af - call OP1ToOP3 - ld hl, 91D0h - rst 20h - call Plus1 - pop af - ld l, a - ld h, 0 - call j_SetXXXXOP2 - ld a, (OP1M) - push af - call cpop1op2 - pop bc - pop hl - pop de - jr c, p02loc_4D7D - jr nz, p02loc_4D9C - -p02loc_4D7D: - bit allowCursor, (iy+plotFlags) - jr z, p02loc_4D89 - bit webMode, (iy+seqFlags) - jr nz, p02loc_4D95 - -p02loc_4D89: - ld a, b - cp 10h - jr nz, p02loc_4D95 - ld a, (unk_91CF) - bit 0, a - jr z, p02loc_4D98 - -p02loc_4D95: - or a - sbc hl, de - -p02loc_4D98: - rst 20h - jp p02loc_4DB8 -; --------------------------------------------------------------------------- - -p02loc_4D9C: - call j_SAVEPARSE - call OP3ToOP1 - ld hl, p02loc_4EA1 - call pushErrorHandleR - call j_PARSEOFF - call popErrorHandleR - -p02loc_4DAE: - rst 8 - call PopRealO1 - call j_GETPARSE - call OP2ToOP1 - -p02loc_4DB8: - call CkOP1Real - jr z, p02loc_4DC2 - cp 0Eh - jp nz, ErrDataType - -p02loc_4DC2: - rst 18h - ld a, (unk_84E9) - or a - jr z, p02loc_4DCE - ld a, 0Eh - ld (OP1), a - -p02loc_4DCE: - rst 18h - -p02loc_4DCF: - pop af - add a, a - ld b, a - cp 8 - jp nz, p02loc_4D16 - set numOP1, (iy+ParsFlag2) - ld hl, un1 - call p02sub_4E95 - call p02sub_4E95 - call p02sub_4E95 - ld hl, 8E2Dh - call p02sub_4E95 - call p02sub_4E95 - call p02sub_4E95 - call PopRealO1 - ld de, wn1 - call MovFrOP1 - call PopRealO1 - ld de, 8E51h - call MovFrOP1 - call PopRealO1 - ld de, vn1 - call MovFrOP1 - call PopRealO1 - ld de, 8E3Fh - call MovFrOP1 - call PopRealO1 - ld de, un1 - call MovFrOP1 - call PopRealO1 - ld de, 8E2Dh - call MovFrOP1 - ld hl, 84E9h - ld a, (hl) - sub 1 - jr c, p02loc_4E63 - ld (hl), a - jr nz, p02loc_4E6E - ld hl, u0 - call CMP_NUM_INIT - ld hl, 8E2Dh - ld de, un1 - call p02sub_4E89 - ld hl, v0 - call CMP_NUM_INIT - ld hl, 8E3Fh - ld de, vn1 - call p02sub_4E89 - ld hl, w0 - call CMP_NUM_INIT - ld hl, 8E51h - ld de, wn1 - call p02sub_4E89 - jr p02loc_4E6E -; --------------------------------------------------------------------------- - -p02loc_4E63: - ld hl, 8E2Dh - ld de, un1 - ld bc, 36h ; '6' - ldir - -p02loc_4E6E: - ; SEQSOLVE+14Ej - call CpyTo2FPST - call j_RclN - call cpop1op2 - jp nc, FPOPREAL - call page0_1867 - call j_RclN - call Plus1 - call j_StoN - jp p02loc_4D14 -; End of function SEQSOLVE - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4E89: - ; SEQSOLVE+13Cp ... - cp 1 - ret c - jp z, mov9B2 - call mov9B2 - jp mov9B2 -; End of function p02sub_4E89 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4E95: - push hl - ld de, 9 - add hl, de - ex de, hl - pop hl - call mov9B2 - ex de, hl - ret -; End of function p02sub_4E95 - -p02loc_4EA1: - call CkOP1Real - cp 0Eh - jp z, p02loc_4DAE - jp JErrorNo -; --------------------------------------------------------------------------- - rst 18h - ld a, 0Eh - ld (OP1), a - rst 18h - jp p02loc_4DCF - -; =============== S U B R O U T I N E ======================================= - - -CMP_NUM_INIT: - ; SEQSOLVE:p02loc_4D42p ... - ld b, 0 - ld a, (hl) - and 1Fh - cp 0Eh - jr z, p02loc_4ECC - inc b - ld de, 1Bh - add hl, de - ld a, (hl) - and 1Fh - cp 0Eh - jr z, p02loc_4ECC - inc b - -p02loc_4ECC: - ; CMP_NUM_INIT+13j - ld a, b - ret -; End of function CMP_NUM_INIT - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_4ECE: - call ErrD_OP1NotPosDoInt - call ckop2pos - jr nz, p02loc_4EE2 - call OP1ToOP5 - call OP2ToOP4 - ld hl, 8484h - call CKDoInt - -p02loc_4EE2: - jp nz, ErrDomain - call CkOP2FP0 - jp z, page0_1228 - call FPSub - call CkOP1Pos - jp nz, page0_EBD - ret -; End of function p02sub_4ECE - -p02loc_4EF5: - call p02sub_4ECE - call CkOP1FP0 - jp z, OP1Set1 - call OP1ToOP3 - call OP4ToOP2 - call FPSub - call CkOP1Pos - call nz, OP3ToOP4 - call OP5ToOP1 - xor a - push af - -p02loc_4F12: - call OP4ToOP2 - call fpdiv - -p02loc_4F18: - call OP1ToOP3 - call OP4ToOP1 - call Minus1 - call CkOP1FP0 - pop bc - jr nz, p02loc_4F2F - call OP3ToOP1 - ld d, 0 - jp Round -; --------------------------------------------------------------------------- - -p02loc_4F2F: - push bc - call OP1ToOP4 - call OP5ToOP1 - call Minus1 - call OP1ToOP5 - call OP3ToOP2 - call FPMult - pop af - -p02loc_4F43: - push af - or a - jr z, p02loc_4F12 - jr p02loc_4F18 -p02loc_4F49: - call p02sub_4ECE - call OP5ToOP1 - ld a, 1 - jr p02loc_4F43 - -; =============== S U B R O U T I N E ======================================= - -p02loc_4F53: -p02sub_4F53: - call CKOP1DoInt - -p02loc_4F56: - jp nz, ErrDomain - call OP1ExOP2 - call CKOP1DoInt - jr nz, p02loc_4F56 - call cpop1op2 - call c, OP1ExOP2 - call PushRealO2 - call FPSub - call Plus1 - rst 18h - call j_Random - call PopRealO2 - call FPMult - call DoInt - call PopRealO2 - rst 30h - ret -; End of function p02sub_4F53 - - -; =============== S U B R O U T I N E ======================================= - - -PtoR: - call OP1ToOP6 - call OP2ToOP1 - call Sin - call OP2ToOP4 - call OP6ToOP2 - call FPMult - call OP1ExOP4 - call OP6ToOP2 - call FPMult - jp OP4ToOP2 -; End of function PtoR - - -; =============== S U B R O U T I N E ======================================= - - -RToP: - call OP2ToOP5 - call OP1ToOP6 - call FPSquare - call OP1ToOP4 - call OP5ToOP1 - call FPSquare - call OP4ToOP2 - rst 30h - call SqRoot - call OP6ToOP2 - call OP1ToOP6 - call OP5ToOP1 - ld d, 0 - call ATan2 - rst 8 - jp OP6ToOP1 - -InitContextA: - ld hl, {+} - jp ldHLind_AWord -+: .dw j_InitHomescreenContext - .dw j_InitLinkIOContext - .dw j_InitMatrixEditorContext - .dw j_InitStatEditorContext - .dw j_InitGraphContext - .dw j_InitModeContext - .dw j_InitProgramEditorContext - .dw j_InitProgramCreateContext - .dw j_InitWindowContext - .dw j_InitYEqualsContext - .dw j_InitTableContext - .dw j_InitTableSetContext - .dw j_InitAboutContext - .dw j_InitMemMgmtContext - .dw j_InitResetMemContext - .dw j_InitResetDefaultContext - .dw j_InitProgramInputContext - .dw j_InitZoomContext - .dw j_InitErrorContext - .dw j_InitTVMContext - .dw j_InitSolverContext - .dw j_InitStatPlotContext - .dw j_InitInfStatEditorContext - .dw j_InitFormatContext - .dw j_ExecuteApp - .dw j_InitGroupContext - .dw j_InitUngroupContext - -SetVertSplitRedisplayFlags: - push af - call Bit_VertSplit - jr z, {+} - ld a, (mcxCurApp) - cp kTable - jr z, {++} - cp kGraph - jr z, {++} -+: bit plotDisp, (iy+plotFlags) - jr nz, {++} - set NEED_BUFCPY, (iy+VERTFLAG2) - set NEED_RETABLE, (iy+VERTFLAG2) -++: pop af - ret -; --------------------------------------------------------------------------- - -Page02_3E73: - call GETEXP - jr nc, p02loc_5049 - cp 70h ; 'p' - jr c, p02loc_5046 - or 0F0h ; '�' - ld l, a - ld a, d - inc a - add a, l - jp nc, OP1Set0 - cpl - and 0Fh - dec a - jr p02loc_5051 -; --------------------------------------------------------------------------- - -p02loc_5040: - call CkOP1FP0 - jp nz, page0_1040 - -p02loc_5046: - jp OP1Set0 -; --------------------------------------------------------------------------- - -p02loc_5049: - sub 80h ; '�' - ld l, a - ld a, 0Dh - sub d - sub l - ret c - -p02loc_5051: - srl a - ld hl, 8480h - jr z, p02loc_505F - ld b, a - -p02loc_5059: - ld a, (hl) - ld (hl), 0 - dec hl - djnz p02loc_5059 - -p02loc_505F: - jr nc, p02loc_506F - ld a, (hl) - ld b, a - and 0F0h ; '�' - ld (hl), a - ld a, b - and 0Fh - cp 5 - ld b, 10h - jr p02loc_5073 -; --------------------------------------------------------------------------- - -p02loc_506F: - cp 50h ; 'P' - ld b, 1 - -p02loc_5073: - jr c, p02loc_5040 - ld a, (OP1+1) - push af - ld a, (OP1) - push af - xor a - ld (OP1), a - ld a, b - call page0_138B - pop af - and 80h ; '�' - ld (OP1), a - ld hl, OP1+1 - ld d, (hl) - pop af - ld (hl), a - cp d - ret z - ld hl, OP1M - ld (hl), 10h - jp INCO1EXP -; --------------------------------------------------------------------------- - -BinOPExec: - call page0_1847 - ld hl, 9817h - ld (hl), 0 - -; =============== S U B R O U T I N E ======================================= - - -BinOPExec2: - - - - - - - - - - - - - - - - - - - - - - - - - push af - call CpyTo3FPST - ld a, (OP3) - and 1Fh - cp 0Eh - jp z, ErrInvalid - ld d, a - cp 0Ch - call nz, FPOPREAL - call ShLAcc - ld b, a - call CkOP1Real - cp 0Eh - jp z, ErrInvalid - add a, b - jr nz, p02loc_50CA - rst 8 - call OP3ToOP1 - -p02loc_50CA: - ld c, a - pop af - ld b, a - cp 0D0h ; '�' - jr nz, p02loc_50E2 - call p02sub_5316 - rst 18h - call OP2ToOP1 - ld a, 25h ; '%' - push af - call p02sub_5601 - ld a, e - jp p02loc_5FE4 -; --------------------------------------------------------------------------- - -p02loc_50E2: - cp 0B6h ; '�' - jr nz, p02loc_50FD - ld hl, j_LSUM - -p02loc_50E9: - push hl - ld a, c - cp 10h - jr z, p02loc_50F4 - cp 0D0h ; '�' - jp nz, ErrDataType - -p02loc_50F4: - call PushRealO3 - ld h, 0FFh - push hl - jp p02loc_6100 -; --------------------------------------------------------------------------- - -p02loc_50FD: - ld hl, p02loc_4962 - cp 0B7h ; '�' - jr z, p02loc_50E9 - cp 0E4h ; '�' - jr nz, p02loc_510F - call p02sub_5316 - ld a, 12h - jr p02loc_515D -; --------------------------------------------------------------------------- - -p02loc_510F: - cp 0E3h ; '�' - jr nz, p02loc_5117 - ld a, 28h ; '(' - jr p02loc_515D -; --------------------------------------------------------------------------- - -p02loc_5117: - cp 0CFh ; '�' - jr nz, p02loc_513E - ld a, c - cp 1 - jp nz, ErrDataType - call p02sub_6042 - call PushRealO3 - call SETMAT1 - ex de, hl - xor a - ld (iMathPtr2+1), a - -p02loc_512F: - ld (unk_90CC), de - call SETesTOfps - ld a, 2Ch ; ',' - call Page0Call_38FD - jp p02loc_5B71 -; --------------------------------------------------------------------------- - -p02loc_513E: - ld hl, p02loc_65AD - cp 0D3h ; '�' - jr z, p02loc_5151 - ld hl, p02loc_65B1 - cp 0D4h ; '�' - jr z, p02loc_5151 - ld hl, p02loc_65A7 - cp 0D5h ; '�' - -p02loc_5151: - ; BinOPExec2+A7j - jp z, p02loc_51D8 - cp 0EDh ; '�' - jr nz, p02loc_5160 - call p02sub_5316 - ld a, 24h ; '$' - -p02loc_515D: - ; BinOPExec2+72j ... - jp p02sub_658F -; --------------------------------------------------------------------------- - -p02loc_5160: - cp 0DBh ; '�' - jr nz, p02loc_5170 - call p02sub_57DF - -p02loc_5167: - call j_ONEVARS_0 - call SqRoot - -p02loc_516D: - jp p02loc_5B71 -; --------------------------------------------------------------------------- - -p02loc_5170: - cp 0DCh ; '�' - jr nz, p02loc_517C - call p02sub_57DF - -p02loc_5177: - call j_ONEVARS_0 - jr p02loc_516D -; --------------------------------------------------------------------------- - -p02loc_517C: - cp 0D1h ; '�' - jr nz, p02loc_518B - call p02sub_5316 - call PUSHMCPLXO1 - ld a, 26h ; '&' - -p02loc_5188: - jp p02loc_5FDA -; --------------------------------------------------------------------------- - -p02loc_518B: - cp 0D2h ; '�' - jr nz, p02loc_5199 - call p02sub_5316 - call PUSHMCPLXO1 - ld a, 27h ; ''' - jr p02loc_5188 -; --------------------------------------------------------------------------- - -p02loc_5199: - cp 0D9h ; '�' - jr nz, p02loc_51A4 - call p02sub_5316 -; End of function BinOPExec2 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_51A0: - ld a, 26h ; '&' - jr p02loc_515D -; End of function p02sub_51A0 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_51A4: - cp 0E9h ; '�' - jr nz, p02loc_51B1 - call p02sub_5316 - call PUSHMCPLXO1 - jp p02loc_5F9A -; --------------------------------------------------------------------------- - -p02loc_51B1: - cp 0DFh ; '�' - jr nz, p02loc_51C1 - call p02sub_5316 - call PUSHMCPLXO1 - call OP1Set1 - jp p02loc_620A -; --------------------------------------------------------------------------- - -p02loc_51C1: - cp 0DEh ; '�' - jr nz, p02loc_51D1 - call p02sub_5316 - call PUSHMCPLXO1 - call OP1Set0 - jp p02loc_62A9 -; --------------------------------------------------------------------------- - -p02loc_51D1: - cp 0E5h ; '�' - jr nz, p02loc_51DB - ld hl, p02loc_6593 - -p02loc_51D8: - ; BinOPExec2+13Fj ... - jp p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_51DB: - cp 0E6h ; '�' - jr nz, p02loc_51E4 - ld hl, p02loc_658E - jr p02loc_51D8 -; --------------------------------------------------------------------------- - -p02loc_51E4: - cp 0E8h ; '�' - jr nz, p02loc_51ED - ld hl, p02loc_659B - jr p02loc_51D8 -; --------------------------------------------------------------------------- - -p02loc_51ED: - cp 0E7h ; '�' - jr nz, p02loc_51F6 - ld hl, p02loc_6597 - jr p02loc_51D8 -; --------------------------------------------------------------------------- - -p02loc_51F6: - cp 0EBh ; '�' - jr nz, p02loc_51FF - ld hl, p02loc_65A3 - jr p02loc_51D8 -; --------------------------------------------------------------------------- - -p02loc_51FF: - cp 0EAh ; '�' - jr nz, p02loc_5208 - ld hl, p02loc_659F - jr p02loc_51D8 -; --------------------------------------------------------------------------- - -p02loc_5208: - cp 70h ; 'p' - jp z, p02loc_5724 - cp 71h ; 'q' - jp z, p02loc_5770 - cp 82h ; '�' - jp z, p02loc_5777 - cp 83h ; '�' - jp z, p02loc_57CD - cp 0F0h ; '�' - jp z, p02loc_55A6 - cp 0F1h ; '�' - jp z, p02loc_55D1 - cp 6Ah ; 'j' - jp z, p02loc_54F3 - cp 6Fh ; 'o' - jp z, p02loc_54F3 - cp 12h - jp z, p02loc_55DE - cp 93h ; '�' - jp z, p02loc_5696 - cp 14h - jp z, p02loc_564F - cp 19h - jp z, p02loc_5402 - cp 1Ah - jp z, p02loc_53FB - cp 0D6h ; '�' - jp z, p02loc_52F4 - cp 0D7h ; '�' - jp z, p02loc_52FE - cp 26h ; '&' - jp z, p02loc_57D4 - cp 1Fh - jp z, p02loc_588E - cp 21h ; '!' - jp z, p02loc_5883 - cp 0D8h ; '�' - jr z, p02loc_52A7 - cp 40h ; '@' - jr z, p02loc_52CB - cp 3Ch ; '<' - jr z, p02loc_52D0 - cp 3Dh ; '=' - jr z, p02loc_52D5 - cp 95h ; '�' - jr z, p02loc_52DA - cp 94h ; '�' - jr z, p02loc_52DF - cp 6Bh ; 'k' - jr z, p02loc_52E5 - cp 6Dh ; 'm' - jr z, p02loc_52EA - cp 6Ch ; 'l' - jr z, p02loc_52EF - cp 6Eh ; 'n' - jr z, p02loc_52F9 - cp 20h ; ' ' - jp z, p02loc_58D2 - cp 0DDh ; '�' - jp z, p02loc_6215 - cp 13h - jr nz, p02loc_52AC - call p02sub_5316 - call PUSHMCPLXO1 - call j_PixelTest - jp z, OP1Set0 - jp OP1Set1 -; --------------------------------------------------------------------------- - -p02loc_52A7: - ld hl, p02loc_4F53 - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52AC: - ld hl, p02loc_6581 - cp 1Bh - jr z, p02loc_5301 - ld hl, p02loc_6572 - cp 1Ch - jr z, p02loc_5301 - ld hl, p02loc_657D - cp 1Dh - jr z, p02loc_5301 - ld hl, p02loc_6578 - cp 1Eh - jr z, p02loc_5301 - jp ErrArgument -; --------------------------------------------------------------------------- - -p02loc_52CB: - ld hl, p02loc_4C37 - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52D0: - ld hl, p02loc_4C2B - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52D5: - ld hl, p02loc_4C3D - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52DA: - ld hl, p02loc_4EF5 - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52DF: - ld hl, p02loc_4F49 - jr p02loc_5301 -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_52E4: - jp (hl) -; End of function p02sub_52E4 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_52E5: - ld hl, p02loc_4C4E - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52EA: - ld hl, Page0Call_3AAD - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52EF: - ld hl, p02loc_4C66 - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52F4: - ld hl, p02loc_4B22 - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52F9: - ld hl, Page0Call_3AB3 - jr p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_52FE: - ld hl, p02loc_4AD3 - -p02loc_5301: - ; BinOPExec2+207j ... - ld a, c - cp 11h - jr z, p02loc_534E - cp 10h - jr z, p02loc_5338 - cp 1 - jr z, p02loc_5345 - or a - jp nz, ErrDataType - call p02sub_52E4 - ret -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5316: - ; BinOPExec2+65p ... - ld a, c - or a - jp nz, ErrDataType - ret -; End of function p02sub_5316 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_531C: - ; BinOPExec2+594j ... - call page0_1847 - cp 11h - jr z, p02loc_534E - cp 10h - jr z, p02loc_5338 - cp 1 - jr z, p02loc_5345 - call page0_1842 - cp 1Ch - jr z, p02loc_5338 - cp 0D0h ; '�' - jr z, p02loc_5338 - cp 0DCh ; '�' - -p02loc_5338: - ; BinOPExec2+282j ... - jp z, p02loc_546A - cp 0Dh - jr z, p02loc_5345 - cp 0C1h ; '�' - jr z, p02loc_5345 - cp 0CDh ; '�' - -p02loc_5345: - ; BinOPExec2+286j ... - jp z, p02loc_5475 - call p02sub_544E - jp nz, ErrDataType - -p02loc_534E: - ; BinOPExec2+27Ej ... - ld a, b - scf - push af - call p02sub_594A - jp nz, ErrDimMismatch - ld (OP6+6), de - or a - jr z, p02loc_536B - ex de, hl - ld (OP6+8), hl - -p02loc_5362: - call CREATETLIST - -p02loc_5365: - ld hl, (OP6+8) - ld (OP6+6), hl - -p02loc_536B: - ; UnOPExec2-5ECj - call PushRealO4 - -p02loc_536E: - ; BinOPExec2+30Aj - call PushRealO6 - call GETL1TOOP1 - pop af - push af - jr c, p02loc_537D - call UnOPExec2 - jr p02loc_5388 -; --------------------------------------------------------------------------- - -p02loc_537D: - call PushOP1 - call p02loc_47BD - pop af - push af - call BinOPExec2 - -p02loc_5388: - call p02sub_53C6 - jr c, p02loc_5393 - jr nz, p02loc_536E - pop af - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_5393: - call p02sub_53AF - ld bc, (iMathPtr2) - ld hl, (iMathPtr3) - or a - sbc hl, bc - jr nz, p02loc_53A6 - ld (iMathPtr2), de - -p02loc_53A6: - ld (iMathPtr3), de - call page0_1842 - jr p02loc_536E -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_53AF: - ; BinOPExec2+441p - ld de, (iMathPtr3) - call j_ConvLrToLc - ld bc, (iMathPtr1) - ld hl, (iMathPtr3) - or a - sbc hl, bc - ret nz - ld (iMathPtr1), de - ret -; End of function p02sub_53AF - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_53C6: - ; BinOPExec2+422p - call PopRealO6 - call CkOP1Cplx - jr nz, p02loc_53D5 - call page0_184C - jr nz, p02loc_53DB - scf - ret -; --------------------------------------------------------------------------- - -p02loc_53D5: - call page0_184C - call nz, page0_104B - -p02loc_53DB: - ld hl, (OP6+6) - call PUTTOLA1 - ld hl, (OP6+6) - dec hl - ld a, h - or l - ld (OP6+4), hl -; End of function p02sub_53C6 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_53EA: - ld (OP6+6), hl - ld (OP6), hl - ret -; End of function p02sub_53EA - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_53F1: - ld (OP6+4), hl - ld (OP6+8), hl - ld (OP6), hl - ret -; End of function p02sub_53F1 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_53FB: - ld hl, Min - ld d, 1 - jr p02loc_5407 -; --------------------------------------------------------------------------- - -p02loc_5402: - ld hl, Max - ld d, 0 - -p02loc_5407: - ld a, c - cp 0DDh ; '�' - jp z, p02loc_534E - cp 0CCh ; '�' - jr z, p02loc_5424 - call page0_1842 - cp 0DCh ; '�' - jp z, p02loc_546A - cp 0CDh ; '�' - jp z, p02loc_5475 - call page0_1847 - jp p02loc_5301 -; --------------------------------------------------------------------------- - -p02loc_5424: - push de - call PushOP1 - call CAbs - call OP1ToOP6 - call CPYCTO1FPS3 - call CAbs - call OP6ToOP2 - call cpop1op2 - pop de - bit 0, d - jr z, p02loc_5440 - ccf - -p02loc_5440: - push af - call POPMCPLXO1 - pop af - push af - call nc, POPMCPLXO1 - pop af - jp c, FPOPCPLX - ret -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_544E: - ; BinOPExec2+5B5p - cp 0DDh ; '�' - ret z - cp 1Dh - ret z - cp 0D1h ; '�' - ret -; End of function p02sub_544E - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5457: - ; UnOPExec2+2F9j ... - ld a, b - or a - push af - call SETMAT1 - ld (OP6+6), hl - call CreateTempRList - ld (iMathPtr3), de - jp p02loc_536B -; END OF FUNCTION CHUNK FOR UnOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_546A: - ; BinOPExec2+373j ... - ld a, b - or a - push af - call PushOP1 - call OP3ToOP1 - jr p02loc_547E -; --------------------------------------------------------------------------- - -p02loc_5475: - ; BinOPExec2+378j ... - push bc - and 0F0h ; '�' - call z, PushRealO3 - pop af - scf - push af - -p02loc_547E: - call p02sub_59D5 - ld (OP6+6), hl - jr z, p02loc_5489 - call CREATETLIST - -p02loc_5489: - ; BinOPExec2+44Ej - call popOP1 - call PushRealO4 - call PushOP1 - -p02loc_5492: - call p02loc_47C6 - call CpyTo1FPST - call CkOP1Cplx - jr nz, p02loc_54AD - rst 8 - call CpyTo1FPS1 - pop af - push af - jr nc, p02loc_54BA - call OP1ExOP3 - call OP2ExOP4 - jr p02loc_54BA -; --------------------------------------------------------------------------- - -p02loc_54AD: - pop af - push af - jr nc, p02loc_54BA - call OP1ExOP3 - call CkOP1Cplx - call z, OP2ExOP4 - -p02loc_54BA: - ; BinOPExec2+408j ... - call PushRealO6 - call PushOP3 - pop af - push af - call BinOPExec2 - call p02sub_53C6 - jr c, p02loc_54D8 - jr nz, p02loc_5492 - pop af - call FPOPREAL - bit 3, (hl) - call nz, FPOPREAL - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_54D8: - call popOP1 - call PopRealO4 - call PushOP1 - call PushRealO4 - call p02sub_53AF - ld (iMathPtr3), de - call page0_1842 - call PopRealO4 - jr p02loc_5489 -; --------------------------------------------------------------------------- - -p02loc_54F3: - ; BinOPExec2+18Aj - cp 6Ah ; 'j' - push af - ld a, c - or a - jr nz, p02loc_5517 - call page0_14A7 - call cpop1op2 - -p02loc_5500: - jr nz, p02loc_550C - pop af -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5503: - push af - call OP1Set0 - pop af - ret nz - jr p02loc_5511 -; End of function p02sub_5503 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_550B: - push af - -p02loc_550C: - call OP1Set0 - pop af - ret z - -p02loc_5511: - ld a, 10h - ld (OP1M), a - ret -; End of function p02sub_550B - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_5517: - cp 0CCh ; '�' - jr nz, p02loc_552C - call p02sub_65BE - call ExMCplxO1 - call p02sub_65BE - call CSub - call CkOP1C0 - jr p02loc_5500 -; --------------------------------------------------------------------------- - -p02loc_552C: - cp 22h ; '"' - jr nz, p02loc_5566 - call SET2MVLPTRS - jp nz, ErrDimMismatch - ld (OP6+8), de - -p02loc_553A: - call GETM1TOOP1 - call RndGuard - rst 8 - ld bc, (OP6) - ld de, (iMathPtr2) - call GetMToOP1 - call RndGuard - call cpop1op2 - jr nz, p02loc_5560 - call p02loc_407E - jr nz, p02loc_553A - -p02loc_5559: - pop af - call p02sub_5503 - -p02loc_555D: - jp p02loc_5B71 -; --------------------------------------------------------------------------- - -p02loc_5560: - ; BinOPExec2+4CAj ... - pop af - call p02sub_550B - jr p02loc_555D -; --------------------------------------------------------------------------- - -p02loc_5566: - cp 44h ; 'D' - jr nz, p02loc_5587 - call SET2MVLPTRS - jr nz, p02loc_5560 - ld b, d - ld c, e - ld hl, (iMathPtr1) - ld de, (iMathPtr2) - inc hl - inc de - -p02loc_557A: - ld a, b - or c - jr z, p02loc_5559 - inc hl - inc de - ld a, (de) - cp (hl) - jr nz, p02loc_5560 - dec bc - jr p02loc_557A -; --------------------------------------------------------------------------- - -p02loc_5587: - pop bc - cp 11h - -p02loc_558A: - jp z, p02loc_534E - cp 0DDh ; '�' - jr z, p02loc_558A - cp 0CDh ; '�' - -p02loc_5593: - jp z, p02loc_5475 - cp 0DCh ; '�' - -p02loc_5598: - jp z, p02loc_546A - cp 1 - jr z, p02loc_5593 - cp 10h - jr z, p02loc_5598 - -p02loc_55A3: - jp ErrDataType -; --------------------------------------------------------------------------- - -p02loc_55A6: - ld a, c - or a - jr nz, p02loc_55AE - call j_YToX - ret -; --------------------------------------------------------------------------- - -p02loc_55AE: - cp 20h ; ' ' - jp z, p02loc_453E - ld hl, p02loc_6C77 - -p02loc_55B6: - cp 0CCh ; '�' - jr z, p02loc_55C3 - cp 0C0h ; '�' - jr nz, p02loc_55C4 - push hl - call OP2Set0 - -p02loc_55C2: - pop hl - -p02loc_55C3: - jp (hl) -; --------------------------------------------------------------------------- - -p02loc_55C4: - cp 0Ch - jr nz, p02loc_55DB - push hl - call OP4Set0 - call PUSHMCPLXO3 - jr p02loc_55C2 -; --------------------------------------------------------------------------- - -p02loc_55D1: - ld a, c - or a - jp z, p02loc_5EAA - ld hl, p02loc_6C56 - jr p02loc_55B6 -; --------------------------------------------------------------------------- - -p02loc_55DB: - jp p02loc_531C -; --------------------------------------------------------------------------- - -p02loc_55DE: - ld a, c - push af - or a - call z, OP2ToOP1 - call p02sub_5604 - -p02loc_55E7: - jp c, ErrDomain - push de - call OP3ToOP1 - pop de - ld d, e - pop af - or a - jp z, Round - push de - cp 0C0h ; '�' - jr nz, p02loc_561F - call POPMCPLXO1 - pop de - jp p02loc_65C4 -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5601: - ; ThreeExec+12p - call CkOP1Real -; End of function p02sub_5601 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5604: - and 0Fh - jr nz, p02loc_55A3 - call ErrD_OP1NotPosDoInt - ld a, (OP1+1) - cp 81h ; '�' - ccf - jr c, p02loc_55E7 - rst 8 - call j_ConvOP1 - ld hl, 9 - sbc hl, de - jr c, p02loc_55E7 - ret -; End of function p02sub_5604 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_561F: - ; UnOPExec2+3B7j - cp 20h ; ' ' - jr nz, p02loc_562C - call p02sub_5A0F - pop af - call p02sub_4488 - jr p02loc_5643 -; --------------------------------------------------------------------------- - -p02loc_562C: - call OP1ToOP3 - call OP2ToOP1 - ld b, 12h - pop de - bit 7, d - jp z, p02loc_531C - call ShRAcc - call OP3ToOP1 - jp p02loc_58B4 -; --------------------------------------------------------------------------- - -p02loc_5643: - ; BinOPExec2+5D1j ... - jp p02loc_5B6E -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5646: - ; UnOPExec2+17Cp - call SETMAT1 -; End of function p02sub_5646 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5649: - ld a, h - cp l - ret z - -p02loc_564C: - ; BinOPExec2+5E5j - jp ErrDimension -; End of function p02sub_5649 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_564F: - ld a, c - cp 22h ; '"' - jr z, p02loc_5679 - cp 11h - jr z, p02loc_5660 - call p02sub_544E - jr nz, p02loc_5676 - call page0_1842 - -p02loc_5660: - call SET2MVLPTRS - add hl, de - add hl, de - ld (OP6+8), hl - call CHK_HL_999 - call CREATETLIST - call PushRealO4 - call p02sub_49C8 - jr p02loc_5643 -; --------------------------------------------------------------------------- - -p02loc_5676: - ; BinOPExec2+63Cj - jp ErrDataType -; --------------------------------------------------------------------------- - -p02loc_5679: - call SET2MVLPTRS - add hl, de - ld a, h - cp d - jp nz, ErrDimMismatch - ld a, l - add a, e - jr c, p02loc_564C - cp 64h ; 'd' - jr nc, p02loc_564C - ld l, a - ld (OP6+8), hl - call p02sub_5A17 - call p02sub_44D4 - jr p02loc_5643 -; --------------------------------------------------------------------------- - -p02loc_5696: - ld a, c - push af - call p02sub_656B - pop af - cp 2 - jr nz, p02loc_56B3 - call PushRealO3 - call SETMAT1 - ld (iMathPtr3), de - call page0_16F4 - call PopRealO1 - jp p02sub_44C8 -; --------------------------------------------------------------------------- - -p02loc_56B3: - cp 1 - jr nz, p02loc_56CA - call PushRealO3 - -p02loc_56BA: - ; BinOPExec2+638j ... - call SETMAT1 - ld (iMathPtr3), de - call page0_17E6 - call popOP1 - jp p02sub_49B2 -; --------------------------------------------------------------------------- - -p02loc_56CA: - cp 0Dh - jr nz, p02loc_56D6 - call PushRealO3 - call j_ConvLcToLr - jr p02loc_56BA -; --------------------------------------------------------------------------- - -p02loc_56D6: - call page0_1842 - cp 0CDh ; '�' - jr z, p02loc_56BA - cp 0C1h ; '�' - jr nz, p02loc_5676 - call PushOP1 - call Page0Call_241E - call j_ConvLrToLc - call PopRealO1 - jr p02loc_56BA -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_56EF: - call p02sub_594A - jp nz, ErrDimMismatch - ld (OP6+8), de - or a - ret -; End of function p02sub_56EF - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_56FB: - call SET2MVLPTRS - add hl, de - add hl, de - ld (OP6+8), hl - call CreateTempString - inc de - inc de - ld hl, (iMathPtr1) - inc hl - inc hl - ld bc, (OP6) - ldir - ld hl, (iMathPtr2) - inc hl - inc hl - ld bc, (OP6+4) - ldir - call OP4ToOP1 - jp p02loc_5B71 -; --------------------------------------------------------------------------- - -p02loc_5724: - ld a, c - or a - jp z, FPAdd - cp 44h ; 'D' - jr z, p02loc_56FB - scf - -p02loc_572E: - push af - cp 0Ch - jr nz, p02loc_5740 - call OP4Set0 - call PUSHMCPLXO3 - -p02loc_5739: - ; BinOPExec2+6A8j - pop af - jp c, CAdd - jp CSub -; --------------------------------------------------------------------------- - -p02loc_5740: - cp 0C0h ; '�' - jr nz, p02loc_5749 - call OP2Set0 - jr p02loc_5739 -; --------------------------------------------------------------------------- - -p02loc_5749: - cp 0CCh ; '�' - jr z, p02loc_5739 - pop af - push af - cp 22h ; '"' - jr z, p02loc_5756 - pop af - jr p02loc_57CA -; --------------------------------------------------------------------------- - -p02loc_5756: - call p02sub_56EF - jr z, p02loc_5761 - ex de, hl - call p02sub_5A17 - jr p02loc_5764 -; --------------------------------------------------------------------------- - -p02loc_5761: - call PushRealO4 - -p02loc_5764: - pop af - push af - call c, p02sub_408E - pop af - call nc, p02sub_408A - -p02loc_576D: - ; BinOPExec2+704j - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_5770: - ld a, c - or a - jp z, FPSub - jr p02loc_572E -; --------------------------------------------------------------------------- - -p02loc_5777: - ld a, c - or a - jp z, FPMult - cp 2 - jr z, p02loc_5787 - cp 20h ; ' ' - jr nz, p02loc_579A - call OP1ExOP3 - -p02loc_5787: - call p02sub_5A0F - call OP3ToOP2 - -p02loc_578D: - call GETM1TOOP1 - call FPMult - call p02sub_4077 - jr nz, p02loc_578D - jr p02loc_576D -; --------------------------------------------------------------------------- - -p02loc_579A: - cp 22h ; '"' - jr nz, p02loc_57A9 - call p02sub_655D - call p02sub_5A17 - call p02sub_40BA - jr p02loc_576D -; --------------------------------------------------------------------------- - -p02loc_57A9: - scf - -p02loc_57AA: - push af - cp 0Ch - jr nz, p02loc_57BC - call OP4Set0 - call PUSHMCPLXO3 - -p02loc_57B5: - ; BinOPExec2+724j - pop af - jp c, CMult - jp CDiv -; --------------------------------------------------------------------------- - -p02loc_57BC: - cp 0C0h ; '�' - jr nz, p02loc_57C5 - call OP2Set0 - jr p02loc_57B5 -; --------------------------------------------------------------------------- - -p02loc_57C5: - cp 0CCh ; '�' - jr z, p02loc_57B5 - pop af - -p02loc_57CA: - jp p02loc_531C -; --------------------------------------------------------------------------- - -p02loc_57CD: - ld a, c - or a - jp z, fpdiv - jr p02loc_57AA -; --------------------------------------------------------------------------- - -p02loc_57D4: - call p02sub_5316 - rst 18h - call OP2ToOP1 - call p02sub_67A5 - ret -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_57DF: - ; BinOPExec2+D1p ... - ld a, c - cp 11h - jp nz, p02loc_58C0 - call p02sub_6042 - call SET2MVLPTRS - jp nz, ErrDimMismatch - ret -; End of function p02sub_57DF - - -; =============== S U B R O U T I N E ======================================= - - -EXMEAN1: - ; UnOPExec2+4D4j - push af - call OP1Set0 - rst 18h - rst 18h - rst 18h - res 1, (iy+0) - -p02loc_57FA: - call OP1Set1 - ld de, (iMathPtr2) - ld a, d - or a - ld hl, (OP6) - call nz, GetLToOP1 - call CkOP1Pos - jp nz, ErrStat - call CKOP1DoInt - jr z, p02loc_5818 - set 1, (iy+0) - -p02loc_5818: - rst 18h - call CpyTo2FPS1 - rst 30h - call CpyO1ToFPS1 - call GETL1TOOP1 - pop af - push af - and 0FEh ; '�' - cp 2 - call z, LnX - call CpyTo2FPST - call FPMult - call CpyTo2FPS2 - rst 30h - call CpyO1ToFPS2 - pop af - push af - jr c, p02loc_5859 - ld hl, (OP6) - call p02sub_4795 - pop af - push af - and 0FDh ; '�' - cp 1 - call z, LnX - call CpyTo2FPST - call FPMult - call CpyTo2FPS3 - rst 30h - call CpyO1ToFPS3 - -p02loc_5859: - call FPOPREAL - ld hl, (OP6) - dec hl - ld (OP6), hl - ld a, h - or l - jr nz, p02loc_57FA - call PopRealO2 - call PopRealO1 - call OP1ToOP5 - call fpdiv - pop af - jp c, FPOPREAL - call OP1ToOP4 - call PopRealO1 - call OP1ToOP6 - jp fpdiv -; End of function EXMEAN1 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_5883: - call p02sub_57DF - xor a - scf - call EXMEAN1 - -p02loc_588B: - jp p02loc_5B71 -; --------------------------------------------------------------------------- - -p02loc_588E: - call p02sub_57DF - -p02loc_5891: - res 3, (iy+16h) - set 4, (iy+16h) - ld hl, (iMathPtr2) - ld (iMathPtr5), hl - call j_ORDSTAT - res 4, (iy+16h) - call OP1ToOP3 - call PopRealO1 - rst 10h - set 7, (hl) - call OP3ToOP1 - jr p02loc_588B -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_58B4: - ; UnOPExec2:p02loc_5B06j ... - call page0_1847 - cp 1 - jr z, p02loc_58C3 - -p02loc_58BB: - call page0_1842 - cp 0Dh - -p02loc_58C0: - jp nz, ErrDataType - -p02loc_58C3: - ; UnOPExec2+230j - ld a, b - or a - push af - call p02sub_59D5 - ld (OP6+8), hl - jp nz, p02loc_5362 - jp p02loc_5365 -; END OF FUNCTION CHUNK FOR UnOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_58D2: - call p02sub_5316 - call p02sub_6520 - push af - call OP2ToOP1 - call p02sub_6520 - pop hl - ld l, e - call p02sub_53EA - call CreateTempRMat - ld (iMathPtr3), de - call PushRealO4 - call PushRealO1 - -p02loc_58F1: - call CpyO6ToFPST - call j_Random - call OP2Set1 - ld hl, 8484h - inc (hl) - inc hl - ld (hl), 19h - call FPMult - call DoInt - call OP2Set1 - ld a, 90h ; '�' - ld (OP2M), a - call FPSub - call CpyTo6FPST - ld hl, (OP6+6) - ld (OP6+8), hl - call p02sub_4077 - ld hl, (OP6+8) - ld (OP6+6), hl - jr nz, p02loc_58F1 - call FPOPREAL - jp PopRealO1 -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_592C: - ; SET2MVLPTRS+7p ... - call Page0Call_241E - jp c, ErrUndefined - call page0_1641 - ret nz -; End of function p02sub_592C - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5936: - ; UnOPExec2+14Ap - ld a, (unk_9817) - or a - jr z, p02loc_5941 - ld (tSymPtr2), hl - jr p02loc_5944 -; --------------------------------------------------------------------------- - -p02loc_5941: - ld (tSymPtr1), hl - -p02loc_5944: - inc a - ld (unk_9817), a - xor a - ret -; End of function p02sub_5936 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_594A: - call p02sub_59BF - push hl - jr nz, p02loc_595C - ld a, (OP1) - call page0_184C - jr nz, p02loc_595F - bit 3, a - jr z, p02loc_5963 - -p02loc_595C: - scf - jr p02loc_5970 -; --------------------------------------------------------------------------- - -p02loc_595F: - bit 3, a - jr z, p02loc_595C - -p02loc_5963: - ld hl, (iMathPtr2) - ld (iMathPtr3), hl - xor a - ld (unk_9817), a - call OP1ToOP4 - -p02loc_5970: - push af - call OP3ToOP1 - call p02sub_592C - jr nz, p02loc_598A - pop af - jr nc, p02loc_59A6 - ld a, (OP1) - call page0_184C - jr nz, p02loc_598F - bit 3, a - jr nz, p02loc_59BB - jr p02loc_5993 -; --------------------------------------------------------------------------- - -p02loc_598A: - pop af - jr nc, p02loc_59A6 - jr p02loc_59BB -; --------------------------------------------------------------------------- - -p02loc_598F: - bit 3, a - jr z, p02loc_59BB - -p02loc_5993: - ld (iMathPtr3), de - ld hl, 9817h - dec (hl) - ld hl, (tSymPtr2) - ld (tSymPtr1), hl - push de - call OP1ToOP4 - pop de - -p02loc_59A6: - xor a - -p02loc_59A7: - push af - call p02loc_59FB - pop af - pop de - or a - sbc hl, de - ret -; End of function p02sub_594A - - -; =============== S U B R O U T I N E ======================================= - - -SET2MVLPTRS: - ; BinOPExec2+4C7p ... - call p02sub_59BF - push hl - call OP3ToOP1 - call p02sub_592C - -p02loc_59BB: - ld a, 1 - jr p02loc_59A7 -; End of function SET2MVLPTRS - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_59BF: - call p02sub_592C - ld (iMathPtr2), de - ld a, (de) - ld l, a - inc de - ld a, (de) - push af - or l - jp z, ErrDimension - pop af - ld h, a - ld (OP6+4), hl - ret -; End of function p02sub_59BF - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_59D5: - ; BinOPExec2:p02loc_547Ep ... - call OP1ToOP4 - call SETMAT1 - inc de - ret nz - ld a, (OP1) - call page0_184C - jr nz, p02loc_59F2 - bit 3, a - ret nz - -p02loc_59E8: - dec de - ld (iMathPtr3), de - xor a - ld (unk_9817), a - ret -; --------------------------------------------------------------------------- - -p02loc_59F2: - bit 3, a - jr nz, p02loc_59E8 - or a - ret -; End of function p02sub_59D5 - - -; =============== S U B R O U T I N E ======================================= - - -SETMAT1: - ; UnOPExec2-5F9p ... - call p02sub_592C - -p02loc_59FB: - ld (iMathPtr1), de - ld a, (de) - ld l, a - inc de - ld a, (de) - dec de - push af - or l - jp z, ErrDimension - pop af - ld h, a - ld (OP6), hl - ret -; End of function SETMAT1 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5A0F: - ; BinOPExec2:p02loc_5787p ... - call p02sub_59D5 - ld (OP6+8), hl - jr z, p02loc_5A1A -; End of function p02sub_5A0F - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5A17: - ; BinOPExec2+5EBp ... - call p02sub_5A1D - -p02loc_5A1A: - jp PushRealO4 -; End of function p02sub_5A17 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5A1D: - call CreateTempRMat - jr p02loc_5A2D -; --------------------------------------------------------------------------- - -CREATETLIST: - ; BinOPExec2+3E3p ... - call page0_184C - push af - call z, CreateTempRList - pop af - call nz, CREATETCLIST - -p02loc_5A2D: - ld (iMathPtr3), de - ret -; End of function p02sub_5A1D - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5A32: - ; UnOPExec2:p02loc_5D95p ... - call p02sub_59D5 - ld (OP6+8), hl - jr z, p02loc_5A1A - call CREATETLIST - ld a, (OP4) - call p02sub_451A - ld hl, (iMathPtr3) - ld (iMathPtr1), hl - jr p02loc_5A1A -; End of function p02sub_5A32 - -; --------------------------------------------------------------------------- - -UnOPExec: - ld hl, 9817h - ld (hl), 0 - call page0_1847 - -; =============== S U B R O U T I N E ======================================= - - -UnOPExec2: - - - - - - - - - - - - - - - - - - - - - push af - call CkOP1Real - cp 0Eh - jp z, ErrInvalid - pop bc - or a - push af - ld a, b - cp 0C0h ; '�' - jr nz, p02loc_5A73 - pop af - jr nz, p02loc_5A6B - call p02sub_6E20 - ret -; --------------------------------------------------------------------------- - -p02loc_5A6B: - cp 0Ch - jr nz, p02loc_5ACD - call CLog - ret -; --------------------------------------------------------------------------- - -p02loc_5A73: - cp 0C1h ; '�' - jr nz, p02loc_5A86 - pop af - jr nz, p02loc_5A7E - call TenX - ret -; --------------------------------------------------------------------------- - -p02loc_5A7E: - cp 0Ch - jr nz, p02loc_5ACD - call CTenX - ret -; --------------------------------------------------------------------------- - -p02loc_5A86: - cp 0BEh ; '�' - jr nz, p02loc_5A99 - pop af - jr nz, p02loc_5A91 - call p02sub_6E15 - ret -; --------------------------------------------------------------------------- - -p02loc_5A91: - cp 0Ch - jr nz, p02loc_5ACD - call CLN - ret -; --------------------------------------------------------------------------- - -p02loc_5A99: - cp 0BFh ; '�' - jr nz, p02loc_5AAC - pop af - jr nz, p02loc_5AA4 - call EToX - ret -; --------------------------------------------------------------------------- - -p02loc_5AA4: - cp 0Ch - jr nz, p02loc_5B06 - call CEtoX - ret -; --------------------------------------------------------------------------- - -p02loc_5AAC: - cp 0B8h ; '�' - jr nz, p02loc_5AB7 - pop af - jr nz, p02loc_5B06 - call p02sub_4C49 - ret -; --------------------------------------------------------------------------- - -p02loc_5AB7: - cp 0C2h ; '�' - jr nz, p02loc_5AC2 - pop af - jr nz, p02loc_5B06 - call Sin - ret -; --------------------------------------------------------------------------- - -p02loc_5AC2: - cp 0C3h ; '�' - jr nz, p02loc_5ACF - pop af - jr nz, p02loc_5ACD - call ASin - ret -; --------------------------------------------------------------------------- - -p02loc_5ACD: - ; UnOPExec2+2Dj ... - jr p02loc_5B06 -; --------------------------------------------------------------------------- - -p02loc_5ACF: - cp 0C4h ; '�' - jr nz, p02loc_5ADA - pop af - jr nz, p02loc_5B06 - call cos - ret -; --------------------------------------------------------------------------- - -p02loc_5ADA: - cp 0C5h ; '�' - jr nz, p02loc_5AE5 - pop af - jr nz, p02loc_5B06 - call ACos - ret -; --------------------------------------------------------------------------- - -p02loc_5AE5: - cp 0C6h ; '�' - jr nz, p02loc_5AF0 - pop af - jr nz, p02loc_5B06 - call Tan - ret -; --------------------------------------------------------------------------- - -p02loc_5AF0: - cp 0C7h ; '�' - jr nz, p02loc_5AFB - pop af - jr nz, p02loc_5B06 - call ATan - ret -; --------------------------------------------------------------------------- - -p02loc_5AFB: - cp 0C8h ; '�' - jr nz, p02loc_5B09 - pop af - jr nz, p02loc_5B06 - call SinH - ret -; --------------------------------------------------------------------------- - -p02loc_5B06: - ; UnOPExec2+5Ej ... - jp p02loc_58B4 -; --------------------------------------------------------------------------- - -p02loc_5B09: - cp 0C9h ; '�' - jr nz, p02loc_5B14 - pop af - jr nz, p02loc_5B06 - call ASinH - ret -; --------------------------------------------------------------------------- - -p02loc_5B14: - cp 0CAh ; '�' - jr nz, p02loc_5B1F - pop af - jr nz, p02loc_5B06 - call cosh - ret -; --------------------------------------------------------------------------- - -p02loc_5B1F: - cp 0CBh ; '�' - jr nz, p02loc_5B2A - pop af - jr nz, p02loc_5B06 - call ACosH - ret -; --------------------------------------------------------------------------- - -p02loc_5B2A: - cp 0CCh ; '�' - jr nz, p02loc_5B35 - pop af - jr nz, p02loc_5B06 - call TanH - ret -; --------------------------------------------------------------------------- - -p02loc_5B35: - cp 0CDh ; '�' - jr nz, p02loc_5B40 - pop af - jr nz, p02loc_5B06 - call ATanH - ret -; --------------------------------------------------------------------------- - -p02loc_5B40: - cp 0Ch - jr nz, p02loc_5B88 - pop af - jp z, fprecip - cp 0Ch - jp z, CRecip - cp 2 - jr nz, p02loc_5B06 - call p02sub_5E10 - ld a, (OP6) - ld h, 0 - ld l, a - call CreateTempString - ld (iMathPtr2), de - call PushRealO4 - xor a - call p02sub_429D - call PopRealO1 - -p02loc_5B6B: - rst 10h - set 7, (hl) - -p02loc_5B6E: - ; BinOPExec2+432j ... - call PopRealO1 - -p02loc_5B71: - ; BinOPExec2:p02loc_516Dj ... - ld a, (unk_9817) - cp 1 - ret c - ld hl, (tSymPtr1) - set 7, (hl) - jr z, p02loc_5B83 - ld hl, (tSymPtr2) - set 7, (hl) - -p02loc_5B83: - xor a - ld (unk_9817), a - ret -; --------------------------------------------------------------------------- - -p02loc_5B88: - cp 0B3h ; '�' - jr nz, p02loc_5BAB - pop af - call p02sub_6534 - call p02sub_5646 - ld a, (OP1+1) - cp 24h ; '$' - jr z, p02loc_5BA3 - call p02sub_5A1D - call p02sub_5936 - call p02sub_5E21 - -p02loc_5BA3: - ld a, 40h ; '@' - call p02sub_429D - jp p02loc_5B71 -; --------------------------------------------------------------------------- - -p02loc_5BAB: - cp 0BCh ; '�' - jr nz, p02loc_5BBE - pop af - jr nz, p02loc_5BB6 - call p02sub_6D49 - ret -; --------------------------------------------------------------------------- - -p02loc_5BB6: - cp 0Ch - jr nz, p02loc_5BE9 - call CSqRoot - ret -; --------------------------------------------------------------------------- - -p02loc_5BBE: - cp 0Dh - jr nz, p02loc_5BEC - pop af - jp z, FPSquare - cp 0Ch - jp z, CSqaure - cp 2 - jr nz, p02loc_5BE9 - call p02sub_5646 - call p02sub_5A17 - call p02sub_4525 - ld hl, (iMathPtr1) - ld (iMathPtr2), hl - ld hl, (OP6) - call p02sub_53F1 - call p02sub_40BA - jr p02loc_5C07 -; --------------------------------------------------------------------------- - -p02loc_5BE9: - ; UnOPExec2+17Aj ... - jp p02loc_58B4 -; --------------------------------------------------------------------------- - -p02loc_5BEC: - cp 0B0h ; '�' - jr nz, p02loc_5C0D - pop af - jp z, InvOP1S - cp 0Ch - jp z, InvOP1SC - ld d, 5 - -p02loc_5BFB: - ; UnOPExec2+1DAj ... - push de - cp 2 - jr nz, p02loc_5C0A - call p02sub_5A0F - pop af - call CMATFUN - -p02loc_5C07: - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_5C0A: - pop de - jr p02loc_5BE9 -; --------------------------------------------------------------------------- - -p02loc_5C0D: - cp 0B9h ; '�' - jr nz, p02loc_5C1E - pop af - jp z, Trunc - cp 0Ch - jp z, CplxTrunc - ld d, 6 - jr p02loc_5BFB -; --------------------------------------------------------------------------- - -p02loc_5C1E: - cp 0BAh ; '�' - jr nz, p02loc_5C2F - pop af - jp z, frac - cp 0Ch - jp z, CplxFrac - ld d, 7 - jr p02loc_5BFB -; --------------------------------------------------------------------------- - -p02loc_5C2F: - cp 0B1h ; '�' - jr nz, p02loc_5C40 - pop af - jp z, DoInt - cp 0Ch - jp z, CplxFloor - ld d, 8 - jr p02loc_5BFB -; --------------------------------------------------------------------------- - -p02loc_5C40: - cp 26h ; '&' - jr nz, p02loc_5C51 - pop af - call p02sub_660A - call CkOP1Real - cp 0Eh - jp z, ErrInvalid - ret -; --------------------------------------------------------------------------- - -p02loc_5C51: - cp 89h ; '�' - jr nz, p02loc_5C76 - pop af - ret z - cp 0Ch - jp z, InvertNonReal - cp 1 - jp nz, p02loc_58BB - -p02loc_5C61: - cp 1 - jr nz, p02loc_5C9F - call p02sub_5A32 - ld a, (OP4) - and 0Fh - ld de, (iMathPtr3) - call p02loc_452B - jr p02loc_5CBE -; --------------------------------------------------------------------------- - -p02loc_5C76: - cp 2Dh ; '-' - jr nz, p02loc_5C88 - pop af - jr nz, p02loc_5C81 - call j_Factorial - ret -; --------------------------------------------------------------------------- - -p02loc_5C81: - ; UnOPExec2+4B0j ... - cp 1 - jp z, p02loc_58C3 - jr p02loc_5C9F -; --------------------------------------------------------------------------- - -p02loc_5C88: - cp 0B2h ; '�' - jr nz, p02loc_5CA2 - pop af - jp z, ClrOP1S - cp 0Ch - jp z, CAbs - cp 0Dh - jp z, p02loc_5457 - ld d, 4 - jp p02loc_5BFB -; --------------------------------------------------------------------------- - -p02loc_5C9F: - ; UnOPExec2+233j ... - jp ErrDataType -; --------------------------------------------------------------------------- - -p02loc_5CA2: - cp 0B4h ; '�' - jr nz, p02loc_5CC0 - pop af - jr nz, p02loc_5C9F - call p02sub_6520 - ld h, a - ld l, a - ld (OP6+8), hl - call CreateTempRMat - ld (iMathPtr3), de - call PushRealO4 - call p02sub_4102 - -p02loc_5CBE: - jr p02loc_5CD8 -; --------------------------------------------------------------------------- - -p02loc_5CC0: - cp 0Eh - jr nz, p02loc_5CDB - pop af - cp 2 - jr nz, p02loc_5C9F - call SETMAT1 - ld a, h - ld h, l - ld l, a - ld (OP6+8), hl - call p02sub_5A17 - call p02sub_4124 - -p02loc_5CD8: - ; UnOPExec2+2BCj - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_5CDB: - cp 0B6h ; '�' - jr nz, p02loc_5CE4 - ld hl, j_LSUM - jr p02loc_5CF4 -; --------------------------------------------------------------------------- - -p02loc_5CE4: - cp 0B7h ; '�' - jr nz, p02loc_5CED - ld hl, p02loc_4962 - jr p02loc_5CF4 -; --------------------------------------------------------------------------- - -p02loc_5CED: - cp 1Ah - jr nz, p02loc_5D03 - ld hl, j_LLOW - -p02loc_5CF4: - ; UnOPExec2+298j ... - call p02sub_6042 - pop af - push hl - cp 1 - jr z, p02loc_5D17 - cp 0Dh - jr z, p02loc_5D17 - jr p02loc_5C9F -; --------------------------------------------------------------------------- - -p02loc_5D03: - cp 19h - jr nz, p02loc_5D35 - ld hl, j_LHIGH - jr p02loc_5CF4 -; --------------------------------------------------------------------------- - call p02sub_6042 - jr p02loc_5CD8 -; --------------------------------------------------------------------------- - pop af - push hl - cp 2 - jr nz, p02loc_5D28 - -p02loc_5D17: - ; UnOPExec2+2ACj - call SETMAT1 - ld hl, 1 - ld (OP6M), hl - -p02loc_5D20: - pop hl - call p02sub_5D27 - jp p02loc_5B71 -; End of function UnOPExec2 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5D27: - - jp (hl) -; End of function p02sub_5D27 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5D28: - ; UnOPExec2+2EAj ... - jp ErrDataType -; END OF FUNCTION CHUNK FOR UnOPExec2 -; --------------------------------------------------------------------------- - call p02sub_5A0F - pop hl - call p02sub_5D27 -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5D32: - ; UnOPExec2+34Bj - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_5D35: - cp 3 - jr nz, p02loc_5D3F - pop af - jp z, ToFrac - jr p02loc_5D28 -; --------------------------------------------------------------------------- - -p02loc_5D3F: - cp 8Ah ; '�' - jr nz, p02loc_5D52 - pop af - ret z - cp 0Ch - jp z, page0_1040 - -p02loc_5D4A: - cp 0Dh - jp z, p02loc_5457 - jp p02loc_5C61 -; --------------------------------------------------------------------------- - -p02loc_5D52: - cp 8Bh ; '�' - jr nz, p02loc_5D66 - pop af - jp z, OP1Set0 - cp 0Ch - jp z, page0_103D - cp 1 - jr z, p02loc_5D95 - jp p02loc_5D4A -; --------------------------------------------------------------------------- - -p02loc_5D66: - cp 8Ch ; '�' - jr nz, p02loc_5DA1 - pop af - jr nz, p02loc_5D78 - call CkOP1Pos - jp z, OP1Set0 - ld a, 4 - jp GETCONOP1 -; --------------------------------------------------------------------------- - -p02loc_5D78: - cp 0Ch - jp z, Angle - cp 2 - jr nz, p02loc_5D8D - call p02sub_5A0F - call OP1Set0 - call p02sub_44C8 - jp p02loc_5D32 -; --------------------------------------------------------------------------- - -p02loc_5D8D: - cp 0Dh - jp z, p02loc_5457 - jp p02loc_58B4 -; --------------------------------------------------------------------------- - -p02loc_5D95: - call p02sub_5A32 - call OP1Set0 - call p02sub_49B2 - jp p02loc_5D32 -; --------------------------------------------------------------------------- - -p02loc_5DA1: - cp 8Eh ; '�' - jr nz, p02loc_5DF6 - pop af - cp 4 - jp nz, p02loc_5D28 - bit 0, (iy+1Fh) - jp nz, Page0Call_2501 - set 0, (iy+1Fh) - call Page0Call_241E - jp c, ErrUndefined - ex de, hl - ld e, (hl) - inc hl - ld a, (hl) - cp e - jp z, ErrInvalid - ld d, a - inc hl - ld (chkDelPtr1), hl - ex de, hl - push hl - inc hl - inc hl - call j_TMPEQUNOSRC - ld hl, (chkDelPtr1) - pop bc - ldir - call OP4ToOP1 - ld hl, p02loc_5DEF - call pushErrorHandleR - call j_PARSEOFF - call popErrorHandleR - res 0, (iy+1Fh) - call page0_1717 - jp p02loc_5B71 -; END OF FUNCTION CHUNK FOR UnOPExec2 -p02loc_5DEF: - res 0, (iy+1Fh) - jp JErrorNo -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5DF6: - cp 12h - jr nz, p02loc_5E30 - pop af - jp z, RndGuard - cp 0Ch - jp z, p02sub_65BE - call ShLAcc - ld de, ramStart - push de - jp p02loc_561F -; --------------------------------------------------------------------------- - -p02loc_5E0D: - jp ErrDataType -; END OF FUNCTION CHUNK FOR UnOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5E10: - call p02sub_59D5 - push af - call p02sub_5649 - pop af -; End of function p02sub_5E10 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5E18: - ld (OP6+8), hl - jp z, PushRealO4 - call p02sub_5A17 -; End of function p02sub_5E18 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5E21: - call p02sub_4525 - ld de, (iMathPtr3) - ld (iMathPtr1), de - ret -; End of function p02sub_5E21 - -; --------------------------------------------------------------------------- - jp ErrDataType -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5E30: - cp 8Fh ; '�' - jr nz, p02loc_5E5D - pop af - cp 4 - jp nz, p02loc_5D28 - call p02sub_592C - ex de, hl - ld e, (hl) - inc hl - ld d, (hl) - ld c, e - ld b, d - -p02loc_5E43: - ; UnOPExec2+3FEj - inc hl - ld a, b - or c - jr z, p02loc_5E53 - dec bc - call isPtrHLA2ByteTok - jr nz, p02loc_5E43 - inc hl - dec de - dec bc - jr p02loc_5E43 -; --------------------------------------------------------------------------- - -p02loc_5E53: - ex de, hl - call j_SetXXXXOP2 - call OP2ToOP1 - jp p02loc_5EF2 -; --------------------------------------------------------------------------- - -p02loc_5E5D: - cp 0Fh - jr nz, p02loc_5E87 - pop af - jp z, Cube - cp 0Ch - jr nz, p02loc_5E79 - call PUSHMCPLXO1 - call OP1Set3 - call OP2Set0 - call page0_104E - call CYtoX - ret -; --------------------------------------------------------------------------- - -p02loc_5E79: - cp 2 - jp nz, p02loc_58B4 - call OP1ToOP3 - call OP1Set3 - jp p02loc_453E -; --------------------------------------------------------------------------- - -p02loc_5E87: - cp 0BDh ; '�' - jr nz, p02loc_5EAE - pop af - jr z, p02loc_5EA6 - cp 0Ch - jp nz, p02loc_58B4 - ld hl, OP3 - call page0_1224 - call PushRealO3 - call OP3Set0 - call PushRealO3 - call CXrootY - ret -; --------------------------------------------------------------------------- - -p02loc_5EA6: - rst 8 - call OP1Set3 -; END OF FUNCTION CHUNK FOR UnOPExec2 -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_5EAA: - call j_XRootY - ret -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5EAE: - cp 0B5h ; '�' - jr nz, p02loc_5EFE - pop af - cp 2 - jr nz, p02loc_5EDB - call SETMAT1 - push hl - ld hl, 2 - call CREATETLIST - pop hl - push hl - call p02sub_5EF6 - ld hl, 2 - call PUTTOLA1 - pop hl - call p02sub_5EF5 - ld hl, 1 - call PUTTOLA1 - call OP4ToOP1 - jr p02loc_5EEF -; --------------------------------------------------------------------------- - -p02loc_5EDB: - cp 1 - jr z, p02loc_5EE4 - cp 0Dh - jp nz, p02loc_5E0D - -p02loc_5EE4: - call p02sub_592C - ex de, hl - ld e, (hl) - inc hl - ld d, (hl) - ex de, hl - call p02sub_5EF8 - -p02loc_5EEF: - call p02sub_6042 - -p02loc_5EF2: - jp p02loc_5B71 -; END OF FUNCTION CHUNK FOR UnOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5EF5: - ld l, h -; End of function p02sub_5EF5 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5EF6: - ld h, 0 -; End of function p02sub_5EF6 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5EF8: - call j_SetXXXXOP2 - jp OP2ToOP1 -; End of function p02sub_5EF8 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5EFE: - cp 0Ah - jr nz, p02loc_5F0E - pop af - jp nz, p02loc_5C81 - bit trigDeg, (iy+trigFlags) - ret z - jp RToD -; --------------------------------------------------------------------------- - -p02loc_5F0E: - cp 0Bh - jr nz, p02loc_5F1E - pop af - jp nz, p02loc_5C81 - bit trigDeg, (iy+trigFlags) - ret nz - jp DToR -; --------------------------------------------------------------------------- - -p02loc_5F1E: - cp 21h ; '!' - jr nz, p02loc_5F2A - pop af - call p02sub_6029 - scf - jp EXMEAN1 -; --------------------------------------------------------------------------- - -p02loc_5F2A: - cp 1Fh - jr nz, p02loc_5F35 - pop af - call p02sub_6029 - jp p02loc_5891 -; --------------------------------------------------------------------------- - -p02loc_5F35: - cp 91h ; '�' - jr nz, p02loc_5F59 - pop af - ld b, a - scf - -p02loc_5F3C: - push af - ld a, b - cp 2 - jp nz, ErrDataType - call p02sub_59D5 - push af - ld a, h - cp l - jr z, p02loc_5F4E - jp nc, ErrDimension - -p02loc_5F4E: - pop af - call p02sub_5E18 - pop af - call ROWECHELON - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_5F59: - cp 92h ; '�' - jr nz, p02loc_5F62 - pop af - ld b, a - xor a - jr p02loc_5F3C -; --------------------------------------------------------------------------- - -p02loc_5F62: - cp 8Dh ; '�' - jr nz, p02loc_5F8E - pop af - cp 2 - jr z, p02loc_5F77 - call p02sub_5F7F - call p02sub_5A32 - call CUMSUM - -p02loc_5F74: - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_5F77: - call p02sub_5A0F - call p02sub_475B - jr p02loc_5F74 -; END OF FUNCTION CHUNK FOR UnOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_5F7F: - ; UnOPExec2+564p - cp 1 - jr z, p02loc_5F8B - call page0_1842 - cp 0Dh - jp nz, p02loc_602B - -p02loc_5F8B: - jp p02sub_6042 -; End of function p02sub_5F7F - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5F8E: - cp 0E9h ; '�' - jr nz, p02loc_5FA0 - pop af - call PushOP1 - call OP1Set0 - rst 18h -; END OF FUNCTION CHUNK FOR UnOPExec2 -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_5F9A: - call OP1Set1 - jp p02loc_614E -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5FA0: - cp 0DFh ; '�' - jr nz, p02loc_5FB2 - pop af - call PushOP1 - call OP1Set0 - rst 18h - call OP1Set1 - jp p02loc_620A -; --------------------------------------------------------------------------- - -p02loc_5FB2: - cp 90h ; '�' - jr nz, p02loc_5FCF - pop af - call p02sub_5F7F - call SETMAT1 - dec hl - ld a, h - or l - jp z, ErrDimension - call CREATETLIST - call PushRealO4 - call p02sub_4A01 - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_5FCF: - cp 0D0h ; '�' - jr nz, p02loc_5FED - pop af - jp nz, ErrDataType - rst 18h - ld a, 25h ; '%' -; END OF FUNCTION CHUNK FOR UnOPExec2 -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_5FDA: - push af - ld a, (fmtDigits) - cp 0FFh - jr nz, p02loc_5FE4 - ld a, 9 - -p02loc_5FE4: - ; BinOPExec2+F3Dj ... - ld (OP1), a - rst 18h - pop af - call Page0Call_395D - ret -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_5FED: - cp 0DBh ; '�' - jr nz, p02loc_5FF9 - pop af - call p02sub_6029 - ex de, hl - jp p02loc_5167 -; --------------------------------------------------------------------------- - -p02loc_5FF9: - cp 0DCh ; '�' - jr nz, p02loc_6005 - pop af - call p02sub_6029 - ex de, hl - jp p02loc_5177 -; --------------------------------------------------------------------------- - -p02loc_6005: - cp 0ABh ; '�' - jp z, p02loc_6159 - cp 0DAh ; '�' - jp nz, ErrArgument - pop af - jp z, FDIV100 - cp 0Ch - jp nz, p02loc_58B4 - rst 18h - call OP2ToOP1 - call FDIV100 - rst 8 - call PopRealO1 - call FDIV100 - jp page0_104E -; END OF FUNCTION CHUNK FOR UnOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6029: - ; UnOPExec2+4DCp ... - - - - cp 1 - -p02loc_602B: - jp nz, p02loc_62A2 - call p02sub_6042 - call SETMAT1 - xor a - ld (iMathPtr2+1), a - ld (iMathPtr5+1), a - ret -; End of function p02sub_6029 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_603C: - call p02sub_64AB - call j_ITSOLVERNB -; END OF FUNCTION CHUNK FOR ThreeExec - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6042: - ; p02sub_57DF+6p ... - ld de, (unk_9665) - dec de - ld (unk_9665), de - ret -; End of function p02sub_6042 - - -; =============== S U B R O U T I N E ======================================= - - -ThreeExec: - - - - - - - - - - - - - - call page0_1847 - ld hl, 9817h - ld (hl), 0 - cp 0D1h ; '�' - jr nz, p02loc_6065 - ld a, 26h ; '&' - -p02loc_605A: - push af - call j_ErrNonReal_FPST_FPS1 - call p02sub_5601 - ld a, e - jp p02loc_5FE4 -; --------------------------------------------------------------------------- - -p02loc_6065: - cp 0D2h ; '�' - jr nz, p02loc_606D - ld a, 27h ; ''' - jr p02loc_605A -; --------------------------------------------------------------------------- - -p02loc_606D: - cp 0E3h ; '�' - jr nz, p02loc_60BE - ld a, 0Eh - -p02loc_6073: - push af - call j_ErrNonReal_FPST_FPS1 - call CkOP1Real - jr nz, p02loc_6080 - pop af - jp p02loc_6156 -; --------------------------------------------------------------------------- - -p02loc_6080: - cp 1 - jp nz, ErrDataType - call p02sub_5A32 - ld hl, (OP6) - ld (OP6M), hl - ld hl, 1 - ld (OP6), hl - call PushRealO6 - rst 18h - rst 18h - -p02loc_6099: - call CHKERRBREAK - call CpyTo1FPS5 - rst 18h - call CpyTo1FPS5 - rst 18h - call GETL1TOOP1 - pop af - push af - call p02sub_658F - call p02sub_616F - jr nc, p02loc_6099 - pop af - ld de, 1Bh - call DeallocFPS1 - call PopRealO1 - jp FPOPCPLX -; --------------------------------------------------------------------------- - -p02loc_60BE: - cp 0E4h ; '�' - jr nz, p02loc_60C6 - ld a, 10h - jr p02loc_6073 -; --------------------------------------------------------------------------- - -p02loc_60C6: - cp 0CFh ; '�' - jr nz, p02loc_60D8 - call p02sub_6430 - push de - call CpyTo1FPST - call EOP1NotReal - pop de - jp p02loc_512F -; --------------------------------------------------------------------------- - -p02loc_60D8: - cp 0CEh ; '�' - jr nz, p02loc_60F1 - call CkOP1Real - cp 1 - jr nz, p02loc_615A - call p02sub_6042 - call SETMAT1 - ex de, hl - xor a - ld (iMathPtr2+1), a - jp p02loc_641B -; --------------------------------------------------------------------------- - -p02loc_60F1: - cp 0B6h ; '�' - jr nz, p02loc_6143 - ld hl, j_LSUM - -p02loc_60F8: - push hl - call p02sub_6136 - push de - call popOP1 -; End of function ThreeExec - -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_6100: - call p02sub_6136 - pop hl - call CpHLDE - jp c, ErrDimension - push hl - push de - call popOP1 - call CkOP1Real - cp 1 - jr z, p02loc_611A - cp 0Dh - jr nz, p02loc_615A - -p02loc_611A: - call SETMAT1 - pop hl - call p02sub_6163 - ld (OP6M), hl - pop hl - ld a, h - cp 0FFh - jr z, p02loc_6130 - call p02sub_6163 - ld (OP6), hl - -p02loc_6130: - call p02sub_6042 - jp p02loc_5D20 -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6136: - ; BinOPExec2:p02loc_6100p - call EOP1NotReal - call PosNo0DoInt - jp nz, ErrDomain - call j_ConvOP1 - ret -; End of function p02sub_6136 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_6143: - cp 0B7h ; '�' - ld hl, p02loc_4962 - jr z, p02loc_60F8 - cp 0E9h ; '�' - jr nz, p02loc_618F -; END OF FUNCTION CHUNK FOR ThreeExec -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_614E: - call EOP1NotReal - call j_ErrNonReal_FPST_FPS1 - ld a, 0Ch - -p02loc_6156: - jp p02sub_658F -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_6159: - pop af - -p02loc_615A: - ; BinOPExec2+1075j - jp nz, ErrDataType - push bc - call PUSHMCPLXO1 - jr p02loc_619B -; END OF FUNCTION CHUNK FOR UnOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6163: - ; BinOPExec2+1087p - ld de, (OP6) - call CpHLDE - ret c - jp nz, ErrDimension - ret -; End of function p02sub_6163 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_616F: - ; UnOPExec2:p02loc_61EEp - call CpyTo6FPS2 - ld de, (iMathPtr1) - ld hl, (OP6) - push hl - call PutToL - pop de - inc de - ld (OP6), de - ld hl, (OP6M) - or a - sbc hl, de - push af - call CpyO6ToFPS2 - pop af - ret -; End of function p02sub_616F - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_618F: - cp 0EDh ; '�' - jp nz, p02loc_61FD - -p02loc_6194: - push af - call EOP1NotReal - call j_ErrNonReal_FPST_FPS1 -; END OF FUNCTION CHUNK FOR ThreeExec -; START OF FUNCTION CHUNK FOR UnOPExec2 - -p02loc_619B: - call PosNo0DoInt - jp nz, ErrDomain - call j_ConvOP1 - ex de, hl - call CHK_HL_999 - ld (OP6M), hl - ld de, 1 - ld (OP6), de - call CreateTempRList - ld (iMathPtr1), de - call POPMCPLXO1 - call PushRealO4 - call PushRealO6 - call PUSHMCPLXO1 - -p02loc_61C5: - call CHKERRBREAK - call POPMCPLXO1 - call PUSHMCPLXO1 - pop af - push af - cp 0ABh ; '�' - jr nz, p02loc_61D9 - call j_Random - jr p02loc_61EE -; --------------------------------------------------------------------------- - -p02loc_61D9: - cp 0D9h ; '�' - jr z, p02loc_61E6 - jr c, p02loc_61EB - ld a, 24h ; '$' - call j_BCALL_4B9D - jr p02loc_61EE -; --------------------------------------------------------------------------- - -p02loc_61E6: - call p02sub_51A0 - jr p02loc_61EE -; --------------------------------------------------------------------------- - -p02loc_61EB: - call p02sub_4F53 - -p02loc_61EE: - ; UnOPExec2+791j ... - call p02sub_616F - jr nc, p02loc_61C5 - pop af - call FPOPCPLX - call FPOPREAL - jp PopRealO1 -; END OF FUNCTION CHUNK FOR UnOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_61FD: - cp 0D9h ; '�' - -p02loc_61FF: - jp z, p02loc_6194 - cp 0D8h ; '�' - jr z, p02loc_61FF - cp 0DFh ; '�' - jr nz, p02loc_621B -; END OF FUNCTION CHUNK FOR ThreeExec -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_620A: - ; UnOPExec2+55Cj - call EOP1NotReal - call j_ErrNonReal_FPST_FPS1 - ld a, 20h ; ' ' - jp p02sub_658F -; --------------------------------------------------------------------------- - -p02loc_6215: - ld de, 1 - push de - jr p02loc_6233 -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_621B: - cp 0DDh ; '�' - jp nz, p02loc_62A5 - call RealPosNo0DoInt - jp nz, ErrDomain - call j_ConvOP1 - jp c, ErrDimension - push de - call popOP1 - call popOP3 -; END OF FUNCTION CHUNK FOR ThreeExec -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_6233: - call CkOP1Real - cp 4 - jr nz, p02loc_62A2 - ld a, (OP3) - and 1Fh - cp 4 - jr nz, p02loc_62A2 - call SET2MVLPTRS - ld (OP6+6), hl - pop bc - jp c, OP1Set0 - push bc - dec bc - ld hl, (iMathPtr1) - ld de, (OP6) - call p02sub_6341 - jp nc, p02loc_6287 - push hl - ld hl, (OP6+6) - -p02loc_6260: - ld (OP6M), bc - or a - sbc hl, bc - jr c, p02loc_6286 - pop hl - push hl - ld de, (iMathPtr2) - inc de - inc de - ld bc, (OP6+4) - -p02loc_6275: - ld a, (de) - inc de - cpi - jr nz, p02loc_628B - jp pe, p02loc_6275 - pop hl - pop hl - call j_SetXXXXOP2 - jp OP2ToOP1 -; --------------------------------------------------------------------------- - -p02loc_6286: - pop hl - -p02loc_6287: - pop hl - jp OP1Set0 -; --------------------------------------------------------------------------- - -p02loc_628B: - pop hl - ld bc, (OP6M) - call isPtrHLA2ByteTok - jr nz, p02loc_6297 - inc hl - inc bc - -p02loc_6297: - pop de - inc de - push de - inc hl - push hl - inc bc - ld hl, (OP6+6) - jr p02loc_6260 -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR p02sub_6029 - -p02loc_62A2: - ; BinOPExec2+1195j ... - jp ErrDataType -; END OF FUNCTION CHUNK FOR p02sub_6029 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_62A5: - cp 0DEh ; '�' - jr nz, p02loc_62B2 -; END OF FUNCTION CHUNK FOR ThreeExec -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_62A9: - call PushOP1 - call OP1Set1 - jp p02loc_6452 -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_62B2: - cp 0E0h ; '�' - jr nz, p02loc_62C1 - call EOP1NotReal - call j_ErrNonReal_FPST_FPS1 - ld a, 18h - jp p02sub_658F -; --------------------------------------------------------------------------- - -p02loc_62C1: - cp 0ECh ; '�' - jr nz, p02loc_62D0 - call EOP1NotReal - call j_ErrNonReal_FPST_FPS1 - ld a, 1Ch - jp p02sub_658F -; --------------------------------------------------------------------------- - -p02loc_62D0: - cp 0E1h ; '�' - jr nz, p02loc_62DF - call EOP1NotReal - call j_ErrNonReal_FPST_FPS1 - ld a, 16h - jp p02sub_658F -; --------------------------------------------------------------------------- - -p02loc_62DF: - cp 0DAh ; '�' - jr z, p02loc_62EC - cp 25h ; '%' - jp nz, p02loc_636A - call p02sub_6969 - ret -; --------------------------------------------------------------------------- - -p02loc_62EC: - call RealPosNo0DoInt - -p02loc_62EF: - jp nz, ErrDomain - call j_ConvOP1 - jp c, ErrDimension - push de - call popOP1 - call RealPosNo0DoInt - jr nz, p02loc_62EF - call j_ConvOP1 - push de - call popOP1 - call CkOP1Real - cp 4 - jr nz, p02loc_62A2 - call SETMAT1 - ex de, hl - pop bc - dec bc - call p02sub_6341 - jp nc, ErrDimension - ld (iMathPtr2), hl - pop bc - call p02loc_6347 - jp nc, ErrDimension - push bc - ld h, b - ld l, c - call CreateTempString - ld (iMathPtr3), de - ld hl, (iMathPtr2) - ld de, (iMathPtr3) - inc de - inc de - pop bc - ldir - call OP4ToOP1 - jp p02loc_5B71 -; END OF FUNCTION CHUNK FOR ThreeExec - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6341: - ; ThreeExec+2C9p - inc hl - inc hl - push hl - add hl, de - ex de, hl - pop hl - -p02loc_6347: - push ix - push bc - pop ix - -p02loc_634C: - ld a, b - or c - jr z, p02loc_6363 - push hl - or a - sbc hl, de - pop hl - jr nc, p02loc_6367 - call isPtrHLA2ByteTok - jr nz, p02loc_635F - inc hl - inc ix - -p02loc_635F: - inc hl - dec bc - jr p02loc_634C -; --------------------------------------------------------------------------- - -p02loc_6363: - push ix - pop bc - scf - -p02loc_6367: - pop ix - ret -; End of function p02sub_6341 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_636A: - cp 26h ; '&' - jr nz, p02loc_6372 - call p02loc_67A9 - ret -; --------------------------------------------------------------------------- - -p02loc_6372: - cp 16h - jp z, p02loc_63AC - cp 15h - jp z, p02loc_63B6 - cp 17h - jp z, p02loc_63BF - cp 18h - jp z, p02loc_64BB - cp 22h ; '"' - jp z, p02loc_603C - jp ErrArgument -; END OF FUNCTION CHUNK FOR ThreeExec - -; =============== S U B R O U T I N E ======================================= - - -p02sub_638E: - ; p02sub_660A+195p ... - call PopRealO3 - call PushOP1 - call OP3ToOP1 - call j_RESTOREDATA - jp popOP1 -; End of function p02sub_638E - -; --------------------------------------------------------------------------- - -p02loc_639D: - ld de, 12h - call DeallocFPS1 - call PopRealO1 -; START OF FUNCTION CHUNK FOR p02sub_660A - -RESTOREERRNO: - - call j_RESTOREDATA - jp JErrorNo -; END OF FUNCTION CHUNK FOR p02sub_660A -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_63AC: - xor a - call p02sub_64C5 - call p02sub_416F - -p02loc_63B3: - ; ThreeExec+37Ej ... - jp p02loc_5B6E -; --------------------------------------------------------------------------- - -p02loc_63B6: - xor a - call p02sub_64C5 - call p02sub_4144 - jr p02loc_63B3 -; --------------------------------------------------------------------------- - -p02loc_63BF: - rst 18h - call OP1Set1 - scf - call p02sub_64C5 - call p02sub_41B4 - jr p02loc_63B3 -; END OF FUNCTION CHUNK FOR ThreeExec -; --------------------------------------------------------------------------- - -p02loc_63CC: - cp 27h ; ''' - jr z, p02loc_63E1 - cp 28h ; '(' - jr z, p02loc_63DE - cp 0E2h ; '�' - jp nz, ErrArgument - ld a, 14h - jp p02sub_658F -; --------------------------------------------------------------------------- - -p02loc_63DE: - scf - jr p02loc_63E2 -; --------------------------------------------------------------------------- - -p02loc_63E1: - xor a - -p02loc_63E2: - push af - rst 18h - call OP1Set1 - ld a, 7Bh ; '{' - ld (OP1+1), a - -p02loc_63EC: - call p02sub_6585 - call OP1ToOP5 - call PopRealO1 - call EOP1NotReal - call OP1ToOP3 - call PopRealO1 - call EOP1NotReal - rst 8 - call PopRealO4 - call PopRealO1 - pop af - ld b, 1 - call j_DFMIN2 - ret -; --------------------------------------------------------------------------- - -FourExec: - ld hl, 9817h - ld (hl), 0 - cp 0CEh ; '�' - jr nz, p02loc_644E - call p02sub_6430 -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_641B: - ld (unk_90CC), de - call j_ErrNonReal_FPST_FPS1 - call SETesTOfps - ld a, 2Bh ; '+' - call Page0Call_38FD - call FPOPCPLX - jp p02loc_5B71 -; END OF FUNCTION CHUNK FOR ThreeExec - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6430: - - call p02sub_6042 - call popOP3 - call CkOP1Real - cp 1 - jr nz, p02loc_6444 - ld a, (OP3) - and 1Fh - cp 1 - -p02loc_6444: - jp nz, ErrDataType - call SET2MVLPTRS - jp nz, ErrDimMismatch - ret -; End of function p02sub_6430 - -; --------------------------------------------------------------------------- - -p02loc_644E: - cp 0DEh ; '�' - jr nz, p02loc_645F -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_6452: - call EOP1NotReal - ld b, 3 - call j_ErrNonReal - ld a, 1Ah - jp p02sub_658F -; END OF FUNCTION CHUNK FOR BinOPExec2 -; --------------------------------------------------------------------------- - -p02loc_645F: - cp 18h - jp z, p02loc_64BB - cp 23h ; '#' - jr nz, p02loc_6471 - call PushOP1 - call OP1Set1 - jp p02loc_653D -; --------------------------------------------------------------------------- - -p02loc_6471: - cp 24h ; '$' - jr nz, p02loc_6482 - rst 18h - call OP1Set1 - ld a, 7Bh ; '{' - ld (OP1+1), a - call j_GRAPHQUAD - ret -; --------------------------------------------------------------------------- - -p02loc_6482: - cp 25h ; '%' - jr nz, p02loc_648D - call ErrD_OP1_0 - call p02sub_6966 - ret -; --------------------------------------------------------------------------- - -p02loc_648D: - cp 22h ; '"' - jp nz, p02loc_63CC - call PopRealO3 - call CkOP1Real - cp 1 - jr nz, p02loc_64B4 - call OP1ExOP3 - call p02sub_64AB - call PushRealO3 - call j_ITSOLVERB - jp p02sub_6042 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_64AB: - - call OP1ToOP6 - call CkOP1Real - ret z - cp 1 - -p02loc_64B4: - jp nz, ErrDataType - call page0_16F4 - ret -; End of function p02sub_64AB - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ThreeExec - -p02loc_64BB: - - scf - call p02sub_64C5 - call p02sub_4172 - jp p02loc_63B3 -; END OF FUNCTION CHUNK FOR ThreeExec - -; =============== S U B R O U T I N E ======================================= - - -p02sub_64C5: - ; ThreeExec+36Bp ... - push af - call p02sub_6520 - ld (OP6+4+1), a - call PopRealO1 - call p02sub_6520 - ld (OP6+4), a - call PopRealO1 - ld a, (OP1) - and 1Fh - cp 2 - jr nz, p02loc_651D - pop af - push af - jr c, p02loc_6511 - -p02loc_64E5: - ; p02sub_64C5+56j - call p02sub_59D5 - push af - ld a, (OP6+4) - cp h - jr c, p02loc_64F2 - -p02loc_64EF: - jp nz, ErrDimension - -p02loc_64F2: - ld a, (OP6+4+1) - cp h - jr c, p02loc_64FA - jr nz, p02loc_64EF - -p02loc_64FA: - ld (OP6+8), hl - pop af - jr z, p02loc_650A - call p02sub_5A1D - call p02sub_4520 - ld de, (iMathPtr3) - -p02loc_650A: - pop af - call c, PopRealO1 - jp PushRealO4 -; --------------------------------------------------------------------------- - -p02loc_6511: - jr nz, p02loc_64E5 - call CpyTo2FPST - ld a, (OP2) - and 1Fh - jr z, p02loc_64E5 -; End of function p02sub_64C5 - -; START OF FUNCTION CHUNK FOR p02sub_6534 - -p02loc_651D: - jp ErrDataType -; END OF FUNCTION CHUNK FOR p02sub_6534 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6520: - ; BinOPExec2+839p ... - call RealPosNo0DoInt - jr nz, p02loc_6531 - ld a, (OP1+1) - cp 82h ; '�' - jr nc, p02loc_6531 - call j_ConvOP1 - ld a, e - ret -; --------------------------------------------------------------------------- - -p02loc_6531: - jp ErrDimension -; End of function p02sub_6520 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6534: - - - - cp 2 - ret z - jr p02loc_651D -; End of function p02sub_6534 - -; --------------------------------------------------------------------------- - -FiveExec: - cp 23h ; '#' - jr nz, p02loc_6541 - -p02loc_653D: - call p02sub_7BC8 - ret -; --------------------------------------------------------------------------- - -p02loc_6541: - cp 24h ; '$' - jr nz, p02loc_654C - call p02sub_6585 - call j_GRAPHQUAD - ret -; --------------------------------------------------------------------------- - -p02loc_654C: - cp 27h ; ''' - jr nz, p02loc_6555 - or a - -p02loc_6551: - push af - jp p02loc_63EC -; --------------------------------------------------------------------------- - -p02loc_6555: - cp 28h ; '(' - jp nz, ErrArgument - scf - jr p02loc_6551 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_655D: - call SET2MVLPTRS - add hl, de - ld a, d - cp l - jp nz, ErrDimMismatch - ld l, e - ld (OP6+8), hl - ret -; End of function p02sub_655D - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_656B: - call page0_1641 - ret nz - jp ErrSyntax -; End of function p02sub_656B - -p02loc_6572: - call RToP -p02loc_6575: - jp OP2ToOP1 -p02loc_6578: - call PtoR - jr p02loc_6575 -p02loc_657D: - call PtoR - ret -p02loc_6581: - call RToP - ret -p02sub_6585: - call EOP1NotReal - call errd_op1notpos - jp ErrD_OP1_0 - -p02loc_658E: - xor a -p02sub_658F: - call j_BCALL_4B9D - ret -p02loc_6593: - ld a, 2 - jr p02sub_658F -p02loc_6597: - ld a, 4 - jr p02sub_658F -p02loc_659B: - ld a, 6 - jr p02sub_658F -p02loc_659F: - ld a, 8 - jr p02sub_658F -p02loc_65A3: - ld a, 0Ah - jr p02sub_658F -p02loc_65A7: - ld a, 28h ; '(' -p02loc_65A9: - call Page0Call_38FD - ret -p02loc_65AD: - ld a, 29h ; ')' - jr p02loc_65A9 -p02loc_65B1: - ld a, 2Ah ; '*' - jr p02loc_65A9 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -Angle: - call OP1ExOP2 - ld d, 0 - call ATan2 - ret -; END OF FUNCTION CHUNK FOR UnOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_65BE: - ; BinOPExec2+47Ep ... - call page0_14A7 - -p02loc_65C1: - jp page0_104E -; End of function p02sub_65BE - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR BinOPExec2 - -p02loc_65C4: - push de - call Round - call OP1ExOP2 - pop de - call Round - call OP1ExOP2 - jr p02loc_65C1 -; END OF FUNCTION CHUNK FOR BinOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -RndGuard: - ; BinOPExec2+49Ap ... - ld d, 9 - -Page02_39C9: - ld a, (OP1+1) - push af - ld a, 80h ; '�' - ld (OP1+1), a - call Round - pop bc - ld hl, OP1+1 - ld a, (hl) - ld (hl), b - cp 80h ; '�' - ret z - jp INCO1EXP -; End of function RndGuard - -; --------------------------------------------------------------------------- - -RnFx: - ld a, (fmtDigits) - cp 0FFh - ret z - ld d, a - jp Round - -; =============== S U B R O U T I N E ======================================= - - -p02sub_65F8: - rst 10h - ex de, hl - call ldHLind - ld a, h - or l - jp z, ErrInvalid - ret -; End of function p02sub_65F8 - -; --------------------------------------------------------------------------- - -CPYO1TOES15: - ld a, (EST) - push af - jp p02loc_66D3 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_660A: - - - - - - ld a, (EST) - inc a - push af - call CpyTo2FPST - ld a, (OP2M) - bit 7, a - jp z, p02loc_66D3 - pop af - bit 5, (iy+7) - jr nz, p02loc_663A - call IsRecursiveMode - jp z, p02loc_66D3 - bit allowCursor, (iy+plotFlags) - jr nz, p02loc_663A - call page0_172A - jp z, p02loc_66D3 - bit webMode, (iy+seqFlags) - jp nz, p02loc_692D - -p02loc_663A: - call EOP1NotReal - call CKOP1DoInt - jp nz, ErrInvalid - ld hl, nMin - call Mov9OP2Cp - jr nc, p02loc_665B - ld a, (unk_84E9) - or a - jp z, ErrInvalid - ld hl, OP1 - ld (hl), 0Eh - call FPOPREAL - ret -; --------------------------------------------------------------------------- - -p02loc_665B: - rst 8 - call CpyTo1FPST - call p02sub_65F8 - call j_RclN - call FPSub - call errd_op1notpos - call ErrD_OP1_0 - call OP2Set3 - call cpop1op2 - jp nc, ErrDomain - call PopRealO2 - ld a, (OP2M) - ld hl, un1 - ld de, 8E2Dh - ld bc, u0 - cp 81h ; '�' - jr c, p02loc_669E - ld hl, vn1 - ld de, 8E3Fh - ld bc, v0 - jr z, p02loc_669E - ld hl, wn1 - ld de, 8E51h - ld bc, w0 - -p02loc_669E: - ld a, (OP1M) - cp 10h - push af - push hl - push de - ld h, b - ld l, c - call CMP_NUM_INIT - ld b, a - pop de - pop hl - pop af - ld a, b - jr z, p02loc_66BD - cp 2 - jr nz, p02loc_66B7 - ex de, hl - -p02loc_66B7: - ld de, 9 - add hl, de - jr p02loc_66C1 -; --------------------------------------------------------------------------- - -p02loc_66BD: - or a - jr z, p02loc_66C1 - ex de, hl - -p02loc_66C1: - rst 20h - call CkOP1Real - cp 0Eh - ret nz - ld a, (unk_84E9) - or a - ret nz - call page0_1040 - jp ErrInvalid -; --------------------------------------------------------------------------- - -p02loc_66D3: - call PushOP1 - call CkOP1Real - cp 2 - jr c, p02loc_66E3 - jp ErrDataType -; --------------------------------------------------------------------------- - jp nz, ErrDataType - -p02loc_66E3: - call CpyTo1FPS1 - call p02sub_65F8 - ld hl, OP1M - ld a, 5Bh ; '[' - bit 6, (hl) - jr nz, p02loc_66FF - ld a, 54h ; 'T' - bit 5, (hl) - jr nz, p02loc_66FF - bit 7, (hl) - jp nz, p02loc_67DD - ld a, 58h ; 'X' - -p02loc_66FF: - push af - call ZeroOP1 - pop af - ld (OP1+1), a - rst 18h - call j_SAVEDATA - call CpyTo1FPS1 - call CkOP1Real - cp 1 - jr z, p02loc_6757 - pop af - cp 4 - jp z, Page0Call_2501 - ld (EST), a - ld hl, p02loc_674A - call pushErrorHandleR - rst 18h - call CpyTo1FPS1 - call j_StoOther - call CpyTo1FPS2 - call j_PARSEOFF - call page0_1717 - call p02sub_638E - call popErrorHandleR - -p02loc_673A: - ; p02sub_67E5+3Aj - ld de, 12h - call DeallocFPS1 - ld hl, EST - dec (hl) - ret -p02loc_6745: - call FPOPREAL - pop af - pop af -p02loc_674A: - xor a - ld (EST), a - call PopRealO1 - call FPOPCPLX - jp RESTOREERRNO -; --------------------------------------------------------------------------- - -p02loc_6757: - pop af - cp 3 - jp z, Page0Call_2501 - ld (EST), a - call p02sub_68F8 - push hl - -p02loc_6764: - call CpyTo1FPS2 - rst 10h - pop hl - push hl - call GetLToOP1 - ld hl, p02loc_6745 - call pushErrorHandleR - rst 18h - call CpyTo1FPS2 - call j_StoOther - call CpyTo1FPS3 - call j_PARSEOFF - call page0_1717 - call CkOP1Real - jp nz, ErrDataType - call popErrorHandleR - pop hl - call p02sub_6910 - jr z, p02loc_6795 - push de - jr p02loc_6764 -; --------------------------------------------------------------------------- - -p02loc_6795: - pop af - call CpyTo1FPS2 - call markTableDirty - call PopRealO1 - call p02sub_638E - jp p02loc_673A -; End of function p02sub_660A - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_67A5: - - - - rst 18h - call OP1Set1 - -p02loc_67A9: - rst 18h - call CpyTo1FPS3 - call p02sub_65F8 - ld a, (OP1M) - bit 7, a - jr z, p02loc_67DA - call page0_172A - jr z, p02loc_67C2 - call IsRecursiveMode - jp nz, ErrInvalid - -p02loc_67C2: - bit 5, (iy+7) - jp nz, ErrInvalid - ld hl, 0 - call CreateTempRList - call PushRealO4 - jr p02loc_6828 -; End of function p02sub_67A5 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_67D4: - call EOP1NotReal - jp ErrD_OP1NotPosDoInt -; End of function p02sub_67D4 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR p02sub_67A5 - -p02loc_67DA: - jp ErrDataType -; END OF FUNCTION CHUNK FOR p02sub_67A5 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR p02sub_660A - -p02loc_67DD: - bit 5, (iy+7) - jp nz, ErrInvalid - pop af -; END OF FUNCTION CHUNK FOR p02sub_660A - -; =============== S U B R O U T I N E ======================================= - - -p02sub_67E5: - call CpyTo1FPST - call CkOP1Real - cp 1 - jr nz, p02loc_6822 - call p02sub_68F8 - push hl - -p02loc_67F3: - call CpyTo1FPS2 - rst 18h - call CpyTo1FPS2 - rst 10h - pop hl - push hl - call GetLToOP1 - rst 18h - call p02sub_67E5 - call CkOP1Real - cp 0Eh - jp z, ErrInvalid - pop hl - call p02sub_6910 - jr z, p02loc_6815 - push de - jr p02loc_67F3 -; --------------------------------------------------------------------------- - -p02loc_6815: - pop af - call CpyTo1FPS1 - call markTableDirty - call PopRealO1 - jp p02loc_673A -; --------------------------------------------------------------------------- - -p02loc_6822: - rst 18h - call OP1Set1 - rst 18h - rst 18h - -p02loc_6828: - call Page0Call_38E5 - jp z, ErrUndefined - call SETesTOfps - call CPYTO1ES1 - call p02sub_67D4 - call ErrD_OP1_0 - call CPYTO1ES3 - call p02sub_67D4 - rst 8 - call CPYTO1ES2 - call p02sub_67D4 - call cpop1op2 - jp c, ErrIncrement - call CPYTO1ES3 - ld hl, nMin - call Mov9OP2Cp - jp c, ErrDomain - set 5, (iy+7) - ld hl, p02loc_68E7 - call pushErrorHandleR - call CPYTO1ES3 - call SEQSET - -p02loc_6869: - call SETesTOfps - call j_RclN - call Plus1 - call j_StoN - call page0_1867 - call CPYTO1ES4 - ld a, (OP1M) - ld hl, 8E2Dh - cp 81h ; '�' - jr c, p02loc_688D - ld hl, 8E3Fh - jr z, p02loc_688D - ld hl, 8E51h - -p02loc_688D: - rst 20h - call CkValidNum - call OP1ToOP6 - call CPYTO1EST - call CkOP1Real - jr nz, p02loc_68B0 - call CpyO6ToFPST - -p02loc_689F: - call popErrorHandleR - call PopRealO1 - ld de, 24h ; '$' - call DeallocFPS1 - res 5, (iy+7) - ret -; --------------------------------------------------------------------------- - -p02loc_68B0: - rst 10h - ld a, 1 - call j_IncLstSize - call AdrLEle - ex de, hl - ld hl, OP6 - call mov9B2 - call CPYTO1ES3 - call CPYTO2ES1 - rst 30h - call CPYTO2ES3 - call CPYO1TOES3 - call cpop1op2 - jp z, ErrIncrement - call CPYTO1ES2 - call CPYTO2ES3 - call cpop1op2 - jr c, p02loc_689F - call CPYTO1ES3 - call SEQSOLVE - jp p02loc_6869 -; End of function p02sub_67E5 - -p02loc_68E7: - xor a - ld (EST), a - res 5, (iy+7) - call PopRealO1 - call markTableDirty - jp JErrorNo - -; =============== S U B R O U T I N E ======================================= - - -p02sub_68F8: - rst 10h - ex de, hl - ld e, (hl) - inc hl - ld d, (hl) - ld a, d - or e - jp z, ErrDimension - pop bc - push de - push bc - ex de, hl - call CreateTempRList - call PushRealO4 - ld hl, 1 - ret -; End of function p02sub_68F8 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6910: - ; p02sub_67E5+28p - push hl - call OP1ToOP3 - call CpyTo1FPST - rst 10h - push de - call OP3ToOP1 - pop de - pop hl - push hl - call PutToL - pop de - pop bc - pop hl - push hl - push bc - or a - sbc hl, de - ret z - inc de - ret -; End of function p02sub_6910 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR p02sub_660A - -p02loc_692D: - call EOP1NotReal - call CKPosDoInt - jp nz, ErrInvalid - call CkOP1FP0 - jp nz, ErrInvalid - call PopRealO1 - ld a, (OP1M) - cp 81h ; '�' - push af - ld a, (unk_89F8) - and 60h ; '`' - cp 40h ; '@' - jr c, p02loc_695C - jr nz, p02loc_6955 - pop af - jr nz, p02loc_695F - jr p02loc_6962 -; --------------------------------------------------------------------------- - -p02loc_6955: - pop af - jr c, p02loc_695F - jr z, p02loc_695F - jr p02loc_6962 -; --------------------------------------------------------------------------- - -p02loc_695C: - pop af - jr c, p02loc_6962 - -p02loc_695F: - ; p02sub_660A+34Cj ... - jp ErrInvalid -; --------------------------------------------------------------------------- - -p02loc_6962: - ; p02sub_660A+350j ... - call j_RclX - ret -; END OF FUNCTION CHUNK FOR p02sub_660A - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6966: - push af - jr p02loc_6973 -; End of function p02sub_6966 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6969: - push af - rst 18h - call OP1Set1 - ld a, 7Dh ; '}' - ld (OP1+1), a - -p02loc_6973: - call CpyTo3FPS1 - rst 18h - call CpyTo1FPS1 - call EOP1NotReal - call OP3ToOP1 - call j_SAVEDATA - call CpyTo1FPS1 - ld hl, p02loc_6A0D - call pushErrorHandleR - call p02sub_6A02 - rst 18h - call OP3ToOP1 - call j_StoOther - call SETesTOfps - call CPYTO1ES2 - call j_RclVarSym - rst 18h - call CPYTO2EST - rst 30h - call p02sub_69EF - call PopRealO3 - call SETesTOfps - rst 18h - call CPYTO2EST - call OP3ToOP1 - call FPSub - call p02sub_69EF - call PopRealO2 - call InvSub - rst 18h - call CpyTo1FPS1 - call Times2 - rst 8 - call PopRealO1 - call fpdiv - call popErrorHandleR - ld de, 12h - call DeallocFPS1 - ld hl, 9304h - dec (hl) - call p02sub_638E - pop af - jp nz, FPOPREAL - call PopRealO3 - rst 18h - call OP3ToOP1 - call markTableDirty - jp PopRealO1 -; End of function p02sub_6969 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_69EF: - rst 18h - call CPYTO1ES2 - call j_StoOther - call CPYTO1ES3 - call j_PARSEOFF - call page0_1717 - jp EOP1NotReal -; End of function p02sub_69EF - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6A02: - ld hl, 9304h - inc (hl) - ld a, (hl) - cp 3 - jp z, Page0Call_2501 - ret -; End of function p02sub_6A02 - -p02loc_6A0D: - pop af - ld hl, 9304h - dec (hl) - jp p02loc_639D -p02loc_6A15: - .db 0 - .db 81h ; � - .db 57h ; W - .db 29h ; ) - .db 57h ; W - .db 79h ; y - .db 51h ; Q - .db 30h ; 0 - .db 82h ; � -; --------------------------------------------------------------------------- - -Page02_38BB: - call PushRealO1 - call XName - jr NDeriv - -; =============== S U B R O U T I N E ======================================= - - -Page02_38C1: - call PushRealO1 - call ThetaName - jr NDeriv -; --------------------------------------------------------------------------- - -Page02_38C7: - - call PushRealO1 - call TName - -NDeriv: - ; Page02_38C1+6j - rst 18h - call j_RclVarSym - ld a, 25h ; '%' - call ThreeExec - call CkOP1Real - jp nz, ErrDomain - ret -; End of function Page02_38C1 - -; --------------------------------------------------------------------------- - -PolarDerivative: - call Page02_38C1 - bit trigDeg, (iy+trigFlags) - ld hl, p02loc_6A15 - call nz, page0_D19 - rst 18h - call ThetaName - call j_RclVarSym - call Sin - call OP2ToOP6 - call OP1ToOP5 - call CpyTo2FPST - call FPMult - call OP1ToOP4 - call OP6ToOP1 - call FPMult - call CpyO1ToFPST - call RName - call j_RclVarSym - rst 8 - call OP6ToOP1 - call FPMult - call OP1ToOP6 - call OP5ToOP1 - call FPMult - call PopRealO2 - call InvSub - call OP1ToOP5 - call OP4ToOP1 - call OP6ToOP2 - call FPAdd - jp OP5ToOP2 -; --------------------------------------------------------------------------- - -Page02_38D3: - call Page02_38C7 - call CpyTo2FPST - call CpyO1ToFPST - call OP2ToOP1 - call Page02_38C7 - call PopRealO2 - jp fpdiv - -; =============== S U B R O U T I N E ======================================= - - -CSub: - ; BinOPExec2+69Aj - call InvOP1SC - -CAdd: - call p02loc_6AB9 - -p02loc_6AB9: - call OP1ToOP3 - call PopRealO1 - rst 30h - call OP3ToOP2 - jr p02loc_6AFE -; End of function CSub - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -CSqaure: - call PUSHMCPLXO1 -; END OF FUNCTION CHUNK FOR UnOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -CMult: - call PushRealO1 - call CpyTo1FPS2 - call FPMult - call p02sub_6D0B - ld hl, (FPS) - ld de, OP1 - ld bc, 0FFF7h - add hl, bc - call Exch9 - rst 8 - call p02sub_6D0E - call OP2ExOP4 - rst 30h - call OP1ExOP4 - call CpyTo2FPS2 - call FPMult - call PopRealO2 - call FPSub - call FPOPCPLX - -p02loc_6AFB: - call OP4ToOP2 - -p02loc_6AFE: - jp page0_104E -; End of function CMult - - -; =============== S U B R O U T I N E ======================================= - - -CRecip: - call OP3Set1 - call PushRealO3 - xor a - ld (OP3M), a - call PushRealO3 - -CDiv: - call p02sub_6D17 - push de - call p02sub_6D0B - call PushRealO1 - call OP2ExOP4 - call p02sub_6D0E - call CpyTo2FPST - call FPSub - call CpyO1ToFPST - call OP3ToOP2 - call CpyTo1FPS2 - call FPMult - call CpyO1ToFPS2 - call OP2ExOP4 - call p02sub_6D0E - call CpyTo2FPS2 - rst 30h - call CpyO1ToFPS2 - call OP3ToOP1 - call p02loc_6B8F - ld a, (OP1+1) - or a - jp z, ErrDomain - pop de - call p02sub_6B6D - call OP1ToOP3 - call PopRealO2 - call FPOPREAL - call PopRealO1 - call CplxDiv - -p02loc_6B60: - jr p02loc_6AFE -; End of function CRecip - - -; =============== S U B R O U T I N E ======================================= - - -CAbs: - ; BinOPExec2+38Ep ... - call p02sub_6D17 - push de - call AddSquares - call SqRoot - pop de -; End of function CAbs - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6B6D: - bit 7, d - jr z, p02loc_6B83 - res 7, d - -p02loc_6B73: - call OP1EXPMinusE - jp c, OP1Set0 - -p02loc_6B79: - ld (OP1+1), a - ret -; End of function p02sub_6B6D - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6B7D: - bit 7, d - jr z, p02loc_6B73 - res 7, d - -p02loc_6B83: - ld a, (OP1+1) - add a, e - jp c, ErrOverflow - jr p02loc_6B79 -; End of function p02sub_6B7D - - -; =============== S U B R O U T I N E ======================================= - - -AddSquares: - ; MAXMINLST+31p ... - call OP2ToOP4 - -p02loc_6B8F: - call FPSquare - call OP1ExOP4 - call FPSquare - call OP4ToOP2 - rst 30h - jp page0_1040 -; End of function AddSquares - - -; =============== S U B R O U T I N E ======================================= - - -CSqRoot: - call OP1ToOP5 - call OP2ToOP6 - call CAbs - call OP5ToOP2 - xor a - ld (OP2), a - rst 30h - call TimesPt5 - call SqRoot - call CkOP1FP0 - jr nz, p02loc_6BBE - rst 8 - jr p02loc_6BE2 -; --------------------------------------------------------------------------- - -p02loc_6BBE: - call OP1ToOP4 - call Times2 - rst 8 - call OP6ToOP1 - call fpdiv - call OP4ToOP2 - ld a, (OP5) - and 80h ; '�' - jr z, p02loc_6BDF - ld a, (OP6) - and 80h ; '�' - call nz, InvOP1SC - jr p02loc_6BE2 -; --------------------------------------------------------------------------- - -p02loc_6BDF: - call OP1ExOP2 - -p02loc_6BE2: - jp p02loc_6B60 -; End of function CSqRoot - - -; =============== S U B R O U T I N E ======================================= - - -CLN: - ; CYtoX:p02loc_6C96p ... - call OP2ToOP6 - call PushRealO1 - call CAbs - call LnX - call OP1ExOP6 - call PopRealO2 - ld d, 0 - call ATan2Rad - -p02loc_6BFC: - rst 8 - call OP6ToOP1 - jr p02loc_6BE2 -; End of function CLN - - -; =============== S U B R O U T I N E ======================================= - - -CLog: - call OP2ToOP6 - call PushRealO1 - call CAbs - call LogX - call OP1ExOP6 - call PopRealO2 - ld d, 0 - call ATan2Rad - ld a, 3 - call GETCONOP2 - call FPMult - jr p02loc_6BFC -; End of function CLog - - -; =============== S U B R O U T I N E ======================================= - - -CTenX: - call OP2ToOP4 - ld a, 3 - call GETCONOP2 - call fpdiv - call OP1ExOP4 - call fpdiv - rst 8 - call OP4ToOP1 -; End of function CTenX - - -; =============== S U B R O U T I N E ======================================= - - -CEtoX: - call OP2ToOP6 - call EToX - call OP1ExOP6 - call SinCosRad - call OP2ExOP6 - call FPMult - call OP1ToOP4 - call OP6ToOP1 - call FPMult - jp p02loc_6AFB -; End of function CEtoX - - -; =============== S U B R O U T I N E ======================================= - -p02loc_6C56: -CXrootY: - call ExMCplxO1 - call CkOP1C0 - jr z, p02loc_6C86 - call CRecip - jr CYtoX -; End of function CXrootY - -; --------------------------------------------------------------------------- - -BCALL_4EAF: - pop af - call page0_1280 - call CpyTo1FPST - bit 1, (iy+1Eh) - call nz, fprecip - call OP2Set0 - call CpyO2ToFPST - -; =============== S U B R O U T I N E ======================================= - -p02loc_6C77: -CYtoX: - call OP1ToOP3 - call ExMCplxO1 - call CkOP1C0 - jr nz, p02loc_6C96 - ld a, (OP3M) - or a - -p02loc_6C86: - jp z, ErrDomain - ld a, (OP3) - or a - jp m, ErrDomain - call FPOPCPLX - jp COP1Set0 -; --------------------------------------------------------------------------- - -p02loc_6C96: - call CLN - call CMult - jr CEtoX -; End of function CYtoX - -; --------------------------------------------------------------------------- - call OP1ExOP2 - jp InvOP1S -; --------------------------------------------------------------------------- - call InvOP1S - jp OP1ExOP2 -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -InvertNonReal: - call InvOP2S - -p02loc_6CAD: - jr p02loc_6CE8 -; END OF FUNCTION CHUNK FOR UnOPExec2 -; --------------------------------------------------------------------------- - -CplxMult: - call OP2ToOP4 - call OP3ToOP2 - call FPMult - call OP1ExOP4 - call FPMult -; START OF FUNCTION CHUNK FOR CplxDiv - -p02loc_6CBE: - call OP2ToOP3 - rst 8 - call OP4ToOP1 - jr p02loc_6CAD -; END OF FUNCTION CHUNK FOR CplxDiv - -; =============== S U B R O U T I N E ======================================= - - -CplxDiv: - - - - call OP2ToOP4 - call OP3ToOP2 - call fpdiv - call OP1ExOP4 - call fpdiv - jr p02loc_6CBE -; End of function CplxDiv - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR UnOPExec2 - -CplxTrunc: - call OP2ToOP3 - call Trunc - call OP1ExOP3 - call Trunc - rst 8 - call OP3ToOP1 - -p02loc_6CE8: - jr p02loc_6D08 -; --------------------------------------------------------------------------- - -CplxFrac: - call frac - call OP1ExOP2 - call frac - call OP1ExOP2 - jr p02loc_6D08 -; --------------------------------------------------------------------------- - -CplxFloor: - call OP2ToOP4 - call DoInt - call OP1ExOP4 - call DoInt - rst 8 - call OP4ToOP1 - -p02loc_6D08: - ; UnOPExec2+12A3j - jp page0_104E -; END OF FUNCTION CHUNK FOR UnOPExec2 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6D0B: - call OP1ToOP4 -; End of function p02sub_6D0B - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6D0E: - call CpyTo1FPS1 - call FPMult - jp OP2ToOP3 -; End of function p02sub_6D0E - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6D17: - call OP1MOP2EXP - ld d, 0 - ld a, (OP1+1) - jr nc, p02loc_6D22 - ld a, (hl) - -p02loc_6D22: - sub 80h ; '�' - jr nc, p02loc_6D2B - cpl - add a, 1 - set 7, d - -p02loc_6D2B: - ld e, a - push de - call p02sub_6B7D - call OP1ExOP2 - pop de - push de - call p02sub_6B7D - call OP1ExOP2 - pop de - ret -; End of function p02sub_6D17 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6D3D: - set 6, (iy+0Eh) - call errd_op1notpos - jr p02loc_6D50 -; End of function p02sub_6D3D - - -; =============== S U B R O U T I N E ======================================= - - -SqRoot: - call errd_op1notpos -; End of function SqRoot - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6D49: - res 6, (iy+0Eh) - call page0_FB5 - -p02loc_6D50: - call CkOP1FP0 - ret z - call ZeroOP3 - ld hl, OP1+1 - ld a, (hl) - rra - ld (OP3+1), a - ld a, 0 - call c, page0_1301 - ld (hl), a - call ZeroOP2 - ld de, OP3M - ld a, 10h - ld (OP2), a - ld c, 0 - ld hl, OP2M - push de - -p02loc_6D76: - push hl - ld b, 1 - call page0_1382 - -p02loc_6D7C: - ld hl, 848Bh - ld de, 8480h - call SUB16D - jr c, p02loc_6D92 - inc c - pop hl - push hl - ld b, 2 - call page0_1382 - jp p02loc_6D7C -; --------------------------------------------------------------------------- - -p02loc_6D92: - ld hl, OP2 - dec (hl) - jr z, p02loc_6DD2 - ld a, c - bit 0, (hl) - call nz, ShLAcc - pop bc - pop de - ld (de), a - bit 0, (hl) - jr nz, p02loc_6DA8 - inc bc - inc de - xor a - -p02loc_6DA8: - push de - push bc - ld c, a - ld hl, 848Bh - ld de, 8480h - or a - call ADD16D - ld hl, OP1+1 - call page0_12EF - rld - push bc - call page0_11B3 - pop bc - ld hl, 848Bh - ld d, h - ld e, l - call ADD14D - ld (hl), 0 - jr nc, p02loc_6DCF - inc (hl) - -p02loc_6DCF: - pop hl - jr p02loc_6D76 -; --------------------------------------------------------------------------- - -p02loc_6DD2: - pop af - pop hl - ld (hl), c - ld a, (OP1) - call OP3ToOP1 - ld (OP1), a - ld a, (OP1+1) - add a, 40h ; '@' - ld (OP1+1), a - call CkOP1Pos - jr z, p02loc_6E03 - call page0_1280 - bit 6, (iy+0Eh) - jr nz, p02loc_6DF7 - call LJRND - -p02loc_6DF7: - rst 8 - call OP1Set0 - ld a, 0Ch - ld (OP2), a - jp page0_104E -; --------------------------------------------------------------------------- - -p02loc_6E03: - bit 6, (iy+0Eh) - ret nz - jp p02sub_78D3 -; End of function p02sub_6D49 - - -; =============== S U B R O U T I N E ======================================= - - -LnX: - call CkOP1Pos - -p02loc_6E0E: - ld c, 2 - jr z, Page02_3861 - jp ErrDomain -; End of function LnX - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6E15: - call CkOP1Pos - jr z, p02loc_6E0E - call page0_1280 - jp CLN -; End of function p02sub_6E15 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_6E20: - ld c, 0 - jr Page02_3861 -; End of function p02sub_6E20 - - -; =============== S U B R O U T I N E ======================================= - - -LogX: - ld c, 0 - call errd_op1notpos - -Page02_3861: - call page0_FB5 - call ErrD_OP1_0 - call CkOP1Pos - jr z, p02loc_6E3B - call page0_1280 - call CLog - ret -; --------------------------------------------------------------------------- - -p02loc_6E3B: - push bc - call page0_1708 - jr nc, p02loc_6E8E - call OP1ToOP4 - call Minus1 - call page0_170F - jr c, p02loc_6E53 - jr nz, p02loc_6E8B - call CkOP1Pos - jr nz, p02loc_6E8B - -p02loc_6E53: - call OP1ToOP3 - call OP2Set2 - rst 30h - rst 8 - call OP3ToOP1 - call fpdiv - call OP2Set1 - ld a, (OP1) - push af - call DecO1Exp - ld a, 80h ; '�' - call p02sub_76B4 - call Times2 - pop af - pop bc - and 80h ; '�' - ld (OP1), a - bit 1, c - ret nz - push bc - ld a, 3 - call page0_CF7 - pop bc - bit 0, c - ret nz - call page0_E2D - ret -; --------------------------------------------------------------------------- - -p02loc_6E8B: - call OP4ToOP1 - -p02loc_6E8E: - call ZeroOP2 - ld (OP3), a - call IsOP1One - jp z, p02loc_6F01 - -p02loc_6E9A: - call p02sub_7210 - jr p02loc_6EA2 -; --------------------------------------------------------------------------- - -p02loc_6E9F: - call page0_138F - -p02loc_6EA2: - ld a, (OP3) - call SRDO1 - call page0_13B5 - jp nc, p02loc_6E9F - call IsOP1Zero - jr z, p02loc_6EFC - call page0_142A - ld hl, OP3 - ld a, (hl) - inc (hl) - and 8 - jr z, p02loc_6E9A - ld de, 8493h - xor a - ld (de), a - ld hl, 8481h - call page0_1448 - -p02loc_6ECA: - inc de - ld a, (de) - call ShRAcc - jr z, p02loc_6EDD - push de - call p02sub_720F - -p02loc_6ED5: - call page0_138F - dec c - jp nz, p02loc_6ED5 - pop de - -p02loc_6EDD: - ld hl, OP3 - inc (hl) - bit 4, (hl) - jr nz, p02loc_6F0A - ld a, (de) - and 0Fh - jr z, p02loc_6EF6 - push de - call p02sub_720F - -p02loc_6EEE: - call page0_138F - dec c - jp nz, p02loc_6EEE - pop de - -p02loc_6EF6: - ld hl, OP3 - inc (hl) - jr p02loc_6ECA -; --------------------------------------------------------------------------- - -p02loc_6EFC: - call page0_138F - jr p02loc_6F0A -; --------------------------------------------------------------------------- - -p02loc_6F01: - call GETEXP - jr nc, p02loc_6F0A - dec a - ld (OP1+1), a - -p02loc_6F0A: - call GETEXP - jr nc, p02loc_6F1C - ld a, 80h ; '�' - ld (OP1), a - call INCO1EXP - call page0_11AB - jr p02loc_6F26 -; --------------------------------------------------------------------------- - -p02loc_6F1C: - xor a - ld (OP1), a - call page0_1290 - call page0_141D - -p02loc_6F26: - call OP1ExpToDec - ld (OP1+1), a - ld e, 81h ; '�' - and 0F0h ; '�' - jr nz, p02loc_6F3D - dec e - ld a, (OP1+1) - and 0Fh - jr nz, p02loc_6F40 - dec e - jr p02loc_6F43 -; --------------------------------------------------------------------------- - -p02loc_6F3D: - call page0_12C4 - -p02loc_6F40: - call page0_12C4 - -p02loc_6F43: - ld a, e - ld (OP1+1), a - pop bc - bit 0, c - jr z, p02loc_6F50 - call LJNORND - ret -; --------------------------------------------------------------------------- - -p02loc_6F50: - push bc - call LJRND - pop bc - bit 1, c - ret z - ld a, 6 - call page0_CF7 - call page0_E2D - ret -; End of function LogX - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR TenX - -p02loc_6F61: - call CkOP1Pos - jp nz, OP1Set0 - jp ErrOverflow -; END OF FUNCTION CHUNK FOR TenX - -; =============== S U B R O U T I N E ======================================= - - -EToX: - call page0_FB5 - ld a, 3 - call page0_CF7 - jr Page02_3867 -; End of function EToX - - -; =============== S U B R O U T I N E ======================================= - - -TenX: - - - - - call page0_FB5 - -Page02_3867: - ld a, (OP1+1) - sub 80h ; '�' - jr c, p02loc_6FB0 - ld b, a - xor a - ld (OP1+1), a - ld a, b - cp 2 - jr nc, p02loc_6F61 - call page0_1301 - rld - ld a, b - or a - jr z, p02loc_6F97 - ld a, (hl) - call page0_1301 - rld - -p02loc_6F97: - ld a, (OP1+1) - ld c, 0 - call ShRAcc - jr z, p02loc_6FA8 - ld b, a - xor a - -p02loc_6FA3: - add a, 0Ah - dec b - jr nz, p02loc_6FA3 - -p02loc_6FA8: - ld b, a - ld a, (hl) - and 0Fh - add a, b - ld e, a - jr p02loc_6FC1 -; --------------------------------------------------------------------------- - -p02loc_6FB0: - cpl - ld e, a - cp 0Fh - jp nc, OP1Set1 - push de - call SRDO1 - call page0_11CB - pop bc - ld e, 0 - -p02loc_6FC1: - ld a, 80h ; '�' - add a, e - ld (OP1+1), a - call ClrOP1S - and 80h ; '�' - jr z, p02loc_6FE7 - ld a, (OP1+1) - cpl - ld (OP1+1), a - call IsOP1Zero - jr nz, p02loc_6FDF - call INCO1EXP - jr p02loc_6FE7 -; --------------------------------------------------------------------------- - -p02loc_6FDF: - rst 8 - call page0_1290 - ld c, a - call page0_141D - -p02loc_6FE7: - ld a, c - ld (OP3), a - ld hl, OP4M - call Zero16D - ld b, a - ld hl, OP4M - srl c - add hl, bc - -p02loc_6FF8: - push hl - xor a - -p02loc_6FFA: - ld c, a - ld de, OP2M - call p02sub_7213 - jr p02loc_700B -; --------------------------------------------------------------------------- - -p02loc_7003: - inc c - ld a, c - and 0Fh - cp 9 - jr z, p02loc_7014 - -p02loc_700B: - call page0_141D - jp nc, p02loc_7003 - call page0_139F - -p02loc_7014: - ld hl, OP3 - ld a, (hl) - cp 0Fh - jr z, p02loc_704E - inc (hl) - and 1 - jr z, p02loc_7026 - pop hl - ld (hl), c - inc hl - jr p02loc_6FF8 -; --------------------------------------------------------------------------- - -p02loc_7026: - call page0_12B8 - jr p02loc_6FFA -; End of function TenX - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_702B: - ret z - push af - push bc - ld a, c - call SRDO1 - call page0_13B5 - jr c, p02loc_703E - pop bc - pop af - or a - dec a - jp p02sub_702B -; --------------------------------------------------------------------------- - -p02loc_703E: - pop hl - pop hl - call INCO1EXP - ld hl, OP1M - call page0_124D - inc hl - ld (hl), 0 - scf - ret -; End of function p02sub_702B - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR TenX - -p02loc_704E: - pop hl - ld (hl), c - ld hl, OP1M - call page0_124D - ld de, 8481h - ld hl, 84A2h - ld bc, 3 - lddr - ld a, (hl) - and 0Fh - ld (de), a - ld c, 0 - ld hl, OP4M - -p02loc_706A: - push hl - ld a, (hl) - push af - call ShRAcc - call p02sub_702B - jr nc, p02loc_707B - pop af - -p02loc_7076: - pop hl - call LJRND - ret -; --------------------------------------------------------------------------- - -p02loc_707B: - pop af - bit 3, c - jp nz, p02loc_7076 - inc c - and 0Fh - call p02sub_702B - jp c, p02loc_7076 - pop hl - inc c - inc hl - jr p02loc_706A - -p02loc_708F: - .db 30h ; 0 - .db 10h - .db 29h ; ) - .db 99h ; � - .db 56h ; V - .db 63h ; c - .db 98h ; � - .db 12h - .db 4 - .db 13h - .db 92h ; � - .db 68h ; h - .db 51h ; Q - .db 58h ; X - .db 22h ; " - .db 50h ; P - .db 0 - .db 43h ; C - .db 21h ; ! - .db 37h ; 7 - .db 37h ; 7 - .db 82h ; � - .db 64h ; d - .db 26h ; & - .db 0 - .db 4 - .db 34h ; 4 - .db 7 - .db 74h ; t - .db 79h ; y - .db 31h ; 1 - .db 86h ; � - .db 0 - .db 0 - .db 43h ; C - .db 42h ; B - .db 72h ; r - .db 76h ; v - .db 86h ; � - .db 27h ; ' - .db 0 - .db 0 - .db 4 - .db 34h ; 4 - .db 29h ; ) - .db 23h ; # - .db 10h - .db 45h ; E - .db 0 - .db 0 - .db 0 - .db 43h ; C - .db 42h ; B - .db 94h ; � - .db 26h ; & - .db 48h ; H - .db 0 - .db 0 - .db 0 - .db 4 - .db 34h ; 4 - .db 29h ; ) - .db 44h ; D - .db 60h ; ` - .db 0 - .db 0 - .db 0 - .db 0 - .db 43h ; C - .db 42h ; B - .db 94h ; � - .db 48h ; H - .db 0 - .db 0 - .db 0 - .db 0 - .db 4 - .db 34h ; 4 - .db 29h ; ) - .db 45h ; E - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 43h ; C - .db 42h ; B - .db 94h ; � - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 4 - .db 34h ; 4 - .db 29h ; ) - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 43h ; C - .db 43h ; C - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 4 - .db 34h ; 4 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 43h ; C - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 4 -p02loc_710F: - .db 9 - .db 96h ; � - .db 68h ; h - .db 65h ; e - .db 24h ; $ - .db 91h ; � - .db 16h - .db 20h - .db 10h - .db 3 - .db 35h ; 5 - .db 34h ; 4 - .db 77h ; w - .db 31h ; 1 - .db 7 - .db 56h ; V - .db 9 - .db 99h ; � - .db 96h ; � - .db 66h ; f - .db 68h ; h - .db 66h ; f - .db 65h ; e - .db 24h ; $ - .db 10h - .db 0 - .db 3 - .db 33h ; 3 - .db 35h ; 5 - .db 33h ; 3 - .db 34h ; 4 - .db 76h ; v - .db 9 - .db 99h ; � - .db 99h ; � - .db 96h ; � - .db 66h ; f - .db 66h ; f - .db 68h ; h - .db 67h ; g - .db 10h - .db 0 - .db 0 - .db 3 - .db 33h ; 3 - .db 33h ; 3 - .db 35h ; 5 - .db 33h ; 3 - .db 9 - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 96h ; � - .db 66h ; f - .db 66h ; f - .db 67h ; g - .db 10h - .db 0 - .db 0 - .db 0 - .db 3 - .db 33h ; 3 - .db 33h ; 3 - .db 33h ; 3 - .db 9 - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 96h ; � - .db 66h ; f - .db 67h ; g - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 3 - .db 33h ; 3 - .db 33h ; 3 - .db 9 - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 96h ; � - .db 67h ; g - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 3 - .db 33h ; 3 - .db 9 - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 97h ; � - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 3 - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 -p02loc_718F: - .db 95h ; � - .db 9 - .db 85h ; � - .db 29h ; ) - .db 44h ; D - .db 83h ; � - .db 72h ; r - .db 2 - .db 10h - .db 52h ; R - .db 6 - .db 69h ; i - .db 51h ; Q - .db 89h ; - .db 55h ; U - .db 92h ; � - .db 99h ; � - .db 94h ; � - .db 95h ; � - .db 10h - .db 19h - .db 99h ; � - .db 69h ; i - .db 80h ; � - .db 10h - .db 0 - .db 50h ; P - .db 52h ; R - .db 3 - .db 8 - .db 13h - .db 30h ; 0 - .db 99h ; � - .db 99h ; � - .db 94h ; � - .db 94h ; � - .db 95h ; � - .db 10h - .db 20h - .db 35h ; 5 - .db 10h - .db 0 - .db 0 - .db 50h ; P - .db 50h ; P - .db 52h ; R - .db 3 - .db 5 - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 94h ; � - .db 94h ; � - .db 94h ; � - .db 95h ; � - .db 10h - .db 10h - .db 0 - .db 0 - .db 0 - .db 50h ; P - .db 50h ; P - .db 50h ; P - .db 52h ; R - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 94h ; � - .db 94h ; � - .db 94h ; � - .db 95h ; � - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 50h ; P - .db 50h ; P - .db 51h ; Q - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 94h ; � - .db 94h ; � - .db 95h ; � - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 50h ; P - .db 51h ; Q - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 94h ; � - .db 95h ; � - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 51h ; Q - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 99h ; � - .db 95h ; � - .db 10h - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 0 - .db 1 - -; =============== S U B R O U T I N E ======================================= - - -p02sub_720F: - ld c, a -; End of function p02sub_720F - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_7210: - ld de, OP4M -; End of function p02sub_7210 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_7213: - ld hl, p02loc_708F - ld a, (OP3) - push bc - ld c, 8 - ld b, a - xor a - jr p02loc_723F -; End of function p02sub_7213 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_7220: - ld hl, p02loc_718F - ld de, OP2M - jr p02loc_722E -; End of function p02sub_7220 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_7228: - ld de, OP4M -; End of function p02sub_7228 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_722B: - ld hl, p02loc_710F - -p02loc_722E: - ld a, (OP5) - push bc - and 80h ; '�' - ld a, 0 - ld c, 10h - jr z, p02loc_723F - add a, 8 - jr p02loc_723F -; --------------------------------------------------------------------------- - -p02loc_723E: - add a, c - -p02loc_723F: - dec b - jp p, p02loc_723E - ld c, a - ld b, 0 - add hl, bc - call Mov8B - pop bc - ret -; End of function p02sub_722B - - -; =============== S U B R O U T I N E ======================================= - - -SinCosRad: - ld a, 81h ; '�' - jr p02loc_7262 -; End of function SinCosRad - - -; =============== S U B R O U T I N E ======================================= - - -Sin: - ld a, 1 - jr p02loc_725A -; End of function Sin - - -; =============== S U B R O U T I N E ======================================= - - -cos: - ld a, 2 - jr p02loc_725A -; End of function cos - - -; =============== S U B R O U T I N E ======================================= - - -Tan: - ld a, 4 - -p02loc_725A: - bit trigDeg, (iy+trigFlags) - jr nz, p02loc_7262 - or 80h ; '�' - -p02loc_7262: - ld (OP4), a - call page0_FB5 - call ZeroOP3 - ld a, (OP1+1) - sub 80h ; '�' - jp c, p02loc_72E2 - cp 0Ch - jp nc, ErrDomain - ld l, a - ld a, (OP4) - and 80h ; '�' - jr z, p02loc_728A - ld hl, PItimes2 - call page0_11D3 - ld b, 80h ; '�' - jr p02loc_7296 -; --------------------------------------------------------------------------- - -p02loc_728A: - ld a, l - cp 2 - jr c, p02loc_72E2 - ld a, 36h ; '6' - ld (OP3M), a - ld b, 82h ; '�' - -p02loc_7296: - ld c, 0 - -p02loc_7298: - call page0_1470 - jr nc, p02loc_7298 - dec c - jp p, p02loc_7298 - call page0_140C - ld hl, OP1+1 - ld a, b - cp (hl) - jr z, p02loc_72B2 - dec (hl) - call page0_12EF - ld c, a - jr p02loc_7298 -; --------------------------------------------------------------------------- - -p02loc_72B2: - ld a, (OP4) - and 80h ; '�' - jr z, p02loc_72C6 - call page0_119E - ld hl, unk_1590 - call page0_1461 - jr c, p02loc_72E2 - jr p02loc_72D4 -; --------------------------------------------------------------------------- - -p02loc_72C6: - ld a, (OP1M) - cp 18h - jr c, p02loc_72E2 - jr nz, p02loc_72D4 - call CKOP1M - jr z, p02loc_72E2 - -p02loc_72D4: - call page0_1467 - call page0_11C3 - ld a, (OP1) - xor 80h ; '�' - ld (OP1), a - -p02loc_72E2: - call LJNORND - call ClrOP1S - and 80h ; '�' - jr z, p02loc_72EE - ld a, 3 - -p02loc_72EE: - push af - call CkOP1FP0 - jp z, p02loc_7383 - call ZeroOP3 - ld a, (OP4) - and 80h ; '�' - jr z, p02loc_730F - ld hl, unk_1598 - call page0_11D3 - call GETEXP - jp c, p02loc_733F - ld c, 0 - jr p02loc_7324 -; --------------------------------------------------------------------------- - -p02loc_730F: - call page0_1708 - ld a, 90h ; '�' - ld (OP3M), a - jr c, p02loc_7373 - ld c, 0 - jr z, p02loc_7324 - call DecO1Exp - call page0_12EF - ld c, a - -p02loc_7324: - call page0_1470 - jr nc, p02loc_7332 - dec c - jp p, p02loc_7332 - call page0_140C - jr p02loc_7338 -; --------------------------------------------------------------------------- - -p02loc_7332: - pop af - xor 1 - or 8 - push af - -p02loc_7338: - ld a, (OP4) - and 80h ; '�' - jr z, p02loc_7362 - -p02loc_733F: - call LJNORND - ld a, (OP1M) - or a - jr z, p02loc_7383 - call page0_170F - jr c, p02loc_7383 - jr nz, p02loc_7369 - call page0_119E - ld hl, unk_1597 - call page0_1461 - jr c, p02loc_7373 - call page0_12BE - call INCO1EXP - jr p02loc_7369 -; --------------------------------------------------------------------------- - -p02loc_7362: - ld a, (OP1M) - cp 45h ; 'E' - jr c, p02loc_7373 - -p02loc_7369: - call page0_1467 - call page0_11C3 - pop af - xor 8 - push af - -p02loc_7373: - call LJNORND - call page0_FB5 - ld a, (OP4) - and 80h ; '�' - jr nz, p02loc_7383 - call page0_CF2 - -p02loc_7383: - ld hl, OP3M - call page0_124D - ld a, 2 - ld (OP3+3), a - call page0_1422 - pop bc - jr c, p02loc_7396 - set 6, b - -p02loc_7396: - ld a, b -; End of function Tan - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_7397: - ld (OP5), a - call CkOP1FP0 - jr nz, p02loc_73AB - -p02loc_739F: - call OP2Set1 - call page0_E2D - call OP1ExOP2 - jp p02loc_74FE -; --------------------------------------------------------------------------- - -p02loc_73AB: - call p02sub_75BB - jr c, p02loc_739F - ld b, a - xor a - -p02loc_73B2: - inc hl - push bc - push hl - push af - ld de, OP2M - call p02sub_722B - call page0_132D - pop af - ld b, 1 - and 0F0h ; '�' - -p02loc_73C4: - ld c, a - or a - jp m, p02loc_73D5 - -p02loc_73C9: - call page0_142A - jr c, p02loc_73DB - inc c - inc b - jp p02loc_73C9 -; --------------------------------------------------------------------------- - -p02loc_73D3: - inc c - inc b - -p02loc_73D5: - call page0_13B5 - jp nc, p02loc_73D3 - -p02loc_73DB: - inc b - ld a, c - xor 80h ; '�' - bit 0, b - jr z, p02loc_73C4 - ld c, a - inc a - and 0Fh - pop hl - ld (hl), a - ld a, c - pop bc - inc b - bit 3, b - jr z, p02loc_73B2 - or a - call m, page0_13B5 - ld a, (OP5+1) - ld b, a - call p02sub_7220 - ld hl, 84A5h - jr p02loc_7402 -; --------------------------------------------------------------------------- - -p02loc_7400: - pop bc - pop hl - -p02loc_7402: - bit 3, b - jr nz, p02loc_7438 - inc b - inc hl - push hl - push bc - ld a, 0Bh - sub (hl) - srl a - jr z, p02loc_7400 - ld d, a - ld a, b - add a, b - ld e, a - push de - -p02loc_7416: - call page0_1332 - call page0_13EC - pop de - dec d - jr z, p02loc_7400 - ld a, e - push de - cp 9 - jr c, p02loc_7416 - ld c, d - -p02loc_7427: - call page0_13FC - jr nc, p02loc_7432 - ex de, hl - ld a, 1 - call MANTPA - -p02loc_7432: - dec c - jr nz, p02loc_7427 - pop de - jr p02loc_7400 -; --------------------------------------------------------------------------- - -p02loc_7438: - set 6, (iy+0Eh) - call page0_D37 - ld hl, OP5 - ld a, (hl) - bit 7, a - jr nz, p02loc_7449 - or 10h - -p02loc_7449: - ld (hl), a - inc hl - ld c, (hl) - inc (hl) - and 40h ; '@' - jr z, p02loc_7456 - call DecO1Exp - jr p02loc_745C -; --------------------------------------------------------------------------- - -p02loc_7456: - dec (hl) - ex de, hl - call page0_12CD - ex de, hl - -p02loc_745C: - call p02sub_75C9 - ld hl, 84A5h - -p02loc_7462: - ; p02sub_7397+14Dj - inc c - inc hl - ld b, (hl) - push hl - ld hl, OP2 - inc (hl) - ld hl, OP3 - inc (hl) - bit 3, c - jr z, p02loc_7481 - ld a, (OP5) - and 20h ; ' ' - jr nz, p02loc_7483 - dec b - jp p, p02loc_7483 - pop hl - jp p02loc_74E7 -; --------------------------------------------------------------------------- - -p02loc_7481: - res 0, b - -p02loc_7483: - push bc - ld a, b - or a - jr z, p02loc_74D2 - ld a, (OP3) - ld c, a - -p02loc_748C: - push bc - ld a, c - call page0_119E - call page0_1332 - ld a, (OP5) - and 20h ; ' ' - jr nz, p02loc_74C1 - call page0_13B5 - jp nc, p02loc_74C4 - call page0_12CD - call INCO1EXP - ld hl, OP1M - ld a, 10h - add a, (hl) - ld (hl), a - ld hl, 84A5h - dec (hl) - call page0_131E - ld hl, OP2 - dec (hl) - ld hl, OP3 - inc (hl) - pop bc - ld c, (hl) - jr p02loc_74C8 -; --------------------------------------------------------------------------- - -p02loc_74C1: - call page0_142A - -p02loc_74C4: - call page0_131E - pop bc - -p02loc_74C8: - ld a, (OP5) - and 10h - call page0_13F1 - djnz p02loc_748C - -p02loc_74D2: - pop bc - pop hl - bit 3, c - jr nz, p02loc_74E7 - ld a, (hl) - cp b - jp nz, p02loc_7462 - ld de, OP5 - ld a, (de) - xor 30h ; '0' - ld (de), a - jp p02loc_7462 -; --------------------------------------------------------------------------- - -p02loc_74E7: - ; p02sub_7397+13Fj - call p02sub_78CC - ld l, 7Fh ; '' - ld a, (OP5) - and 80h ; '�' - jr z, p02loc_74F4 - inc l - -p02loc_74F4: - ld a, l - ld (OP2+1), a - call OP1ExOP2 - call p02sub_78D3 - -p02loc_74FE: - ld a, (OP5) - and 8 - call z, OP1ExOP2 - ld c, 0 - ld a, (OP5) - and 3 - jr z, p02loc_751C - cp 2 - jr c, p02loc_7517 - ld c, 80h ; '�' - jr nz, p02loc_751C - -p02loc_7517: - ld a, 80h ; '�' - ld (OP2), a - -p02loc_751C: - ; p02sub_7397+17Ej - ld a, c - ld (OP1), a - ld a, (OP4) - and 7 - cp 2 - ret c - jp z, OP2ToOP1 - call CkOP2FP0 - jp z, ErrDomain - jp fpdiv -; End of function p02sub_7397 - -; --------------------------------------------------------------------------- - -SinHCosH: - ld c, 81h ; '�' - jr p02loc_7542 - -; =============== S U B R O U T I N E ======================================= - - -TanH: - ld c, 4 - jr p02loc_7542 -; End of function TanH - - -; =============== S U B R O U T I N E ======================================= - - -cosh: - ld c, 2 - jr p02loc_7542 -; End of function cosh - - -; =============== S U B R O U T I N E ======================================= - - -SinH: - - - - ld c, 1 - -p02loc_7542: - call ClrOP1S - push af - ld a, c - ld (OP4), a - call GETEXP - jr nc, p02loc_755E - ld a, 80h ; '�' - call p02sub_7397 - pop af - ld hl, OP4 - bit 1, (hl) - ret nz - jp p02loc_78DB -; --------------------------------------------------------------------------- - -p02loc_755E: - push bc - bit 2, c - jr z, p02loc_758E - call Times2 - ld e, 82h ; '�' - call OP1EXPMinusE - jr c, p02loc_7578 - call OP1Set1 - -p02loc_7570: - pop bc - -p02loc_7571: - pop af - bit 1, c - ret nz - jp p02loc_78DB -; --------------------------------------------------------------------------- - -p02loc_7578: - call EToX - call Plus1 - rst 8 - call OP1Set2 - call fpdiv - rst 8 - call OP1Set1 - call FPSub - jr p02loc_7570 -; --------------------------------------------------------------------------- - -p02loc_758E: - call EToX - call fprecip - call OP1ToOP4 - call OP2ToOP5 - pop bc - bit 0, c - push bc - call nz, InvOP1S - rst 30h - call TimesPt5 - pop bc - bit 7, c - jr z, p02loc_7571 - push bc - call OP1ExOP4 - call OP5ToOP2 - rst 30h - call TimesPt5 - rst 8 - call OP4ToOP1 - jr p02loc_7570 -; End of function SinH - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_75BB: - ; p02sub_76B4+Bp - ld a, (OP1+1) - cp 78h ; 'x' - ret c - cpl - and 7Fh ; '' - ld hl, 84A5h - ld (hl), a - ret -; End of function p02sub_75BB - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_75C9: - ; p02sub_76B4+47p - ld a, (OP5+1) - ld d, a - add a, c - ld (OP2), a - sub d - sub d - ld (OP3), a - ret -; End of function p02sub_75C9 - -; --------------------------------------------------------------------------- - -ACosRad: - ld a, 1 - ld b, 20h ; ' ' - jr p02loc_7609 -; --------------------------------------------------------------------------- - -ATanRad: - call OP2Set1 - ld d, 2 - -; =============== S U B R O U T I N E ======================================= - - -ATan2Rad: - ld b, 20h ; ' ' - push bc - jp p02loc_7659 -; End of function ATan2Rad - -; --------------------------------------------------------------------------- - -ASinRad: - xor a - ld b, 20h ; ' ' - jr p02loc_7609 - -; =============== S U B R O U T I N E ======================================= - - -ACos: - call p02sub_78E1 - jp c, ErrDomain - ld a, 1 - jr p02loc_7607 -; End of function ACos - - -; =============== S U B R O U T I N E ======================================= - - -ATan: - call OP2Set1 - ld d, 2 - jp ATan2 -; End of function ATan - - -; =============== S U B R O U T I N E ======================================= - - -ASin: - call p02sub_78E1 - ret z - jp c, ErrDomain - xor a - -p02loc_7607: - ld b, 0 - -p02loc_7609: - push bc - or a - push af - call page0_FB5 - ld e, 80h ; '�' - call OP1EXPMinusE - jr c, p02loc_7623 - jr nz, p02loc_7620 - call CkOP1FP0 - jr z, p02loc_7623 - call IsOP1One - -p02loc_7620: - jp nz, ErrDomain - -p02loc_7623: - call OP1ToOP3 - call OP1ToOP4 - call OP2Set1 - call page0_C3D - call OP1ToOP5 - call OP3ToOP1 - call OP2Set1 - call page0_C0A - call OP5ToOP2 - call page0_CFA - call p02sub_6D3D - xor a - ld (OP4+9), a - pop af - jr z, p02loc_7650 - call OP4ToOP2 - jr p02loc_7654 -; --------------------------------------------------------------------------- - -p02loc_7650: - rst 8 - call OP4ToOP1 - -p02loc_7654: - ld d, a - jr p02loc_765C -; End of function ASin - - -; =============== S U B R O U T I N E ======================================= - - -ATan2: - xor a - push af - -p02loc_7659: - call page0_FB5 - -p02loc_765C: - call CkOP1Pos - jr z, p02loc_7665 - ld a, d - add a, 0Ch - ld d, a - -p02loc_7665: - call ckop2pos - jr z, p02loc_766E - ld a, d - xor 4 - ld d, a - -p02loc_766E: - call CkOP2FP0 - jr nz, p02loc_7684 - call CkOP1FP0 - jr nz, p02loc_767C - pop bc - jp OP1Set0 -; --------------------------------------------------------------------------- - -p02loc_767C: - set 4, d - push de - call OP1ExOP2 - jr p02loc_769E -; --------------------------------------------------------------------------- - -p02loc_7684: - push de - call CkOP1FP0 - jr z, p02loc_769E - call OP1ToOP3 - call page0_141D - ld a, (OP1+1) - ld hl, 8484h - sbc a, (hl) - call OP3ToOP1 - pop de - jr nc, p02loc_767C - push de - -p02loc_769E: - call OP1MOP2EXP - add a, 80h ; '�' - jr z, p02loc_76AB - jr c, p02loc_76AD - cp 80h ; '�' - jr z, p02loc_76AD - -p02loc_76AB: - ld a, 1 - -p02loc_76AD: - dec a - ld (OP1+1), a - pop af - pop bc - add a, b -; End of function ATan2 - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_76B4: - push af - ld a, 7Fh ; '' - ld (OP2+1), a - call CkOP1FP0 - jr z, p02loc_76CA - call p02sub_75BB - jr nc, p02loc_76D2 - call fpdiv - call ClrOP1S - -p02loc_76CA: - pop af - ld (OP5), a - ld b, a - jp p02loc_77DA -; --------------------------------------------------------------------------- - -p02loc_76D2: - call OP1ToOP3 - ld hl, OP2EXT - ld de, 8497h - call SUB16D - pop de - set 6, d - ld hl, 84A5h - ld a, (hl) - jr c, p02loc_76F6 - or a - jr nz, p02loc_76F3 - push de - ld a, 2 - call GETCONOP1 - jp p02loc_77EB -; --------------------------------------------------------------------------- - -p02loc_76F3: - dec a - res 6, d - -p02loc_76F6: - dec hl - ld (hl), d - inc a - ld c, a - push bc - call p02sub_75C9 - inc hl - inc hl - push hl - ld b, 0 - jr p02loc_7707 -; --------------------------------------------------------------------------- - -p02loc_7705: - pop bc - inc b - -p02loc_7707: - push bc - call page0_119E - ld a, (OP3) - call page0_1332 - call page0_142A - jr c, p02loc_772A - call page0_131E - call page0_13EC - jp nc, p02loc_7705 - call page0_12CD - ld hl, OP2M - call page0_12F8 - jr p02loc_7705 -; --------------------------------------------------------------------------- - -p02loc_772A: - call page0_11A6 - pop bc - pop hl - ld (hl), b - bit 3, c - jr nz, p02loc_7743 - inc c - inc hl - push hl - ld hl, OP2 - inc (hl) - ld hl, OP3 - inc (hl) - ld b, 0 - jr p02loc_7707 -; --------------------------------------------------------------------------- - -p02loc_7743: - call LJNORND - call OP1ToOP3 - call OP2ToOP1 - call LJNORND - rst 8 - call OP3ToOP1 - call page0_EC6 - call ClrOP1S - ld hl, OP2M - call Zero16D - ld hl, 84A5h - pop bc - ld b, c - xor a - ld (OP3+1), a - -p02loc_7768: - inc hl - push hl - ld a, (hl) - or a - jr z, p02loc_779E - ld c, a - dec b - call p02sub_7228 - ld a, (OP5) - and 40h ; '@' - jr nz, p02loc_777B - inc b - -p02loc_777B: - push bc - ld a, b - ld hl, 84A5h - sub (hl) - call page0_1321 - pop bc - push bc - -p02loc_7786: - ld hl, 8497h - ld de, OP2EXT - call ADD16D - jr c, p02loc_77A6 - -p02loc_7791: - dec c - jp nz, p02loc_7786 - pop bc - ld a, (OP5) - and 40h ; '@' - jr z, p02loc_779E - inc b - -p02loc_779E: - pop hl - bit 3, b - jr nz, p02loc_77AC - inc b - jr p02loc_7768 -; --------------------------------------------------------------------------- - -p02loc_77A6: - ld hl, 848Fh - inc (hl) - jr p02loc_7791 -; --------------------------------------------------------------------------- - -p02loc_77AC: - ld a, 80h ; '�' - ld hl, 84A5h - sub (hl) - ld l, a - ld a, (OP5) - push af - bit 6, a - jr z, p02loc_77BC - dec l - -p02loc_77BC: - ld a, l - ld (OP2+1), a - ld a, (OP3+1) - or a - jr z, p02loc_77D0 - ld hl, 8484h - inc (hl) - ld hl, OP2M - call page0_12D1 - -p02loc_77D0: - call OP1ExOP2 - call LJNORND - call page0_C3D - pop bc - -p02loc_77DA: - bit 7, b - jr nz, p02loc_7813 - bit 4, b - jr z, p02loc_77EC - push bc - ld a, 1 - call GETCONOP2 - call page0_C0A - -p02loc_77EB: - pop bc - -p02loc_77EC: - push bc - ld a, b - and 0Ch - jr z, p02loc_7800 - cp 0Ch - jr z, p02loc_7804 - push bc - ld a, 4 - call GETCONOP2 - call page0_C0A - pop bc - -p02loc_7800: - bit 3, b - jr z, p02loc_7807 - -p02loc_7804: - call InvOP1S - -p02loc_7807: - pop af - and 20h ; ' ' - jr nz, p02loc_7813 - bit trigDeg, (iy+trigFlags) - call nz, page0_CF6 - -p02loc_7813: - ; p02sub_76B4+156j - call LJRND - ret -; End of function p02sub_76B4 - - -; =============== S U B R O U T I N E ======================================= - - -ATanH: - - - - call p02sub_78E1 - ret z - jp c, ErrDomain - call page0_170F - jr c, p02loc_782C - jr nz, p02loc_786F - ld a, (OP1M) - cp 70h ; 'p' - jr nc, p02loc_7846 - -p02loc_782C: - call OP2Set1 - call ClrOP1S - and 80h ; '�' - push af - -p02loc_7835: - or 80h ; '�' - ld b, a - call DecO1Exp - call page0_FB5 - ld a, b - call p02sub_76B4 - pop af - jp p02loc_78DB -; --------------------------------------------------------------------------- - -p02loc_7846: - call Page02_3879 - call fpdiv - call LnX - jp TimesPt5 -; End of function ATanH - - -; =============== S U B R O U T I N E ======================================= - - -Page02_3879: - call OP1ToOP4 - call InvOP1S - call Plus1 - call OP1ExOP4 - call Plus1 - jp OP4ToOP2 -; End of function Page02_3879 - - -; =============== S U B R O U T I N E ======================================= - - -ASinH: - call ClrOP1S - and 80h ; '�' - push af - ld a, (OP1+1) - jr p02loc_7885 -; End of function ASinH - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR ATanH - -p02loc_786F: - jp ErrDomain -; END OF FUNCTION CHUNK FOR ATanH - -; =============== S U B R O U T I N E ======================================= - - -ACosH: - call CkOP1FP0 - jr z, p02loc_7882 - call errd_op1notpos - ld a, 1 - push af - call GETEXP - jr nc, p02loc_7885 - -p02loc_7882: - jp ErrDomain -; --------------------------------------------------------------------------- - -p02loc_7885: - sub 90h ; '�' - jr c, p02loc_7894 - rst 8 - jr p02loc_78C4 -; --------------------------------------------------------------------------- - -p02loc_788C: - call FPSquare - call Plus1 - jr p02loc_78AF -; --------------------------------------------------------------------------- - -p02loc_7894: - call OP1ToOP5 - pop af - push af - and 1 - jr z, p02loc_788C - call Plus1 - call OP1ToOP3 - call OP5ToOP1 - call Minus1 - call OP3ToOP2 - call FPMult - -p02loc_78AF: - call SqRoot - call OP5ToOP2 - pop af - push af - bit 0, a - call z, OP1ExOP2 - call GETEXP - jr nc, p02loc_78C4 - jp p02loc_7835 -; --------------------------------------------------------------------------- - -p02loc_78C4: - rst 30h - call LnX - pop af - jp p02loc_78DB -; End of function ACosH - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_78CC: - ld a, (OP5) - or a - call m, INCO1EXP -; End of function p02sub_78CC - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_78D3: - ; p02sub_7397+164p - xor a - ld (OP1), a - call LJRND - ret -; End of function p02sub_78D3 - -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR SinH - -p02loc_78DB: - and 80h ; '�' - ld (OP1), a - ret -; END OF FUNCTION CHUNK FOR SinH - -; =============== S U B R O U T I N E ======================================= - - -p02sub_78E1: - call CkOP1FP0 - ret z - call GETEXP - jr c, p02loc_78F3 - cp 80h ; '�' - jr nz, p02loc_78F7 - call IsOP1One - jr nz, p02loc_78F7 - -p02loc_78F3: - ld a, 1 - or a - ret -; --------------------------------------------------------------------------- - -p02loc_78F7: - call OP2Set0 - ld a, 1 - cp 2 - ret -; End of function p02sub_78E1 - - -; =============== S U B R O U T I N E ======================================= - - -Page02_387F: - push hl - ld a, (hl) - and 1Fh - call Page0Call_2407 - ld de, 9 - call page0_17B3 - jr z, p02loc_7915 - dec hl - ld a, (hl) - inc hl - cp 5Dh ; ']' - jr nz, p02loc_791A - -p02loc_7915: - ld a, 6 - add a, (hl) - inc a - ld e, a - -p02loc_791A: - pop hl - ret -; End of function Page02_387F - -; --------------------------------------------------------------------------- - -Page02_3885: - ld (unk_83F1), hl - ld a, (hl) - and 1Fh - push hl - dec hl - dec hl - dec hl - ld e, (hl) - dec hl - ld d, (hl) - ex de, hl - ld (unk_83F3), hl - call DataSize - ld (unk_83F7), de - ld hl, (unk_83F9) - add hl, de - ex de, hl - pop hl - push hl - push de - call Page02_387F - ld (unk_83F5), de - pop hl - add hl, de - ld (unk_83F9), hl - pop hl - ret -; --------------------------------------------------------------------------- - -Page02_388B: - ld hl, {+}-(100*2) - ld e, a - ld d, 0 - add hl, de - add hl, de - call ldHLind - jp (hl) -+: .dw p02loc_7A70 - .dw p02loc_7A7B - .dw p02loc_7A02 - .dw p02loc_7A0B - .dw p02loc_7A11 - .dw p02loc_7A1A - .dw ErrSyntax - .dw p02loc_799E - .dw p02loc_79C1 - .dw p02loc_7A20 - .dw p02loc_7A24 - .dw p02loc_7A28 - .dw p02loc_7A2C - .dw p02loc_79E0 - .dw p02loc_79E9 - .dw p02loc_79F6 - .dw p02loc_79FC - .dw p02loc_7A61 - .dw p02loc_7A86 - .dw p02loc_7A30 - .dw p02loc_7A35 - .dw p02loc_7A3A - .dw p02loc_7A3F - .dw p02loc_7A8D - .dw p02loc_7AA3 - .dw p02loc_7AAC - .dw p02loc_7AB3 - .dw p02loc_7ABA - .dw p02loc_7AC1 - .dw p02loc_7AC8 - .dw p02loc_7ACD - .dw p02loc_7A44 - .dw p02loc_7A5D - .dw p02loc_7A50 - .dw p02loc_7A4C - .dw p02loc_7A48 -p02loc_799E: - call Bit_VertSplit - jr nz, p02loc_79A8 - bit grfSplit, (iy+sGrFlags) - ret nz - -p02loc_79A8: - set grfSplit, (iy+sGrFlags) - res vertSplit, (iy+sGrFlags) - set grfSChanged, (iy+sGrFlags) - call Page0Call_3831 - call RESETWINTOP - call REGCLRCHNG - call j_RunIndicOn - ret -p02loc_79C1: - call Bit_VertSplit - jr nz, p02loc_79CB - bit grfSplit, (iy+sGrFlags) - ret z - -p02loc_79CB: - res vertSplit, (iy+sGrFlags) - res grfSplit, (iy+sGrFlags) - call Page0Call_3831 - call RESETWINTOP - call p02sub_79E4 - call Page0Call_3837 - ret -p02loc_79E0: - res autoFill, (iy+tblFlags) -p02sub_79E4: - set reTable, (iy+tblFlags) - ret -p02loc_79E9: - bit autoFill, (iy+tblFlags) - call z, Page0Call_383D - set autoFill, (iy+tblFlags) - jr p02sub_79E4 -p02loc_79F6: - res autoCalc, (iy+tblFlags) - jr p02sub_79E4 -p02loc_79FC: - set autoCalc, (iy+tblFlags) - jr p02sub_79E4 -p02loc_7A02: - res fmtExponent, (iy+fmtFlags) -p02loc_7A06: - res fmtEng, (iy+fmtFlags) - ret -p02loc_7A0B: - set fmtExponent, (iy+fmtFlags) - jr p02loc_7A06 -p02loc_7A11: - set fmtExponent, (iy+fmtFlags) - set fmtEng, (iy+fmtFlags) - ret -p02loc_7A1A: - ld a, 0FFh - ld (fmtDigits), a - ret -p02loc_7A20: - call j_SetFuncM - ret -p02loc_7A24: - call j_SetParM - ret -p02loc_7A28: - call j_SetPolM - ret -p02loc_7A2C: - call j_SetSeqM - ret -p02loc_7A30: - set grfPolar, (iy+grfDBFlags) - ret -p02loc_7A35: - res grfPolar, (iy+grfDBFlags) - ret -p02loc_7A3A: - res grfNoCoord, (iy+grfDBFlags) - ret -p02loc_7A3F: - set grfNoCoord, (iy+grfDBFlags) - ret -p02loc_7A44: - ld b, 1 - jr p02loc_7A52 -p02loc_7A48: - ld b, 10h - jr p02loc_7A52 -p02loc_7A4C: - ld b, 8 - jr p02loc_7A52 -p02loc_7A50: - ld b, 4 -p02loc_7A52: - ld a, (iy+0Fh) - and 80h ; '�' - or b - ld (iy+0Fh), a - jr p02loc_7A6D -p02loc_7A5D: - ld b, 0 - jr p02loc_7A52 -p02loc_7A61: - ld a, (iy+4) - res 1, a -p02loc_7A66: - cp (iy+4) - ret z - ld (iy+4), a -p02loc_7A6D: - jp SetTblGraphDraw -p02loc_7A70: - bit trigDeg, (iy+trigFlags) - ret z - res trigDeg, (iy+trigFlags) - jr p02loc_7A6D -p02loc_7A7B: - bit trigDeg, (iy+trigFlags) - ret nz - set trigDeg, (iy+trigFlags) - jr p02loc_7A6D -p02loc_7A86: - ld a, (iy+4) - set 1, a - jr p02loc_7A66 -p02loc_7A8D: - ld a, (iy+4) - res 0, a - ld b, 0 -p02loc_7A94: - ld (iy+4), a - ld a, b - ld b, 19h - ld hl, y1LineType -p02loc_7A9D: - ld (hl), a - inc hl - djnz p02loc_7A9D - jr p02loc_7A6D -p02loc_7AA3: - ld a, (iy+4) - set 0, a - ld b, 6 - jr p02loc_7A94 -p02loc_7AAC: - ld a, (iy+4) - res 5, a - jr p02loc_7A66 -p02loc_7AB3: - ld a, (iy+4) - set 5, a - jr p02loc_7A66 -p02loc_7ABA: - ld a, (iy+4) - set 2, a - jr p02loc_7A66 -p02loc_7AC1: - ld a, (iy+4) - res 2, a - jr p02loc_7A66 -p02loc_7AC8: - set grfLabel, (iy+grfDBFlags) - ret -p02loc_7ACD: - res grfLabel, (iy+grfDBFlags) - ret -YONOFF: - push af - push bc - rst 18h - pop bc - ld hl, (FPS) - ld a, (numArguments) - ld c, b - ld b, a - -p02loc_7ADE: - push bc - bit 0, c - push af - ld de, 0FFF7h - add hl, de - push hl - rst 20h - call EOP1NotReal - ld (OP1+9), a - pop hl - pop af - push hl - push af - jr nz, p02loc_7AF9 - call IsFuncMode - jr nz, p02loc_7AFC - -p02loc_7AF9: - call ErrD_OP1_0 - -p02loc_7AFC: - ld a, (OP1+1) - cp 80h ; '�' - jp nz, ErrDomain - call ErrD_OP1NotPosDoInt - ld b, 4 - pop af - jr nz, p02loc_7B1C - ld b, 0Ah - call IsFuncMode - jr nz, p02loc_7B1C - ld b, 3 - call IsRecursiveMode - jr nz, p02loc_7B1C - ld b, 7 - -p02loc_7B1C: - ld a, (OP1M) - call ShRAcc - cp b - jp nc, ErrDomain - pop hl - ld (hl), a - pop bc - djnz p02loc_7ADE - ld a, (numArguments) - ld b, a - -p02loc_7B2F: - push bc - bit 0, c - jr z, p02loc_7B5E - call FPOPREAL - ld a, (hl) - ld hl, 92C8h - ld b, a - xor a - -p02loc_7B3D: - add a, 11h - djnz p02loc_7B3D - ld e, a - ld d, 0 - add hl, de - pop bc - pop af - push af - push bc - jr c, p02loc_7B53 - bit 0, (hl) - jr z, p02loc_7B91 - res 0, (hl) - jr p02loc_7B59 -; --------------------------------------------------------------------------- - -p02loc_7B53: - bit 0, (hl) - jr nz, p02loc_7B91 - set 0, (hl) - -p02loc_7B59: - call SetTblGraphDraw - jr p02loc_7B91 -; --------------------------------------------------------------------------- - -p02loc_7B5E: - call FPOPREAL - ld a, (hl) - or a - jr nz, p02loc_7B67 - ld a, 0Ah - -p02loc_7B67: - call Page0Call_385B - rst 10h - ex de, hl - ld a, (hl) - inc hl - or (hl) - jr z, p02loc_7B91 - call IsParametricMode - jr z, p02loc_7B89 - push de - call page0_17E0 - rst 10h - ex de, hl - ld a, (hl) - inc hl - or (hl) - pop hl - jr z, p02loc_7B91 - pop bc - pop af - push af - push bc - call EQSELUNSEL - -p02loc_7B89: - ex de, hl - pop bc - pop af - push af - push bc - call EQSELUNSEL - -p02loc_7B91: - pop bc - djnz p02loc_7B2F - pop af - ret - -; =============== S U B R O U T I N E ======================================= - - -EQSELUNSEL: - jr c, p02loc_7BAB - bit 5, (hl) - ret z - res 5, (hl) - call IsRecursiveMode - jr nz, p02loc_7BC5 - bit 3, (hl) - ret nz - set smarter_test, (iy+smartFlags) - jr p02loc_7BC5 -; --------------------------------------------------------------------------- - -p02loc_7BAB: - bit 5, (hl) - ret nz - set 5, (hl) - call IsRecursiveMode - jr nz, p02loc_7BC5 - bit smarter_test, (iy+smartFlags) - jr nz, p02loc_7BC5 - ld a, (hl) - and 0E0h ; '�' - or 0Bh - ld (hl), a - set smartGraph, (iy+smartFlags) - -p02loc_7BC5: - ; EQSELUNSEL+13j ... - jp SetTblGraphDrawPreserveSmartTest -; End of function EQSELUNSEL - - -; =============== S U B R O U T I N E ======================================= - - -p02sub_7BC8: - bit 6, (iy+7) - jp nz, Page0Call_2501 - call j_FORSEQINIT - call cpop1op2 - jr z, p02loc_7BE8 - push af - ld a, (OP3) - and 80h ; '�' - jr nz, p02loc_7BE5 - pop af - jr c, p02loc_7BE8 - -p02loc_7BE2: - jp ErrIncrement -; --------------------------------------------------------------------------- - -p02loc_7BE5: - pop af - jr c, p02loc_7BE2 - -p02loc_7BE8: - call j_SAVEPARSE - ld hl, 0 - call CreateTempRList - call PushRealO4 - call SETesTOfps - call CPYTO1ES5 - call j_SAVEDATA - set 6, (iy+7) - ld hl, p02loc_7CA3 - call pushErrorHandleR - call OP2Set0 - call PushRealO2 - call j_StoOther - call CPYTO1ES4 - -p02loc_7C13: - rst 8 - call CPYTO1ES5 - rst 10h - ld hl, OP2 - call mov9B2 - call CPYTO1ES6 - ld hl, (pTempCnt) - push hl - call j_PARSEOFF - pop hl - ld (pTempCnt), hl - call page0_1717 - call SETesTOfps - call EOP1NotReal - call CkValidNum - call OP1ToOP6 - call CPYTO1EST - rst 10h - ld a, 1 - call j_IncLstSize - call AdrLEle - ex de, hl - ld hl, OP6 - call mov9B2 - call CPYTO1ES4 - call CPYTO2ES2 - call ckop2pos - push af - rst 30h - call CPYTO2ES4 - call CPYO1TOES4 - call cpop1op2 - jp z, p02loc_7BE2 - call CPYTO1ES4 - call CPYTO2ES3 - call cpop1op2 - jr z, p02loc_7C9C - jr c, p02loc_7C77 - pop af - jr z, p02loc_7C7A - jr p02loc_7C9D -; --------------------------------------------------------------------------- - -p02loc_7C77: - pop af - jr z, p02loc_7C9D - -p02loc_7C7A: - call popErrorHandleR - res 6, (iy+7) - call CPYTO1ES5 - call j_RESTOREDATA - call CPYTO1ES1 - call j_GETPARSE - call CPYTO1ES6 - call markTableDirty - call CPYTO1EST - ld de, 3Fh ; '?' - jp DeallocFPS1 -; --------------------------------------------------------------------------- - -p02loc_7C9C: - pop af - -p02loc_7C9D: - call CPYTO1ES4 - jp p02loc_7C13 - -p02loc_7CA3: - res 6, (iy+7) - call CpyTo1FPS5 - jp RESTOREERRNO diff -r f4f75ec42b53 -r 78c162ac1d82 source/page02/list_matrix.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/page02/list_matrix.asm Mon Jun 02 01:03:33 2014 -0400 @@ -0,0 +1,3752 @@ +AdrMRow: + ld c, 1 +AdrMEle: + ld a, b + or a + jr nz, p02loc_400B +p02loc_4006: + ld a, 78h + jp JError +p02loc_400B: + ld a, c + or a + jr z, p02loc_4006 + ld a, (de) + ld l, a + inc de + inc de + xor a + ld h, a + jr p02loc_401B +p02loc_4017: + add a, l + jr nc, p02loc_401B + inc h +p02loc_401B: + djnz p02loc_4017 + dec c + add a, c + jr nc, p02loc_4022 + inc h +p02loc_4022: + ld l, a + call HLTimes9 + add hl, de + ret + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;I don't think this is necessary. + ld bc, (OP6+8) +#endif + +GETMATOP1A: + ld de, (iMathPtr3) + jr GetMToOP1 + +p02sub_4032: + ld bc, (OP6+4) + ld de, (iMathPtr2) + jr GetMToOP1 + +GETM1TOOP1: + ld bc, (OP6) +GETM1TOP1A: + ld de, (iMathPtr1) +GetMToOP1: + call AdrMEle + rst 20h + ret + +p02sub_4049: + ld bc, (OP6+4) +p02sub_404D: + ld de, (iMathPtr2) +p02loc_4051: + call AdrMEle + ld de, OP2 + jp mov9B2 + +p02sub_405A: + ld bc, (OP6) +PUTTOM1A: + ld de, (iMathPtr1) + jr PutToMat + +p02sub_4064: + ld bc, (OP6+8) +PUTTOMA1: + ld de, (iMathPtr3) +PutToMat: + call AdrMEle + push hl + call CkValidNum + pop de + jp MovFrOP1 + +p02sub_4077: + ld bc, (OP6) + call PUTTOMA1 +p02loc_407E: + ld hl, OP6 + dec (hl) + ret nz + ld a, (OP6+8) + ld (hl), a + inc hl + dec (hl) + ret + +p02sub_408A: + ld a, 1 + jr p02loc_408F + +p02sub_408E: + xor a +p02loc_408F: + or a +MAT_EL_DIV: + push af +p02loc_4091: + call GETM1TOOP1 + ld bc, (OP6) + call p02sub_404D + pop af + jr nc, p02loc_40A4 + push af + call fpdiv + jr p02loc_40AD +p02loc_40A4: + push af + call z, FPAdd + pop af + push af + call nz, FPSub +p02loc_40AD: + call p02sub_4077 + ld hl, (OP6) + ld (OP6+4), hl + jr nz, p02loc_4091 + pop af + ret + +p02sub_40BA: + ld hl, (OP6+8) + push hl + ld bc, (OP6+4) + push bc +p02loc_40C3: + call OP1Set0 +p02loc_40C6: + call OP1ToOP5 + call GETM1TOOP1 + call p02sub_4049 + call FPMult + call OP5ToOP2 + rst 30h + pop bc + push bc + ld hl, OP6 + dec (hl) + push hl + ld hl, OP6+4+1 + dec (hl) + pop de + jr nz, p02loc_40C6 + ld (hl), b + dec hl + dec (hl) + ex de, hl + ld (hl), b + jr nz, p02loc_40EF + inc hl + dec (hl) + ex de, hl + ld (hl), c +p02loc_40EF: + call p02sub_4064 + ld hl, 84B7h + dec (hl) + jr nz, p02loc_40C3 + pop bc + push bc + ld (hl), c + inc hl + dec (hl) + jr nz, p02loc_40C3 + pop bc + pop bc + ret + +p02sub_4102: + ld bc, (OP6+8) + ld (OP6), bc + call OP1Set1 +p02loc_410D: + call p02sub_4077 + ret z + ld hl, OP1M + ld (hl), 0 + ld a, (OP6) + ld b, a + ld a, (OP6+1) + cp b + jr nz, p02loc_410D + ld (hl), 10h + jr p02loc_410D + +p02sub_4124: + ld hl, (OP6) + push hl +p02loc_4128: + call GETM1TOOP1 + ld hl, (OP6) + ld b, l + ld c, h + call PUTTOMA1 + ld hl, OP6 + dec (hl) + jr nz, p02loc_4128 + pop bc + push bc + ld (hl), c + inc hl + dec (hl) + jr nz, p02loc_4128 + pop hl + ld b, l + ld c, h + ret + +p02sub_4144: + ld de, (iMathPtr3) +p02sub_4148: + ld a, (de) + ld l, a + ld h, 0 + call HLTimes9 + push hl + ld a, (OP6+4) + ld b, a + push de + call AdrMRow + pop de + push hl + ld a, (OP6+4+1) + ld b, a + call AdrMRow + pop de + pop bc +p02loc_4163: + push bc + ld b, c + call ExLp + pop bc + dec b + ret m + ld c, 0 + jr p02loc_4163 + +p02sub_416F: + xor a + jr p02loc_4179 + +p02sub_4172: + ld a, 1 +p02loc_4174: + push af + call OP1ToOP5 + pop af +p02loc_4179: + ld (OP6), a + ld a, (OP6+8) + ld (OP6+6), a +p02loc_4182: + ld hl, OP6+4 + ld b, (hl) + inc hl + inc hl + ld c, (hl) + push bc + call GETMATOP1A + ld a, (OP6) + sub 1 + jr c, p02loc_419E + push af + call OP5ToOP2 + call FPMult + pop af + jr nz, p02loc_41A9 +p02loc_419E: + rst 8 + pop bc + ld a, (OP6+4+1) + ld b, a + push bc + call GETMATOP1A + rst 30h +p02loc_41A9: + pop bc + call PUTTOMA1 + ld hl, OP6+6 + dec (hl) + jr nz, p02loc_4182 + ret + +p02sub_41B4: + ld a, 2 + jr p02loc_4174 + +p02sub_41B8: + call OP1ToOP3 + call CpyTo2FPST + call AbsO1O2Cp + push af + call OP3ToOP1 + pop af + ret + +p02sub_41C7: + push af + push bc + call GETM1TOOP1 + call ClrOP1S + call OP1ToOP3 +p02loc_41D2: + ld a, (OP6+1) + pop bc + cp c + jr nz, p02loc_41DB + pop af + ret +p02loc_41DB: + push bc + inc a + ld (OP6+1), a + call GETM1TOOP1 + call OP3ToOP2 + call AbsO1O2Cp + jr c, p02loc_41D2 + jr z, p02loc_41D2 + call GETM1TOOP1 + call ClrOP1S + call OP1ToOP3 + pop bc + pop af + xor 1 + push af + push bc + ld c, b + ld b, a + ld a, (OP6+1) + call p02sub_43C3 + jr p02loc_41D2 + +p02loc_4206: + push bc + ld hl, (iMathPtr2) + inc hl + inc hl + ld c, b + ld b, 0 + add hl, bc + dec hl + ld b, c +p02loc_4212: + ld a, (hl) + cp b + jr nz, p02loc_421B + dec hl + djnz p02loc_4212 + pop bc + ret + +p02loc_421B: + ld a, b +p02loc_421C: + dec hl + dec b + cp (hl) + jr nz, p02loc_421C + ld c, a + push bc + ld a, b + call p02sub_4250 + pop bc + pop af + push af +p02loc_422A: + push af + push bc + ld b, a + ld de, (iMathPtr1) + call AdrMEle + pop bc + pop af + push af + push bc + ld c, b + ld b, a + push hl + ld de, (iMathPtr1) + call AdrMEle + pop de + ld b, 9 + call ExLp + pop bc + pop af + dec a + jr nz, p02loc_422A + pop bc + jr p02loc_4206 + +p02sub_4250: + ld d, 0 + ld e, a + ld hl, (iMathPtr2) + inc hl + add hl, de + push hl + sbc hl, de + ld e, c + add hl, de + pop de + ld a, (de) + ld b, (hl) + ld (hl), a + ld a, b + ld (de), a + ret + +p02sub_4264: + ld a, 1 +p02sub_4266: + ld (OP6+4), a + call OP1Set0 +p02sub_426C: + ld hl, OP6+4 +p02loc_426F: + ld c, (hl) + ld a, (OP6+1) + ld b, a + ld a, (OP6+4+1) + cp (hl) + ret c + push bc + call OP1ToOP5 + pop bc + call GETM1TOP1A + ld bc, (OP6) + ld a, (OP6+4) + ld b, a + ld de, (iMathPtr1) + call p02loc_4051 + call FPMult + call OP5ToOP2 + rst 30h + ld hl, OP6+4 + inc (hl) + jr p02loc_426F + +p02sub_429D: + push af + ld hl, (OP6) + ld a, h + cp l + jp nz, ErrDimension + cp 1 + jr nz, p02loc_42B6 + call GETM1TOOP1 + pop af + or a + ret nz + call fprecip + jp p02sub_405A +p02loc_42B6: + push hl + ld hl, (OP6) + push hl + call p02sub_4608 + pop hl + ld (OP6), hl + ld (OP6+8), hl + ld h, 0 + call j_SetXXXXOP2 + call FPMult + call OP2Set3 + ld a, 73h + ld (OP2+1), a + call FPMult + call PushRealO1 + pop hl + pop af + push hl + push af + or a + jr nz, p02loc_42EF + ld c, h + ld b, 0 + ld hl, (iMathPtr2) + inc hl + add hl, bc + ld b, c +p02loc_42EB: + ld (hl), b + dec hl + djnz p02loc_42EB +p02loc_42EF: + ld bc, 0 + ld (OP6), bc +p02loc_42F6: + pop af +p02loc_42F7: + pop hl + push hl + and 6Fh + push af + ld c, b + inc c + ld a, b + ld b, c + ld (OP6+4+1), a +p02loc_4303: + ld (OP6), bc + pop af + push af + bit 5, a + jr z, p02loc_4323 + bit 7, a + jr nz, p02loc_431A + call OP1Set1 + pop af + set 7, a + push af + jr p02loc_4346 +p02loc_431A: + ld a, c + call p02sub_4266 + call InvOP1S + jr p02loc_4346 +p02loc_4323: + call p02sub_4264 + call p02sub_447D + pop af + bit 4, a + jr nz, p02loc_4345 + or a + set 7, a + push af + call p02sub_405A +p02loc_4335: + pop af + pop hl + push hl + push af + ld l, a + ld bc, (OP6) + ld a, h + cp b + jr z, p02loc_4373 + inc b + jr p02loc_4303 +p02loc_4345: + push af +p02loc_4346: + ld bc, (OP6) + ld c, b + ld de, (iMathPtr1) + call p02loc_4051 + call fpdiv + call p02sub_405A + pop bc + pop hl + push hl + push bc + bit 5, b + jr z, p02loc_4366 + ld hl, OP6+4+1 + inc (hl) + jr p02loc_4335 +p02loc_4366: + ld a, h + ld bc, (OP6) + cp c + jp z, p02loc_42F6 + inc c +p02loc_4370: + jp p02loc_4303 +p02loc_4373: + cp c + jr z, p02loc_437F + pop af + bit 5, a + jr z, p02loc_438E + ld b, c + jp p02loc_42F7 +p02loc_437F: + pop af + push af + bit 5, a + jp nz, p02loc_43E2 + call p02sub_41B8 + jr c, p02loc_43AB + jp p02loc_43E2 +p02loc_438E: + or 10h + push bc + push af + ld a, b + ld b, c + ld (OP6), bc + ld c, a + pop af + call p02sub_41C7 + push af + call OP3ToOP1 + call CkOP1FP0 + jr z, p02loc_43AB + call p02sub_41B8 + jr nc, p02loc_43B9 +p02loc_43AB: + pop af + pop bc + bit 6, a + jp z, ErrSingularMat + pop af + call FPOPREAL + jp OP1Set0 +p02loc_43B9: + pop af + pop bc + push af + ld b, c + inc c + and 8 + jp p02loc_4370 + +p02sub_43C3: + bit 6, b + call z, p02sub_4250 + ld de, (iMathPtr1) + ld a, c + ld (OP6+4), a + ld a, (OP6+4+1) + push af + ld a, (OP6+1) + ld (OP6+4+1), a + call p02sub_4148 + pop af + ld (OP6+4+1), a + ret +p02loc_43E2: + pop af + bit 6, a + jr z, p02loc_4409 + push af + call FPOPREAL + pop af + pop hl + push af + call OP1Set1 +p02loc_43F1: + rst 8 + call GETM1TOOP1 + call FPMult + ld hl, 84B0h + dec (hl) + jr z, p02loc_4402 + dec hl + dec (hl) + jr p02loc_43F1 +p02loc_4402: + pop af + and 1 + jp nz, InvOP1S + ret +p02loc_4409: + pop hl + push hl + bit 5, a + jr nz, p02loc_4417 + set 5, a + ld bc, 0 + jp p02loc_42F7 +p02loc_4417: + call FPOPREAL +p02loc_441A: + pop hl + push hl + ld bc, (OP6) + dec b + jr z, p02loc_4446 + ld c, h +p02loc_4424: + ld (OP6), bc + ld l, b + inc l + ld h, c + dec h + ld (OP6+4), hl + call GETM1TOOP1 + call p02sub_426C + call InvOP1S + call p02sub_405A + ld bc, (OP6) + dec c + ld a, c + cp b + jr z, p02loc_441A + jr p02loc_4424 +p02loc_4446: + ld b, 1 + pop af + push af + ld (OP6+4+1), a +p02loc_444D: + ld c, 1 +p02loc_444F: + call OP1Set0 + ld (OP6), bc + ld a, c + inc b + cp b + jr nc, p02loc_445C + ld a, b +p02loc_445C: + ld (OP6+4), a + call c, GETM1TOOP1 + call p02sub_426C + call p02sub_405A + ld bc, (OP6) + ld a, (OP6+4+1) + cp c + jr z, p02loc_4475 + inc c + jr p02loc_444F +p02loc_4475: + inc b + cp b + jr nz, p02loc_444D + pop bc + jp p02loc_4206 + +p02sub_447D: + rst 8 + call GETM1TOOP1 + jp FPSub + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;I don't think this is necessary. + ld a, 0Ah + jr CMATFUN +#endif + +p02sub_4488: + ld (OP6+4+1), a + ld a, 9 + jr CMATFUN + +CMATFUN:ld (OP6+4), a +p02loc_4492: + call GETM1TOOP1 + call p02sub_449E + call p02sub_4077 + jr nz, p02loc_4492 + ret + +p02sub_449E: + ld a, (OP6+4) + cp 4 + jp z, ClrOP1S + cp 6 + jp c, InvOP1S + jp z, Trunc + cp 8 + jp c, frac + jp z, DoInt + cp 0Ah + jp z, FPSquare + ld a, (OP6+4+1) + ld d, a + cp 80h + jp nz, Round + call RndGuard + ret + +p02sub_44C8: + ld a, (OP6) + ld (OP6+8), a +p02loc_44CE: + call p02sub_4077 + jr nz, p02loc_44CE + ret + +p02sub_44D4: + ld a, (OP6+8) + ld b, a + ld a, (OP6+4) + ld c, a + push bc +p02loc_44DD: + call p02sub_4032 + call p02sub_4064 + ld a, (OP6+8) + dec a + ld (OP6+8), a + ld a, (OP6+4) + dec a + jr z, p02loc_44F5 + ld (OP6+4), a + jr p02loc_44DD +p02loc_44F5: + ld bc, (OP6+8) + call GETM1TOP1A + call p02sub_4064 + ld hl, (OP6+8) + dec l + jr z, p02loc_450A + ld (OP6+8), hl + jr p02loc_44F5 +p02loc_450A: + pop bc + dec h + ret z + ld l, c + ld (OP6+4), hl + ld l, b + ld (OP6+8), hl + push bc + jr p02loc_44DD + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;I don't think this is necessary. + ld a, 1 +#endif + +p02sub_451A: + ld de, (iMathPtr3) + jr p02loc_452B +p02sub_4520: + ld hl, (iMathPtr1) + inc hl + inc hl +p02sub_4525: + ld de, (iMathPtr3) +p02sub_4529: + ld a, 2 +p02loc_452B: + inc de + inc de + push de + ld hl, (iMathPtr1) + call DataSize + ld b, d + ld c, e + dec bc + dec bc + inc hl + inc hl + pop de + ldir + ret + +p02loc_453E: + call ErrD_OP1NotPosDoInt + call j_ConvOP1 + ld hl, 0FFh + or a + sbc hl, de + jp c, ErrDomain + ld a, e + push af + call OP3ToOP1 + call p02sub_59D5 + push af + ld a, h + cp l + jp nz, ErrDimension + pop af + jr z, p02loc_4566 + call p02sub_5A17 + call p02sub_4525 + jr p02loc_4569 +p02loc_4566: + call PushRealO4 +p02loc_4569: + ld hl, (OP6) + pop af + or a + jr nz, p02loc_4579 + ld (OP6+8), hl + call p02sub_4102 + jp PopRealO1 +p02loc_4579: + ld d, a + ld b, 8 +p02loc_457C: + dec b + rla + jr nc, p02loc_457C + push bc + push de + ld hl, (iMathPtr3) + ld (iMathPtr1), hl + ld (iMathPtr2), hl + ld hl, (OP6) + push hl + call p02sub_5A1D + call p02sub_5936 + ld bc, 100h +p02loc_4598: + pop hl + pop af + push af + and b + jr nz, p02loc_45A9 + push hl + push bc + call p02sub_45EB + pop bc + inc c + sla b + jr p02loc_4598 +p02loc_45A9: + push bc + push hl + call CreateTempRMat + ld (iMathPtr4), de + call p02sub_4529 + call PushRealO4 +p02loc_45B8: + pop hl + pop bc +p02loc_45BA: + pop de + pop af + cp c + jr nz, p02loc_45CB + call PopRealO2 + call CpyTo1FPST + call CpyO2ToFPST + jp p02loc_5B6B +p02loc_45CB: + push af + push de + push bc + push hl + call p02sub_45EB + pop hl + pop bc + pop af + push af + inc c + sla b + and b + jr z, p02loc_45BA + push bc + push hl + ld de, (iMathPtr4) + ld (iMathPtr1), de + call p02sub_45EE + jr p02loc_45B8 + +p02sub_45EB: + call CHKERRBREAK +p02sub_45EE: + call p02sub_53F1 + call p02sub_40BA + ld hl, (iMathPtr3) + ld de, (iMathPtr1) + ld (iMathPtr1), hl + call p02sub_4529 + ld hl, (iMathPtr2) + ld (iMathPtr1), hl + ret + +p02sub_4608: + ld a, (OP6) + ld (OP6+8), a + call OP1Set0 + call PushRealO1 +p02loc_4614: + rst 8 + call GETM1TOOP1 + call FPAdd_AbsoluteValues + ld a, (OP6) + cp 1 + jr nz, p02loc_4631 + call CpyTo2FPST + call OP1ToOP3 + call cpop1op2 + call nc, CpyO3ToFPST + call OP1Set0 +p02loc_4631: + call p02loc_407E + jr nz, p02loc_4614 + jp PopRealO1 + +ROWECH_POLY: + push af + ld hl, (OP6) + push hl + ld l, h + ld (OP6), hl + call p02sub_4608 + pop hl + ld (OP6), hl + ld (OP6+8), hl + ld l, h + jr p02loc_4663 + +ROWECHELON: + push af + ld hl, (OP6) + push hl + call p02sub_4608 + pop hl + ld (OP6), hl + ld (OP6+8), hl + ld a, h + cp l + jr c, p02loc_4663 + ld l, h +p02loc_4663: + ld h, 0 + call j_SetXXXXOP2 + call FPMult + call OP2Set3 + ld a, 73h + ld (OP2+1), a + call FPMult + rst 18h + ld bc, 101h +p02loc_467A: + ld (OP6), bc + push bc + ld a, (OP6+1) + ld b, a + ld a, (OP6+8+1) + ld c, a + set 6, a + call p02sub_41C7 + call CpyTo2FPST + call OP3ToOP1 + call cpop1op2 + pop bc + push bc + jr c, p02loc_469B + jr nz, p02loc_46AE +p02loc_469B: + push bc + call OP1Set0 + call PUTTOM1A + pop bc + inc b + ld a, (OP6+8+1) + cp b + jr nc, p02loc_469B + pop bc + jp p02loc_470A +p02loc_46AE: + ld (OP6), bc + call GETM1TOOP1 + rst 18h + pop bc +p02loc_46B7: + push bc + ld de, (iMathPtr1) + call GetMToOP1 + call CpyTo2FPST + call fpdiv + pop bc + push bc + call PUTTOM1A + pop bc + inc c + jr z, p02loc_46D4 + ld a, (OP6+8) + cp c + jr nc, p02loc_46B7 +p02loc_46D4: + call PopRealO1 + pop af + push af + jr c, p02loc_46EC + ld a, 1 + ld hl, OP6+4+1 + ld (hl), a +p02loc_46E1: + ld a, (OP6+1) + cp (hl) + jr z, p02loc_46EC + call p02sub_4719 + jr p02loc_46E1 +p02loc_46EC: + ld a, (OP6+1) + inc a + ld hl, OP6+4+1 + ld (hl), a +p02loc_46F4: + ld a, (OP6+8+1) + cp (hl) + jr c, p02loc_46FF + call p02sub_4719 + jr p02loc_46F4 +p02loc_46FF: + ld bc, (OP6) + inc b + ld a, (OP6+8+1) + cp b + jr c, p02loc_4714 +p02loc_470A: + ld a, (OP6+8) + inc c + jr z, p02loc_4714 + cp c + jp nc, p02loc_467A +p02loc_4714: + call FPOPREAL + pop af + ret + +p02sub_4719: + ld a, (OP6+8) + ld (OP6+4), a +p02loc_471F: + ld bc, (OP6) + ld a, (OP6+4) + ld c, a + call GETM1TOP1A + rst 8 + ld bc, (OP6) + ld a, (OP6+4+1) + ld b, a + call GETM1TOP1A + call FPMult + call InvOP1S + rst 8 + ld bc, (OP6+4) + call GETM1TOP1A + rst 30h + ld bc, (OP6+4) + call PUTTOM1A + ld hl, OP6+4 + dec (hl) + ld a, (OP6) + cp (hl) + jr c, p02loc_471F + jr z, p02loc_471F + inc hl + inc (hl) + ret + +p02sub_475B: + ld c, 0 +p02loc_475D: + ld a, (OP6) + cp c + ret z + inc c + ld b, 1 + push bc + call GETM1TOP1A +p02loc_4769: + pop bc + push bc + call PUTTOMA1 + pop bc + inc b + ld a, (OP6+1) + cp b + jr c, p02loc_475D + push bc + ld de, (iMathPtr1) + call p02loc_4051 + rst 30h + jr p02loc_4769 + +p02sub_4781: + ld de, (iMathPtr1) +AdrLEle: + inc de + inc de + ld a, (de) + and 0Ch + push af + dec hl + call HLTimes9 + pop af + jr z, p02loc_4793 + add hl, hl +p02loc_4793: + add hl, de + ret + +p02sub_4795: + ld de, (iMathPtr3) + jr GetLToOP1 +GETL1TOOP1: + ld hl, (OP6) +GETL1TOP1A: + ld de, (iMathPtr1) +GetLToOP1: + call AdrLEle + ld de, OP1 +p02loc_47A8: + or a + jr z, p02loc_47F0 + jp MOVCPLX +GETL1TOOP2: + ld hl, (OP6) +GETL1TOP2A: + ld de, (iMathPtr1) +Page02_3B07: + call AdrLEle + ld de, OP2 + jr p02loc_47A8 +p02loc_47BD: + ld hl, (OP6+4) +GETL2TOP1A: + ld de, (iMathPtr2) + jr GetLToOP1 +p02loc_47C6: + ld hl, (OP6) + ld de, (iMathPtr1) + call AdrLEle + ld de, OP3 + jr p02loc_47A8 + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;I don't think this is used. + ld hl, (OP6+8) +#endif + +PUTTOLA1: + ld de, (iMathPtr3) +PutToL: + call AdrLEle + push hl + call CkValidNum + pop de + ld hl, OP1 + ld a, (hl) + call mov9B2 + and 0Ch + ret z + inc hl + inc hl +p02loc_47F0: + jp mov9B2 + +p02sub_47F3: + ld h, 0 + call HLTimes9 + ex de, hl + ld hl, (FPS) + or a + sbc hl, de + rst 20h + ret + +Page02_3B1F: + ld b, 2 + jr p02loc_4807 +Page02_3B25: + ld b, 0 +p02loc_4807: + push bc + ld (OP6+4+1), a + rst 18h + ld l, 1 + xor a + ld (OP6+6), a +p02loc_4812: + push hl + call p02sub_47F3 + call FIND_E_UNDEF + call page0_1641 + jp z, ErrSyntax + cp 5Dh + jp nz, ErrDataType + ld a, (OP1M) + inc a + ld b, a + ld a, 1 + jr p02loc_482E +p02loc_482D: + add a, a +p02loc_482E: + djnz p02loc_482D + ld hl, OP6+6 + ld b, a + and (hl) + jp nz, ErrSyntax + ld a, b + or (hl) + ld (hl), a + call page0_17E6 + pop hl + inc l + ld a, (OP6+4+1) + cp l + jr nc, p02loc_4812 + call FINDSYM_GET_SIZE + ld (iMathPtr1), de + or h + jp z, ErrDimension + ld (OP6), hl + ld l, 1 +p02loc_4856: + ld a, (OP6+4+1) + cp l + jr z, p02loc_4879 + push hl + call p02sub_47F3 + push hl + rst 10h + pop hl + dec hl + ld (hl), d + dec hl + ld (hl), e + ex de, hl + call ldHLind + ld de, (OP6) + or a + sbc hl, de + jp nz, ErrDimMismatch + pop hl + inc l + jr p02loc_4856 +p02loc_4879: + ld bc, (OP6) +p02loc_487D: + or a + ld hl, 1 + sbc hl, bc + jr z, p02loc_48CF + add hl, bc + pop af + push af + push bc + cp 2 + ld a, 1 + jr c, p02loc_4890 + dec a +p02loc_4890: + call MAXMINLST + pop bc + or a + sbc hl, bc + jr z, p02loc_48CC + add hl, bc + push hl + push bc + call p02sub_48DA + ld hl, (iMathPtr1) + ld (iMathPtr2), hl + ld l, 0 +p02loc_48A7: + inc l + ld a, (OP6+4+1) + cp l + jr z, p02loc_48C4 + push hl + call p02sub_47F3 + ld hl, (OP1+7) + ld (iMathPtr1), hl + pop de + pop bc + pop hl + push hl + push bc + push de + call p02sub_48DA + pop hl + jr p02loc_48A7 +p02loc_48C4: + ld hl, (iMathPtr2) + ld (iMathPtr1), hl + pop de + pop de +p02loc_48CC: + dec bc + jr p02loc_487D +p02loc_48CF: + ld a, (OP6+4+1) + ld l, a + ld h, 0 + call DeallocFPS + jr p02loc_48F1 + +p02sub_48DA: + push bc + call p02sub_4781 + ex de, hl + pop hl + push hl + push de + call p02sub_4781 + pop de + ld b, 9 + bit 3, (hl) + jr z, p02loc_48EE + ld b, 12h +p02loc_48EE: + call ExLp +p02loc_48F1: + pop bc + ret + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;I don't think these are used. + xor a + jr MAXMINLST + ld a, 1 +#endif + +MAXMINLST: + ld (OP6+6), a + ld a, (OP6+4+1) + push af + ld (OP6+4), hl + push hl + push bc + call GETL1TOP1A + call CkOP1Cplx + call z, AddSquares + call OP1ToOP5 +p02loc_4910: + pop bc + pop hl +p02loc_4912: + or a + sbc hl, bc + jr nz, p02loc_491F + ld hl, (OP6+4) + pop af + ld (OP6+4+1), a + ret +p02loc_491F: + add hl, bc + inc hl + push hl + push bc + call GETL1TOP1A + call CkOP1Cplx + call z, AddSquares + call OP1ToOP4 + call OP5ToOP2 + ld a, (OP6+6) + or a + jr nz, p02loc_493F + call cpop1op2 + jr nc, p02loc_4910 + jr p02loc_4946 +p02loc_493F: + call cpop1op2 + jr c, p02loc_4910 + jr z, p02loc_4910 +p02loc_4946: + call OP4ToOP5 + pop bc + pop hl + ld (OP6+4), hl + jr p02loc_4912 + +LLOW: + xor a +p02loc_4951: + ld hl, 1 + ld bc, (OP6) + call MAXMINLST + jp GETL1TOP1A +LHIGH: + ld a, 1 + jr p02loc_4951 +p02loc_4962: + call OP1Set1 + ld a, 82h + jr p02loc_496E +LSUM: call OP1Set0 + ld a, 70h +p02loc_496E: + push af +p02loc_496F: + call PushOP1 + call GETL1TOOP1 + pop af + push af + call BinOPExec2 + ld hl, (OP6) + dec hl + ld (OP6), hl + ld de, (OP6M) + call CpHLDE + jr nc, p02loc_496F + pop af + ret + +CUMSUM: + ld hl, 1 + push hl + call GETL1TOP1A +p02loc_4993: + pop hl + push hl + call PUTTOLA1 + pop hl + ld de, (OP6) + call CpHLDE + ret z + inc hl + push hl + call PushOP1 + pop hl + push hl + call GETL1TOP1A + ld a, 70h + call BinOPExec2 + jr p02loc_4993 + +p02sub_49B2: + ld hl, (OP6) +p02loc_49B5: + call PUTTOLA1 + call p02sub_49BE + jr nz, p02loc_49B5 + ret + +p02sub_49BE: + ld hl, (OP6) + dec hl + ld a, h + or l + ld (OP6), hl + ret + +p02sub_49C8: + ld de, 0 + call p02sub_49DF + ld de, (iMathPtr2) + ld (iMathPtr1), de + ld de, (OP6+4) + ld (OP6), de + ex de, hl +p02sub_49DF: + ld hl, 0 +p02loc_49E2: + inc hl + push hl + inc de + push de + call GETL1TOP1A + call page0_184C + jr z, p02loc_49F4 + call CkOP1Cplx + call nz, page0_104B +p02loc_49F4: + pop hl + push hl + call PUTTOLA1 + call p02sub_49BE + pop de + pop hl + ret z + jr p02loc_49E2 + +p02sub_4A01: + ld hl, 1 + push hl +p02loc_4A05: + call p02sub_49BE + pop hl + ret z + inc hl + push hl + call GETL1TOP1A + call PushOP1 + pop hl + push hl + dec hl + push hl + call GETL1TOP1A + ld a, 71h + call BinOPExec2 + pop hl + call PUTTOLA1 + jr p02loc_4A05 + +Page02_3B49: + call j_CKENDLINERR + ld a, 0FFh + call page0_1682 +p02loc_4A2C: + call j_FindAlphaUp + ret c + rst 10h + ret c + call IsBZero + jr nz, p02loc_4A2C + call DelVar + ld hl, 0 + call CreateRList + call OP4ToOP1 + jr p02loc_4A2C + +Page02_3B4F: + cp 2 + jp c, ErrArgument + cp 101 + jp nc, ErrArgument + dec a + push af + push af + call Page0Call_241E + jr nc, p02loc_4A60 + ld hl, 101h + call CreateRMat + call OP4ToOP1 +p02loc_4A60: + call OP1ToOP6 + ld b, 0 + ld hl, (FPS) + pop af +p02loc_4A69: + push af + push bc + call HLMINUS9 + push hl + rst 20h + call FINDSYM_GET_SIZE + ld a, h + or a + jp nz, ErrDimension + ld a, l + cp 64h + jp nc, ErrDimension + pop hl + pop bc + cp b + jr c, p02loc_4A84 + ld b, a +p02loc_4A84: + pop af + dec a + jr nz, p02loc_4A69 + pop af + push af + ld c, a + push bc + call OP6ToOP1 + pop hl + push hl + call j_RedimMat + call OP6ToOP1 + call Page0Call_241E + ld (iMathPtr3), de + pop bc + push bc +p02loc_4AA0: + ld b, 1 + push bc + call PopRealO1 + call markTableDirty + call FINDSYM_GET_SIZE + ld (iMathPtr1), de + pop bc +p02loc_4AB1: + ld a, l + cp b + push hl + push bc + jr nc, p02loc_4ABC + call OP1Set0 + jr p02loc_4AC0 +p02loc_4ABC: + ld l, b + call GETL1TOP1A +p02loc_4AC0: + pop bc + push bc + call PUTTOMA1 + pop bc + inc b + pop hl + pop af + cp b + push af + jr nc, p02loc_4AB1 + dec c + jr nz, p02loc_4AA0 + pop af + pop af + ret + +p02sub_4AD3: + call CKPosDoInt + jr z, p02loc_4ADB +p02loc_4AD8: + jp ErrDomain +p02loc_4ADB: + call ckop2pos + jr nz, p02loc_4AD8 + ld hl, 8484h + call CKDoInt + jr nz, p02loc_4AD8 + call page0_1713 + jr nc, p02loc_4AD8 + ld a, (OP2+1) + sub e + jr nc, p02loc_4AD8 + call CkOP1FP0 + jr nz, p02loc_4AFF + call CkOP2FP0 + ret z + jp OP2ToOP1 +p02loc_4AFF: + call CkOP2FP0 + ret z +p02loc_4B03: + call fpdiv + call frac + call FPMult + call OP2ToOP3 + ld hl, page0_FC3 + call FPAdd_FromHL + call Trunc + rst 8 + call OP3ToOP1 + call CkOP2FP0 + ret z + jr p02loc_4B03 + +p02loc_4B22: + call OP1ToOP4 + call FPMult + call OP1ExOP4 + call p02sub_4AD3 + call CkOP1FP0 + ret z + rst 8 + call OP4ToOP1 + jp fpdiv + +ToFrac: call CKOP1DoInt + jr z, p02loc_4B43 + ld a, (OP1+1) + cp 84h +p02loc_4B43: + jp nc, p02loc_4C29 + sub 0Bh + push af + ld de, userMenuSA + call MovFrOP1 + call MovFrOP1 + call OP1Set1 + call OP1ToOP5 + ld de, 8610h + call MovFrOP1 + xor a + ld (OP1M), a + call MovFrOP1 + call OP1ToOP6 +p02loc_4B68: + ld hl, 8607h + rst 20h + ld hl, page0_FC3 + call Mov9ToOP2 + ld a, (OP1) + ld (OP2), a + rst 30h + call Trunc + call OP1ToOP4 + rst 8 + ld hl, 8607h + rst 20h + call FPSub + ld de, 8607h + call MovFrOP1 + call OP6ToOP1 + call OP4ToOP2 + call FPMult + ld hl, 8610h + call FPAdd_FromHL + ld a, (OP1+1) + cp 84h + jr nc, p02loc_4BE6 + call OP1ExOP6 + ld de, 8610h + call MovFrOP1 + call OP5ToOP1 + call OP4ToOP2 + call FPMult + ld hl, 8619h + call FPAdd_FromHL + call OP1ExOP5 + ld de, 8619h + call MovFrOP1 + ld hl, 8607h + rst 20h + call OP2Set1 + ld a, 7Dh + ld (OP2+1), a + call AbsO1O2Cp + jr c, p02loc_4BE6 + jr z, p02loc_4BE6 + ld hl, 8607h + rst 20h + call fprecip + ld de, 8607h + call MovFrOP1 + jr p02loc_4B68 +p02loc_4BE6: + call OP6ToOP2 + call CkOP2FP0 + jr z, p02loc_4C24 + call OP5ToOP1 + call fpdiv + call InvOP1S + ld hl, userMenuSA + call FPAdd_FromHL + call OP2Set1 + pop af + ld (OP2+1), a + call AbsO1O2Cp + jr nc, p02loc_4C25 + call OP6ToOP2 + call OP1Set1 + call AbsO1O2Cp + jr z, p02loc_4C25 + call OP5ToOP1 + call OP6ToOP2 + call ClrOP2S + ld hl, OP1 + xor (hl) + ld (hl), a + or a + ret +p02loc_4C24: + pop af +p02loc_4C25: + ld hl, userMenuSA + rst 20h +p02loc_4C29: + scf + ret + +p02loc_4C2B: + call CkOP1FP0 + jr nz, p02loc_4C56 +p02loc_4C30: + call CkOP2FP0 + jr z, p02loc_4C63 + jr p02loc_4C56 +p02loc_4C37: + call CkOP1FP0 + ret z + jr p02loc_4C30 +p02loc_4C3D: + call CkOP1FP0 + jr z, p02loc_4C30 + call CkOP2FP0 + +p02loc_4C45: + jr z, p02loc_4C56 + jr p02loc_4C63 +p02sub_4C49: + call CkOP1FP0 + jr p02loc_4C45 +p02loc_4C4E: + call page0_14A7 + call cpop1op2 + jr nc, p02loc_4C63 +p02loc_4C56: + jp OP1Set1 + +Page02_3AAD: + call page0_14A7 + call cpop1op2 + jr c, p02loc_4C56 + jr z, p02loc_4C56 +p02loc_4C63: + jp OP1Set0 + +p02loc_4C66: + call page0_14A7 + call cpop1op2 + jr z, p02loc_4C63 + +p02loc_4C6E: + jr c, p02loc_4C63 + jr p02loc_4C56 +Page02_3AB3: + call page0_14A7 + call cpop1op2 + jr p02loc_4C6E +p02loc_4C7A: + ld hl, 11h + push hl + call ErrNotEnoughMem + call FIND_E_UNDEF + ld (unk_9306), de + inc de + inc de + inc de +p02loc_4C8B: + inc hl + ld (hl), 10h + ex de, hl + ld hl, (unk_9306) + ld c, (hl) + inc hl + ld b, (hl) + ex de, hl + add hl, bc + ex de, hl + push bc +p02loc_4C99: + ld hl, p02loc_4C7A + ldir + pop bc + pop hl + add hl, bc + ex de, hl + ld hl, (unk_9306) + ld (hl), e + inc hl + ld (hl), d + rst 18h + rst 18h + call XName + rst 18h + call PopRealO1 + call markTableDirty + ret + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;Doesn't seem to be used. + ld hl, 4 + call InsertMem + ex de, hl + ld (hl), 25h + inc hl + ld (hl), 10h + inc hl + ld (hl), 25h + jr p02loc_4C8B + + ld hl, 0Dh + call InsertMem + ld bc, 0Dh + jr p02loc_4C99 +#endif + +p02sub_4CD1: + call CMP_NUM_INIT + ld hl, 84E9h + cp (hl) + ret c + ld (hl), a + ret + +SEQSET: rst 18h + xor a + ld (unk_84E9), a + ld hl, 91CEh + bit 0, (hl) + ld hl, u0 + call nz, p02sub_4CD1 + ld hl, 91CEh + bit 1, (hl) + ld hl, v0 + call nz, p02sub_4CD1 + ld hl, 91CEh + bit 2, (hl) + ld hl, w0 + call nz, p02sub_4CD1 + call OP1Set0 + ld de, 91D0h + call MovFrOP1 + ld hl, nMin + rst 20h + call j_StoN + jr p02loc_4D14 + +SEQSOLVE: + rst 18h +p02loc_4D14: + ld b, 1 +p02loc_4D16: + push bc + ld a, (unk_91CE) + and b + jp z, p02loc_4DB8 + cp 4 + jr nz, p02loc_4D23 + dec a +p02loc_4D23: + push af + call j_serrort + bit drawingGraph, (iy+graphFlags) + jr z, p02loc_4D32 + call FIND_E_UNDEF + set 6, (hl) +p02loc_4D32: + pop af + ld hl, u0 + dec a + jr z, p02loc_4D42 + ld hl, v0 + dec a + jr z, p02loc_4D42 + ld hl, w0 +p02loc_4D42: + call CMP_NUM_INIT + bit allowCursor, (iy+plotFlags) + jr z, p02loc_4D58 + call IsRecursiveMode + jr z, p02loc_4D58 + bit webMode, (iy+seqFlags) + jr z, p02loc_4D58 + ld a, 1 +p02loc_4D58: + ld (unk_91CF), a + push de + push hl + push af + call OP1ToOP3 + ld hl, 91D0h + rst 20h + call Plus1 + pop af + ld l, a + ld h, 0 + call j_SetXXXXOP2 + ld a, (OP1M) + push af + call cpop1op2 + pop bc + pop hl + pop de + jr c, p02loc_4D7D + jr nz, p02loc_4D9C +p02loc_4D7D: + bit allowCursor, (iy+plotFlags) + jr z, p02loc_4D89 + bit webMode, (iy+seqFlags) + jr nz, p02loc_4D95 +p02loc_4D89: + ld a, b + cp 10h + jr nz, p02loc_4D95 + ld a, (unk_91CF) + bit 0, a + jr z, p02loc_4D98 +p02loc_4D95: + or a + sbc hl, de +p02loc_4D98: + rst 20h + jp p02loc_4DB8 +p02loc_4D9C: + call j_SAVEPARSE + call OP3ToOP1 + ld hl, p02loc_4EA1 + call pushErrorHandleR + call j_PARSEOFF + call popErrorHandleR +p02loc_4DAE: + rst 8 + call PopRealO1 + call j_GETPARSE + call OP2ToOP1 +p02loc_4DB8: + call CkOP1Real + jr z, p02loc_4DC2 + cp 0Eh + jp nz, ErrDataType +p02loc_4DC2: + rst 18h + ld a, (unk_84E9) + or a + jr z, p02loc_4DCE + ld a, 0Eh + ld (OP1), a +p02loc_4DCE: + rst 18h +p02loc_4DCF: + pop af + add a, a + ld b, a + cp 8 + jp nz, p02loc_4D16 + set numOP1, (iy+ParsFlag2) + ld hl, un1 + call p02sub_4E95 + call p02sub_4E95 + call p02sub_4E95 + ld hl, 8E2Dh + call p02sub_4E95 + call p02sub_4E95 + call p02sub_4E95 + call PopRealO1 + ld de, wn1 + call MovFrOP1 + call PopRealO1 + ld de, 8E51h + call MovFrOP1 + call PopRealO1 + ld de, vn1 + call MovFrOP1 + call PopRealO1 + ld de, 8E3Fh + call MovFrOP1 + call PopRealO1 + ld de, un1 + call MovFrOP1 + call PopRealO1 + ld de, 8E2Dh + call MovFrOP1 + ld hl, 84E9h + ld a, (hl) + sub 1 + jr c, p02loc_4E63 + ld (hl), a + jr nz, p02loc_4E6E + ld hl, u0 + call CMP_NUM_INIT + ld hl, 8E2Dh + ld de, un1 + call p02sub_4E89 + ld hl, v0 + call CMP_NUM_INIT + ld hl, 8E3Fh + ld de, vn1 + call p02sub_4E89 + ld hl, w0 + call CMP_NUM_INIT + ld hl, 8E51h + ld de, wn1 + call p02sub_4E89 + jr p02loc_4E6E +p02loc_4E63: + ld hl, 8E2Dh + ld de, un1 + ld bc, 54 + ldir +p02loc_4E6E: + call CpyTo2FPST + call j_RclN + call cpop1op2 + jp nc, FPOPREAL + call page0_1867 + call j_RclN + call Plus1 + call j_StoN + jp p02loc_4D14 +p02sub_4E89: + cp 1 + ret c + jp z, mov9B2 + call mov9B2 + jp mov9B2 + +p02sub_4E95: + push hl + ld de, 9 + add hl, de + ex de, hl + pop hl + call mov9B2 + ex de, hl + ret + +p02loc_4EA1: + call CkOP1Real + cp 0Eh + jp z, p02loc_4DAE + jp JErrorNo + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;Doesn't seem to be used. + rst 18h + ld a, 0Eh + ld (OP1), a + rst 18h + jp p02loc_4DCF +#endif + +CMP_NUM_INIT: + ld b, 0 + ld a, (hl) + and 1Fh + cp 0Eh + jr z, p02loc_4ECC + inc b + ld de, 1Bh + add hl, de + ld a, (hl) + and 1Fh + cp 0Eh + jr z, p02loc_4ECC + inc b +p02loc_4ECC: + ld a, b + ret + +p02sub_4ECE: + call ErrD_OP1NotPosDoInt + call ckop2pos + jr nz, p02loc_4EE2 + call OP1ToOP5 + call OP2ToOP4 + ld hl, 8484h + call CKDoInt +p02loc_4EE2: + jp nz, ErrDomain + call CkOP2FP0 + jp z, page0_1228 + call FPSub + call CkOP1Pos + jp nz, page0_EBD + ret + +p02loc_4EF5: + call p02sub_4ECE + call CkOP1FP0 + jp z, OP1Set1 + call OP1ToOP3 + call OP4ToOP2 + call FPSub + call CkOP1Pos + call nz, OP3ToOP4 + call OP5ToOP1 + xor a + push af +p02loc_4F12: + call OP4ToOP2 + call fpdiv +p02loc_4F18: + call OP1ToOP3 + call OP4ToOP1 + call Minus1 + call CkOP1FP0 + pop bc + jr nz, p02loc_4F2F + call OP3ToOP1 + ld d, 0 + jp Round +p02loc_4F2F: + push bc + call OP1ToOP4 + call OP5ToOP1 + call Minus1 + call OP1ToOP5 + call OP3ToOP2 + call FPMult + pop af +p02loc_4F43: + push af + or a + jr z, p02loc_4F12 + jr p02loc_4F18 +p02loc_4F49: + call p02sub_4ECE + call OP5ToOP1 + ld a, 1 + jr p02loc_4F43 + +p02sub_4F53: + call CKOP1DoInt +p02loc_4F56: + jp nz, ErrDomain + call OP1ExOP2 + call CKOP1DoInt + jr nz, p02loc_4F56 + call cpop1op2 + call c, OP1ExOP2 + call PushRealO2 + call FPSub + call Plus1 + rst 18h + call j_Random + call PopRealO2 + call FPMult + call DoInt + call PopRealO2 + rst 30h + ret + +PtoR: call OP1ToOP6 + call OP2ToOP1 + call Sin + call OP2ToOP4 + call OP6ToOP2 + call FPMult + call OP1ExOP4 + call OP6ToOP2 + call FPMult + jp OP4ToOP2 + +RToP: call OP2ToOP5 + call OP1ToOP6 + call FPSquare + call OP1ToOP4 + call OP5ToOP1 + call FPSquare + call OP4ToOP2 + rst 30h + call SqRoot + call OP6ToOP2 + call OP1ToOP6 + call OP5ToOP1 + ld d, 0 + call ATan2 + rst 8 + jp OP6ToOP1 + +;Why is this in the middle of the list/matrix stuff?! +InitContextA: + ld hl, {+} + jp ldHLind_AWord ++: .dw j_InitHomescreenContext + .dw j_InitLinkIOContext + .dw j_InitMatrixEditorContext + .dw j_InitStatEditorContext + .dw j_InitGraphContext + .dw j_InitModeContext + .dw j_InitProgramEditorContext + .dw j_InitProgramCreateContext + .dw j_InitWindowContext + .dw j_InitYEqualsContext + .dw j_InitTableContext + .dw j_InitTableSetContext + .dw j_InitAboutContext + .dw j_InitMemMgmtContext + .dw j_InitResetMemContext + .dw j_InitResetDefaultContext + .dw j_InitProgramInputContext + .dw j_InitZoomContext + .dw j_InitErrorContext + .dw j_InitTVMContext + .dw j_InitSolverContext + .dw j_InitStatPlotContext + .dw j_InitInfStatEditorContext + .dw j_InitFormatContext + .dw j_ExecuteApp + .dw j_InitGroupContext + .dw j_InitUngroupContext + +SetVertSplitRedisplayFlags: + push af + call Bit_VertSplit + jr z, {+} + ld a, (mcxCurApp) + cp kTable + jr z, {++} + cp kGraph + jr z, {++} ++: bit plotDisp, (iy+plotFlags) + jr nz, {++} + set NEED_BUFCPY, (iy+VERTFLAG2) + set NEED_RETABLE, (iy+VERTFLAG2) +++: pop af + ret + +Page02_3E73: + call GETEXP + jr nc, p02loc_5049 + cp 70h + jr c, p02loc_5046 + or 0F0h + ld l, a + ld a, d + inc a + add a, l + jp nc, OP1Set0 + cpl + and 0Fh + dec a + jr p02loc_5051 +p02loc_5040: + call CkOP1FP0 + jp nz, page0_1040 +p02loc_5046: + jp OP1Set0 +p02loc_5049: + sub 80h + ld l, a + ld a, 0Dh + sub d + sub l + ret c +p02loc_5051: + srl a + ld hl, 8480h + jr z, p02loc_505F + ld b, a +p02loc_5059: + ld a, (hl) + ld (hl), 0 + dec hl + djnz p02loc_5059 +p02loc_505F: + jr nc, p02loc_506F + ld a, (hl) + ld b, a + and 0F0h + ld (hl), a + ld a, b + and 0Fh + cp 5 + ld b, 10h + jr p02loc_5073 +p02loc_506F: + cp 50h + ld b, 1 +p02loc_5073: + jr c, p02loc_5040 + ld a, (OP1+1) + push af + ld a, (OP1) + push af + xor a + ld (OP1), a + ld a, b + call page0_138B + pop af + and 80h + ld (OP1), a + ld hl, OP1+1 + ld d, (hl) + pop af + ld (hl), a + cp d + ret z + ld hl, OP1M + ld (hl), 10h + jp INCO1EXP + +BinOPExec: + call page0_1847 + ld hl, 9817h + ld (hl), 0 +BinOPExec2: + push af + call CpyTo3FPST + ld a, (OP3) + and 1Fh + cp 0Eh + jp z, ErrInvalid + ld d, a + cp 0Ch + call nz, FPOPREAL + call ShLAcc + ld b, a + call CkOP1Real + cp 0Eh + jp z, ErrInvalid + add a, b + jr nz, p02loc_50CA + rst 8 + call OP3ToOP1 +p02loc_50CA: + ld c, a + pop af + ld b, a + cp 0D0h + jr nz, p02loc_50E2 + call p02sub_5316 + rst 18h + call OP2ToOP1 + ld a, 25h + push af + call p02sub_5601 + ld a, e + jp p02loc_5FE4 +p02loc_50E2: + cp 0B6h + jr nz, p02loc_50FD + ld hl, j_LSUM +p02loc_50E9: + push hl + ld a, c + cp 10h + jr z, p02loc_50F4 + cp 0D0h + jp nz, ErrDataType +p02loc_50F4: + call PushRealO3 + ld h, 0FFh + push hl + jp p02loc_6100 +p02loc_50FD: + ld hl, p02loc_4962 + cp 0B7h + jr z, p02loc_50E9 + cp 0E4h + jr nz, p02loc_510F + call p02sub_5316 + ld a, 12h + jr p02loc_515D +p02loc_510F: + cp 0E3h + jr nz, p02loc_5117 + ld a, 28h + jr p02loc_515D +p02loc_5117: + cp 0CFh + jr nz, p02loc_513E + ld a, c + cp 1 + jp nz, ErrDataType + call p02sub_6042 + call PushRealO3 + call SETMAT1 + ex de, hl + xor a + ld (iMathPtr2+1), a +p02loc_512F: + ld (unk_90CC), de + call SETesTOfps + ld a, 2Ch + call Page0Call_38FD + jp p02loc_5B71 +p02loc_513E: + ld hl, p02loc_65AD + cp 0D3h + jr z, p02loc_5151 + ld hl, p02loc_65B1 + cp 0D4h + jr z, p02loc_5151 + ld hl, p02loc_65A7 + cp 0D5h +p02loc_5151: + jp z, p02loc_51D8 + cp 0EDh + jr nz, p02loc_5160 + call p02sub_5316 + ld a, 24h +p02loc_515D: + jp p02sub_658F +p02loc_5160: + cp 0DBh + jr nz, p02loc_5170 + call p02sub_57DF +p02loc_5167: + call j_ONEVARS_0 + call SqRoot +p02loc_516D: + jp p02loc_5B71 +p02loc_5170: + cp 0DCh + jr nz, p02loc_517C + call p02sub_57DF +p02loc_5177: + call j_ONEVARS_0 + jr p02loc_516D +p02loc_517C: + cp 0D1h + jr nz, p02loc_518B + call p02sub_5316 + call PUSHMCPLXO1 + ld a, 26h +p02loc_5188: + jp p02loc_5FDA +p02loc_518B: + cp 0D2h + jr nz, p02loc_5199 + call p02sub_5316 + call PUSHMCPLXO1 + ld a, 27h + jr p02loc_5188 +p02loc_5199: + cp 0D9h + jr nz, p02loc_51A4 + call p02sub_5316 +p02sub_51A0: + ld a, 26h + jr p02loc_515D +p02loc_51A4: + cp 0E9h + jr nz, p02loc_51B1 + call p02sub_5316 + call PUSHMCPLXO1 + jp p02loc_5F9A +p02loc_51B1: + cp 0DFh + jr nz, p02loc_51C1 + call p02sub_5316 + call PUSHMCPLXO1 + call OP1Set1 + jp p02loc_620A +p02loc_51C1: + cp 0DEh + jr nz, p02loc_51D1 + call p02sub_5316 + call PUSHMCPLXO1 + call OP1Set0 + jp p02loc_62A9 +p02loc_51D1: + cp 0E5h + jr nz, p02loc_51DB + ld hl, p02loc_6593 +p02loc_51D8: + jp p02loc_5301 +p02loc_51DB: + cp 0E6h + jr nz, p02loc_51E4 + ld hl, p02loc_658E + jr p02loc_51D8 +p02loc_51E4: + cp 0E8h + jr nz, p02loc_51ED + ld hl, p02loc_659B + jr p02loc_51D8 +p02loc_51ED: + cp 0E7h + jr nz, p02loc_51F6 + ld hl, p02loc_6597 + jr p02loc_51D8 +p02loc_51F6: + cp 0EBh + jr nz, p02loc_51FF + ld hl, p02loc_65A3 + jr p02loc_51D8 +p02loc_51FF: + cp 0EAh + jr nz, p02loc_5208 + ld hl, p02loc_659F + jr p02loc_51D8 +p02loc_5208: + cp 70h + jp z, p02loc_5724 + cp 71h + jp z, p02loc_5770 + cp 82h + jp z, p02loc_5777 + cp 83h + jp z, p02loc_57CD + cp 0F0h + jp z, p02loc_55A6 + cp 0F1h + jp z, p02loc_55D1 + cp 6Ah + jp z, p02loc_54F3 + cp 6Fh + jp z, p02loc_54F3 + cp 12h + jp z, p02loc_55DE + cp 93h + jp z, p02loc_5696 + cp 14h + jp z, p02loc_564F + cp 19h + jp z, p02loc_5402 + cp 1Ah + jp z, p02loc_53FB + cp 0D6h + jp z, p02loc_52F4 + cp 0D7h + jp z, p02loc_52FE + cp 26h + jp z, p02loc_57D4 + cp 1Fh + jp z, p02loc_588E + cp 21h + jp z, p02loc_5883 + cp 0D8h + jr z, p02loc_52A7 + cp 40h + jr z, p02loc_52CB + cp 3Ch + jr z, p02loc_52D0 + cp 3Dh + jr z, p02loc_52D5 + cp 95h + jr z, p02loc_52DA + cp 94h + jr z, p02loc_52DF + cp 6Bh + jr z, p02loc_52E5 + cp 6Dh + jr z, p02loc_52EA + cp 6Ch + jr z, p02loc_52EF + cp 6Eh + jr z, p02loc_52F9 + cp 20h + jp z, p02loc_58D2 + cp 0DDh + jp z, p02loc_6215 + cp 13h + jr nz, p02loc_52AC + call p02sub_5316 + call PUSHMCPLXO1 + call j_PixelTest + jp z, OP1Set0 + jp OP1Set1 +p02loc_52A7: + ld hl, p02sub_4F53 + jr p02loc_5301 +p02loc_52AC: + ld hl, p02loc_6581 + cp 1Bh + jr z, p02loc_5301 + ld hl, p02loc_6572 + cp 1Ch + jr z, p02loc_5301 + ld hl, p02loc_657D + cp 1Dh + jr z, p02loc_5301 + ld hl, p02loc_6578 + cp 1Eh + jr z, p02loc_5301 + jp ErrArgument +p02loc_52CB: + ld hl, p02loc_4C37 + jr p02loc_5301 +p02loc_52D0: + ld hl, p02loc_4C2B + jr p02loc_5301 +p02loc_52D5: + ld hl, p02loc_4C3D + jr p02loc_5301 +p02loc_52DA: + ld hl, p02loc_4EF5 + jr p02loc_5301 +p02loc_52DF: + ld hl, p02loc_4F49 + jr p02loc_5301 +p02sub_52E4: + jp (hl) +p02loc_52E5: + ld hl, p02loc_4C4E + jr p02loc_5301 +p02loc_52EA: + ld hl, Page0Call_3AAD + jr p02loc_5301 +p02loc_52EF: + ld hl, p02loc_4C66 + jr p02loc_5301 +p02loc_52F4: + ld hl, p02loc_4B22 + jr p02loc_5301 +p02loc_52F9: + ld hl, Page0Call_3AB3 + jr p02loc_5301 +p02loc_52FE: + ld hl, p02sub_4AD3 +p02loc_5301: + ld a, c + cp 11h + jr z, p02loc_534E + cp 10h + jr z, p02loc_5338 + cp 1 + jr z, p02loc_5345 + or a + jp nz, ErrDataType + call p02sub_52E4 + ret + +p02sub_5316: + ld a, c + or a + jp nz, ErrDataType + ret +p02loc_531C: + call page0_1847 + cp 11h + jr z, p02loc_534E + cp 10h + jr z, p02loc_5338 + cp 1 + jr z, p02loc_5345 + call page0_1842 + cp 1Ch + jr z, p02loc_5338 + cp 0D0h + jr z, p02loc_5338 + cp 0DCh +p02loc_5338: + jp z, p02loc_546A + cp 0Dh + jr z, p02loc_5345 + cp 0C1h + jr z, p02loc_5345 + cp 0CDh +p02loc_5345: + jp z, p02loc_5475 + call p02sub_544E + jp nz, ErrDataType +p02loc_534E: + ld a, b + scf + push af + call p02sub_594A + jp nz, ErrDimMismatch + ld (OP6+6), de + or a + jr z, p02loc_536B + ex de, hl + ld (OP6+8), hl +p02loc_5362: + call CREATETLIST +p02loc_5365: + ld hl, (OP6+8) + ld (OP6+6), hl +p02loc_536B: + call PushRealO4 +p02loc_536E: + call PushRealO6 + call GETL1TOOP1 + pop af + push af + jr c, p02loc_537D + call UnOPExec2 + jr p02loc_5388 +p02loc_537D: + call PushOP1 + call p02loc_47BD + pop af + push af + call BinOPExec2 +p02loc_5388: + call p02sub_53C6 + jr c, p02loc_5393 + jr nz, p02loc_536E + pop af + jp p02loc_5B6E +p02loc_5393: + call p02sub_53AF + ld bc, (iMathPtr2) + ld hl, (iMathPtr3) + or a + sbc hl, bc + jr nz, p02loc_53A6 + ld (iMathPtr2), de +p02loc_53A6: + ld (iMathPtr3), de + call page0_1842 + jr p02loc_536E +p02sub_53AF: + ld de, (iMathPtr3) + call j_ConvLrToLc + ld bc, (iMathPtr1) + ld hl, (iMathPtr3) + or a + sbc hl, bc + ret nz + ld (iMathPtr1), de + ret +p02sub_53C6: + call PopRealO6 + call CkOP1Cplx + jr nz, p02loc_53D5 + call page0_184C + jr nz, p02loc_53DB + scf + ret +p02loc_53D5: + call page0_184C + call nz, page0_104B +p02loc_53DB: + ld hl, (OP6+6) + call PUTTOLA1 + ld hl, (OP6+6) + dec hl + ld a, h + or l + ld (OP6+4), hl +p02sub_53EA: + ld (OP6+6), hl + ld (OP6), hl + ret +p02sub_53F1: + ld (OP6+4), hl + ld (OP6+8), hl + ld (OP6), hl + ret + +p02loc_53FB: + ld hl, Min + ld d, 1 + jr p02loc_5407 +p02loc_5402: + ld hl, Max + ld d, 0 +p02loc_5407: + ld a, c + cp 0DDh + jp z, p02loc_534E + cp 0CCh + jr z, p02loc_5424 + call page0_1842 + cp 0DCh + jp z, p02loc_546A + cp 0CDh + jp z, p02loc_5475 + call page0_1847 + jp p02loc_5301 +p02loc_5424: + push de + call PushOP1 + call CAbs + call OP1ToOP6 + call CPYCTO1FPS3 + call CAbs + call OP6ToOP2 + call cpop1op2 + pop de + bit 0, d + jr z, p02loc_5440 + ccf +p02loc_5440: + push af + call POPMCPLXO1 + pop af + push af + call nc, POPMCPLXO1 + pop af + jp c, FPOPCPLX + ret + +p02sub_544E: + cp 0DDh + ret z + cp 1Dh + ret z + cp 0D1h + ret + +p02loc_5457: + ld a, b + or a + push af + call SETMAT1 + ld (OP6+6), hl + call CreateTempRList + ld (iMathPtr3), de + jp p02loc_536B + +p02loc_546A: + ld a, b + or a + push af + call PushOP1 + call OP3ToOP1 + jr p02loc_547E +p02loc_5475: + push bc + and 0F0h + call z, PushRealO3 + pop af + scf + push af +p02loc_547E: + call p02sub_59D5 + ld (OP6+6), hl + jr z, p02loc_5489 + call CREATETLIST +p02loc_5489: + call popOP1 + call PushRealO4 + call PushOP1 +p02loc_5492: + call p02loc_47C6 + call CpyTo1FPST + call CkOP1Cplx + jr nz, p02loc_54AD + rst 8 + call CpyTo1FPS1 + pop af + push af + jr nc, p02loc_54BA + call OP1ExOP3 + call OP2ExOP4 + jr p02loc_54BA +p02loc_54AD: + pop af + push af + jr nc, p02loc_54BA + call OP1ExOP3 + call CkOP1Cplx + call z, OP2ExOP4 +p02loc_54BA: + call PushRealO6 + call PushOP3 + pop af + push af + call BinOPExec2 + call p02sub_53C6 + jr c, p02loc_54D8 + jr nz, p02loc_5492 + pop af + call FPOPREAL + bit 3, (hl) + call nz, FPOPREAL + jp p02loc_5B6E +p02loc_54D8: + call popOP1 + call PopRealO4 + call PushOP1 + call PushRealO4 + call p02sub_53AF + ld (iMathPtr3), de + call page0_1842 + call PopRealO4 + jr p02loc_5489 +p02loc_54F3: + cp 6Ah + push af + ld a, c + or a + jr nz, p02loc_5517 + call page0_14A7 + call cpop1op2 +p02loc_5500: + jr nz, p02loc_550C + pop af +p02sub_5503: + push af + call OP1Set0 + pop af + ret nz + jr p02loc_5511 + +p02sub_550B: + push af +p02loc_550C: + call OP1Set0 + pop af + ret z +p02loc_5511: + ld a, 10h + ld (OP1M), a + ret + +p02loc_5517: + cp 0CCh + jr nz, p02loc_552C + call p02sub_65BE + call ExMCplxO1 + call p02sub_65BE + call CSub + call CkOP1C0 + jr p02loc_5500 +p02loc_552C: + cp 22h + jr nz, p02loc_5566 + call SET2MVLPTRS + jp nz, ErrDimMismatch + ld (OP6+8), de +p02loc_553A: + call GETM1TOOP1 + call RndGuard + rst 8 + ld bc, (OP6) + ld de, (iMathPtr2) + call GetMToOP1 + call RndGuard + call cpop1op2 + jr nz, p02loc_5560 + call p02loc_407E + jr nz, p02loc_553A +p02loc_5559: + pop af + call p02sub_5503 +p02loc_555D: + jp p02loc_5B71 +p02loc_5560: + pop af + call p02sub_550B + jr p02loc_555D +p02loc_5566: + cp 44h + jr nz, p02loc_5587 + call SET2MVLPTRS + jr nz, p02loc_5560 + ld b, d + ld c, e + ld hl, (iMathPtr1) + ld de, (iMathPtr2) + inc hl + inc de +p02loc_557A: + ld a, b + or c + jr z, p02loc_5559 + inc hl + inc de + ld a, (de) + cp (hl) + jr nz, p02loc_5560 + dec bc + jr p02loc_557A +p02loc_5587: + pop bc + cp 11h +p02loc_558A: + jp z, p02loc_534E + cp 0DDh + jr z, p02loc_558A + cp 0CDh +p02loc_5593: + jp z, p02loc_5475 + cp 0DCh +p02loc_5598: + jp z, p02loc_546A + cp 1 + jr z, p02loc_5593 + cp 10h + jr z, p02loc_5598 +p02loc_55A3: + jp ErrDataType +p02loc_55A6: + ld a, c + or a + jr nz, p02loc_55AE + call j_YToX + ret +p02loc_55AE: + cp 20h + jp z, p02loc_453E + ld hl, CYtoX +p02loc_55B6: + cp 0CCh + jr z, p02loc_55C3 + cp 0C0h + jr nz, p02loc_55C4 + push hl + call OP2Set0 +p02loc_55C2: + pop hl +p02loc_55C3: + jp (hl) +p02loc_55C4: + cp 0Ch + jr nz, p02loc_55DB + push hl + call OP4Set0 + call PUSHMCPLXO3 + jr p02loc_55C2 +p02loc_55D1: + ld a, c + or a + jp z, p02loc_5EAA + ld hl, CXrootY + jr p02loc_55B6 +p02loc_55DB: + jp p02loc_531C +p02loc_55DE: + ld a, c + push af + or a + call z, OP2ToOP1 + call p02sub_5604 +p02loc_55E7: + jp c, ErrDomain + push de + call OP3ToOP1 + pop de + ld d, e + pop af + or a + jp z, Round + push de + cp 0C0h + jr nz, p02loc_561F + call POPMCPLXO1 + pop de + jp p02loc_65C4 + +p02sub_5601: + call CkOP1Real +p02sub_5604: + and 0Fh + jr nz, p02loc_55A3 + call ErrD_OP1NotPosDoInt + ld a, (OP1+1) + cp 81h + ccf + jr c, p02loc_55E7 + rst 8 + call j_ConvOP1 + ld hl, 9 + sbc hl, de + jr c, p02loc_55E7 + ret + +p02loc_561F: + cp 20h + jr nz, p02loc_562C + call p02sub_5A0F + pop af + call p02sub_4488 + jr p02loc_5643 +p02loc_562C: + call OP1ToOP3 + call OP2ToOP1 + ld b, 12h + pop de + bit 7, d + jp z, p02loc_531C + call ShRAcc + call OP3ToOP1 + jp p02loc_58B4 +p02loc_5643: + jp p02loc_5B6E +p02sub_5646: + call SETMAT1 +p02sub_5649: + ld a, h + cp l + ret z +p02loc_564C: + jp ErrDimension +p02loc_564F: + ld a, c + cp 22h + jr z, p02loc_5679 + cp 11h + jr z, p02loc_5660 + call p02sub_544E + jr nz, p02loc_5676 + call page0_1842 +p02loc_5660: + call SET2MVLPTRS + add hl, de + add hl, de + ld (OP6+8), hl + call CHK_HL_999 + call CREATETLIST + call PushRealO4 + call p02sub_49C8 + jr p02loc_5643 +p02loc_5676: + jp ErrDataType +p02loc_5679: + call SET2MVLPTRS + add hl, de + ld a, h + cp d + jp nz, ErrDimMismatch + ld a, l + add a, e + jr c, p02loc_564C + cp 64h + jr nc, p02loc_564C + ld l, a + ld (OP6+8), hl + call p02sub_5A17 + call p02sub_44D4 + jr p02loc_5643 +p02loc_5696: + ld a, c + push af + call p02sub_656B + pop af + cp 2 + jr nz, p02loc_56B3 + call PushRealO3 + call SETMAT1 + ld (iMathPtr3), de + call page0_16F4 + call PopRealO1 + jp p02sub_44C8 +p02loc_56B3: + cp 1 + jr nz, p02loc_56CA + call PushRealO3 +p02loc_56BA: + call SETMAT1 + ld (iMathPtr3), de + call page0_17E6 + call popOP1 + jp p02sub_49B2 +p02loc_56CA: + cp 0Dh + jr nz, p02loc_56D6 + call PushRealO3 + call j_ConvLcToLr + jr p02loc_56BA +p02loc_56D6: + call page0_1842 + cp 0CDh + jr z, p02loc_56BA + cp 0C1h + jr nz, p02loc_5676 + call PushOP1 + call Page0Call_241E + call j_ConvLrToLc + call PopRealO1 + jr p02loc_56BA +p02sub_56EF: + call p02sub_594A + jp nz, ErrDimMismatch + ld (OP6+8), de + or a + ret +p02loc_56FB: + call SET2MVLPTRS + add hl, de + add hl, de + ld (OP6+8), hl + call CreateTempString + inc de + inc de + ld hl, (iMathPtr1) + inc hl + inc hl + ld bc, (OP6) + ldir + ld hl, (iMathPtr2) + inc hl + inc hl + ld bc, (OP6+4) + ldir + call OP4ToOP1 + jp p02loc_5B71 +p02loc_5724: + ld a, c + or a + jp z, FPAdd + cp 44h + jr z, p02loc_56FB + scf +p02loc_572E: + push af + cp 0Ch + jr nz, p02loc_5740 + call OP4Set0 + call PUSHMCPLXO3 +p02loc_5739: + pop af + jp c, CAdd + jp CSub +p02loc_5740: + cp 0C0h + jr nz, p02loc_5749 + call OP2Set0 + jr p02loc_5739 +p02loc_5749: + cp 0CCh + jr z, p02loc_5739 + pop af + push af + cp 22h + jr z, p02loc_5756 + pop af + jr p02loc_57CA +p02loc_5756: + call p02sub_56EF + jr z, p02loc_5761 + ex de, hl + call p02sub_5A17 + jr p02loc_5764 +p02loc_5761: + call PushRealO4 +p02loc_5764: + pop af + push af + call c, p02sub_408E + pop af + call nc, p02sub_408A +p02loc_576D: + jp p02loc_5B6E +p02loc_5770: + ld a, c + or a + jp z, FPSub + jr p02loc_572E +p02loc_5777: + ld a, c + or a + jp z, FPMult + cp 2 + jr z, p02loc_5787 + cp 20h + jr nz, p02loc_579A + call OP1ExOP3 +p02loc_5787: + call p02sub_5A0F + call OP3ToOP2 +p02loc_578D: + call GETM1TOOP1 + call FPMult + call p02sub_4077 + jr nz, p02loc_578D + jr p02loc_576D +p02loc_579A: + cp 22h + jr nz, p02loc_57A9 + call p02sub_655D + call p02sub_5A17 + call p02sub_40BA + jr p02loc_576D +p02loc_57A9: + scf +p02loc_57AA: + push af + cp 0Ch + jr nz, p02loc_57BC + call OP4Set0 + call PUSHMCPLXO3 +p02loc_57B5: + pop af + jp c, CMult + jp CDiv +p02loc_57BC: + cp 0C0h + jr nz, p02loc_57C5 + call OP2Set0 + jr p02loc_57B5 +p02loc_57C5: + cp 0CCh + jr z, p02loc_57B5 + pop af +p02loc_57CA: + jp p02loc_531C +p02loc_57CD: + ld a, c + or a + jp z, fpdiv + jr p02loc_57AA +p02loc_57D4: + call p02sub_5316 + rst 18h + call OP2ToOP1 + call p02sub_67A5 + ret +p02sub_57DF: + ld a, c + cp 11h + jp nz, p02loc_58C0 + call p02sub_6042 + call SET2MVLPTRS + jp nz, ErrDimMismatch + ret + +EXMEAN1: + push af + call OP1Set0 + rst 18h + rst 18h + rst 18h + res 1, (iy+0) +p02loc_57FA: + call OP1Set1 + ld de, (iMathPtr2) + ld a, d + or a + ld hl, (OP6) + call nz, GetLToOP1 + call CkOP1Pos + jp nz, ErrStat + call CKOP1DoInt + jr z, p02loc_5818 + set 1, (iy+0) +p02loc_5818: + rst 18h + call CpyTo2FPS1 + rst 30h + call CpyO1ToFPS1 + call GETL1TOOP1 + pop af + push af + and 0FEh + cp 2 + call z, LnX + call CpyTo2FPST + call FPMult + call CpyTo2FPS2 + rst 30h + call CpyO1ToFPS2 + pop af + push af + jr c, p02loc_5859 + ld hl, (OP6) + call p02sub_4795 + pop af + push af + and 0FDh + cp 1 + call z, LnX + call CpyTo2FPST + call FPMult + call CpyTo2FPS3 + rst 30h + call CpyO1ToFPS3 +p02loc_5859: + call FPOPREAL + ld hl, (OP6) + dec hl + ld (OP6), hl + ld a, h + or l + jr nz, p02loc_57FA + call PopRealO2 + call PopRealO1 + call OP1ToOP5 + call fpdiv + pop af + jp c, FPOPREAL + call OP1ToOP4 + call PopRealO1 + call OP1ToOP6 + jp fpdiv +p02loc_5883: + call p02sub_57DF + xor a + scf + call EXMEAN1 +p02loc_588B: + jp p02loc_5B71 +p02loc_588E: + call p02sub_57DF +p02loc_5891: + res 3, (iy+16h) + set 4, (iy+16h) + ld hl, (iMathPtr2) + ld (iMathPtr5), hl + call j_ORDSTAT + res 4, (iy+16h) + call OP1ToOP3 + call PopRealO1 + rst 10h + set 7, (hl) + call OP3ToOP1 + jr p02loc_588B +p02loc_58B4: + call page0_1847 + cp 1 + jr z, p02loc_58C3 +p02loc_58BB: + call page0_1842 + cp 0Dh +p02loc_58C0: + jp nz, ErrDataType +p02loc_58C3: + ld a, b + or a + push af + call p02sub_59D5 + ld (OP6+8), hl + jp nz, p02loc_5362 + jp p02loc_5365 +p02loc_58D2: + call p02sub_5316 + call p02sub_6520 + push af + call OP2ToOP1 + call p02sub_6520 + pop hl + ld l, e + call p02sub_53EA + call CreateTempRMat + ld (iMathPtr3), de + call PushRealO4 + call PushRealO1 +p02loc_58F1: + call CpyO6ToFPST + call j_Random + call OP2Set1 + ld hl, 8484h + inc (hl) + inc hl + ld (hl), 19h + call FPMult + call DoInt + call OP2Set1 + ld a, 90h + ld (OP2M), a + call FPSub + call CpyTo6FPST + ld hl, (OP6+6) + ld (OP6+8), hl + call p02sub_4077 + ld hl, (OP6+8) + ld (OP6+6), hl + jr nz, p02loc_58F1 + call FPOPREAL + jp PopRealO1 + +p02sub_592C: + call Page0Call_241E + jp c, ErrUndefined + call page0_1641 + ret nz + +p02sub_5936: + ld a, (unk_9817) + or a + jr z, p02loc_5941 + ld (tSymPtr2), hl + jr p02loc_5944 +p02loc_5941: + ld (tSymPtr1), hl +p02loc_5944: + inc a + ld (unk_9817), a + xor a + ret + +p02sub_594A: + call p02sub_59BF + push hl + jr nz, p02loc_595C + ld a, (OP1) + call page0_184C + jr nz, p02loc_595F + bit 3, a + jr z, p02loc_5963 +p02loc_595C: + scf + jr p02loc_5970 +p02loc_595F: + bit 3, a + jr z, p02loc_595C +p02loc_5963: + ld hl, (iMathPtr2) + ld (iMathPtr3), hl + xor a + ld (unk_9817), a + call OP1ToOP4 +p02loc_5970: + push af + call OP3ToOP1 + call p02sub_592C + jr nz, p02loc_598A + pop af + jr nc, p02loc_59A6 + ld a, (OP1) + call page0_184C + jr nz, p02loc_598F + bit 3, a + jr nz, p02loc_59BB + jr p02loc_5993 +p02loc_598A: + pop af + jr nc, p02loc_59A6 + jr p02loc_59BB +p02loc_598F: + bit 3, a + jr z, p02loc_59BB +p02loc_5993: + ld (iMathPtr3), de + ld hl, 9817h + dec (hl) + ld hl, (tSymPtr2) + ld (tSymPtr1), hl + push de + call OP1ToOP4 + pop de +p02loc_59A6: + xor a +p02loc_59A7: + push af + call p02loc_59FB + pop af + pop de + or a + sbc hl, de + ret + +SET2MVLPTRS: + call p02sub_59BF + push hl + call OP3ToOP1 + call p02sub_592C +p02loc_59BB: + ld a, 1 + jr p02loc_59A7 +p02sub_59BF: + call p02sub_592C + ld (iMathPtr2), de + ld a, (de) + ld l, a + inc de + ld a, (de) + push af + or l + jp z, ErrDimension + pop af + ld h, a + ld (OP6+4), hl + ret + +p02sub_59D5: + call OP1ToOP4 + call SETMAT1 + inc de + ret nz + ld a, (OP1) + call page0_184C + jr nz, p02loc_59F2 + bit 3, a + ret nz +p02loc_59E8: + dec de + ld (iMathPtr3), de + xor a + ld (unk_9817), a + ret + +p02loc_59F2: + bit 3, a + jr nz, p02loc_59E8 + or a + ret + +SETMAT1: + call p02sub_592C +p02loc_59FB: + ld (iMathPtr1), de + ld a, (de) + ld l, a + inc de + ld a, (de) + dec de + push af + or l + jp z, ErrDimension + pop af + ld h, a + ld (OP6), hl + ret + +p02sub_5A0F: + call p02sub_59D5 + ld (OP6+8), hl + jr z, p02loc_5A1A + +p02sub_5A17: + call p02sub_5A1D +p02loc_5A1A: + jp PushRealO4 + +p02sub_5A1D: + call CreateTempRMat + jr p02loc_5A2D + +CREATETLIST: + call page0_184C + push af + call z, CreateTempRList + pop af + call nz, CREATETCLIST +p02loc_5A2D: + ld (iMathPtr3), de + ret + +p02sub_5A32: + call p02sub_59D5 + ld (OP6+8), hl + jr z, p02loc_5A1A + call CREATETLIST + ld a, (OP4) + call p02sub_451A + ld hl, (iMathPtr3) + ld (iMathPtr1), hl + jr p02loc_5A1A diff -r f4f75ec42b53 -r 78c162ac1d82 source/page02/opexec.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/page02/opexec.asm Mon Jun 02 01:03:33 2014 -0400 @@ -0,0 +1,4895 @@ +UnOPExec: + ld hl, 9817h + ld (hl), 0 + call page0_1847 +UnOPExec2: + push af + call CkOP1Real + cp 0Eh + jp z, ErrInvalid + pop bc + or a + push af + ld a, b + cp 0C0h + jr nz, p02loc_5A73 + pop af + jr nz, p02loc_5A6B + call p02sub_6E20 + ret +p02loc_5A6B: + cp 0Ch + jr nz, p02loc_5ACD + call CLog + ret +p02loc_5A73: + cp 0C1h + jr nz, p02loc_5A86 + pop af + jr nz, p02loc_5A7E + call TenX + ret +p02loc_5A7E: + cp 0Ch + jr nz, p02loc_5ACD + call CTenX + ret +p02loc_5A86: + cp 0BEh + jr nz, p02loc_5A99 + pop af + jr nz, p02loc_5A91 + call p02sub_6E15 + ret +p02loc_5A91: + cp 0Ch + jr nz, p02loc_5ACD + call CLN + ret +p02loc_5A99: + cp 0BFh + jr nz, p02loc_5AAC + pop af + jr nz, p02loc_5AA4 + call EToX + ret +p02loc_5AA4: + cp 0Ch + jr nz, p02loc_5B06 + call CEtoX + ret +p02loc_5AAC: + cp 0B8h + jr nz, p02loc_5AB7 + pop af + jr nz, p02loc_5B06 + call p02sub_4C49 + ret +p02loc_5AB7: + cp 0C2h + jr nz, p02loc_5AC2 + pop af + jr nz, p02loc_5B06 + call Sin + ret +p02loc_5AC2: + cp 0C3h + jr nz, p02loc_5ACF + pop af + jr nz, p02loc_5ACD + call ASin + ret +p02loc_5ACD: + jr p02loc_5B06 +p02loc_5ACF: + cp 0C4h + jr nz, p02loc_5ADA + pop af + jr nz, p02loc_5B06 + call cos + ret +p02loc_5ADA: + cp 0C5h + jr nz, p02loc_5AE5 + pop af + jr nz, p02loc_5B06 + call ACos + ret +p02loc_5AE5: + cp 0C6h + jr nz, p02loc_5AF0 + pop af + jr nz, p02loc_5B06 + call Tan + ret +p02loc_5AF0: + cp 0C7h + jr nz, p02loc_5AFB + pop af + jr nz, p02loc_5B06 + call ATan + ret +p02loc_5AFB: + cp 0C8h + jr nz, p02loc_5B09 + pop af + jr nz, p02loc_5B06 + call SinH + ret +p02loc_5B06: + jp p02loc_58B4 +p02loc_5B09: + cp 0C9h + jr nz, p02loc_5B14 + pop af + jr nz, p02loc_5B06 + call ASinH + ret +p02loc_5B14: + cp 0CAh + jr nz, p02loc_5B1F + pop af + jr nz, p02loc_5B06 + call cosh + ret +p02loc_5B1F: + cp 0CBh + jr nz, p02loc_5B2A + pop af + jr nz, p02loc_5B06 + call ACosH + ret +p02loc_5B2A: + cp 0CCh + jr nz, p02loc_5B35 + pop af + jr nz, p02loc_5B06 + call TanH + ret +p02loc_5B35: + cp 0CDh + jr nz, p02loc_5B40 + pop af + jr nz, p02loc_5B06 + call ATanH + ret +p02loc_5B40: + cp 0Ch + jr nz, p02loc_5B88 + pop af + jp z, fprecip + cp 0Ch + jp z, CRecip + cp 2 + jr nz, p02loc_5B06 + call p02sub_5E10 + ld a, (OP6) + ld h, 0 + ld l, a + call CreateTempString + ld (iMathPtr2), de + call PushRealO4 + xor a + call p02sub_429D + call PopRealO1 +p02loc_5B6B: + rst 10h + set 7, (hl) +p02loc_5B6E: + call PopRealO1 +p02loc_5B71: + ld a, (unk_9817) + cp 1 + ret c + ld hl, (tSymPtr1) + set 7, (hl) + jr z, p02loc_5B83 + ld hl, (tSymPtr2) + set 7, (hl) +p02loc_5B83: + xor a + ld (unk_9817), a + ret +p02loc_5B88: + cp 0B3h + jr nz, p02loc_5BAB + pop af + call p02sub_6534 + call p02sub_5646 + ld a, (OP1+1) + cp 24h + jr z, p02loc_5BA3 + call p02sub_5A1D + call p02sub_5936 + call p02sub_5E21 +p02loc_5BA3: + ld a, 40h + call p02sub_429D + jp p02loc_5B71 +p02loc_5BAB: + cp 0BCh + jr nz, p02loc_5BBE + pop af + jr nz, p02loc_5BB6 + call p02sub_6D49 + ret +p02loc_5BB6: + cp 0Ch + jr nz, p02loc_5BE9 + call CSqRoot + ret + +p02loc_5BBE: + cp 0Dh + jr nz, p02loc_5BEC + pop af + jp z, FPSquare + cp 0Ch + jp z, CSqaure + cp 2 + jr nz, p02loc_5BE9 + call p02sub_5646 + call p02sub_5A17 + call p02sub_4525 + ld hl, (iMathPtr1) + ld (iMathPtr2), hl + ld hl, (OP6) + call p02sub_53F1 + call p02sub_40BA + jr p02loc_5C07 +p02loc_5BE9: + jp p02loc_58B4 +p02loc_5BEC: + cp 0B0h + jr nz, p02loc_5C0D + pop af + jp z, InvOP1S + cp 0Ch + jp z, InvOP1SC + ld d, 5 +p02loc_5BFB: + push de + cp 2 + jr nz, p02loc_5C0A + call p02sub_5A0F + pop af + call CMATFUN +p02loc_5C07: + jp p02loc_5B6E +p02loc_5C0A: + pop de + jr p02loc_5BE9 +p02loc_5C0D: + cp 0B9h + jr nz, p02loc_5C1E + pop af + jp z, Trunc + cp 0Ch + jp z, CplxTrunc + ld d, 6 + jr p02loc_5BFB +p02loc_5C1E: + cp 0BAh + jr nz, p02loc_5C2F + pop af + jp z, frac + cp 0Ch + jp z, CplxFrac + ld d, 7 + jr p02loc_5BFB +p02loc_5C2F: + cp 0B1h + jr nz, p02loc_5C40 + pop af + jp z, DoInt + cp 0Ch + jp z, CplxFloor + ld d, 8 + jr p02loc_5BFB +p02loc_5C40: + cp 26h + jr nz, p02loc_5C51 + pop af + call p02sub_660A + call CkOP1Real + cp 0Eh + jp z, ErrInvalid + ret +p02loc_5C51: + cp 89h + jr nz, p02loc_5C76 + pop af + ret z + cp 0Ch + jp z, InvertNonReal + cp 1 + jp nz, p02loc_58BB +p02loc_5C61: + cp 1 + jr nz, p02loc_5C9F + call p02sub_5A32 + ld a, (OP4) + and 0Fh + ld de, (iMathPtr3) + call p02loc_452B + jr p02loc_5CBE +p02loc_5C76: + cp 2Dh + jr nz, p02loc_5C88 + pop af + jr nz, p02loc_5C81 + call j_Factorial + ret +p02loc_5C81: + cp 1 + jp z, p02loc_58C3 + jr p02loc_5C9F +p02loc_5C88: + cp 0B2h + jr nz, p02loc_5CA2 + pop af + jp z, ClrOP1S + cp 0Ch + jp z, CAbs + cp 0Dh + jp z, p02loc_5457 + ld d, 4 + jp p02loc_5BFB +p02loc_5C9F: + jp ErrDataType +p02loc_5CA2: + cp 0B4h + jr nz, p02loc_5CC0 + pop af + jr nz, p02loc_5C9F + call p02sub_6520 + ld h, a + ld l, a + ld (OP6+8), hl + call CreateTempRMat + ld (iMathPtr3), de + call PushRealO4 + call p02sub_4102 +p02loc_5CBE: + jr p02loc_5CD8 +p02loc_5CC0: + cp 0Eh + jr nz, p02loc_5CDB + pop af + cp 2 + jr nz, p02loc_5C9F + call SETMAT1 + ld a, h + ld h, l + ld l, a + ld (OP6+8), hl + call p02sub_5A17 + call p02sub_4124 +p02loc_5CD8: + jp p02loc_5B6E +p02loc_5CDB: + cp 0B6h + jr nz, p02loc_5CE4 + ld hl, j_LSUM + jr p02loc_5CF4 +p02loc_5CE4: + cp 0B7h + jr nz, p02loc_5CED + ld hl, p02loc_4962 + jr p02loc_5CF4 +p02loc_5CED: + cp 1Ah + jr nz, p02loc_5D03 + ld hl, j_LLOW +p02loc_5CF4: + call p02sub_6042 + pop af + push hl + cp 1 + jr z, p02loc_5D17 + cp 0Dh + jr z, p02loc_5D17 + jr p02loc_5C9F +p02loc_5D03: + cp 19h + jr nz, p02loc_5D35 + ld hl, j_LHIGH + jr p02loc_5CF4 + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;Don't think this is used anywhere. + call p02sub_6042 + jr p02loc_5CD8 + + pop af + push hl + cp 2 + jr nz, p02loc_5D28 +#endif + +p02loc_5D17: + call SETMAT1 + ld hl, 1 + ld (OP6M), hl +p02loc_5D20: + pop hl + call p02sub_5D27 + jp p02loc_5B71 + +p02sub_5D27: + jp (hl) + +p02loc_5D28: + jp ErrDataType + +#ifndef DEVIATE_FROM_ORIGINAL_FILE + call p02sub_5A0F + pop hl + call p02sub_5D27 +#endif + +p02loc_5D32: + jp p02loc_5B6E + +p02loc_5D35: + cp 3 + jr nz, p02loc_5D3F + pop af + jp z, ToFrac + jr p02loc_5D28 +p02loc_5D3F: + cp 8Ah + jr nz, p02loc_5D52 + pop af + ret z + cp 0Ch + jp z, page0_1040 +p02loc_5D4A: + cp 0Dh + jp z, p02loc_5457 + jp p02loc_5C61 +p02loc_5D52: + cp 8Bh + jr nz, p02loc_5D66 + pop af + jp z, OP1Set0 + cp 0Ch + jp z, page0_103D + cp 1 + jr z, p02loc_5D95 + jp p02loc_5D4A +p02loc_5D66: + cp 8Ch + jr nz, p02loc_5DA1 + pop af + jr nz, p02loc_5D78 + call CkOP1Pos + jp z, OP1Set0 + ld a, 4 + jp GETCONOP1 +p02loc_5D78: + cp 0Ch + jp z, Angle + cp 2 + jr nz, p02loc_5D8D + call p02sub_5A0F + call OP1Set0 + call p02sub_44C8 + jp p02loc_5D32 +p02loc_5D8D: + cp 0Dh + jp z, p02loc_5457 + jp p02loc_58B4 +p02loc_5D95: + call p02sub_5A32 + call OP1Set0 + call p02sub_49B2 + jp p02loc_5D32 +p02loc_5DA1: + cp 8Eh + jr nz, p02loc_5DF6 + pop af + cp 4 + jp nz, p02loc_5D28 + bit 0, (iy+1Fh) + jp nz, Page0Call_2501 + set 0, (iy+1Fh) + call Page0Call_241E + jp c, ErrUndefined + ex de, hl + ld e, (hl) + inc hl + ld a, (hl) + cp e + jp z, ErrInvalid + ld d, a + inc hl + ld (chkDelPtr1), hl + ex de, hl + push hl + inc hl + inc hl + call j_TMPEQUNOSRC + ld hl, (chkDelPtr1) + pop bc + ldir + call OP4ToOP1 + ld hl, p02loc_5DEF + call pushErrorHandleR + call j_PARSEOFF + call popErrorHandleR + res 0, (iy+1Fh) + call page0_1717 + jp p02loc_5B71 + +p02loc_5DEF: + res 0, (iy+1Fh) + jp JErrorNo + +p02loc_5DF6: + cp 12h + jr nz, p02loc_5E30 + pop af + jp z, RndGuard + cp 0Ch + jp z, p02sub_65BE + call ShLAcc + ld de, ramStart + push de + jp p02loc_561F + +p02loc_5E0D: + jp ErrDataType + +p02sub_5E10: + call p02sub_59D5 + push af + call p02sub_5649 + pop af + +p02sub_5E18: + ld (OP6+8), hl + jp z, PushRealO4 + call p02sub_5A17 + +p02sub_5E21: + call p02sub_4525 + ld de, (iMathPtr3) + ld (iMathPtr1), de + ret + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;Don't think this is used anywhere. + jp ErrDataType +#endif + +p02loc_5E30: + cp 8Fh + jr nz, p02loc_5E5D + pop af + cp 4 + jp nz, p02loc_5D28 + call p02sub_592C + ex de, hl + ld e, (hl) + inc hl + ld d, (hl) + ld c, e + ld b, d +p02loc_5E43: + inc hl + ld a, b + or c + jr z, p02loc_5E53 + dec bc + call isPtrHLA2ByteTok + jr nz, p02loc_5E43 + inc hl + dec de + dec bc + jr p02loc_5E43 +p02loc_5E53: + ex de, hl + call j_SetXXXXOP2 + call OP2ToOP1 + jp p02loc_5EF2 +p02loc_5E5D: + cp 0Fh + jr nz, p02loc_5E87 + pop af + jp z, Cube + cp 0Ch + jr nz, p02loc_5E79 + call PUSHMCPLXO1 + call OP1Set3 + call OP2Set0 + call page0_104E + call CYtoX + ret +p02loc_5E79: + cp 2 + jp nz, p02loc_58B4 + call OP1ToOP3 + call OP1Set3 + jp p02loc_453E +p02loc_5E87: + cp 0BDh + jr nz, p02loc_5EAE + pop af + jr z, p02loc_5EA6 + cp 0Ch + jp nz, p02loc_58B4 + ld hl, OP3 + call page0_1224 + call PushRealO3 + call OP3Set0 + call PushRealO3 + call CXrootY + ret +p02loc_5EA6: + rst 8 + call OP1Set3 +p02loc_5EAA: + call j_XRootY + ret +p02loc_5EAE: + cp 0B5h + jr nz, p02loc_5EFE + pop af + cp 2 + jr nz, p02loc_5EDB + call SETMAT1 + push hl + ld hl, 2 + call CREATETLIST + pop hl + push hl + call p02sub_5EF6 + ld hl, 2 + call PUTTOLA1 + pop hl + call p02sub_5EF5 + ld hl, 1 + call PUTTOLA1 + call OP4ToOP1 + jr p02loc_5EEF +p02loc_5EDB: + cp 1 + jr z, p02loc_5EE4 + cp 0Dh + jp nz, p02loc_5E0D +p02loc_5EE4: + call p02sub_592C + ex de, hl + ld e, (hl) + inc hl + ld d, (hl) + ex de, hl + call p02sub_5EF8 +p02loc_5EEF: + call p02sub_6042 +p02loc_5EF2: + jp p02loc_5B71 + +p02sub_5EF5: + ld l, h +p02sub_5EF6: + ld h, 0 +p02sub_5EF8: + call j_SetXXXXOP2 + jp OP2ToOP1 +p02loc_5EFE: + cp 0Ah + jr nz, p02loc_5F0E + pop af + jp nz, p02loc_5C81 + bit trigDeg, (iy+trigFlags) + ret z + jp RToD +p02loc_5F0E: + cp 0Bh + jr nz, p02loc_5F1E + pop af + jp nz, p02loc_5C81 + bit trigDeg, (iy+trigFlags) + ret nz + jp DToR +p02loc_5F1E: + cp 21h + jr nz, p02loc_5F2A + pop af + call p02sub_6029 + scf + jp EXMEAN1 +p02loc_5F2A: + cp 1Fh + jr nz, p02loc_5F35 + pop af + call p02sub_6029 + jp p02loc_5891 +p02loc_5F35: + cp 91h + jr nz, p02loc_5F59 + pop af + ld b, a + scf +p02loc_5F3C: + push af + ld a, b + cp 2 + jp nz, ErrDataType + call p02sub_59D5 + push af + ld a, h + cp l + jr z, p02loc_5F4E + jp nc, ErrDimension +p02loc_5F4E: + pop af + call p02sub_5E18 + pop af + call ROWECHELON + jp p02loc_5B6E +p02loc_5F59: + cp 92h + jr nz, p02loc_5F62 + pop af + ld b, a + xor a + jr p02loc_5F3C +p02loc_5F62: + cp 8Dh + jr nz, p02loc_5F8E + pop af + cp 2 + jr z, p02loc_5F77 + call p02sub_5F7F + call p02sub_5A32 + call CUMSUM +p02loc_5F74: + jp p02loc_5B6E +p02loc_5F77: + call p02sub_5A0F + call p02sub_475B + jr p02loc_5F74 +p02sub_5F7F: + cp 1 + jr z, p02loc_5F8B + call page0_1842 + cp 0Dh + jp nz, p02loc_602B +p02loc_5F8B: + jp p02sub_6042 +p02loc_5F8E: + cp 0E9h + jr nz, p02loc_5FA0 + pop af + call PushOP1 + call OP1Set0 + rst 18h +p02loc_5F9A: + call OP1Set1 + jp p02loc_614E +p02loc_5FA0: + cp 0DFh + jr nz, p02loc_5FB2 + pop af + call PushOP1 + call OP1Set0 + rst 18h + call OP1Set1 + jp p02loc_620A +p02loc_5FB2: + cp 90h + jr nz, p02loc_5FCF + pop af + call p02sub_5F7F + call SETMAT1 + dec hl + ld a, h + or l + jp z, ErrDimension + call CREATETLIST + call PushRealO4 + call p02sub_4A01 + jp p02loc_5B6E +p02loc_5FCF: + cp 0D0h + jr nz, p02loc_5FED + pop af + jp nz, ErrDataType + rst 18h + ld a, 25h +p02loc_5FDA: + push af + ld a, (fmtDigits) + cp 0FFh + jr nz, p02loc_5FE4 + ld a, 9 +p02loc_5FE4: + ld (OP1), a + rst 18h + pop af + call Page0Call_395D + ret +p02loc_5FED: + cp 0DBh + jr nz, p02loc_5FF9 + pop af + call p02sub_6029 + ex de, hl + jp p02loc_5167 +p02loc_5FF9: + cp 0DCh + jr nz, p02loc_6005 + pop af + call p02sub_6029 + ex de, hl + jp p02loc_5177 +p02loc_6005: + cp 0ABh + jp z, p02loc_6159 + cp 0DAh + jp nz, ErrArgument + pop af + jp z, FDIV100 + cp 0Ch + jp nz, p02loc_58B4 + rst 18h + call OP2ToOP1 + call FDIV100 + rst 8 + call PopRealO1 + call FDIV100 + jp page0_104E +p02sub_6029: + cp 1 +p02loc_602B: + jp nz, p02loc_62A2 + call p02sub_6042 + call SETMAT1 + xor a + ld (iMathPtr2+1), a + ld (iMathPtr5+1), a + ret +p02loc_603C: + call p02sub_64AB + call j_ITSOLVERNB +p02sub_6042: + ld de, (unk_9665) + dec de + ld (unk_9665), de + ret + +ThreeExec: + call page0_1847 + ld hl, 9817h + ld (hl), 0 + cp 0D1h + jr nz, p02loc_6065 + ld a, 26h +p02loc_605A: + push af + call j_ErrNonReal_FPST_FPS1 + call p02sub_5601 + ld a, e + jp p02loc_5FE4 +p02loc_6065: + cp 0D2h + jr nz, p02loc_606D + ld a, 27h + jr p02loc_605A +p02loc_606D: + cp 0E3h + jr nz, p02loc_60BE + ld a, 0Eh +p02loc_6073: + push af + call j_ErrNonReal_FPST_FPS1 + call CkOP1Real + jr nz, p02loc_6080 + pop af + jp p02loc_6156 +p02loc_6080: + cp 1 + jp nz, ErrDataType + call p02sub_5A32 + ld hl, (OP6) + ld (OP6M), hl + ld hl, 1 + ld (OP6), hl + call PushRealO6 + rst 18h + rst 18h +p02loc_6099: + call CHKERRBREAK + call CpyTo1FPS5 + rst 18h + call CpyTo1FPS5 + rst 18h + call GETL1TOOP1 + pop af + push af + call p02sub_658F + call p02sub_616F + jr nc, p02loc_6099 + pop af + ld de, 1Bh + call DeallocFPS1 + call PopRealO1 + jp FPOPCPLX +p02loc_60BE: + cp 0E4h + jr nz, p02loc_60C6 + ld a, 10h + jr p02loc_6073 +p02loc_60C6: + cp 0CFh + jr nz, p02loc_60D8 + call p02sub_6430 + push de + call CpyTo1FPST + call EOP1NotReal + pop de + jp p02loc_512F +p02loc_60D8: + cp 0CEh + jr nz, p02loc_60F1 + call CkOP1Real + cp 1 + jr nz, p02loc_615A + call p02sub_6042 + call SETMAT1 + ex de, hl + xor a + ld (iMathPtr2+1), a + jp p02loc_641B +p02loc_60F1: + cp 0B6h + jr nz, p02loc_6143 + ld hl, j_LSUM +p02loc_60F8: + push hl + call p02sub_6136 + push de + call popOP1 +p02loc_6100: + call p02sub_6136 + pop hl + call CpHLDE + jp c, ErrDimension + push hl + push de + call popOP1 + call CkOP1Real + cp 1 + jr z, p02loc_611A + cp 0Dh + jr nz, p02loc_615A +p02loc_611A: + call SETMAT1 + pop hl + call p02sub_6163 + ld (OP6M), hl + pop hl + ld a, h + cp 0FFh + jr z, p02loc_6130 + call p02sub_6163 + ld (OP6), hl +p02loc_6130: + call p02sub_6042 + jp p02loc_5D20 +p02sub_6136: + call EOP1NotReal + call PosNo0DoInt + jp nz, ErrDomain + call j_ConvOP1 + ret +p02loc_6143: + cp 0B7h + ld hl, p02loc_4962 + jr z, p02loc_60F8 + cp 0E9h + jr nz, p02loc_618F +p02loc_614E: + call EOP1NotReal + call j_ErrNonReal_FPST_FPS1 + ld a, 0Ch +p02loc_6156: + jp p02sub_658F +p02loc_6159: + pop af +p02loc_615A: + jp nz, ErrDataType + push bc + call PUSHMCPLXO1 + jr p02loc_619B +p02sub_6163: + ld de, (OP6) + call CpHLDE + ret c + jp nz, ErrDimension + ret +p02sub_616F: + call CpyTo6FPS2 + ld de, (iMathPtr1) + ld hl, (OP6) + push hl + call PutToL + pop de + inc de + ld (OP6), de + ld hl, (OP6M) + or a + sbc hl, de + push af + call CpyO6ToFPS2 + pop af + ret +p02loc_618F: + cp 0EDh + jp nz, p02loc_61FD +p02loc_6194: + push af + call EOP1NotReal + call j_ErrNonReal_FPST_FPS1 +p02loc_619B: + call PosNo0DoInt + jp nz, ErrDomain + call j_ConvOP1 + ex de, hl + call CHK_HL_999 + ld (OP6M), hl + ld de, 1 + ld (OP6), de + call CreateTempRList + ld (iMathPtr1), de + call POPMCPLXO1 + call PushRealO4 + call PushRealO6 + call PUSHMCPLXO1 +p02loc_61C5: + call CHKERRBREAK + call POPMCPLXO1 + call PUSHMCPLXO1 + pop af + push af + cp 0ABh + jr nz, p02loc_61D9 + call j_Random + jr p02loc_61EE +p02loc_61D9: + cp 0D9h + jr z, p02loc_61E6 + jr c, p02loc_61EB + ld a, 24h + call j_BCALL_4B9D + jr p02loc_61EE +p02loc_61E6: + call p02sub_51A0 + jr p02loc_61EE +p02loc_61EB: + call p02sub_4F53 +p02loc_61EE: + call p02sub_616F + jr nc, p02loc_61C5 + pop af + call FPOPCPLX + call FPOPREAL + jp PopRealO1 +p02loc_61FD: + cp 0D9h +p02loc_61FF: + jp z, p02loc_6194 + cp 0D8h + jr z, p02loc_61FF + cp 0DFh + jr nz, p02loc_621B +p02loc_620A: + call EOP1NotReal + call j_ErrNonReal_FPST_FPS1 + ld a, 20h + jp p02sub_658F +p02loc_6215: + ld de, 1 + push de + jr p02loc_6233 +p02loc_621B: + cp 0DDh + jp nz, p02loc_62A5 + call RealPosNo0DoInt + jp nz, ErrDomain + call j_ConvOP1 + jp c, ErrDimension + push de + call popOP1 + call popOP3 +p02loc_6233: + call CkOP1Real + cp 4 + jr nz, p02loc_62A2 + ld a, (OP3) + and 1Fh + cp 4 + jr nz, p02loc_62A2 + call SET2MVLPTRS + ld (OP6+6), hl + pop bc + jp c, OP1Set0 + push bc + dec bc + ld hl, (iMathPtr1) + ld de, (OP6) + call p02sub_6341 + jp nc, p02loc_6287 + push hl + ld hl, (OP6+6) +p02loc_6260: + ld (OP6M), bc + or a + sbc hl, bc + jr c, p02loc_6286 + pop hl + push hl + ld de, (iMathPtr2) + inc de + inc de + ld bc, (OP6+4) +p02loc_6275: + ld a, (de) + inc de + cpi + jr nz, p02loc_628B + jp pe, p02loc_6275 + pop hl + pop hl + call j_SetXXXXOP2 + jp OP2ToOP1 +p02loc_6286: + pop hl +p02loc_6287: + pop hl + jp OP1Set0 +p02loc_628B: + pop hl + ld bc, (OP6M) + call isPtrHLA2ByteTok + jr nz, p02loc_6297 + inc hl + inc bc +p02loc_6297: + pop de + inc de + push de + inc hl + push hl + inc bc + ld hl, (OP6+6) + jr p02loc_6260 +p02loc_62A2: + jp ErrDataType +p02loc_62A5: + cp 0DEh + jr nz, p02loc_62B2 +p02loc_62A9: + call PushOP1 + call OP1Set1 + jp p02loc_6452 +p02loc_62B2: + cp 0E0h + jr nz, p02loc_62C1 + call EOP1NotReal + call j_ErrNonReal_FPST_FPS1 + ld a, 18h + jp p02sub_658F +p02loc_62C1: + cp 0ECh + jr nz, p02loc_62D0 + call EOP1NotReal + call j_ErrNonReal_FPST_FPS1 + ld a, 1Ch + jp p02sub_658F +p02loc_62D0: + cp 0E1h + jr nz, p02loc_62DF + call EOP1NotReal + call j_ErrNonReal_FPST_FPS1 + ld a, 16h + jp p02sub_658F +p02loc_62DF: + cp 0DAh + jr z, p02loc_62EC + cp 25h + jp nz, p02loc_636A + call p02sub_6969 + ret +p02loc_62EC: + call RealPosNo0DoInt +p02loc_62EF: + jp nz, ErrDomain + call j_ConvOP1 + jp c, ErrDimension + push de + call popOP1 + call RealPosNo0DoInt + jr nz, p02loc_62EF + call j_ConvOP1 + push de + call popOP1 + call CkOP1Real + cp 4 + jr nz, p02loc_62A2 + call SETMAT1 + ex de, hl + pop bc + dec bc + call p02sub_6341 + jp nc, ErrDimension + ld (iMathPtr2), hl + pop bc + call p02loc_6347 + jp nc, ErrDimension + push bc + ld h, b + ld l, c + call CreateTempString + ld (iMathPtr3), de + ld hl, (iMathPtr2) + ld de, (iMathPtr3) + inc de + inc de + pop bc + ldir + call OP4ToOP1 + jp p02loc_5B71 +p02sub_6341: + inc hl + inc hl + push hl + add hl, de + ex de, hl + pop hl +p02loc_6347: + push ix + push bc + pop ix +p02loc_634C: + ld a, b + or c + jr z, p02loc_6363 + push hl + or a + sbc hl, de + pop hl + jr nc, p02loc_6367 + call isPtrHLA2ByteTok + jr nz, p02loc_635F + inc hl + inc ix +p02loc_635F: + inc hl + dec bc + jr p02loc_634C +p02loc_6363: + push ix + pop bc + scf +p02loc_6367: + pop ix + ret +p02loc_636A: + cp 26h + jr nz, p02loc_6372 + call p02loc_67A9 + ret +p02loc_6372: + cp 16h + jp z, p02loc_63AC + cp 15h + jp z, p02loc_63B6 + cp 17h + jp z, p02loc_63BF + cp 18h + jp z, p02loc_64BB + cp 22h + jp z, p02loc_603C + jp ErrArgument + +p02sub_638E: + call PopRealO3 + call PushOP1 + call OP3ToOP1 + call j_RESTOREDATA + jp popOP1 +p02loc_639D: + ld de, 12h + call DeallocFPS1 + call PopRealO1 + +RESTOREERRNO: + call j_RESTOREDATA + jp JErrorNo +p02loc_63AC: + xor a + call p02sub_64C5 + call p02sub_416F +p02loc_63B3: + jp p02loc_5B6E +p02loc_63B6: + xor a + call p02sub_64C5 + call p02sub_4144 + jr p02loc_63B3 +p02loc_63BF: + rst 18h + call OP1Set1 + scf + call p02sub_64C5 + call p02sub_41B4 + jr p02loc_63B3 +p02loc_63CC: + cp 27h + jr z, p02loc_63E1 + cp 28h + jr z, p02loc_63DE + cp 0E2h + jp nz, ErrArgument + ld a, 14h + jp p02sub_658F +p02loc_63DE: + scf + jr p02loc_63E2 +p02loc_63E1: + xor a +p02loc_63E2: + push af + rst 18h + call OP1Set1 + ld a, 7Bh + ld (OP1+1), a +p02loc_63EC: + call p02sub_6585 + call OP1ToOP5 + call PopRealO1 + call EOP1NotReal + call OP1ToOP3 + call PopRealO1 + call EOP1NotReal + rst 8 + call PopRealO4 + call PopRealO1 + pop af + ld b, 1 + call j_DFMIN2 + ret +FourExec: + ld hl, 9817h + ld (hl), 0 + cp 0CEh + jr nz, p02loc_644E + call p02sub_6430 +p02loc_641B: + ld (unk_90CC), de + call j_ErrNonReal_FPST_FPS1 + call SETesTOfps + ld a, 2Bh + call Page0Call_38FD + call FPOPCPLX + jp p02loc_5B71 + +p02sub_6430: + call p02sub_6042 + call popOP3 + call CkOP1Real + cp 1 + jr nz, p02loc_6444 + ld a, (OP3) + and 1Fh + cp 1 +p02loc_6444: + jp nz, ErrDataType + call SET2MVLPTRS + jp nz, ErrDimMismatch + ret +p02loc_644E: + cp 0DEh + jr nz, p02loc_645F +p02loc_6452: + call EOP1NotReal + ld b, 3 + call j_ErrNonReal + ld a, 1Ah + jp p02sub_658F +p02loc_645F: + cp 18h + jp z, p02loc_64BB + cp 23h + jr nz, p02loc_6471 + call PushOP1 + call OP1Set1 + jp p02loc_653D +p02loc_6471: + cp 24h + jr nz, p02loc_6482 + rst 18h + call OP1Set1 + ld a, 7Bh + ld (OP1+1), a + call j_GRAPHQUAD + ret +p02loc_6482: + cp 25h + jr nz, p02loc_648D + call ErrD_OP1_0 + call p02sub_6966 + ret +p02loc_648D: + cp 22h + jp nz, p02loc_63CC + call PopRealO3 + call CkOP1Real + cp 1 + jr nz, p02loc_64B4 + call OP1ExOP3 + call p02sub_64AB + call PushRealO3 + call j_ITSOLVERB + jp p02sub_6042 +p02sub_64AB: + call OP1ToOP6 + call CkOP1Real + ret z + cp 1 +p02loc_64B4: + jp nz, ErrDataType + call page0_16F4 + ret +p02loc_64BB: + scf + call p02sub_64C5 + call p02sub_4172 + jp p02loc_63B3 +p02sub_64C5: + push af + call p02sub_6520 + ld (OP6+4+1), a + call PopRealO1 + call p02sub_6520 + ld (OP6+4), a + call PopRealO1 + ld a, (OP1) + and 1Fh + cp 2 + jr nz, p02loc_651D + pop af + push af + jr c, p02loc_6511 +p02loc_64E5: + call p02sub_59D5 + push af + ld a, (OP6+4) + cp h + jr c, p02loc_64F2 +p02loc_64EF: + jp nz, ErrDimension +p02loc_64F2: + ld a, (OP6+4+1) + cp h + jr c, p02loc_64FA + jr nz, p02loc_64EF +p02loc_64FA: + ld (OP6+8), hl + pop af + jr z, p02loc_650A + call p02sub_5A1D + call p02sub_4520 + ld de, (iMathPtr3) +p02loc_650A: + pop af + call c, PopRealO1 + jp PushRealO4 +p02loc_6511: + jr nz, p02loc_64E5 + call CpyTo2FPST + ld a, (OP2) + and 1Fh + jr z, p02loc_64E5 +p02loc_651D: + jp ErrDataType +p02sub_6520: + call RealPosNo0DoInt + jr nz, p02loc_6531 + ld a, (OP1+1) + cp 82h + jr nc, p02loc_6531 + call j_ConvOP1 + ld a, e + ret +p02loc_6531: + jp ErrDimension +p02sub_6534: + cp 2 + ret z + jr p02loc_651D +FiveExec: + cp 23h + jr nz, p02loc_6541 +p02loc_653D: + call p02sub_7BC8 + ret +p02loc_6541: + cp 24h + jr nz, p02loc_654C + call p02sub_6585 + call j_GRAPHQUAD + ret +p02loc_654C: + cp 27h + jr nz, p02loc_6555 + or a +p02loc_6551: + push af + jp p02loc_63EC +p02loc_6555: + cp 28h + jp nz, ErrArgument + scf + jr p02loc_6551 +p02sub_655D: + call SET2MVLPTRS + add hl, de + ld a, d + cp l + jp nz, ErrDimMismatch + ld l, e + ld (OP6+8), hl + ret +p02sub_656B: + call page0_1641 + ret nz + jp ErrSyntax +p02loc_6572: + call RToP +p02loc_6575: + jp OP2ToOP1 +p02loc_6578: + call PtoR + jr p02loc_6575 +p02loc_657D: + call PtoR + ret +p02loc_6581: + call RToP + ret +p02sub_6585: + call EOP1NotReal + call errd_op1notpos + jp ErrD_OP1_0 +p02loc_658E: + xor a +p02sub_658F: + call j_BCALL_4B9D + ret +p02loc_6593: + ld a, 2 + jr p02sub_658F +p02loc_6597: + ld a, 4 + jr p02sub_658F +p02loc_659B: + ld a, 6 + jr p02sub_658F +p02loc_659F: + ld a, 8 + jr p02sub_658F +p02loc_65A3: + ld a, 0Ah + jr p02sub_658F +p02loc_65A7: + ld a, 28h +p02loc_65A9: + call Page0Call_38FD + ret +p02loc_65AD: + ld a, 29h + jr p02loc_65A9 +p02loc_65B1: + ld a, 2Ah + jr p02loc_65A9 +Angle: + call OP1ExOP2 + ld d, 0 + call ATan2 + ret +p02sub_65BE: + call page0_14A7 +p02loc_65C1: + jp page0_104E +p02loc_65C4: + push de + call Round + call OP1ExOP2 + pop de + call Round + call OP1ExOP2 + jr p02loc_65C1 + +RndGuard: + ld d, 9 +Page02_39C9: + ld a, (OP1+1) + push af + ld a, 80h + ld (OP1+1), a + call Round + pop bc + ld hl, OP1+1 + ld a, (hl) + ld (hl), b + cp 80h + ret z + jp INCO1EXP + +RnFx: ld a, (fmtDigits) + cp 0FFh + ret z + ld d, a + jp Round + +p02sub_65F8: + rst 10h + ex de, hl + call ldHLind + ld a, h + or l + jp z, ErrInvalid + ret + +CPYO1TOES15: + ld a, (EST) + push af + jp p02loc_66D3 + +p02sub_660A: + ld a, (EST) + inc a + push af + call CpyTo2FPST + ld a, (OP2M) + bit 7, a + jp z, p02loc_66D3 + pop af + bit 5, (iy+7) + jr nz, p02loc_663A + call IsRecursiveMode + jp z, p02loc_66D3 + bit allowCursor, (iy+plotFlags) + jr nz, p02loc_663A + call page0_172A + jp z, p02loc_66D3 + bit webMode, (iy+seqFlags) + jp nz, p02loc_692D +p02loc_663A: + call EOP1NotReal + call CKOP1DoInt + jp nz, ErrInvalid + ld hl, nMin + call Mov9OP2Cp + jr nc, p02loc_665B + ld a, (unk_84E9) + or a + jp z, ErrInvalid + ld hl, OP1 + ld (hl), 0Eh + call FPOPREAL + ret + +p02loc_665B: + rst 8 + call CpyTo1FPST + call p02sub_65F8 + call j_RclN + call FPSub + call errd_op1notpos + call ErrD_OP1_0 + call OP2Set3 + call cpop1op2 + jp nc, ErrDomain + call PopRealO2 + ld a, (OP2M) + ld hl, un1 + ld de, 8E2Dh + ld bc, u0 + cp 81h + jr c, p02loc_669E + ld hl, vn1 + ld de, 8E3Fh + ld bc, v0 + jr z, p02loc_669E + ld hl, wn1 + ld de, 8E51h + ld bc, w0 +p02loc_669E: + ld a, (OP1M) + cp 10h + push af + push hl + push de + ld h, b + ld l, c + call CMP_NUM_INIT + ld b, a + pop de + pop hl + pop af + ld a, b + jr z, p02loc_66BD + cp 2 + jr nz, p02loc_66B7 + ex de, hl +p02loc_66B7: + ld de, 9 + add hl, de + jr p02loc_66C1 +p02loc_66BD: + or a + jr z, p02loc_66C1 + ex de, hl +p02loc_66C1: + rst 20h + call CkOP1Real + cp 0Eh + ret nz + ld a, (unk_84E9) + or a + ret nz + call page0_1040 + jp ErrInvalid +p02loc_66D3: + call PushOP1 + call CkOP1Real + cp 2 + jr c, p02loc_66E3 + jp ErrDataType + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;Don't think this is used anywhere. + jp nz, ErrDataType +#endif + +p02loc_66E3: + call CpyTo1FPS1 + call p02sub_65F8 + ld hl, OP1M + ld a, 5Bh + bit 6, (hl) + jr nz, p02loc_66FF + ld a, 54h + bit 5, (hl) + jr nz, p02loc_66FF + bit 7, (hl) + jp nz, p02loc_67DD + ld a, 58h +p02loc_66FF: + push af + call ZeroOP1 + pop af + ld (OP1+1), a + rst 18h + call j_SAVEDATA + call CpyTo1FPS1 + call CkOP1Real + cp 1 + jr z, p02loc_6757 + pop af + cp 4 + jp z, Page0Call_2501 + ld (EST), a + ld hl, p02loc_674A + call pushErrorHandleR + rst 18h + call CpyTo1FPS1 + call j_StoOther + call CpyTo1FPS2 + call j_PARSEOFF + call page0_1717 + call p02sub_638E + call popErrorHandleR +p02loc_673A: + ld de, 12h + call DeallocFPS1 + ld hl, EST + dec (hl) + ret +p02loc_6745: + call FPOPREAL + pop af + pop af +p02loc_674A: + xor a + ld (EST), a + call PopRealO1 + call FPOPCPLX + jp RESTOREERRNO +p02loc_6757: + pop af + cp 3 + jp z, Page0Call_2501 + ld (EST), a + call p02sub_68F8 + push hl +p02loc_6764: + call CpyTo1FPS2 + rst 10h + pop hl + push hl + call GetLToOP1 + ld hl, p02loc_6745 + call pushErrorHandleR + rst 18h + call CpyTo1FPS2 + call j_StoOther + call CpyTo1FPS3 + call j_PARSEOFF + call page0_1717 + call CkOP1Real + jp nz, ErrDataType + call popErrorHandleR + pop hl + call p02sub_6910 + jr z, p02loc_6795 + push de + jr p02loc_6764 +p02loc_6795: + pop af + call CpyTo1FPS2 + call markTableDirty + call PopRealO1 + call p02sub_638E + jp p02loc_673A + +p02sub_67A5: + rst 18h + call OP1Set1 +p02loc_67A9: + rst 18h + call CpyTo1FPS3 + call p02sub_65F8 + ld a, (OP1M) + bit 7, a + jr z, p02loc_67DA + call page0_172A + jr z, p02loc_67C2 + call IsRecursiveMode + jp nz, ErrInvalid +p02loc_67C2: + bit 5, (iy+7) + jp nz, ErrInvalid + ld hl, 0 + call CreateTempRList + call PushRealO4 + jr p02loc_6828 + +p02sub_67D4: + call EOP1NotReal + jp ErrD_OP1NotPosDoInt +p02loc_67DA: + jp ErrDataType +p02loc_67DD: + bit 5, (iy+7) + jp nz, ErrInvalid + pop af +p02sub_67E5: + call CpyTo1FPST + call CkOP1Real + cp 1 + jr nz, p02loc_6822 + call p02sub_68F8 + push hl +p02loc_67F3: + call CpyTo1FPS2 + rst 18h + call CpyTo1FPS2 + rst 10h + pop hl + push hl + call GetLToOP1 + rst 18h + call p02sub_67E5 + call CkOP1Real + cp 0Eh + jp z, ErrInvalid + pop hl + call p02sub_6910 + jr z, p02loc_6815 + push de + jr p02loc_67F3 +p02loc_6815: + pop af + call CpyTo1FPS1 + call markTableDirty + call PopRealO1 + jp p02loc_673A +p02loc_6822: + rst 18h + call OP1Set1 + rst 18h + rst 18h +p02loc_6828: + call Page0Call_38E5 + jp z, ErrUndefined + call SETesTOfps + call CPYTO1ES1 + call p02sub_67D4 + call ErrD_OP1_0 + call CPYTO1ES3 + call p02sub_67D4 + rst 8 + call CPYTO1ES2 + call p02sub_67D4 + call cpop1op2 + jp c, ErrIncrement + call CPYTO1ES3 + ld hl, nMin + call Mov9OP2Cp + jp c, ErrDomain + set 5, (iy+7) + ld hl, p02loc_68E7 + call pushErrorHandleR + call CPYTO1ES3 + call SEQSET +p02loc_6869: + call SETesTOfps + call j_RclN + call Plus1 + call j_StoN + call page0_1867 + call CPYTO1ES4 + ld a, (OP1M) + ld hl, 8E2Dh + cp 81h + jr c, p02loc_688D + ld hl, 8E3Fh + jr z, p02loc_688D + ld hl, 8E51h +p02loc_688D: + rst 20h + call CkValidNum + call OP1ToOP6 + call CPYTO1EST + call CkOP1Real + jr nz, p02loc_68B0 + call CpyO6ToFPST +p02loc_689F: + call popErrorHandleR + call PopRealO1 + ld de, 24h + call DeallocFPS1 + res 5, (iy+7) + ret + +p02loc_68B0: + rst 10h + ld a, 1 + call j_IncLstSize + call AdrLEle + ex de, hl + ld hl, OP6 + call mov9B2 + call CPYTO1ES3 + call CPYTO2ES1 + rst 30h + call CPYTO2ES3 + call CPYO1TOES3 + call cpop1op2 + jp z, ErrIncrement + call CPYTO1ES2 + call CPYTO2ES3 + call cpop1op2 + jr c, p02loc_689F + call CPYTO1ES3 + call SEQSOLVE + jp p02loc_6869 + +p02loc_68E7: + xor a + ld (EST), a + res 5, (iy+7) + call PopRealO1 + call markTableDirty + jp JErrorNo + +p02sub_68F8: + rst 10h + ex de, hl + ld e, (hl) + inc hl + ld d, (hl) + ld a, d + or e + jp z, ErrDimension + pop bc + push de + push bc + ex de, hl + call CreateTempRList + call PushRealO4 + ld hl, 1 + ret + +p02sub_6910: + push hl + call OP1ToOP3 + call CpyTo1FPST + rst 10h + push de + call OP3ToOP1 + pop de + pop hl + push hl + call PutToL + pop de + pop bc + pop hl + push hl + push bc + or a + sbc hl, de + ret z + inc de + ret + +p02loc_692D: + call EOP1NotReal + call CKPosDoInt + jp nz, ErrInvalid + call CkOP1FP0 + jp nz, ErrInvalid + call PopRealO1 + ld a, (OP1M) + cp 81h + push af + ld a, (unk_89F8) + and 60h + cp 40h + jr c, p02loc_695C + jr nz, p02loc_6955 + pop af + jr nz, p02loc_695F + jr p02loc_6962 +p02loc_6955: + pop af + jr c, p02loc_695F + jr z, p02loc_695F + jr p02loc_6962 +p02loc_695C: + pop af + jr c, p02loc_6962 +p02loc_695F: + jp ErrInvalid +p02loc_6962: + call j_RclX + ret + +p02sub_6966: + push af + jr p02loc_6973 +p02sub_6969: + push af + rst 18h + call OP1Set1 + ld a, 7Dh + ld (OP1+1), a +p02loc_6973: + call CpyTo3FPS1 + rst 18h + call CpyTo1FPS1 + call EOP1NotReal + call OP3ToOP1 + call j_SAVEDATA + call CpyTo1FPS1 + ld hl, p02loc_6A0D + call pushErrorHandleR + call p02sub_6A02 + rst 18h + call OP3ToOP1 + call j_StoOther + call SETesTOfps + call CPYTO1ES2 + call j_RclVarSym + rst 18h + call CPYTO2EST + rst 30h + call p02sub_69EF + call PopRealO3 + call SETesTOfps + rst 18h + call CPYTO2EST + call OP3ToOP1 + call FPSub + call p02sub_69EF + call PopRealO2 + call InvSub + rst 18h + call CpyTo1FPS1 + call Times2 + rst 8 + call PopRealO1 + call fpdiv + call popErrorHandleR + ld de, 12h + call DeallocFPS1 + ld hl, 9304h + dec (hl) + call p02sub_638E + pop af + jp nz, FPOPREAL + call PopRealO3 + rst 18h + call OP3ToOP1 + call markTableDirty + jp PopRealO1 + +p02sub_69EF: + rst 18h + call CPYTO1ES2 + call j_StoOther + call CPYTO1ES3 + call j_PARSEOFF + call page0_1717 + jp EOP1NotReal + +p02sub_6A02: + ld hl, 9304h + inc (hl) + ld a, (hl) + cp 3 + jp z, Page0Call_2501 + ret + +p02loc_6A0D: + pop af + ld hl, 9304h + dec (hl) + jp p02loc_639D +p02loc_6A15: + .db 0 + .db 81h + .db 57h + .db 29h + .db 57h + .db 79h + .db 51h + .db 30h + .db 82h + +Page02_38BB: + call PushRealO1 + call XName + jr NDeriv + +Page02_38C1: + call PushRealO1 + call ThetaName + jr NDeriv + +Page02_38C7: + call PushRealO1 + call TName +NDeriv: rst 18h + call j_RclVarSym + ld a, 25h + call ThreeExec + call CkOP1Real + jp nz, ErrDomain + ret + +PolarDerivative: + call Page02_38C1 + bit trigDeg, (iy+trigFlags) + ld hl, p02loc_6A15 + call nz, page0_D19 + rst 18h + call ThetaName + call j_RclVarSym + call Sin + call OP2ToOP6 + call OP1ToOP5 + call CpyTo2FPST + call FPMult + call OP1ToOP4 + call OP6ToOP1 + call FPMult + call CpyO1ToFPST + call RName + call j_RclVarSym + rst 8 + call OP6ToOP1 + call FPMult + call OP1ToOP6 + call OP5ToOP1 + call FPMult + call PopRealO2 + call InvSub + call OP1ToOP5 + call OP4ToOP1 + call OP6ToOP2 + call FPAdd + jp OP5ToOP2 + +Page02_38D3: + call Page02_38C7 + call CpyTo2FPST + call CpyO1ToFPST + call OP2ToOP1 + call Page02_38C7 + call PopRealO2 + jp fpdiv + +CSub: call InvOP1SC +CAdd: call p02loc_6AB9 +p02loc_6AB9: + call OP1ToOP3 + call PopRealO1 + rst 30h + call OP3ToOP2 + jr p02loc_6AFE + +CSqaure: + call PUSHMCPLXO1 +CMult: + call PushRealO1 + call CpyTo1FPS2 + call FPMult + call p02sub_6D0B + ld hl, (FPS) + ld de, OP1 + ld bc, 0FFF7h + add hl, bc + call Exch9 + rst 8 + call p02sub_6D0E + call OP2ExOP4 + rst 30h + call OP1ExOP4 + call CpyTo2FPS2 + call FPMult + call PopRealO2 + call FPSub + call FPOPCPLX +p02loc_6AFB: + call OP4ToOP2 +p02loc_6AFE: + jp page0_104E + +CRecip: call OP3Set1 + call PushRealO3 + xor a + ld (OP3M), a + call PushRealO3 +CDiv: call p02sub_6D17 + push de + call p02sub_6D0B + call PushRealO1 + call OP2ExOP4 + call p02sub_6D0E + call CpyTo2FPST + call FPSub + call CpyO1ToFPST + call OP3ToOP2 + call CpyTo1FPS2 + call FPMult + call CpyO1ToFPS2 + call OP2ExOP4 + call p02sub_6D0E + call CpyTo2FPS2 + rst 30h + call CpyO1ToFPS2 + call OP3ToOP1 + call p02loc_6B8F + ld a, (OP1+1) + or a + jp z, ErrDomain + pop de + call p02sub_6B6D + call OP1ToOP3 + call PopRealO2 + call FPOPREAL + call PopRealO1 + call CplxDiv +p02loc_6B60: + jr p02loc_6AFE + +CAbs: call p02sub_6D17 + push de + call AddSquares + call SqRoot + pop de + +p02sub_6B6D: + bit 7, d + jr z, p02loc_6B83 + res 7, d +p02loc_6B73: + call OP1EXPMinusE + jp c, OP1Set0 +p02loc_6B79: + ld (OP1+1), a + ret + +p02sub_6B7D: + bit 7, d + jr z, p02loc_6B73 + res 7, d +p02loc_6B83: + ld a, (OP1+1) + add a, e + jp c, ErrOverflow + jr p02loc_6B79 + +AddSquares: + call OP2ToOP4 +p02loc_6B8F: + call FPSquare + call OP1ExOP4 + call FPSquare + call OP4ToOP2 + rst 30h + jp page0_1040 + +CSqRoot:call OP1ToOP5 + call OP2ToOP6 + call CAbs + call OP5ToOP2 + xor a + ld (OP2), a + rst 30h + call TimesPt5 + call SqRoot + call CkOP1FP0 + jr nz, p02loc_6BBE + rst 8 + jr p02loc_6BE2 +p02loc_6BBE: + call OP1ToOP4 + call Times2 + rst 8 + call OP6ToOP1 + call fpdiv + call OP4ToOP2 + ld a, (OP5) + and 80h + jr z, p02loc_6BDF + ld a, (OP6) + and 80h + call nz, InvOP1SC + jr p02loc_6BE2 +p02loc_6BDF: + call OP1ExOP2 +p02loc_6BE2: + jp p02loc_6B60 + +CLN: call OP2ToOP6 + call PushRealO1 + call CAbs + call LnX + call OP1ExOP6 + call PopRealO2 + ld d, 0 + call ATan2Rad +p02loc_6BFC: + rst 8 + call OP6ToOP1 + jr p02loc_6BE2 + +CLog: call OP2ToOP6 + call PushRealO1 + call CAbs + call LogX + call OP1ExOP6 + call PopRealO2 + ld d, 0 + call ATan2Rad + ld a, 3 + call GETCONOP2 + call FPMult + jr p02loc_6BFC + +CTenX: call OP2ToOP4 + ld a, 3 + call GETCONOP2 + call fpdiv + call OP1ExOP4 + call fpdiv + rst 8 + call OP4ToOP1 + +CEtoX: call OP2ToOP6 + call EToX + call OP1ExOP6 + call SinCosRad + call OP2ExOP6 + call FPMult + call OP1ToOP4 + call OP6ToOP1 + call FPMult + jp p02loc_6AFB + +CXrootY:call ExMCplxO1 + call CkOP1C0 + jr z, p02loc_6C86 + call CRecip + jr CYtoX + +BCALL_4EAF: + pop af + call page0_1280 + call CpyTo1FPST + bit 1, (iy+1Eh) + call nz, fprecip + call OP2Set0 + call CpyO2ToFPST +CYtoX: call OP1ToOP3 + call ExMCplxO1 + call CkOP1C0 + jr nz, p02loc_6C96 + ld a, (OP3M) + or a +p02loc_6C86: + jp z, ErrDomain + ld a, (OP3) + or a + jp m, ErrDomain + call FPOPCPLX + jp COP1Set0 + +p02loc_6C96: + call CLN + call CMult + jr CEtoX + +#ifndef DEVIATE_FROM_ORIGINAL_FILE +;Don't think these are used anywhere. + call OP1ExOP2 + jp InvOP1S + + call InvOP1S + jp OP1ExOP2 +#endif + +InvertNonReal: + call InvOP2S +p02loc_6CAD: + jr p02loc_6CE8 +CplxMult: + call OP2ToOP4 + call OP3ToOP2 + call FPMult + call OP1ExOP4 + call FPMult +p02loc_6CBE: + call OP2ToOP3 + rst 8 + call OP4ToOP1 + jr p02loc_6CAD + +CplxDiv: + call OP2ToOP4 + call OP3ToOP2 + call fpdiv + call OP1ExOP4 + call fpdiv + jr p02loc_6CBE +CplxTrunc: + call OP2ToOP3 + call Trunc + call OP1ExOP3 + call Trunc + rst 8 + call OP3ToOP1 +p02loc_6CE8: + jr p02loc_6D08 + +CplxFrac: + call frac + call OP1ExOP2 + call frac + call OP1ExOP2 + jr p02loc_6D08 + +CplxFloor: + call OP2ToOP4 + call DoInt + call OP1ExOP4 + call DoInt + rst 8 + call OP4ToOP1 +p02loc_6D08: + jp page0_104E + +p02sub_6D0B: + call OP1ToOP4 + +p02sub_6D0E: + call CpyTo1FPS1 + call FPMult + jp OP2ToOP3 + +p02sub_6D17: + call OP1MOP2EXP + ld d, 0 + ld a, (OP1+1) + jr nc, p02loc_6D22 + ld a, (hl) +p02loc_6D22: + sub 80h + jr nc, p02loc_6D2B + cpl + add a, 1 + set 7, d +p02loc_6D2B: + ld e, a + push de + call p02sub_6B7D + call OP1ExOP2 + pop de + push de + call p02sub_6B7D + call OP1ExOP2 + pop de + ret + +p02sub_6D3D: + set 6, (iy+0Eh) + call errd_op1notpos + jr p02loc_6D50 + +SqRoot: call errd_op1notpos +p02sub_6D49: + res 6, (iy+0Eh) + call page0_FB5 +p02loc_6D50: + call CkOP1FP0 + ret z + call ZeroOP3 + ld hl, OP1+1 + ld a, (hl) + rra + ld (OP3+1), a + ld a, 0 + call c, page0_1301 + ld (hl), a + call ZeroOP2 + ld de, OP3M + ld a, 10h + ld (OP2), a + ld c, 0 + ld hl, OP2M + push de +p02loc_6D76: + push hl + ld b, 1 + call page0_1382 +p02loc_6D7C: + ld hl, 848Bh + ld de, 8480h + call SUB16D + jr c, p02loc_6D92 + inc c + pop hl + push hl + ld b, 2 + call page0_1382 + jp p02loc_6D7C +p02loc_6D92: + ld hl, OP2 + dec (hl) + jr z, p02loc_6DD2 + ld a, c + bit 0, (hl) + call nz, ShLAcc + pop bc + pop de + ld (de), a + bit 0, (hl) + jr nz, p02loc_6DA8 + inc bc + inc de + xor a +p02loc_6DA8: + push de + push bc + ld c, a + ld hl, 848Bh + ld de, 8480h + or a + call ADD16D + ld hl, OP1+1 + call page0_12EF + rld + push bc + call page0_11B3 + pop bc + ld hl, 848Bh + ld d, h + ld e, l + call ADD14D + ld (hl), 0 + jr nc, p02loc_6DCF + inc (hl) +p02loc_6DCF: + pop hl + jr p02loc_6D76 +p02loc_6DD2: + pop af + pop hl + ld (hl), c + ld a, (OP1) + call OP3ToOP1 + ld (OP1), a + ld a, (OP1+1) + add a, 40h + ld (OP1+1), a + call CkOP1Pos + jr z, p02loc_6E03 + call page0_1280 + bit 6, (iy+0Eh) + jr nz, p02loc_6DF7 + call LJRND +p02loc_6DF7: + rst 8 + call OP1Set0 + ld a, 0Ch + ld (OP2), a + jp page0_104E +p02loc_6E03: + bit 6, (iy+0Eh) + ret nz + jp p02sub_78D3 + +LnX: call CkOP1Pos +p02loc_6E0E: + ld c, 2 + jr z, Page02_3861 + jp ErrDomain + +p02sub_6E15: + call CkOP1Pos + jr z, p02loc_6E0E + call page0_1280 + jp CLN + +p02sub_6E20: + ld c, 0 + jr Page02_3861 + +LogX: ld c, 0 + call errd_op1notpos +Page02_3861: + call page0_FB5 + call ErrD_OP1_0 + call CkOP1Pos + jr z, p02loc_6E3B + call page0_1280 + call CLog + ret +p02loc_6E3B: + push bc + call page0_1708 + jr nc, p02loc_6E8E + call OP1ToOP4 + call Minus1 + call page0_170F + jr c, p02loc_6E53 + jr nz, p02loc_6E8B + call CkOP1Pos + jr nz, p02loc_6E8B +p02loc_6E53: + call OP1ToOP3 + call OP2Set2 + rst 30h + rst 8 + call OP3ToOP1 + call fpdiv + call OP2Set1 + ld a, (OP1) + push af + call DecO1Exp + ld a, 80h + call p02sub_76B4 + call Times2 + pop af + pop bc + and 80h + ld (OP1), a + bit 1, c + ret nz + push bc + ld a, 3 + call page0_CF7 + pop bc + bit 0, c + ret nz + call page0_E2D + ret +p02loc_6E8B: + call OP4ToOP1 +p02loc_6E8E: + call ZeroOP2 + ld (OP3), a + call IsOP1One + jp z, p02loc_6F01 +p02loc_6E9A: + call p02sub_7210 + jr p02loc_6EA2 +p02loc_6E9F: + call page0_138F +p02loc_6EA2: + ld a, (OP3) + call SRDO1 + call page0_13B5 + jp nc, p02loc_6E9F + call IsOP1Zero + jr z, p02loc_6EFC + call page0_142A + ld hl, OP3 + ld a, (hl) + inc (hl) + and 8 + jr z, p02loc_6E9A + ld de, 8493h + xor a + ld (de), a + ld hl, 8481h + call page0_1448 +p02loc_6ECA: + inc de + ld a, (de) + call ShRAcc + jr z, p02loc_6EDD + push de + call p02sub_720F +p02loc_6ED5: + call page0_138F + dec c + jp nz, p02loc_6ED5 + pop de +p02loc_6EDD: + ld hl, OP3 + inc (hl) + bit 4, (hl) + jr nz, p02loc_6F0A + ld a, (de) + and 0Fh + jr z, p02loc_6EF6 + push de + call p02sub_720F +p02loc_6EEE: + call page0_138F + dec c + jp nz, p02loc_6EEE + pop de +p02loc_6EF6: + ld hl, OP3 + inc (hl) + jr p02loc_6ECA +p02loc_6EFC: + call page0_138F + jr p02loc_6F0A +p02loc_6F01: + call GETEXP + jr nc, p02loc_6F0A + dec a + ld (OP1+1), a +p02loc_6F0A: + call GETEXP + jr nc, p02loc_6F1C + ld a, 80h + ld (OP1), a + call INCO1EXP + call page0_11AB + jr p02loc_6F26 +p02loc_6F1C: + xor a + ld (OP1), a + call page0_1290 + call page0_141D +p02loc_6F26: + call OP1ExpToDec + ld (OP1+1), a + ld e, 81h + and 0F0h + jr nz, p02loc_6F3D + dec e + ld a, (OP1+1) + and 0Fh + jr nz, p02loc_6F40 + dec e + jr p02loc_6F43 +p02loc_6F3D: + call page0_12C4 +p02loc_6F40: + call page0_12C4 +p02loc_6F43: + ld a, e + ld (OP1+1), a + pop bc + bit 0, c + jr z, p02loc_6F50 + call LJNORND + ret +p02loc_6F50: + push bc + call LJRND + pop bc + bit 1, c + ret z + ld a, 6 + call page0_CF7 + call page0_E2D + ret +p02loc_6F61: + call CkOP1Pos + jp nz, OP1Set0 + jp ErrOverflow +EToX: call page0_FB5 + ld a, 3 + call page0_CF7 + jr Page02_3867 + +TenX: call page0_FB5 +Page02_3867: + ld a, (OP1+1) + sub 80h + jr c, p02loc_6FB0 + ld b, a + xor a + ld (OP1+1), a + ld a, b + cp 2 + jr nc, p02loc_6F61 + call page0_1301 + rld + ld a, b + or a + jr z, p02loc_6F97 + ld a, (hl) + call page0_1301 + rld +p02loc_6F97: + ld a, (OP1+1) + ld c, 0 + call ShRAcc + jr z, p02loc_6FA8 + ld b, a + xor a +p02loc_6FA3: + add a, 0Ah + dec b + jr nz, p02loc_6FA3 +p02loc_6FA8: + ld b, a + ld a, (hl) + and 0Fh + add a, b + ld e, a + jr p02loc_6FC1 +p02loc_6FB0: + cpl + ld e, a + cp 0Fh + jp nc, OP1Set1 + push de + call SRDO1 + call page0_11CB + pop bc + ld e, 0 +p02loc_6FC1: + ld a, 80h + add a, e + ld (OP1+1), a + call ClrOP1S + and 80h + jr z, p02loc_6FE7 + ld a, (OP1+1) + cpl + ld (OP1+1), a + call IsOP1Zero + jr nz, p02loc_6FDF + call INCO1EXP + jr p02loc_6FE7 +p02loc_6FDF: + rst 8 + call page0_1290 + ld c, a + call page0_141D +p02loc_6FE7: + ld a, c + ld (OP3), a + ld hl, OP4M + call Zero16D + ld b, a + ld hl, OP4M + srl c + add hl, bc +p02loc_6FF8: + push hl + xor a +p02loc_6FFA: + ld c, a + ld de, OP2M + call p02sub_7213 + jr p02loc_700B +p02loc_7003: + inc c + ld a, c + and 0Fh + cp 9 + jr z, p02loc_7014 +p02loc_700B: + call page0_141D + jp nc, p02loc_7003 + call page0_139F +p02loc_7014: + ld hl, OP3 + ld a, (hl) + cp 0Fh + jr z, p02loc_704E + inc (hl) + and 1 + jr z, p02loc_7026 + pop hl + ld (hl), c + inc hl + jr p02loc_6FF8 +p02loc_7026: + call page0_12B8 + jr p02loc_6FFA + +p02sub_702B: + ret z + push af + push bc + ld a, c + call SRDO1 + call page0_13B5 + jr c, p02loc_703E + pop bc + pop af + or a + dec a + jp p02sub_702B +p02loc_703E: + pop hl + pop hl + call INCO1EXP + ld hl, OP1M + call page0_124D + inc hl + ld (hl), 0 + scf + ret + +p02loc_704E: + pop hl + ld (hl), c + ld hl, OP1M + call page0_124D + ld de, 8481h + ld hl, 84A2h + ld bc, 3 + lddr + ld a, (hl) + and 0Fh + ld (de), a + ld c, 0 + ld hl, OP4M +p02loc_706A: + push hl + ld a, (hl) + push af + call ShRAcc + call p02sub_702B + jr nc, p02loc_707B + pop af +p02loc_7076: + pop hl + call LJRND + ret + +p02loc_707B: + pop af + bit 3, c + jp nz, p02loc_7076 + inc c + and 0Fh + call p02sub_702B + jp c, p02loc_7076 + pop hl + inc c + inc hl + jr p02loc_706A +p02loc_708F: + .db 30h + .db 10h + .db 29h + .db 99h + .db 56h + .db 63h + .db 98h + .db 12h + .db 4 + .db 13h + .db 92h + .db 68h + .db 51h + .db 58h + .db 22h + .db 50h + .db 0 + .db 43h + .db 21h + .db 37h + .db 37h + .db 82h + .db 64h + .db 26h + .db 0 + .db 4 + .db 34h + .db 7 + .db 74h + .db 79h + .db 31h + .db 86h + .db 0 + .db 0 + .db 43h + .db 42h + .db 72h + .db 76h + .db 86h + .db 27h + .db 0 + .db 0 + .db 4 + .db 34h + .db 29h + .db 23h + .db 10h + .db 45h + .db 0 + .db 0 + .db 0 + .db 43h + .db 42h + .db 94h + .db 26h + .db 48h + .db 0 + .db 0 + .db 0 + .db 4 + .db 34h + .db 29h + .db 44h + .db 60h + .db 0 + .db 0 + .db 0 + .db 0 + .db 43h + .db 42h + .db 94h + .db 48h + .db 0 + .db 0 + .db 0 + .db 0 + .db 4 + .db 34h + .db 29h + .db 45h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 43h + .db 42h + .db 94h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 4 + .db 34h + .db 29h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 43h + .db 43h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 4 + .db 34h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 43h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 4 +p02loc_710F: + .db 9 + .db 96h + .db 68h + .db 65h + .db 24h + .db 91h + .db 16h + .db 20h + .db 10h + .db 3 + .db 35h + .db 34h + .db 77h + .db 31h + .db 7 + .db 56h + .db 9 + .db 99h + .db 96h + .db 66h + .db 68h + .db 66h + .db 65h + .db 24h + .db 10h + .db 0 + .db 3 + .db 33h + .db 35h + .db 33h + .db 34h + .db 76h + .db 9 + .db 99h + .db 99h + .db 96h + .db 66h + .db 66h + .db 68h + .db 67h + .db 10h + .db 0 + .db 0 + .db 3 + .db 33h + .db 33h + .db 35h + .db 33h + .db 9 + .db 99h + .db 99h + .db 99h + .db 96h + .db 66h + .db 66h + .db 67h + .db 10h + .db 0 + .db 0 + .db 0 + .db 3 + .db 33h + .db 33h + .db 33h + .db 9 + .db 99h + .db 99h + .db 99h + .db 99h + .db 96h + .db 66h + .db 67h + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 3 + .db 33h + .db 33h + .db 9 + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 96h + .db 67h + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 3 + .db 33h + .db 9 + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 97h + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 3 + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 +p02loc_718F: + .db 95h + .db 9 + .db 85h + .db 29h + .db 44h + .db 83h + .db 72h + .db 2 + .db 10h + .db 52h + .db 6 + .db 69h + .db 51h + .db 89h + .db 55h + .db 92h + .db 99h + .db 94h + .db 95h + .db 10h + .db 19h + .db 99h + .db 69h + .db 80h + .db 10h + .db 0 + .db 50h + .db 52h + .db 3 + .db 8 + .db 13h + .db 30h + .db 99h + .db 99h + .db 94h + .db 94h + .db 95h + .db 10h + .db 20h + .db 35h + .db 10h + .db 0 + .db 0 + .db 50h + .db 50h + .db 52h + .db 3 + .db 5 + .db 99h + .db 99h + .db 99h + .db 94h + .db 94h + .db 94h + .db 95h + .db 10h + .db 10h + .db 0 + .db 0 + .db 0 + .db 50h + .db 50h + .db 50h + .db 52h + .db 99h + .db 99h + .db 99h + .db 99h + .db 94h + .db 94h + .db 94h + .db 95h + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 50h + .db 50h + .db 51h + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 94h + .db 94h + .db 95h + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 50h + .db 51h + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 94h + .db 95h + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 51h + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 99h + .db 95h + .db 10h + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 0 + .db 1 + +p02sub_720F: + ld c, a +p02sub_7210: + ld de, OP4M +p02sub_7213: + ld hl, p02loc_708F + ld a, (OP3) + push bc + ld c, 8 + ld b, a + xor a + jr p02loc_723F +p02sub_7220: + ld hl, p02loc_718F + ld de, OP2M + jr p02loc_722E +p02sub_7228: + ld de, OP4M +p02sub_722B: + ld hl, p02loc_710F +p02loc_722E: + ld a, (OP5) + push bc + and 80h + ld a, 0 + ld c, 10h + jr z, p02loc_723F + add a, 8 + jr p02loc_723F +p02loc_723E: + add a, c +p02loc_723F: + dec b + jp p, p02loc_723E + ld c, a + ld b, 0 + add hl, bc + call Mov8B + pop bc + ret + +SinCosRad: + ld a, 81h + jr p02loc_7262 +Sin: ld a, 1 + jr p02loc_725A +cos: ld a, 2 + jr p02loc_725A +Tan: ld a, 4 +p02loc_725A: + bit trigDeg, (iy+trigFlags) + jr nz, p02loc_7262 + or 80h +p02loc_7262: + ld (OP4), a + call page0_FB5 + call ZeroOP3 + ld a, (OP1+1) + sub 80h + jp c, p02loc_72E2 + cp 0Ch + jp nc, ErrDomain + ld l, a + ld a, (OP4) + and 80h + jr z, p02loc_728A + ld hl, PItimes2 + call page0_11D3 + ld b, 80h + jr p02loc_7296 +p02loc_728A: + ld a, l + cp 2 + jr c, p02loc_72E2 + ld a, 36h + ld (OP3M), a + ld b, 82h +p02loc_7296: + ld c, 0 +p02loc_7298: + call page0_1470 + jr nc, p02loc_7298 + dec c + jp p, p02loc_7298 + call page0_140C + ld hl, OP1+1 + ld a, b + cp (hl) + jr z, p02loc_72B2 + dec (hl) + call page0_12EF + ld c, a + jr p02loc_7298 +p02loc_72B2: + ld a, (OP4) + and 80h + jr z, p02loc_72C6 + call page0_119E + ld hl, unk_1590 + call page0_1461 + jr c, p02loc_72E2 + jr p02loc_72D4 +p02loc_72C6: + ld a, (OP1M) + cp 18h + jr c, p02loc_72E2 + jr nz, p02loc_72D4 + call CKOP1M + jr z, p02loc_72E2 +p02loc_72D4: + call page0_1467 + call page0_11C3 + ld a, (OP1) + xor 80h + ld (OP1), a +p02loc_72E2: + call LJNORND + call ClrOP1S + and 80h + jr z, p02loc_72EE + ld a, 3 +p02loc_72EE: + push af + call CkOP1FP0 + jp z, p02loc_7383 + call ZeroOP3 + ld a, (OP4) + and 80h + jr z, p02loc_730F + ld hl, unk_1598 + call page0_11D3 + call GETEXP + jp c, p02loc_733F + ld c, 0 + jr p02loc_7324 +p02loc_730F: + call page0_1708 + ld a, 90h + ld (OP3M), a + jr c, p02loc_7373 + ld c, 0 + jr z, p02loc_7324 + call DecO1Exp + call page0_12EF + ld c, a +p02loc_7324: + call page0_1470 + jr nc, p02loc_7332 + dec c + jp p, p02loc_7332 + call page0_140C + jr p02loc_7338 +p02loc_7332: + pop af + xor 1 + or 8 + push af +p02loc_7338: + ld a, (OP4) + and 80h + jr z, p02loc_7362 +p02loc_733F: + call LJNORND + ld a, (OP1M) + or a + jr z, p02loc_7383 + call page0_170F + jr c, p02loc_7383 + jr nz, p02loc_7369 + call page0_119E + ld hl, unk_1597 + call page0_1461 + jr c, p02loc_7373 + call page0_12BE + call INCO1EXP + jr p02loc_7369 +p02loc_7362: + ld a, (OP1M) + cp 45h + jr c, p02loc_7373 +p02loc_7369: + call page0_1467 + call page0_11C3 + pop af + xor 8 + push af +p02loc_7373: + call LJNORND + call page0_FB5 + ld a, (OP4) + and 80h + jr nz, p02loc_7383 + call page0_CF2 +p02loc_7383: + ld hl, OP3M + call page0_124D + ld a, 2 + ld (OP3+3), a + call page0_1422 + pop bc + jr c, p02loc_7396 + set 6, b +p02loc_7396: + ld a, b +p02sub_7397: + ld (OP5), a + call CkOP1FP0 + jr nz, p02loc_73AB +p02loc_739F: + call OP2Set1 + call page0_E2D + call OP1ExOP2 + jp p02loc_74FE +p02loc_73AB: + call p02sub_75BB + jr c, p02loc_739F + ld b, a + xor a +p02loc_73B2: + inc hl + push bc + push hl + push af + ld de, OP2M + call p02sub_722B + call page0_132D + pop af + ld b, 1 + and 0F0h +p02loc_73C4: + ld c, a + or a + jp m, p02loc_73D5 +p02loc_73C9: + call page0_142A + jr c, p02loc_73DB + inc c + inc b + jp p02loc_73C9 +p02loc_73D3: + inc c + inc b +p02loc_73D5: + call page0_13B5 + jp nc, p02loc_73D3 +p02loc_73DB: + inc b + ld a, c + xor 80h + bit 0, b + jr z, p02loc_73C4 + ld c, a + inc a + and 0Fh + pop hl + ld (hl), a + ld a, c + pop bc + inc b + bit 3, b + jr z, p02loc_73B2 + or a + call m, page0_13B5 + ld a, (OP5+1) + ld b, a + call p02sub_7220 + ld hl, 84A5h + jr p02loc_7402 +p02loc_7400: + pop bc + pop hl +p02loc_7402: + bit 3, b + jr nz, p02loc_7438 + inc b + inc hl + push hl + push bc + ld a, 0Bh + sub (hl) + srl a + jr z, p02loc_7400 + ld d, a + ld a, b + add a, b + ld e, a + push de +p02loc_7416: + call page0_1332 + call page0_13EC + pop de + dec d + jr z, p02loc_7400 + ld a, e + push de + cp 9 + jr c, p02loc_7416 + ld c, d +p02loc_7427: + call page0_13FC + jr nc, p02loc_7432 + ex de, hl + ld a, 1 + call MANTPA +p02loc_7432: + dec c + jr nz, p02loc_7427 + pop de + jr p02loc_7400 +p02loc_7438: + set 6, (iy+0Eh) + call page0_D37 + ld hl, OP5 + ld a, (hl) + bit 7, a + jr nz, p02loc_7449 + or 10h +p02loc_7449: + ld (hl), a + inc hl + ld c, (hl) + inc (hl) + and 40h + jr z, p02loc_7456 + call DecO1Exp + jr p02loc_745C +p02loc_7456: + dec (hl) + ex de, hl + call page0_12CD + ex de, hl +p02loc_745C: + call p02sub_75C9 + ld hl, 84A5h +p02loc_7462: + inc c + inc hl + ld b, (hl) + push hl + ld hl, OP2 + inc (hl) + ld hl, OP3 + inc (hl) + bit 3, c + jr z, p02loc_7481 + ld a, (OP5) + and 20h + jr nz, p02loc_7483 + dec b + jp p, p02loc_7483 + pop hl + jp p02loc_74E7 +p02loc_7481: + res 0, b +p02loc_7483: + push bc + ld a, b + or a + jr z, p02loc_74D2 + ld a, (OP3) + ld c, a +p02loc_748C: + push bc + ld a, c + call page0_119E + call page0_1332 + ld a, (OP5) + and 20h + jr nz, p02loc_74C1 + call page0_13B5 + jp nc, p02loc_74C4 + call page0_12CD + call INCO1EXP + ld hl, OP1M + ld a, 10h + add a, (hl) + ld (hl), a + ld hl, 84A5h + dec (hl) + call page0_131E + ld hl, OP2 + dec (hl) + ld hl, OP3 + inc (hl) + pop bc + ld c, (hl) + jr p02loc_74C8 +p02loc_74C1: + call page0_142A +p02loc_74C4: + call page0_131E + pop bc +p02loc_74C8: + ld a, (OP5) + and 10h + call page0_13F1 + djnz p02loc_748C +p02loc_74D2: + pop bc + pop hl + bit 3, c + jr nz, p02loc_74E7 + ld a, (hl) + cp b + jp nz, p02loc_7462 + ld de, OP5 + ld a, (de) + xor 30h + ld (de), a + jp p02loc_7462 +p02loc_74E7: + call p02sub_78CC + ld l, 7Fh + ld a, (OP5) + and 80h + jr z, p02loc_74F4 + inc l +p02loc_74F4: + ld a, l + ld (OP2+1), a + call OP1ExOP2 + call p02sub_78D3 +p02loc_74FE: + ld a, (OP5) + and 8 + call z, OP1ExOP2 + ld c, 0 + ld a, (OP5) + and 3 + jr z, p02loc_751C + cp 2 + jr c, p02loc_7517 + ld c, 80h + jr nz, p02loc_751C +p02loc_7517: + ld a, 80h + ld (OP2), a +p02loc_751C: + ld a, c + ld (OP1), a + ld a, (OP4) + and 7 + cp 2 + ret c + jp z, OP2ToOP1 + call CkOP2FP0 + jp z, ErrDomain + jp fpdiv +SinHCosH: + ld c, 81h + jr p02loc_7542 +TanH: ld c, 4 + jr p02loc_7542 +cosh: ld c, 2 + jr p02loc_7542 +SinH: ld c, 1 +p02loc_7542: + call ClrOP1S + push af + ld a, c + ld (OP4), a + call GETEXP + jr nc, p02loc_755E + ld a, 80h + call p02sub_7397 + pop af + ld hl, OP4 + bit 1, (hl) + ret nz + jp p02loc_78DB +p02loc_755E: + push bc + bit 2, c + jr z, p02loc_758E + call Times2 + ld e, 82h + call OP1EXPMinusE + jr c, p02loc_7578 + call OP1Set1 +p02loc_7570: + pop bc +p02loc_7571: + pop af + bit 1, c + ret nz + jp p02loc_78DB +p02loc_7578: + call EToX + call Plus1 + rst 8 + call OP1Set2 + call fpdiv + rst 8 + call OP1Set1 + call FPSub + jr p02loc_7570 +p02loc_758E: + call EToX + call fprecip + call OP1ToOP4 + call OP2ToOP5 + pop bc + bit 0, c + push bc + call nz, InvOP1S + rst 30h + call TimesPt5 + pop bc + bit 7, c + jr z, p02loc_7571 + push bc + call OP1ExOP4 + call OP5ToOP2 + rst 30h + call TimesPt5 + rst 8 + call OP4ToOP1 + jr p02loc_7570 +p02sub_75BB: + ld a, (OP1+1) + cp 78h + ret c + cpl + and 7Fh + ld hl, 84A5h + ld (hl), a + ret +p02sub_75C9: + ld a, (OP5+1) + ld d, a + add a, c + ld (OP2), a + sub d + sub d + ld (OP3), a + ret +ACosRad: + ld a, 1 + ld b, 20h + jr p02loc_7609 +ATanRad: + call OP2Set1 + ld d, 2 +ATan2Rad: + ld b, 20h + push bc + jp p02loc_7659 +ASinRad: + xor a + ld b, 20h + jr p02loc_7609 +ACos: call p02sub_78E1 + jp c, ErrDomain + ld a, 1 + jr p02loc_7607 +ATan: call OP2Set1 + ld d, 2 + jp ATan2 +ASin: call p02sub_78E1 + ret z + jp c, ErrDomain + xor a +p02loc_7607: + ld b, 0 +p02loc_7609: + push bc + or a + push af + call page0_FB5 + ld e, 80h + call OP1EXPMinusE + jr c, p02loc_7623 + jr nz, p02loc_7620 + call CkOP1FP0 + jr z, p02loc_7623 + call IsOP1One +p02loc_7620: + jp nz, ErrDomain +p02loc_7623: + call OP1ToOP3 + call OP1ToOP4 + call OP2Set1 + call page0_C3D + call OP1ToOP5 + call OP3ToOP1 + call OP2Set1 + call page0_C0A + call OP5ToOP2 + call page0_CFA + call p02sub_6D3D + xor a + ld (OP4+9), a + pop af + jr z, p02loc_7650 + call OP4ToOP2 + jr p02loc_7654 +p02loc_7650: + rst 8 + call OP4ToOP1 +p02loc_7654: + ld d, a + jr p02loc_765C + +ATan2: xor a + push af +p02loc_7659: + call page0_FB5 +p02loc_765C: + call CkOP1Pos + jr z, p02loc_7665 + ld a, d + add a, 0Ch + ld d, a +p02loc_7665: + call ckop2pos + jr z, p02loc_766E + ld a, d + xor 4 + ld d, a +p02loc_766E: + call CkOP2FP0 + jr nz, p02loc_7684 + call CkOP1FP0 + jr nz, p02loc_767C + pop bc + jp OP1Set0 +p02loc_767C: + set 4, d + push de + call OP1ExOP2 + jr p02loc_769E +p02loc_7684: + push de + call CkOP1FP0 + jr z, p02loc_769E + call OP1ToOP3 + call page0_141D + ld a, (OP1+1) + ld hl, 8484h + sbc a, (hl) + call OP3ToOP1 + pop de + jr nc, p02loc_767C + push de +p02loc_769E: + call OP1MOP2EXP + add a, 80h + jr z, p02loc_76AB + jr c, p02loc_76AD + cp 80h + jr z, p02loc_76AD +p02loc_76AB: + ld a, 1 +p02loc_76AD: + dec a + ld (OP1+1), a + pop af + pop bc + add a, b +p02sub_76B4: + push af + ld a, 7Fh + ld (OP2+1), a + call CkOP1FP0 + jr z, p02loc_76CA + call p02sub_75BB + jr nc, p02loc_76D2 + call fpdiv + call ClrOP1S +p02loc_76CA: + pop af + ld (OP5), a + ld b, a + jp p02loc_77DA +p02loc_76D2: + call OP1ToOP3 + ld hl, OP2EXT + ld de, 8497h + call SUB16D + pop de + set 6, d + ld hl, 84A5h + ld a, (hl) + jr c, p02loc_76F6 + or a + jr nz, p02loc_76F3 + push de + ld a, 2 + call GETCONOP1 + jp p02loc_77EB +p02loc_76F3: + dec a + res 6, d +p02loc_76F6: + dec hl + ld (hl), d + inc a + ld c, a + push bc + call p02sub_75C9 + inc hl + inc hl + push hl + ld b, 0 + jr p02loc_7707 +p02loc_7705: + pop bc + inc b +p02loc_7707: + push bc + call page0_119E + ld a, (OP3) + call page0_1332 + call page0_142A + jr c, p02loc_772A + call page0_131E + call page0_13EC + jp nc, p02loc_7705 + call page0_12CD + ld hl, OP2M + call page0_12F8 + jr p02loc_7705 +p02loc_772A: + call page0_11A6 + pop bc + pop hl + ld (hl), b + bit 3, c + jr nz, p02loc_7743 + inc c + inc hl + push hl + ld hl, OP2 + inc (hl) + ld hl, OP3 + inc (hl) + ld b, 0 + jr p02loc_7707 +p02loc_7743: + call LJNORND + call OP1ToOP3 + call OP2ToOP1 + call LJNORND + rst 8 + call OP3ToOP1 + call page0_EC6 + call ClrOP1S + ld hl, OP2M + call Zero16D + ld hl, 84A5h + pop bc + ld b, c + xor a + ld (OP3+1), a +p02loc_7768: + inc hl + push hl + ld a, (hl) + or a + jr z, p02loc_779E + ld c, a + dec b + call p02sub_7228 + ld a, (OP5) + and 40h + jr nz, p02loc_777B + inc b +p02loc_777B: + push bc + ld a, b + ld hl, 84A5h + sub (hl) + call page0_1321 + pop bc + push bc +p02loc_7786: + ld hl, 8497h + ld de, OP2EXT + call ADD16D + jr c, p02loc_77A6 +p02loc_7791: + dec c + jp nz, p02loc_7786 + pop bc + ld a, (OP5) + and 40h + jr z, p02loc_779E + inc b +p02loc_779E: + pop hl + bit 3, b + jr nz, p02loc_77AC + inc b + jr p02loc_7768 +p02loc_77A6: + ld hl, 848Fh + inc (hl) + jr p02loc_7791 +p02loc_77AC: + ld a, 80h + ld hl, 84A5h + sub (hl) + ld l, a + ld a, (OP5) + push af + bit 6, a + jr z, p02loc_77BC + dec l +p02loc_77BC: + ld a, l + ld (OP2+1), a + ld a, (OP3+1) + or a + jr z, p02loc_77D0 + ld hl, 8484h + inc (hl) + ld hl, OP2M + call page0_12D1 +p02loc_77D0: + call OP1ExOP2 + call LJNORND + call page0_C3D + pop bc +p02loc_77DA: + bit 7, b + jr nz, p02loc_7813 + bit 4, b + jr z, p02loc_77EC + push bc + ld a, 1 + call GETCONOP2 + call page0_C0A +p02loc_77EB: + pop bc +p02loc_77EC: + push bc + ld a, b + and 0Ch + jr z, p02loc_7800 + cp 0Ch + jr z, p02loc_7804 + push bc + ld a, 4 + call GETCONOP2 + call page0_C0A + pop bc +p02loc_7800: + bit 3, b + jr z, p02loc_7807 +p02loc_7804: + call InvOP1S +p02loc_7807: + pop af + and 20h + jr nz, p02loc_7813 + bit trigDeg, (iy+trigFlags) + call nz, page0_CF6 +p02loc_7813: + call LJRND + ret + +ATanH: call p02sub_78E1 + ret z + jp c, ErrDomain + call page0_170F + jr c, p02loc_782C + jr nz, p02loc_786F + ld a, (OP1M) + cp 70h + jr nc, p02loc_7846 +p02loc_782C: + call OP2Set1 + call ClrOP1S + and 80h + push af +p02loc_7835: + or 80h + ld b, a + call DecO1Exp + call page0_FB5 + ld a, b + call p02sub_76B4 + pop af + jp p02loc_78DB +p02loc_7846: + call Page02_3879 + call fpdiv + call LnX + jp TimesPt5 +Page02_3879: + call OP1ToOP4 + call InvOP1S + call Plus1 + call OP1ExOP4 + call Plus1 + jp OP4ToOP2 +ASinH: call ClrOP1S + and 80h + push af + ld a, (OP1+1) + jr p02loc_7885 +p02loc_786F: + jp ErrDomain + +ACosH: call CkOP1FP0 + jr z, p02loc_7882 + call errd_op1notpos + ld a, 1 + push af + call GETEXP + jr nc, p02loc_7885 +p02loc_7882: + jp ErrDomain +p02loc_7885: + sub 90h + jr c, p02loc_7894 + rst 8 + jr p02loc_78C4 +p02loc_788C: + call FPSquare + call Plus1 + jr p02loc_78AF +p02loc_7894: + call OP1ToOP5 + pop af + push af + and 1 + jr z, p02loc_788C + call Plus1 + call OP1ToOP3 + call OP5ToOP1 + call Minus1 + call OP3ToOP2 + call FPMult +p02loc_78AF: + call SqRoot + call OP5ToOP2 + pop af + push af + bit 0, a + call z, OP1ExOP2 + call GETEXP + jr nc, p02loc_78C4 + jp p02loc_7835 +p02loc_78C4: + rst 30h + call LnX + pop af + jp p02loc_78DB +p02sub_78CC: + ld a, (OP5) + or a + call m, INCO1EXP +p02sub_78D3: + xor a + ld (OP1), a + call LJRND + ret +p02loc_78DB: + and 80h + ld (OP1), a + ret + +p02sub_78E1: + call CkOP1FP0 + ret z + call GETEXP + jr c, p02loc_78F3 + cp 80h + jr nz, p02loc_78F7 + call IsOP1One + jr nz, p02loc_78F7 +p02loc_78F3: + ld a, 1 + or a + ret +p02loc_78F7: + call OP2Set0 + ld a, 1 + cp 2 + ret +Page02_387F: + push hl + ld a, (hl) + and 1Fh + call Page0Call_2407 + ld de, 9 + call page0_17B3 + jr z, p02loc_7915 + dec hl + ld a, (hl) + inc hl + cp 5Dh + jr nz, p02loc_791A +p02loc_7915: + ld a, 6 + add a, (hl) + inc a + ld e, a +p02loc_791A: + pop hl + ret + +Page02_3885: + ld (unk_83F1), hl + ld a, (hl) + and 1Fh + push hl + dec hl + dec hl + dec hl + ld e, (hl) + dec hl + ld d, (hl) + ex de, hl + ld (unk_83F3), hl + call DataSize + ld (unk_83F7), de + ld hl, (unk_83F9) + add hl, de + ex de, hl + pop hl + push hl + push de + call Page02_387F + ld (unk_83F5), de + pop hl + add hl, de + ld (unk_83F9), hl + pop hl + ret + +Page02_388B: + ld hl, {+}-(100*2) + ld e, a + ld d, 0 + add hl, de + add hl, de + call ldHLind + jp (hl) ++: .dw p02loc_7A70 + .dw p02loc_7A7B + .dw p02loc_7A02 + .dw p02loc_7A0B + .dw p02loc_7A11 + .dw p02loc_7A1A + .dw ErrSyntax + .dw p02loc_799E + .dw p02loc_79C1 + .dw p02loc_7A20 + .dw p02loc_7A24 + .dw p02loc_7A28 + .dw p02loc_7A2C + .dw p02loc_79E0 + .dw p02loc_79E9 + .dw p02loc_79F6 + .dw p02loc_79FC + .dw p02loc_7A61 + .dw p02loc_7A86 + .dw p02loc_7A30 + .dw p02loc_7A35 + .dw p02loc_7A3A + .dw p02loc_7A3F + .dw p02loc_7A8D + .dw p02loc_7AA3 + .dw p02loc_7AAC + .dw p02loc_7AB3 + .dw p02loc_7ABA + .dw p02loc_7AC1 + .dw p02loc_7AC8 + .dw p02loc_7ACD + .dw p02loc_7A44 + .dw p02loc_7A5D + .dw p02loc_7A50 + .dw p02loc_7A4C + .dw p02loc_7A48 +p02loc_799E: + call Bit_VertSplit + jr nz, p02loc_79A8 + bit grfSplit, (iy+sGrFlags) + ret nz +p02loc_79A8: + set grfSplit, (iy+sGrFlags) + res vertSplit, (iy+sGrFlags) + set grfSChanged, (iy+sGrFlags) + call Page0Call_3831 + call RESETWINTOP + call REGCLRCHNG + call j_RunIndicOn + ret +p02loc_79C1: + call Bit_VertSplit + jr nz, p02loc_79CB + bit grfSplit, (iy+sGrFlags) + ret z +p02loc_79CB: + res vertSplit, (iy+sGrFlags) + res grfSplit, (iy+sGrFlags) + call Page0Call_3831 + call RESETWINTOP + call p02sub_79E4 + call Page0Call_3837 + ret +p02loc_79E0: + res autoFill, (iy+tblFlags) +p02sub_79E4: + set reTable, (iy+tblFlags) + ret +p02loc_79E9: + bit autoFill, (iy+tblFlags) + call z, Page0Call_383D + set autoFill, (iy+tblFlags) + jr p02sub_79E4 +p02loc_79F6: + res autoCalc, (iy+tblFlags) + jr p02sub_79E4 +p02loc_79FC: + set autoCalc, (iy+tblFlags) + jr p02sub_79E4 +p02loc_7A02: + res fmtExponent, (iy+fmtFlags) +p02loc_7A06: + res fmtEng, (iy+fmtFlags) + ret +p02loc_7A0B: + set fmtExponent, (iy+fmtFlags) + jr p02loc_7A06 +p02loc_7A11: + set fmtExponent, (iy+fmtFlags) + set fmtEng, (iy+fmtFlags) + ret +p02loc_7A1A: + ld a, 0FFh + ld (fmtDigits), a + ret +p02loc_7A20: + call j_SetFuncM + ret +p02loc_7A24: + call j_SetParM + ret +p02loc_7A28: + call j_SetPolM + ret +p02loc_7A2C: + call j_SetSeqM + ret +p02loc_7A30: + set grfPolar, (iy+grfDBFlags) + ret +p02loc_7A35: + res grfPolar, (iy+grfDBFlags) + ret +p02loc_7A3A: + res grfNoCoord, (iy+grfDBFlags) + ret +p02loc_7A3F: + set grfNoCoord, (iy+grfDBFlags) + ret +p02loc_7A44: + ld b, 1 + jr p02loc_7A52 +p02loc_7A48: + ld b, 10h + jr p02loc_7A52 +p02loc_7A4C: + ld b, 8 + jr p02loc_7A52 +p02loc_7A50: + ld b, 4 +p02loc_7A52: + ld a, (iy+0Fh) + and 80h + or b + ld (iy+0Fh), a + jr p02loc_7A6D +p02loc_7A5D: + ld b, 0 + jr p02loc_7A52 +p02loc_7A61: + ld a, (iy+4) + res 1, a +p02loc_7A66: + cp (iy+4) + ret z + ld (iy+4), a +p02loc_7A6D: + jp SetTblGraphDraw +p02loc_7A70: + bit trigDeg, (iy+trigFlags) + ret z + res trigDeg, (iy+trigFlags) + jr p02loc_7A6D +p02loc_7A7B: + bit trigDeg, (iy+trigFlags) + ret nz + set trigDeg, (iy+trigFlags) + jr p02loc_7A6D +p02loc_7A86: + ld a, (iy+4) + set 1, a + jr p02loc_7A66 +p02loc_7A8D: + ld a, (iy+4) + res 0, a + ld b, 0 +p02loc_7A94: + ld (iy+4), a + ld a, b + ld b, 19h + ld hl, y1LineType +p02loc_7A9D: + ld (hl), a + inc hl + djnz p02loc_7A9D + jr p02loc_7A6D +p02loc_7AA3: + ld a, (iy+4) + set 0, a + ld b, 6 + jr p02loc_7A94 +p02loc_7AAC: + ld a, (iy+4) + res 5, a + jr p02loc_7A66 +p02loc_7AB3: + ld a, (iy+4) + set 5, a + jr p02loc_7A66 +p02loc_7ABA: + ld a, (iy+4) + set 2, a + jr p02loc_7A66 +p02loc_7AC1: + ld a, (iy+4) + res 2, a + jr p02loc_7A66 +p02loc_7AC8: + set grfLabel, (iy+grfDBFlags) + ret +p02loc_7ACD: + res grfLabel, (iy+grfDBFlags) + ret +YONOFF: push af + push bc + rst 18h + pop bc + ld hl, (FPS) + ld a, (numArguments) + ld c, b + ld b, a +p02loc_7ADE: + push bc + bit 0, c + push af + ld de, 0FFF7h + add hl, de + push hl + rst 20h + call EOP1NotReal + ld (OP1+9), a + pop hl + pop af + push hl + push af + jr nz, p02loc_7AF9 + call IsFuncMode + jr nz, p02loc_7AFC +p02loc_7AF9: + call ErrD_OP1_0 +p02loc_7AFC: + ld a, (OP1+1) + cp 80h + jp nz, ErrDomain + call ErrD_OP1NotPosDoInt + ld b, 4 + pop af + jr nz, p02loc_7B1C + ld b, 0Ah + call IsFuncMode + jr nz, p02loc_7B1C + ld b, 3 + call IsRecursiveMode + jr nz, p02loc_7B1C + ld b, 7 +p02loc_7B1C: + ld a, (OP1M) + call ShRAcc + cp b + jp nc, ErrDomain + pop hl + ld (hl), a + pop bc + djnz p02loc_7ADE + ld a, (numArguments) + ld b, a +p02loc_7B2F: + push bc + bit 0, c + jr z, p02loc_7B5E + call FPOPREAL + ld a, (hl) + ld hl, 92C8h + ld b, a + xor a +p02loc_7B3D: + add a, 11h + djnz p02loc_7B3D + ld e, a + ld d, 0 + add hl, de + pop bc + pop af + push af + push bc + jr c, p02loc_7B53 + bit 0, (hl) + jr z, p02loc_7B91 + res 0, (hl) + jr p02loc_7B59 +p02loc_7B53: + bit 0, (hl) + jr nz, p02loc_7B91 + set 0, (hl) +p02loc_7B59: + call SetTblGraphDraw + jr p02loc_7B91 +p02loc_7B5E: + call FPOPREAL + ld a, (hl) + or a + jr nz, p02loc_7B67 + ld a, 0Ah +p02loc_7B67: + call Page0Call_385B + rst 10h + ex de, hl + ld a, (hl) + inc hl + or (hl) + jr z, p02loc_7B91 + call IsParametricMode + jr z, p02loc_7B89 + push de + call page0_17E0 + rst 10h + ex de, hl + ld a, (hl) + inc hl + or (hl) + pop hl + jr z, p02loc_7B91 + pop bc + pop af + push af + push bc + call EQSELUNSEL +p02loc_7B89: + ex de, hl + pop bc + pop af + push af + push bc + call EQSELUNSEL +p02loc_7B91: + pop bc + djnz p02loc_7B2F + pop af + ret + +EQSELUNSEL: + jr c, p02loc_7BAB + bit 5, (hl) + ret z + res 5, (hl) + call IsRecursiveMode + jr nz, p02loc_7BC5 + bit 3, (hl) + ret nz + set smarter_test, (iy+smartFlags) + jr p02loc_7BC5 +p02loc_7BAB: + bit 5, (hl) + ret nz + set 5, (hl) + call IsRecursiveMode + jr nz, p02loc_7BC5 + bit smarter_test, (iy+smartFlags) + jr nz, p02loc_7BC5 + ld a, (hl) + and 0E0h + or 0Bh + ld (hl), a + set smartGraph, (iy+smartFlags) +p02loc_7BC5: + jp SetTblGraphDrawPreserveSmartTest + +p02sub_7BC8: + bit 6, (iy+7) + jp nz, Page0Call_2501 + call j_FORSEQINIT + call cpop1op2 + jr z, p02loc_7BE8 + push af + ld a, (OP3) + and 80h + jr nz, p02loc_7BE5 + pop af + jr c, p02loc_7BE8 +p02loc_7BE2: + jp ErrIncrement +p02loc_7BE5: + pop af + jr c, p02loc_7BE2 +p02loc_7BE8: + call j_SAVEPARSE + ld hl, 0 + call CreateTempRList + call PushRealO4 + call SETesTOfps + call CPYTO1ES5 + call j_SAVEDATA + set 6, (iy+7) + ld hl, p02loc_7CA3 + call pushErrorHandleR + call OP2Set0 + call PushRealO2 + call j_StoOther + call CPYTO1ES4 +p02loc_7C13: + rst 8 + call CPYTO1ES5 + rst 10h + ld hl, OP2 + call mov9B2 + call CPYTO1ES6 + ld hl, (pTempCnt) + push hl + call j_PARSEOFF + pop hl + ld (pTempCnt), hl + call page0_1717 + call SETesTOfps + call EOP1NotReal + call CkValidNum + call OP1ToOP6 + call CPYTO1EST + rst 10h + ld a, 1 + call j_IncLstSize + call AdrLEle + ex de, hl + ld hl, OP6 + call mov9B2 + call CPYTO1ES4 + call CPYTO2ES2 + call ckop2pos + push af + rst 30h + call CPYTO2ES4 + call CPYO1TOES4 + call cpop1op2 + jp z, p02loc_7BE2 + call CPYTO1ES4 + call CPYTO2ES3 + call cpop1op2 + jr z, p02loc_7C9C + jr c, p02loc_7C77 + pop af + jr z, p02loc_7C7A + jr p02loc_7C9D +p02loc_7C77: + pop af + jr z, p02loc_7C9D +p02loc_7C7A: + call popErrorHandleR + res 6, (iy+7) + call CPYTO1ES5 + call j_RESTOREDATA + call CPYTO1ES1 + call j_GETPARSE + call CPYTO1ES6 + call markTableDirty + call CPYTO1EST + ld de, 3Fh + jp DeallocFPS1 +p02loc_7C9C: + pop af +p02loc_7C9D: + call CPYTO1ES4 + jp p02loc_7C13 +p02loc_7CA3: + res 6, (iy+7) + call CpyTo1FPS5 + jp RESTOREERRNO diff -r f4f75ec42b53 -r 78c162ac1d82 source/page02/page02.asm --- a/source/page02/page02.asm Thu May 22 01:52:19 2014 -0400 +++ b/source/page02/page02.asm Mon Jun 02 01:03:33 2014 -0400 @@ -1,6 +1,7 @@ .page $02 -.include "initial.asm" +.include "list_matrix.asm" +.include "opexec.asm" .echo "Page 02 bytes remaining: " .echo $8000-$ diff -r f4f75ec42b53 -r 78c162ac1d82 source/page07/initial.asm --- a/source/page07/initial.asm Thu May 22 01:52:19 2014 -0400 +++ b/source/page07/initial.asm Mon Jun 02 01:03:33 2014 -0400 @@ -8986,7 +8986,7 @@ p07sub_6BCA: ; GRAPHQUAD:p07loc_68EEp ... - ld hl, 84B3h + ld hl, OP6+4 set 0, (hl) ret ; End of function p07sub_6BCA diff -r f4f75ec42b53 -r 78c162ac1d82 source/prosus.inc --- a/source/prosus.inc Thu May 22 01:52:19 2014 -0400 +++ b/source/prosus.inc Mon Jun 02 01:03:33 2014 -0400 @@ -1,7 +1,7 @@ ;If not defined, this will build to the source OS, 1.19, ignoring any changes. ;#define DEVIATE_FROM_ORIGINAL_FILE -;This needs to be at least 2.x to work properly on Wabbitemu. +;This needs to be at least 2.x to work properly on Wabbitemu for the 84+/SE. #define OS_VERSION_STRING '2.00 ' #define OS_VERSION_MAJOR 2 #define OS_VERSION_MINOR 0 diff -r f4f75ec42b53 -r 78c162ac1d82 source/prosus.xml --- a/source/prosus.xml Thu May 22 01:52:19 2014 -0400 +++ b/source/prosus.xml Mon Jun 02 01:03:33 2014 -0400 @@ -11,12 +11,15 @@ - + + + - + +