123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598 |
- Sqrt:
- ld a,(hl)
- cp 3Ah
- jr z,floatsqrt
- inc hl
- cp $AE
- push af
- jr nz,+_
- ld (parsePtr),hl
- _:
- call ParseFullArg
- ld hl,sqrtHL
- ld (next_page_call_address),hl
- ld h,b
- ld l,c
- call next_page_call
- ld (ThetaPrimeVar),hl
- ld c,a
- ld b,0
- pop af
- ret nz
- ;if HL<=BC, increment BC
- sbc hl,bc
- ret c
- ret z
- inc bc
- ret
- floatsqrt:
- ld hl,sqrtSingle
- jr float_stepin_1
- sinefloat:
- pop af
- ld hl,sinSingle
- jr float_stepin_1
- _:
- ld hl,cosSingle
- float_stepin_1:
- push hl ;the call to make
- call ParseNextFullArg
- float_stepin_1_:
- push bc ;the second argument
- call floatstackpush
- ld b,h
- ld c,l
- pop de
- pop hl
- ld (next_page_call_address),hl
- ex de,hl
- jp next_page_call
- Cos:
- ld a,(hl)
- cp 3Ah
- jr z,-_
- ld a,64
- .db $FE
- Sin:
- xor a
- push af
- ld a,(hl)
- cp 3Ah
- jr z,sinefloat
- call ParseFullArg
- pop af
- add a,c
- Sine:
- ld d,a
- rlca
- rlca
- sbc a,a
- xor d
- and 63
- ld b,0
- #if (sinTable&255)<192
- #if (sintable&255)==0
- ld h,sinTable>>8
- ld l,a
- #else
- ld hl,sinTable
- add a,l
- ld l,a
- #endif
- #else
- ld c,a
- ld hl,sinTable
- add hl,bc
- #endif
- ld c,(hl)
- rlc d
- jr c,NegateBC
- ret
- _:
- ld hl,absSingle
- jp float_stepin_1
- absToken:
- ld a,(hl)
- cp 3Ah
- jr z,-_
- call ParseFullArg
- bit 7,b
- ret z
- jr negateBC
- Negative:
- ld a,(hl)
- cp 3Ah
- jr z,+_
- call ParseFullArg
- negateBC:
- xor a \ sub c \ ld c,a
- sbc a,a \ sub b \ ld b,a
- ret
- _:
- ld hl,negSingle
- jp float_stepin_1
- logToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- call ParseNextFullArg
- cp 2Bh
- ld hl,logSingle
- jp z,float_stepin_2_
- ld hl,log10Single
- push hl
- jr float_stepin_1_
- Add:
- push bc
- ld a,(hl)
- cp 3Ah
- jr z,+_
- call ParseFullArg
- pop hl
- xor a
- add hl,bc
- ld b,h
- ld c,l
- ld h,a
- adc a,a
- ld l,a
- ld (ThetaPrimeVar),hl
- ret
- _:
- ld hl,addSingle
- jp float_stepin
- SubtractToken:
- push bc
- ld a,(hl)
- cp 3Ah
- jr z,+_
- call ParseFullArg
- pop hl
- xor a
- sbc hl,bc
- ld b,h
- ld c,l
- ld h,a
- ld l,a
- ld (ThetaPrimeVar),hl
- ret
- _:
- ld hl,subSingle
- jp float_stepin
- Cubed:
- ld d,b
- ld e,c
- call DE_Times_BC
- ex de,hl
- jr mul_stepin
- Squared:
- ld d,b
- ld e,c
- jr mul_stepin
- Multiply:
- push bc
- ld a,(hl)
- cp 3Ah
- jr z,+_
- call ParseFullArg
- pop de
- mul_stepin:
- call DE_Times_BC
- ld b,h
- ld c,l
- ld (ThetaPrimeVar),de
- ret
- _:
- ld hl,mulSingle
- float_stepin:
- push hl
- call ParseNextFullArg
- push bc
- call floatstackpush
- ld b,h
- ld c,l
- pop de
- pop hl
- ld (next_page_call_address),hl
- pop hl
- jp next_page_call
- floatstackpush:
- ld hl,(floatstack_ptr)
- ld bc,4
- add hl,bc
- ld (floatstack_ptr),hl
- ld a,l \ cp floatstack_top&255
- ret nz
- #if (floatstack_top>>8)!=(floatstack_bottom>>8)
- ld a,h \ cp floatstack_top>>8
- ret nz
- #endif
- ld hl,floatstack_bottom
- ld (floatstack_ptr),hl
- ret
- Comment:
- SkipLine:
- bit floatmode,(iy+ModeFlags2)
- jp nz,ConvRStr_Float
- call EndOfLine
- jp ParseArg2
- SkipLineDiv:
- ld a,(hl)
- cp 93h \ jp z,SlowText
- cp 83h
- jr z,SkipLine
- cp 29h
- jr nz,Divide
- push bc
- call ParseNextFullArg
- pop hl
- ;1366cc+6cc for every 0 bit in the result (up to +90cc
- ;+48cc unless HL and BC are both positive
- ;min: 1366cc
- ;max: 1504cc
- ;avg: 1447cc
- ld a,h
- xor b
- push af
- xor b
- jp p,+_
- xor a
- sub l
- ld l,a
- sbc a,a
- sub h
- ld h,a
- _:
- xor b
- jp p,+_
- xor a
- sub c
- ld c,a
- sbc a,a
- sub b
- ld b,a
- _:
- call HL_Div_BC
- pop af
- jp p,+_
- xor a
- sub l
- ld l,a
- sbc a,a
- sub h
- ld h,a
- _:
- ld b,h
- ld c,l
- ld (ThetaPrimeVar),de
- ret
- Divide:
- push bc
- ld a,(hl)
- cp 3Ah
- jr z,+_
- call ParseFullArg
- pop hl
- call HL_Div_BC
- ld b,h
- ld c,l
- ld (ThetaPrimeVar),de
- ret
- _:
- ld hl,divSingle
- jp float_stepin
- PowToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadTOken
- push bc
- ld hl,powSingle
- jp float_stepin
- _:
- ld hl,expSingle
- jp float_stepin_1
- PowerOf2:
- ld a,(hl)
- cp 3Ah
- jr z,-_
- call ParseFullArg
- ld a,c
- ld hl,0
- ld d,h
- ld e,h
- cp 32
- jr nc,Po2End
- inc l
- or a
- jr z,Po2End
- ld b,a
- _:
- add hl,hl
- rl e
- rl d
- djnz -_
- Po2End:
- ld b,h
- ld c,l
- ret
- Logic:
- Equals:
- ld a,(hl)
- cp $3A
- jr z,feq
- push bc
- factorialStepIn:
- call ParseFullArg
- pop hl
- xor a
- sbc hl,bc
- ld b,a
- ld c,a
- ret nz
- inc c
- ret
- feq:
- call fcmp
- ld bc,0
- ret nz
- inc c
- ret
- fcmp:
- push bc
- call ParseNextFullArg
- ld hl,cmpSingle
- ld (next_page_call_address),hl
- pop hl
- ld d,b
- ld e,c
- jp next_page_call
- moreLogic:
- push af
- push bc
- call ParseFullArg
- pop hl
- pop af
- ret
- notLogic:
- call MoreLogic
- ld a,b \ cpl \ ld b,a
- ld a,c \ cpl \ ld c,a
- ret
- andLogic:
- call MoreLogic
- ld a,h \ and b \ ld b,a
- ld a,l \ and c \ ld c,a
- ret
- orLogic:
- call MoreLogic
- ld a,h \ or b \ ld b,a
- ld a,l \ or c \ ld c,a
- ret
- xorLogic:
- call MoreLogic
- ld a,h \ xor b \ ld b,a
- ld a,l \ xor c \ ld c,a
- ret
- Less:
- ld a,(hl)
- cp $3A
- jr z,flt
- call MoreLogic
- xor a
- sbc hl,bc
- ld b,a
- adc a,a
- ld c,a
- ret
- flt:
- call fcmp
- ld bc,0
- ret nc
- inc c
- ret
- Greater:
- ld a,(hl)
- cp $3A
- jr z,fgt
- call MoreLogic
- xor a
- scf
- sbc hl,bc
- ccf
- ld b,a
- adc a,a
- ld c,a
- ret
- fgt:
- call fcmp
- ld bc,0
- ret z
- ret c
- inc c
- ret
- LessOrEqual:
- ld a,(hl)
- cp $3A
- jr z,fle
- call MoreLogic
- xor a
- scf
- sbc hl,bc
- ld b,a
- adc a,a
- ld c,a
- ret
- fle:
- call fcmp
- ld bc,1
- ret c
- ret z
- dec c
- ret
- MoreOrEqual:
- ld a,(hl)
- cp $3A
- jr z,fge
- call MoreLogic
- xor a
- sbc hl,bc
- ccf
- ld b,a
- adc a,a
- ld c,a
- ret
- fge:
- call fcmp
- ld bc,0
- ret c
- inc c
- ret
- NotEqual:
- ld a,(hl)
- cp $3A
- jr z,fne
- call MoreLogic
- xor a
- sbc hl,bc
- ld b,a
- ld c,a
- ret z
- inc c
- ret
- fne:
- call fcmp
- ld bc,0
- ret z
- inc c
- ret
- RandToken:
- ld a,(hl)
- cp 3Ah
- jr z,+_
- call prng16
- ld b,h
- ld c,l
- ret
- _:
- inc hl
- ld (parsePtr),hl
- ld hl,randSingle
- float_stepin_0:
- push hl
- call floatstackpush
- ld b,h
- ld c,l
- pop hl
- ld (next_page_call_address),hl
- jp next_page_call
- tanToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,tanSingle
- jp float_stepin_1
- atanToken:
- ld a,(hl)
- cp 3Ah
- jr z,atan_float
- call ParseFullArg
- push bc
- ld bc,128
- cp 2Bh
- call z,ParseNextFullArg
- pop de
- ld hl,atanbin
- ld (next_page_call_address),hl
- jp next_page_call
- atan_float:
- ld hl,atanSingle
- jp float_stepin_1
- acosToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,acosSingle
- jp float_stepin_1
- asinToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,asinSingle
- jp float_stepin_1
- tanhToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,tanhSingle
- jp float_stepin_1
- coshToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,coshSingle
- jp float_stepin_1
- sinhToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,sinhSingle
- jp float_stepin_1
- atanhToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,atanhSingle
- jp float_stepin_1
- acoshToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,acoshSingle
- jp float_stepin_1
- asinhToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,asinhSingle
- jp float_stepin_1
- pow10Token:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,pow10Single
- jp float_stepin_1
- meanToken:
- ld a,(hl)
- cp 3Ah
- jp nz,ErrBadToken
- ld hl,ameanSingle
- float_stepin_2:
- push hl
- call ParseNextFullArg
- pop hl
- float_stepin_2_:
- push bc
- push hl
- call ParseNextFullArg
- push bc
- call floatstackpush
- ld b,h
- ld c,l
- pop de
- pop hl
- ld (next_page_call_address),hl
- pop hl
- jp next_page_call
|