!*************************************************************************
!
! AMUS DESKTOP CALCULATOR (ADC.BAS)
!
! by Dave Heyliger - AMUS Staff
!
! Notes: The ADC simulates a cheap calculator and is good only for
! quick math functions. Directions are printed to the screen
! during runtime, and the keys allowed are displayed via the
! "calculator".
!
! You will need a subroutine called INKEY.M68 in the [100,52]
! subroutine account.
!
! For fast access to the ADC, place the .RUN and the .SBR into
! the BAS: account - DSK0:[7,6], then create in the .CMD account
! the file called ADC.CMD:
! :R
! LOAD BAS:ADC.RUN
! LOAD BAS:INKEY.SBR
! RUN ADC
!
!*************************************************************************
MAP1 clearsp,s,33," "
MAP1 f'number,f
MAP1 function,s,1
MAP1 s'number,f
MAP1 continue,s,30,"Enter math function or any key"
MAP1 clearsts,s,31," "
! Main Loop
!__________
main:
function = ""
? tab (3,26) clearsts
? tab (3,33) "enter number"
? tab (5,25);
input,f'number
? tab (3,26) clearsts
? tab (3,33) "enter function"
wait1: ? tab (5,54);
xcall inkey,function
if function = "" then goto wait1
parsem: call parse
goto parsem
end
! PARSE subroutine
!_________________
parse:
if function = "*" then call multiply : return
if function = "/" then call divide : return
if function = "+" then call add : return
if function = "-" then call subtract : return
if ucs(function) = "Q" then ? tab (-1,0) : end
if function = "^" then call power : return
if function = "!" then call factorial : return
if function = "%" then call percent : return
goto main