home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug060.arc
/
CPM#006.LBR
/
CALC.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1979-12-31
|
5KB
|
174 lines
****************************< CALC.CMD >*****************************
* This is a dBASE II calculator program which utilizes a "Keyin" func- *
* tion and programmed function keys. The program is ready to run on *
* TeleVideo 802s, 803s & TPC-1s. Others will require modification for *
* cursor on and off and function key settings. *
* The "Keyin" location is set as 17616 because I've modified my dBASE II*
* with Gene Head's NEWBASE.ASM file. *
* 01/15/85 Originally Written *
******************************< Wes Tyler >******************************
ERASE
*--> Cursor Off
? chr(27)+'.0'
? chr(27)+'.0'
*--> Set Up Function Keys For
*--> a carriage return followed by a symbol
? chr(27)+"|11"+chr(13)+"@"+chr(25)
? chr(27)+"|21"+chr(13)+"A"+chr(25)
? chr(27)+"|31"+chr(13)+"B"+chr(25)
? chr(27)+"|41"+chr(13)+"C"+chr(25)
? chr(27)+"|51"+chr(13)+"D"+chr(25)
? chr(27)+"|61"+chr(13)+"E"+chr(25)
? chr(27)+"|71"+chr(13)+"F"+chr(25)
? chr(27)+"|81"+chr(13)+"G"+chr(25)
? chr(27)+"|91"+chr(13)+"H"+chr(25)
? chr(27)+"|:1"+chr(13)+"I"+chr(25)
SET TALK OFF
SET INTE OFF
*--> Sign On
@ 7,37 SAY "CALC.CMD"
SET INTE ON
@ 8,30 SAY "A dBASE II Calculator"
SET INTE OFF
@ 9,35 SAY "by Wes Tyler"
STORE 0 TO mcount
DO WHILE mcount < 150
STORE mcount + 1 TO mcount
ENDDO
ERASE
*--> Menu For The Function Keys Set Above
@ 13,34 SAY "F1 = ADD"
@ 14,34 SAY "F2 = MULTIPLY"
@ 15,34 SAY "F3 = SUBTRACT"
@ 16,34 SAY "F4 = DIVIDE"
@ 18,34 SAY "F7 = CE/CM"
@ 19,34 SAY "F9 = QUIT TO CPM"
@ 20,34 SAY "F10 = dBASE II"
*--> Initialize memory and entry values
STORE 0.0 TO memory, entry
*--> Set It to not clear memory
STORE F TO clearmem
*--> Begin Calculator loop
DO WHILE T
@ 9,32 GET entry PICTURE '999999999999.9999'
*--> Cursor On
@ 9,32 SAY chr(27)+'.2'
READ
*--> Cursor Off
@ 9,32 SAY chr(27)+'.0'
@ 9,32 SAY chr(27)+'.0'
*--> Function Key 'RETURNS' from above read
*--> and loads keyin with 'maction'
*--> This WILL NOT WORK unless your dBASE II has been modified
*--> for a keyin feature at decimal location 17616
STORE chr(peek(17616)) TO maction
DO CASE
CASE maction = '@'
*--> ADDITION
STORE memory + entry TO memory
*--> Next line sets memory up for display
STORE memory TO entry
*--> Set It to not clear memory
STORE F TO clearmem
LOOP
CASE maction = 'A'
*--> MULTIPLICATION
IF memory <> 0
STORE memory * entry TO memory
ELSE
*--> If memory = 0 assume they wish
*--> to multiply this entry to next
*--> entry, so change this entry to memory!
STORE entry TO memory
ENDIF
*--> Next line sets memory up for display
STORE memory TO entry
*--> Set It to not clear memory
STORE F TO clearmem
LOOP
CASE maction = 'B'
*--> SUBTRACTION
STORE memory - entry TO memory
*--> Next line sets memory up for display
STORE memory TO entry
*--> Set It to not clear memory
STORE F TO clearmem
LOOP
CASE maction = 'C'
*--> DIVISION
IF memory <> 0
STORE memory / entry TO round
STORE INT((round * 10000) + .5 ) / 10000 TO memory
ELSE
*--> If memory = 0 assume they wish
*--> to divide this entry by next
*--> entry, so change this entry to memory!
STORE entry TO memory
ENDIF
*--> Next line sets memory up for display
STORE memory TO entry
*--> Set It to not clear memory
STORE F TO clearmem
LOOP
CASE maction = 'F'
*--> CLEAR ENTRY/CLEAR MEMORY
IF .NOT. clearmem
*--> Set It to clear memory next time through
STORE T TO clearmem
*--> Next line sets memory up for display and clears
*--> entry by replacing it with memory
STORE memory TO entry
ELSE
*--> Set It to not clear memory
STORE F TO clearmem
*--> Actually clear it now
STORE 0 TO memory, entry
ENDIF
LOOP
CASE maction = 'H'
*--> QUIT TO CP/M
ERASE
*--> If memory isn't zero we'll leave it on the screen
IF memory <> 0
@ 9,33 SAY memory USING '999999999999.9999'
ENDIF
*--> Cursor On
@ 0, 0 SAY chr(27)+'.2'
SET CONSOLE OFF
QUIT
CASE maction = 'I'
*--> QUIT TO dBASE II
ERASE
*--> If memory isn't zero we'll leave it on the screen
IF memory <> 0
@ 9,33 SAY memory USING '999999999999.9999'
ENDIF
SET TALK ON
CLEAR
*--> Cursor On
@ 0, 0 SAY chr(27)+'.2'
CANCEL
OTHERWISE
STORE memory TO entry
ENDCASE
ENDDO *< DO WHILE T >*
*<<<EOF CALC.CMD