├── SCREENS.FTH ├── docs ├── editor.pdf ├── Makefile ├── ASSEMBLR.TXT ├── EDITOR.TXT ├── ADDENDA.TXT └── editor.tex ├── scr2txt.sh ├── .gitignore ├── Makefile ├── conprtio.asm ├── romwbw.asm ├── STARTUP.FTH ├── README.md ├── discio.asm ├── LICENSE └── figforth.asm /SCREENS.FTH: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dimitrit/figforth/HEAD/SCREENS.FTH -------------------------------------------------------------------------------- /docs/editor.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dimitrit/figforth/HEAD/docs/editor.pdf -------------------------------------------------------------------------------- /scr2txt.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Convert screens file to text 4 | # 5 | fold -b64 $1 | sed -e 's/[ \t]*$//' 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gz 2 | *.aux 3 | *.log 4 | *.rom 5 | *.com 6 | *.bin 7 | *.img 8 | *.lst 9 | .idea 10 | .DS_Store -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | figforth: figforth.img 2 | 3 | figforth.img: figforth.com SCREENS.FTH 4 | @rm -f figforth.img 5 | @mkfs.cpm -f wbw_fd144 figforth.img 6 | @cpmcp -f wbw_fd144 figforth.img figforth.com 0:forth.com 7 | @cpmcp -f wbw_fd144 figforth.img SCREENS.FTH 0:screens.fth 8 | 9 | figforth.com: conprtio.asm discio.asm figforth.asm romwbw.asm 10 | @uz80as -t z80 figforth.asm figforth.com figforth.lst 11 | 12 | clean: 13 | @rm -f *.lst *.img *.com 14 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # List of documents that need to be generated 2 | documents = editor.pdf 3 | 4 | # You want latexmk to *always* run, because make does not have all the info. 5 | # Also, include non-file targets in .PHONY so they are run regardless of any 6 | # file of the given name existing. 7 | .PHONY: all clean 8 | 9 | # The first rule in a Makefile is the one executed by default ("make"). It 10 | # should always be the "all" rule, so that "make" and "make all" are identical. 11 | all: $(documents) 12 | 13 | # CUSTOM BUILD RULES 14 | 15 | # MAIN LATEXMK RULE 16 | 17 | # -pdf tells latexmk to generate PDF directly (instead of DVI). 18 | # -pdflatex="" tells latexmk to call a specific backend with specific options. 19 | # -use-make tells latexmk to call make for generating missing files. 20 | 21 | # -interaction=nonstopmode keeps the pdflatex backend from stopping at a 22 | # missing file reference and interactively asking you for an alternative. 23 | 24 | %.pdf: %.tex 25 | latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make $< 26 | 27 | purge: 28 | rm -f *.{aux,dvi,log,bbl,blg,brf,fls,toc,thm,out,fdb_latexmk} 29 | 30 | clean: 31 | latexmk -CA 32 | -------------------------------------------------------------------------------- /conprtio.asm: -------------------------------------------------------------------------------- 1 | ; CP/M CONSOLE & PRINTER INTERFACE 2 | ; 3 | ; Last update: 4 | ; 5 | ; 850511 - Saved BC' prior to CP/M calls 6 | ; 841010 - Saved IX & IY prior to CP/M calls 7 | ; 840909 - Converted all BIOS calls to BDOS calls for compatibility 8 | ; with CP/M 3.0 9 | ; 10 | ; 11 | ; 12 | LSTOUT .EQU 05H ;printer output 13 | DCONIO .EQU 06H ;direct console I/O 14 | ; 15 | RUBOUT .EQU 7FH 16 | INPREQ .EQU 0FFH ;DCONIO input request 17 | ; 18 | EPRINT: .BYTE 0 ;printer flag 19 | ;0=disabled, 1=enabled 20 | ; 21 | SYSENT: PUSH BC 22 | PUSH DE 23 | PUSH HL 24 | PUSH IX 25 | PUSH IY 26 | exx 27 | push bc ;save ip (if used as such) 28 | exx 29 | CALL BDOSS ;perform function (C) 30 | exx 31 | pop bc ;restore ip 32 | exx 33 | POP IY 34 | POP IX 35 | POP HL 36 | POP DE 37 | POP BC 38 | RET 39 | ; 40 | CSTAT: PUSH BC 41 | LD C,DCONIO ;direct console I/O 42 | LD E,INPREQ ;input request 43 | CALL SYSENT ;any CHR typed? 44 | POP BC ;if yes, (A)<--CHAR 45 | RET ;else (A)<--00H (ignore CHR) 46 | ; 47 | CIN: PUSH BC 48 | LD C,DCONIO ;direct console I/O 49 | LD E,INPREQ ;request input 50 | CINLP: CALL SYSENT ;(A)<--CHR (or 0 if nothing typed) 51 | OR A 52 | JR Z,CINLP ;wait for CHR to be typed 53 | CP RUBOUT 54 | JR NZ,CIN0 55 | LD A,BSOUT ;convert RUB to ^H 56 | CIN0: CP HT 57 | JR NZ,CIN1 58 | LD A,ABL ;convert HT to space 59 | CIN1: RES 7,A ;(MSB)<--0 60 | POP BC 61 | RET 62 | ; 63 | COUT: PUSH BC 64 | PUSH DE ;save (E) = CHR 65 | LD C,DCONIO ;direct console output 66 | CALL SYSENT ;send (E) to CON: 67 | POP DE 68 | POP BC 69 | RET 70 | ; 71 | POUT: PUSH BC 72 | LD C,LSTOUT 73 | CALL SYSENT ;send (E) to LST: 74 | POP BC 75 | RET 76 | ; 77 | CPOUT: CALL COUT ;send (E) to console 78 | LD A,(EPRINT) 79 | OR A ;if (EPRINT) <> 0 80 | CALL NZ,POUT ;send (E) to LST: 81 | RET 82 | ; 83 | ; FORTH TO CP/M SERIAL I/O INTERFACE 84 | ; 85 | PQTER: CALL CSTAT 86 | LD HL,0 87 | OR A ;CHR TYPED? 88 | JR Z,PQTE1 ;NO 89 | INC L ;YES, (S1)<--TRUE 90 | PQTE1: JHPUSH 91 | ; 92 | PKEY: CALL CIN ;READ CHR FROM CONSOLE 93 | CP DLE ;^P? 94 | LD E,A 95 | JR NZ,PKEY1 ;NO 96 | LD HL,EPRINT 97 | LD E,ABL ;(E)<--BLANK 98 | LD A,(HL) 99 | XOR 01H ;TOGGLE (EPRINT) LSB 100 | LD (HL),A 101 | PKEY1: LD L,E 102 | LD H,0 103 | JHPUSH ;(S1)LB<--CHR 104 | ; 105 | PEMIT: .WORD $+2 ;(EMIT) orphan 106 | POP DE ;(E)<--(S1)LB = CHR 107 | LD A,E 108 | CP BSOUT 109 | JR NZ,PEMIT1 110 | CALL COUT ;backspace 111 | LD E,ABL ;blank 112 | CALL COUT ;erase CHR on CON: 113 | LD E,BSOUT ;backspace 114 | PEMIT1: CALL CPOUT ;send CHR to CON: 115 | ;and LST: if (EPRINT)=01H 116 | JNEXT 117 | ; 118 | PCR: LD E,ACR 119 | CALL CPOUT ;output CR 120 | LD E,LF 121 | CALL CPOUT ;and LF 122 | JNEXT 123 | ; 124 | ; 125 | ; 126 | -------------------------------------------------------------------------------- /romwbw.asm: -------------------------------------------------------------------------------- 1 | ; RomWBW extensions 2 | ; 3 | ; Last update: 4 | ; 5 | ; 200110 - initial version 6 | ; 7 | ; 8 | ; RomWBW FUNCTIONS 9 | ; 10 | CIOIN .EQU 00H ; character input 11 | CIOIST .EQU 02H ; character input status 12 | ; 13 | RTCGETTIM .EQU 20H ; RTC get time 14 | RTCSETTIM .EQU 21H ; RTC set time 15 | ; 16 | VDARES .EQU 42H ; video reset 17 | VDASCP .EQU 45H ; video set cursor position 18 | ; 19 | CURCON .EQU 80H ; 'current console' unit number 20 | ; 21 | #DEFINE HBIOS RST 08 22 | ; 23 | ; 24 | ; ROMWBW LOW LEVEL ROUTINES 25 | ; 26 | .BYTE 84H ; KEY? ( -- c t ¦ f ) 27 | .TEXT "KEY" ; Check if a key has been pressed. Returns false 28 | .BYTE '?'+$80 ; if no key has been pressed. If a key has been 29 | .WORD ARROW-6 ; pressed, returns true and the key's ascii code. 30 | KEYQ: .WORD $+2 31 | PUSH BC 32 | LD C,CURCON 33 | LD B,CIOIST 34 | HBIOS 35 | OR A 36 | JR NZ,KEYQ1 37 | POP BC 38 | LD HL,0 39 | JHPUSH 40 | KEYQ1: LD C,CURCON 41 | LD B,CIOIN 42 | HBIOS 43 | POP BC 44 | LD HL,0 45 | OR A 46 | JR NZ,KEYQ2 47 | LD L,1 48 | LD D,0 49 | PUSH DE 50 | KEYQ2: JHPUSH 51 | ; 52 | .BYTE 84H ; TIME ( -- addr ) 53 | .TEXT "TIM" ; Get the RTC time and leave the address of the 54 | .BYTE 'E'+$80 ; 6 byte date/time buffer, YMDHMS. Each byte is 55 | .WORD KEYQ-7 ; BCD encoded. 56 | TIME: .WORD $+2 57 | PUSH BC 58 | LD HL,ORIG+28H 59 | LD B,RTCGETTIM 60 | HBIOS 61 | POP BC 62 | LD HL,ORIG+28H 63 | JHPUSH 64 | ; 65 | .BYTE 85H ; STIME ( addr -- ) 66 | .TEXT "STIM" ; Set the RTC time. addr is the address of the 67 | .BYTE 'E'+$80 ; 6 byte date/time buffer, YMDHMS. Each byte is 68 | .WORD TIME-7 ; BCD encoded. 69 | STIME: .WORD $+2 70 | POP HL 71 | PUSH BC 72 | LD B,RTCSETTIM 73 | HBIOS 74 | POP BC 75 | JNEXT 76 | ; 77 | .BYTE 83H ; CLS ( -- ) 78 | .TEXT "CL" ; Clear VDU screen. 79 | .BYTE 'S'+$80 80 | .WORD STIME-8 81 | CLS: .WORD $+2 82 | PUSH BC 83 | LD HL,(ORIG+26H) 84 | LD C,L 85 | LD B,VDARES 86 | HBIOS 87 | POP BC 88 | JNEXT 89 | ; 90 | .BYTE 82H ; AT ( col row -- ) 91 | .BYTE 'A' ; Positions the text cursor at the given position. 92 | .BYTE 'T'+$80 ; Both column and row positions are zero indexed, 93 | .WORD CLS-6 ; i.e. 0 0 AT will move the cursor to the top left. 94 | SETPOS: .WORD $+2 ; Note that AT does *not* update OUT. 95 | POP HL 96 | POP DE 97 | PUSH BC 98 | LD D,L 99 | LD HL,(ORIG+26H) 100 | LD C,L 101 | LD B,VDASCP 102 | HBIOS 103 | POP BC 104 | JNEXT 105 | ; 106 | ; ROMWBW HIGH LEVEL ROUTINES 107 | ; 108 | .BYTE 82H ; .B ( n -- ) 109 | .BYTE '.' ; Print a BCD value, converted to decimal. No 110 | .BYTE 'B'+$80 ; following blank is printed. 111 | .WORD SETPOS-5 112 | BCD: .WORD DOCOL 113 | .WORD DUP 114 | .WORD TWOSLA 115 | .WORD TWOSLA 116 | .WORD TWOSLA 117 | .WORD TWOSLA 118 | .WORD LIT,30H 119 | .WORD PLUS 120 | .WORD EMIT 121 | .WORD LIT,0FH 122 | .WORD ANDD 123 | .WORD LIT,30H 124 | .WORD PLUS 125 | .WORD EMIT 126 | .WORD SEMIS 127 | ; 128 | ; -------------------------------------------------------------------------------- /docs/ASSEMBLR.TXT: -------------------------------------------------------------------------------- 1 | SCR # 17 2 | 0 ( fig-FORTH 8080 Assembler with Z80 extensions SCR 1 of 5) 3 | 1 4 | 2 HEX VOCABULARY ASSEMBLER IMMEDIATE 5 | 3 ' ASSEMBLER CFA ' ;CODE 0A + ! 6 | 4 : CODE ?EXEC CREATE [COMPILE] ASSEMBLER !CSP ; IMMEDIATE 7 | 5 : C; CURRENT @ CONTEXT ! ?EXEC ?CSP SMUDGE ; IMMEDIATE 8 | 6 : LABEL ?EXEC 0 VARIABLE SMUDGE -2 ALLOT 9 | 7 [COMPILE] ASSEMBLER !CSP ; IMMEDIATE 10 | 8 : 8* DUP + DUP + DUP + ; 11 | 9 12 | 10 ASSEMBLER DEFINITIONS 13 | 11 --> 14 | 12 15 | 13 16 | 14 17 | 15 18 | 19 | SCR # 18 20 | 0 ( fig-FORTH 8080 Assembler with Z80 extensions SCR 2 of 5) 21 | 1 22 | 2 4 CONSTANT H 5 CONSTANT L 7 CONSTANT A 6 CONSTANT PSW 23 | 3 2 CONSTANT D 3 CONSTANT E 0 CONSTANT B 1 CONSTANT C 24 | 4 6 CONSTANT M 6 CONSTANT SP 25 | 5 26 | 6 : 1MI C@ C, ; 27 | 7 : 2MI C@ + C, ; 28 | 8 : 3MI C@ SWAP 8* + C, ; 29 | 9 : 4MI C@ C, C, ; 30 | 10 : 5MI C@ C, , ; 31 | 11 --> 32 | 12 33 | 13 34 | 14 35 | 15 36 | 37 | SCR # 19 38 | 0 ( fig-FORTH 8080 Assembler with Z80 extensions SCR 3 of 5) 39 | 1 40 | 2 00 1MI NOP 76 1MI HLT F3 1MI DI FB 1MI EI 07 1MI RLC 41 | 3 0F 1MI RRC 17 1MI RAL 1F 1MI RAR E9 1MI PCHL F9 1MI SPHL 42 | 4 E3 1MI XTHL EB 1MI XCHG 27 1MI DAA 2F 1MI CMA 37 1MI STC 43 | 5 3F 1MI CMC 08 1MI EXAF D9 1MI EXX C0 1MI RNZ C8 1MI RZ 44 | 6 D0 1MI RNC D8 1MI RC E0 1MI RPO E8 1MI RPE F0 1MI RP 45 | 7 F8 1MI RM C9 1MI RET 46 | 8 47 | 9 80 2MI ADD 88 2MI ADC 90 2MI SUB 98 2MI SBB A0 2MI ANA 48 | 10 A8 2MI XRA B0 2MI ORA B8 2MI CMP 49 | 11 50 | 12 09 3MI DAD C1 3MI POP C5 3MI PUSH 02 3MI STAX 0A 3MI LDAX 51 | 13 04 3MI INR 05 3MI DCR 03 3MI INX 0B 3MI DCX C7 3MI RST 52 | 14 --> 53 | 15 54 | 55 | SCR # 20 56 | 0 ( fig-FORTH 8080 Assembler with Z80 extensions SCR 4 of 5) 57 | 1 58 | 2 D3 4MI OUT DB 4MI IN C6 4MI ADI CE 4MI ACI D6 4MI SUI 59 | 3 DE 4MI SBI E6 4MI ANI EE 4MI XRI F6 4MI ORI FE 4MI CPI 60 | 4 61 | 5 22 5MI SHLD 2A 5MI LHLD 32 5MI STA 3A 5MI LDA C4 5MI CNZ 62 | 6 CC 5MI CZ D4 5MI CNC DC 5MI CC E4 5MI CPO EC 5MI CPE 63 | 7 F4 5MI CP FC 5MI CM CD 5MI CALL C3 5MI JMP 64 | 8 65 | 9 C2 CONSTANT 0= D2 CONSTANT CS E2 CONSTANT PE F2 CONSTANT 0< 66 | 10 67 | 11 : NOT 8 + ; : MOV 8* 40 + + C, ; 68 | 12 : MVI 8* 6 + C, C, ; : LXI 8* 1+ C, , ; 69 | 13 : PCIX DD C, E9 C, ; : PCIY FD C, E9 C, ; 70 | 14 --> 71 | 15 72 | 73 | SCR # 21 74 | 0 ( fig-FORTH 8080 Assembler with Z80 extensions SCR 5 of 5) 75 | 1 76 | 2 : ENDIF 2 ?PAIRS HERE SWAP ! ; 77 | 3 : THEN [COMPILE] ENDIF ; 78 | 4 : IF C, HERE 0 , 2 ; 79 | 5 : ELSE 2 ?PAIRS C3 IF ROT SWAP ENDIF 2 ; 80 | 6 : BEGIN HERE 1 ; 81 | 7 : UNTIL SWAP 1 ?PAIRS C, , ; 82 | 8 : AGAIN 1 ?PAIRS C3 C, , ; 83 | 9 : WHILE IF 2+ ; 84 | 10 : REPEAT >R >R AGAIN R> R> 2- ENDIF ; 85 | 11 86 | 12 FORTH DEFINITIONS DECIMAL 87 | 13 ;S 88 | 14 89 | 15 90 | 91 | 92 | -------------------------------------------------------------------------------- /docs/EDITOR.TXT: -------------------------------------------------------------------------------- 1 | EDITOR USER MANUAL 2 | 3 | by Bill Stoddart 4 | of FIG, United Kingdom 5 | 6 | FORTH organizes its mass storage into "screens" of 1024 characters. 7 | If, for example, a diskette of 250k byte capacity is used entirely 8 | for storing text, it will appear to the user as 250 screens 9 | numbered O to 249. 10 | 11 | Each screen is organized as 16 lines with 64 characters per line. 12 | The FORTH screens are merely an arrangement of virtual memory and 13 | need not correspond exactly with the screen format of a particular 14 | terminal. 15 | 16 | Selecting a Screen and Input of Text 17 | 18 | To start an editing session the user types EDITOR to invoke the 19 | appropriate vocabulary. 20 | 21 | The screen to be edited is then selected, using either: 22 | 23 | n LIST ( list screen n and select it for editing ) OR 24 | n CLEAR ( clear screen n and select for editing ) 25 | 26 | To input new test to screen n after LIST or CLEAR the P (put) 27 | command is used. 28 | 29 | Example: 30 | 31 | O P THIS IS HOW 32 | 1 P TO INPUT TEXT 33 | 2 P TO LINES O, 1, AND 2 OF THE SELECTED SCREEN. 34 | 35 | 36 | Line Editing 37 | 38 | During this descirption of the editor, reference is made to PAD. 39 | This is a text buffer which may hold a line of text used by or 40 | saved with a line editing command, or a text string to be found or 41 | deleted by a string editing command. 42 | 43 | PAD can be used to transfer a line from one screen to another, as 44 | well as to perform edit operations within a single screen. 45 | 46 | Line Editor Commands 47 | 48 | n H Hold line n at PAD (used by system more often than by user) 49 | 50 | n D Delete line n but hold it in PAD. Line 15 becomes blank` 51 | as lines n+1 to 15 move up 1 line. 52 | 53 | n T Type line n and save it in PAD. 54 | 55 | n R Replace line n with the text in PAD. 56 | 57 | n I Insert the text from PAD at line n, moving the old line n 58 | and following lines down. Line 15 is lost. _ 59 | 60 | n E Erase line n with blanks. 61 | 62 | n S Spread at line n. n and subsequent lines move down 1 63 | line. Line n becomes blank. Line 15 is lost. 64 | 65 | 66 | Cursor Control and String Editing 67 | 68 | The screen of text being edited resides in a buffer area of 69 | storage. The editing cursor is a variable holding an offset into 70 | this buffer area. Commands are provided for the user to position 71 | the cursor, either directly or by searching for a string of buffer 72 | text, and to insert or delete text at the cursor position. 73 | 74 | Commands to Position the Cursor 75 | 76 | TOP Position the cursor at the start of the screen. 77 | 78 | N M Move the cursor by a signed amount n and print the cursor 79 | line. The position of the cursor on its line is shown by 80 | a __ (underline). 81 | 82 | String Editing Commands 83 | 84 | F text Search forward from the current cursor position until 85 | string "text" is found. The cursor is left at the end 86 | of the text string, and the cursor line is printed. 87 | If the string is not found an error message is given 88 | and the cursor is repositioned at the top of screen. 89 | 90 | B Used after F to back up the cursor by the length of 91 | the most recent text. 92 | 93 | N Find the next occurrence of the string found by an F 94 | command. 95 | 96 | X text Find and delete the string "text." 97 | 98 | C text Copy in text to the cursor line at the cursor position 99 | 100 | TILL text Delete on the cursor line from the cursor till the end 101 | of the text string "text." 102 | 103 | NOTE: Typing C with no text will copy a null into the text 104 | at the cursor position. This will abruptly stop later 105 | compiling! To delete this error type TOP X 'return‘. 106 | 107 | 108 | 109 | Screen Editing Commands 110 | 111 | n LIST List screen n and select it for editing 112 | 113 | n CLEAR Clear screen n with blanks and select it for editing 114 | 115 | n1 n2 COPY Copy screen n1 to screen n2. 116 | 117 | L List the current screen. The cursor line is relisted 118 | after the screen listing, to show the cursor position. 119 | 120 | FLUSH Used at the end of an editing session to ensure that 121 | all entries and updates of text have been transferred 122 | to disc. 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /docs/ADDENDA.TXT: -------------------------------------------------------------------------------- 1 | 2 | 3 | ADDENDA to Glossary for 4 | 8080 fig-FORTH Release 1.1 5 | 6 | 7 | #BUF --- n 8 | A constant returning the number of disk buffers allocated. For 9 | the disk I-O routines to work correctly #BUF must be greater than 1. 10 | 11 | .CPU 12 | Prints the processor name (i.e.8080) from ORIG+22H encoded as a 13 | 32 bit, base 36 integer. 14 | 15 | 2! nlow nhigh addr --- 16 | 32 bit store. nhigh is stored at addr; nlow is stored at addr+2. 17 | 18 | 2@ addr --- nlow nhigh 19 | 32 bit fetch. nhigh is fetched from addr; nlow is fetched from 20 | addr+2. 21 | 22 | 2DUP n2 n1 --- n2 n1 n2 n1 23 | Duplicates the top two values on the stack. Equivalent to OVER OVER. 24 | 25 | C/L --- n 26 | Constant leaving the number of characters per line; used by the 27 | editor. 28 | 29 | DENSITY --- addr 30 | A variable used by the disk interface. 31 | 0 = single density; 1 = double density. 32 | 33 | DISK-ERROR --- addr 34 | A variable used by the disk interface, containing the disk status 35 | for the last sector read or written. 0 means no error. 36 | 37 | DRIVE --- addr 38 | A variable used by disk interface, containing the disk drive 39 | number (0 to MXDRV) used on the last sector read or written. 40 | 41 | FLUSH 42 | Write all UPDATEd disk buffers to disk. Should be used after 43 | editing, before dismounting a disk, or before exiting FORTH. 44 | 45 | NOOP 46 | A Forth ‘no operation’. 47 | 48 | P! b port# --- 49 | 8080 or Z-80 I-0 port store. Outputs byte b to port#. 50 | 51 | P@ port# --- b 52 | 8080 or Z-80 I-O port fetch. Inputs byte b from port#. 53 | 54 | RP@ --- addr 55 | Leaves the current value in the return stack pointer register. 56 | 57 | SEC --- addr 58 | A variable used by the disk interface, containing the sector number 59 | last read or written relative to the last drive used. 60 | 61 | 62 | 63 | FORTH INTEREST GROUP ----- P.O. Box 1105 ----- San Carlos, Ca. 94070 64 | 65 | 66 | 67 | 68 | 69 | SEC-READ 70 | Reads a disc sector (BPS bytes) into memory. All parameters must 71 | have been set by SET-DRIVE and SET-I0. The status on completion 72 | is stored in DISK-ERROR. 73 | 74 | SEC-WRITE 75 | Writes a disk-sector (BPS bytes) from memory. All parameters must 76 | have been set by SET-DRIVE and SET-I0. The status on completion 77 | is stored in DISK-ERROR. 78 | 79 | SET-DRIVE 80 | A CP/M service call which makes subsequent disk reads and writes use 81 | 82 | the drive designated in DRIVE. T&SCALC is usually used to set 83 | DRIVE and call SET-DRIVE. 0 = first drive to MXDRV 84 | 85 | SET-I0 86 | A CP/M service call which makes subsequent disc reads and writes 87 | use the drive last set by SET-DRIVE, the memory address in variable 88 | USE, the sector number in SEC, and the track number in TRACK. 89 | T&SCALC is usually used to set these variables. 90 | 91 | T&SCALC n --- 92 | Track & Sector and drive calculation for disk I0. n is the 93 | total sector dispacement from the first logical drive to the 94 | desired sector. 95 | n = (block# + OFFSET) * SEC/BLK 96 | The corresponding drive, track, and sector numbers are calculated. 97 | If the drive number is different from the contents of DRIVE, the new 98 | drive number is stored in DRIVE and SET-DRIVE is executed. 99 | 100 | The track number is stored in TRACK; the sector number is stored 101 | in SEC. T&SCALC is usually executed before SET-DRIVE. 102 | 103 | TRACK --- addr 104 | A variable used by disk I-O. Contains the track number last 105 | read or written relative to the current drive. 106 | 107 | U< u1 u2 --- f 108 | Leave the boolean value of an unsigned less-than comparison. Leaves 109 | f = 1 for ul < u2; otherwise leaves 0. This function must be 110 | used when comparing memory addresses. u1 and u2 are unsigned 111 | 16 bit integers. 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | FORTH INTEREST GROUP ----- P.O. Box 1105 ----- San Carlos, Ca. 94070 130 | 131 | 132 | -------------------------------------------------------------------------------- /STARTUP.FTH: -------------------------------------------------------------------------------- 1 | 10 0 DO DUP I + C@ B. *************** fig FORTH MODEL *********************** FORTH INTEREST GROUP P.O. BOX 1105 SAN CARLOS, CA. 94070 RELEASE 1.1F FOR CP/M WITH COMPILER SECURITY AND VARIABLE LENGTH NAMES ADAPTED TO CP/M 2.2 SCREENS ALLOCATED IN RANDOM ACCESS FILE HEX : HOME 1A EMIT ; 0 VARIABLE I-STATE : A-L SCR @ (LINE) ; ( 1/2 ADDRESS OF LINE) : GET-L A-L F000 SWAP CMOVE ; ( /0 MOVE LINE TO SCREEN) : PUT-L A-L F000 ROT ROT CMOVE ; ( /0 MOVE LINE FR SCREEN) : DISPATCH ( 1/0 EXECUTE CONTROL CHARACTER) ( ^D) DUP 4 = IF 1B EMIT 57 EMIT DROP ELSE ( ^I) DUP 9 = IF I-STATE 1 TOGGLE DROP ELSE ( ^X) DUP 18 = IF 1B EMIT 45 EMIT DROP ELSE ( ^Y) DUP 19 = IF 1B EMIT 52 EMIT DROP ELSE ( ^Q) DUP 11 = IF ." ABORTED" QUIT ELSE EMIT THEN THEN THEN THEN THEN ; : EMIT1 I-STATE @ IF 1B EMIT 51 EMIT THEN EMIT ; ( 1/0) : XX BEGIN KEY DUP DUP 20 < IF DISPATCH ELSE EMIT1 THEN ( ^E) 5 = UNTIL ; : E-L HOME DUP GET-L XX A EMIT PUT-L UPDATE ; : C-L SWAP A-L DROP SWAP A-L CMOVE ; --> : GET-S 10 0 DO I A-L F000 I 80 * + SWAP CMOVE LOOP ; : PUT-S 10 0 DO F000 I 80 * + I A-L UPDATE CMOVE LOOP ; : CLEAN F800 F000 DO I C@ 7F AND I C! LOOP ; : E-S 0 I-STATE ! HOME GET-S XX CLEAN PUT-S HOME ; : EDIT SCR ! E-S ; ( EXTENDING THE SPACE ALLOCATED ) : LAST-SEC ( 0/1 LEAVES ONE MORE THAN THE LAST BLOCK NR) 0 BEGIN 1+ F000 OVER 1 R/W DISK-ERROR @ UNTIL ; : EXTEND ( 1/0 EXTENDS # BLOCKS WITH NUMBER-1 ) 8 * LAST-SEC HOME ( GET AMOUNT OF BLOCKS) SWAP OVER + SWAP DO F000 I 0 R/W LOOP FCB 10 BDOS DROP ( CLOSE THE FILE,I.E. UPDATE DIRECTORY) FCB 0F BDOS DROP ( OPEN AGAIN ) ; ( SCR # 3) : COPY-SCREEN ( 2/0 COPY SCREEN-2 TO SCREEN-1 ) B/SCR * SWAP B/SCR * SWAP ( GET START BUFFER #'S) B/SCR 0 DO DUP I + BUFFER DROP LOOP ( RESERVE BUFFERS) B/SCR 0 DO OVER I + BLOCK OVER I + BLOCK B/BUF CMOVE UPDATE LOOP DROP DROP FLUSH ; ( ERROR MESSAGES ) MSG # 1 : EMPTY STACK MSG # 2 : DICTIONARY FULL MSG # 3 : HAS INCORRECT ADDRESS MODE MSG # 4 : ISN'T UNIQUE MSG # 6 : DISK RANGE ? MSG # 7 : FULL STACK MSG # 8 : DISC ERROR ! ( FIGFORTH CP/M 2.2 ** HOBBY COMPUTER CLUB HOLLAND **) ( ERROR MESSAGES ) MSG # 17 : COMPILATION ONLY, USE IN DEFINITION MSG # 18 : EXECUTION ONLY MSG # 19 : CONDITIONALS NOT PAIRED MSG # 20 : DEFINITION NOT FINISHED MSG # 21 : IN PROTECTED DICTIONARY MSG # 22 : USE ONLY WHEN LOADING MSG # 23 : OFF CURRENT EDITING SCREEN MSG # 24 : DECLARE VOCABULARY ( DEBUG SCR#6) 0 VARIABLE BASE' : BASE' @ BASE ! ; ( 1/0 AND BACK) ( 1/0 PRINT IN HEX REGARDLESS OF BASE) : H. TYPE SPACE HEX> ; ( 1/0 IDEM FOR A SINGLE BYTE) : B. TYPE HEX> ; : BASE? BASE @ H. ; ( 0/0 TRUE VALUE OF BASE) : ^ ( 0/0 NON DESTRUCTIVE STACK PRINT) CR ." S: " SP@ S0 @ ( FIND LIMITS) BEGIN OVER OVER = 0= WHILE 2 - DUP @ H. REPEAT DROP DROP ; -->

figForth Refuses to Die1

4 |
5 | A fig-FORTH2 implementation for the Z80 that can be built using TASM3: 6 | 7 | ``` 8 | $ tasm -80 -b figforth.asm forth.com forth.lst 9 | ``` 10 | 11 | Alternatively, non-Windows users can use the `uz80as`4 Z80 compiler. 12 | 13 | The resulting `forth.com` executable can be run in CP/M. For example5: 14 | ``` 15 | A>FORTH ↵ 16 | 17 | Z80 fig-FORTH 1.3c 18 | : CUBE ( N -> N. CUBE A NUMBER ) ↵ 19 | DUP DUP ( NOW THERE ARE THREE COPIES ) ↵ 20 | * * ↵ 21 | ; ↵ ok 22 | 5 CUBE . 125 ↵ ok 23 | -28 CUBE . ↵ -21952 ok 24 | HEX 17 CUBE BINARY . DECIMAL ↵ 10111110000111 ok 25 | BYE ↵ 26 | A> 27 | ``` 28 | 29 | ## Custom Words 30 | This fig-FORTH implementation includes the following custom words6: 31 | 32 | `(OF)`    ` n1 n2 --- n1 ` _(if no match)_ 33 |       ` n1 n2 --- ` _(if there is a match)_ 34 |
    35 | The run-time procedure compiled by `OF`. See the description of the 36 | run-time behaviour of `OF`. 37 |
38 | 39 | `CASE`    ` --- addr n ` _(compiling)_ 40 |
    41 | Used in a colon definition in the form: `CASE...OF...ENDOF...ENDCASE`. 42 | Note that `OF ... ENDOF` pairs may be repeated as necessary. 43 | 44 | At compile time `CASE` saves the current value of `CSP` and resets 45 | it to the current position of the stack. This information is used 46 | by `ENDCASE` to resolve forward references left on the stack by any 47 | `ENDOF`s which precede it. `n` is left for compiler error checking. 48 | 49 | `CASE` has no run-time effects. 50 |
51 | 52 | `ENDCASE`    ` addr1...addrn n --- ` _(compiling)_ 53 |       ` n --- ` _(if no match)_ 54 |       ` --- ` _(if a match was found)_ 55 |
    56 | Used in a colon definition in the form: `CASE...OF...ENDOF...ENDCASE`. 57 | Note that `OF ... ENDOF` pairs may be repeated as necessary. 58 | 59 | At run-time, `ENDCASE` drops the select value if it does not equal any 60 | case values. `ENDCASE` then serves as the destination of forward 61 | branches from all previous `ENDOF`s. 62 | 63 | At compile-time. `ENDCASE` compiles a `DROP` then computes forward 64 | branch offsets until all addresses left by previous `ENDOF`s have been 65 | resolved. Finally, the value of `CSP` saved by `CASE` is restored. `n` 66 | is used for error checking. 67 |
68 | 69 | `ENDOF`    ` addr1 n1 --- addr2 n2 ` _(compiling)_ 70 |
    71 | Used in a colon definition in the form: `CASE...OF...ENDOF...ENDCASE`. 72 | Note that `OF ... ENDOF` pairs may be repeated as necessary. 73 | 74 | At run-time, `ENDOF` transfers control to the code following the next 75 | `ENDCASE` provided there was a match at the last `OF`. If the was no 76 | match at the last `OF`, `ENDOF` is the location to which execution 77 | will branch. 78 | 79 | At compile-time `ENDOF` emplaces `BRANCH` reserving a branch offset, 80 | leaves the address `addr2` and `n2` for error checking. `ENDOF` also 81 | resolves the pending forward branch from `OF` by calculating the offset 82 | from `addr1` to `HERE` and storing it at `addr1`. 83 |
84 | 85 | `FILE`    ` cccc ` 86 |
    87 | Close the current .FTH file, and opens the given file. Note that a 88 | file can be loaded automatically on startup by specifying its name on 89 | the command line, e.g. `FORTH SCREENS.FTH`. Startup will be aborted 90 | with a `No File` error message if the file cannot be opened. 91 |
92 | 93 | `FTYPE`    ` --- addr ` 94 |
    95 | A constant containing the three character file type used by `FILE`. 96 | Defaults to **.FTH**. 97 |
98 | 99 | `OF`    ` --- addr n ` _(compiling)_ 100 |       ` n1 n2 --- n1 ` _(if no match)_ 101 |       ` n1 n2 --- ` _(if there is a match)_ 102 |
    103 | Used in a colon definition in the form: `CASE...OF...ENDOF...ENDCASE`. 104 | Note that `OF ... ENDOF` pairs may be repeated as necessary. 105 | 106 | At run-time, `OF` checks `n1` and `n2` for equality. If equal, `n1` and `n2` 107 | are both dropped from the stack, and execution continues to the next `ENDOF`. 108 | If not equal, only `n2` is dropped, and execution jumps to whatever follows 109 | the next `ENDOF`. 110 |
111 | 112 | ## RomWBW extensions 113 | Support for RomWBW HBIOS features7 is included when fig-FORTH 114 | is built with the `-DROMWBW` flag: 115 | 116 | `.B`    ` n -- ` 117 |
    118 | Print a BCD value, converted to decimal. No following blank is printed. 119 |
120 | 121 | `AT`    ` col row --- ` 122 |
    123 | Position the text cursor at the given position. Both column and 124 | row positions are zero indexed, thus `0 0 AT` will move the cursor 125 | to the top left. Note that `AT` does *not* update `OUT`. 126 |
127 | 128 | `CLS`    ` --- ` 129 |
    130 | Clear VDU screen. 131 |
132 | 133 | `KEY?`    ` --- c t ¦ f ` 134 |
    135 | Check if a key has been pressed. Returns false if no key has been 136 | pressed. Returns true and the key's ascii code if a key has been 137 | pressed. 138 |
139 | 140 | `STIME`    ` addr --- ` 141 |
    142 | Set the RTC time. addr is the address of the 6 byte date/time buffer, 143 | YMDHMS. Each byte is BCD encoded. 144 |
145 | 146 | `TIME`    ` --- addr ` 147 |
    148 | Get the RTC time and leave the address of the 6 byte date/time buffer, 149 | YMDHMS. Each byte is BCD encoded. 150 |
151 | 152 | ## fig-FORTH Editor 153 | The fig-FORTH EDITOR8 is included in the `SCREENS.FTH` file: 154 | ``` 155 | FILE SCREENS ↵ ok 156 | 7 12 INDEX ↵ 157 | 158 | 7 ( fig-FORTH EDITOR V2.0 SCR 1 of 6) 159 | 8 ( fig-FORTH EDITOR V2.0 SCR 2 of 6) 160 | 9 ( fig-FORTH EDITOR V2.0 SCR 3 of 6) 161 | 10 ( fig-FORTH EDITOR V2.0 SCR 4 of 6) 162 | 11 ( fig-FORTH EDITOR V2.0 SCR 5 of 6) 163 | 12 ( fig-FORTH EDITOR V2.0 SCR 6 of 6)ok 164 | 7 LOAD ↵ 2DROP MSG # 4 R MSG # 4 I MSG # 4 ok 165 | EDITOR ↵ ok 166 | 1 CLEAR ↵ ok 167 | 0 P ( EAT MORE PIES! ) ↵ ok 168 | 1 LIST ↵ 169 | SCR # 1 170 | 0 ( EAT MORE PIES! ) 171 | 1 172 | 2 173 | 3 174 | ... 175 | 14 176 | 15 177 | ok 178 | FLUSH ↵ ok 179 | ``` 180 | 181 | ## fig-FORTH 8080/Z80 Assembler 182 | The fig-FORTH assembler enables the creation of both full and defining 183 | words using assembly language. 184 | 185 | The assembler is invoked using `CODE`, which creates a dictionary entry 186 | with given name and then assembles the mnemonics following. The mnemonics 187 | are based on the 8080 instruction set with Z80 specific extensions. 188 | The assembly code must end with `PCIX` to ensure control is returned to Forth. 189 | 190 | Note that Forth postfix notation applies between opcodes and operands. 191 | 192 | ``` 193 | CODE FOO ( n1 n2 -- n3 as sum of n1 + n2 ) 194 | H POP ( get first number from stack ) 195 | D POP ( get second number from stack ) 196 | D DAD ( add hl and de, result in hl ) 197 | H PUSH ( push result to top of stack ) 198 | PCIX ( jump to NEXT ) 199 | C; ( end of definition, return to FORTH ) 200 | ``` 201 | 202 | The following rules apply when creating words using the assembler: 203 | 204 | 1. The `BC` register pair must be preserved across words. 205 | 1. Avoid use of the Z80 alternative register set. 206 | 1. Do NOT use the `IY` or `IX` registers, which are used by fig-FORTH to 207 | keep track of the inner interpreter routine. 208 | 1. Definitions must end with `PCIX` (cf. `JNEXT` in `figforth.asm`) or 209 | `PCIY` (cf. `JHPUSH`). 210 | 211 | Additionally, the assembler performs minimal checks which means that it is 212 | easy to create illegal instructions, resulting in systems hangs or crashes. 213 | 214 | ## References 215 | 1. C. H. Ting, _Systems Guide to figForth_, 3rd Edn (San Mateo, CA: Offete Enterprises, 2013), p. vi 216 | 2. William Ragsdale, _'fig-FORTH INSTALLATION MANUAL'_ (San Carlos, CA: FORTH INTEREST GROUP, 1980) 217 | 3. Thomas Anderson, _The Telemark Assembler (TASM) User's Manual (1998)_, Vintagecomputer [Accessed 14 December 2020] 218 | 4. Jorge Giner, _uz80as - Micro Z80 Assembler_, Github [Accessed 19 January 2021] 219 | 5. John James, _‘What Is Forth? A Tutorial Introduction’_, in BYTE, 5.8 (1980), 100–26 220 | 6. Charles Eaker, _'JUST IN CASE'_ in FORTH DIMENSIONS, II/3 (1980), 37-40 221 | 7. Wayne Warthen, _RomWBW Architecture_, (RetroBrew Computers Group, 2020) 222 | 8. Bill Stoddart, _'EDITOR USER MANUAL'_, (London, UK: FIG United Kingdom, ND) 223 | -------------------------------------------------------------------------------- /discio.asm: -------------------------------------------------------------------------------- 1 | ; CP/M DISC INTERFACE 2 | ; 3 | ; Last update: 4 | ; 5 | ; 201212 - added FILE 6 | ; 881228 - EXTEND's R/W address now initialized with blanks 7 | ; 860120 - EXTEND's R/W address now HERE, was Osborne video ram 8 | ; 850511 - saved BC' in 'BDOS' 9 | ; 850227 - saved index regs. in 'BDOS' 10 | ; 840812 - added EXTEND 11 | ; 840731 - installed BDOS calls 12 | ; 13 | ; 14 | ; CP/M BDOS CALLS USED (as per Albert van der Horst, HCCH) 15 | ; 16 | ; R/W reads or writes a sector in the file specified when invoking 17 | ; Z80 fig-FORTH (A>Z80FORTH d:filename.ext), using the default FCB. 18 | ; More than one disc may be accessed by temporary use of a user de- 19 | ; fined FCB. 20 | ; 21 | ; 22 | ; 23 | DEFFCB .EQU 005CH ;default FCB 24 | ; 25 | ; CP/M FUNCTIONS 26 | ; 27 | OPNFIL .EQU 0FH ;open file 28 | CLSFIL .EQU 10H ;close file 29 | SETDMA .EQU 1AH ;set DMA address 30 | WRTRND .EQU 22H ;write random 31 | ; 32 | MAXLEN .EQU 08H ;max filename length 33 | FTLEN .EQU 03H ;filetype length 34 | ; 35 | ; FORTH variables & constants used in disc interface 36 | ; 37 | .BYTE 83H ;FCB (current FCB address) 38 | .TEXT "FC" 39 | .BYTE 'B'+$80 40 | .WORD PTSTO-5 41 | FCB: .WORD DOCON,DEFFCB 42 | ; 43 | .BYTE 84H ;REC# (returns address of random rec.#) 44 | .TEXT "REC" 45 | .BYTE '#'+$80 46 | .WORD FCB-6 47 | RECADR: .WORD DOCOL,FCB 48 | .WORD LIT,21H 49 | .WORD PLUS 50 | .WORD SEMIS 51 | ; 52 | .BYTE 83H ;USE 53 | .TEXT "US" 54 | .BYTE 'E'+$80 55 | .WORD RECADR-7 56 | USE: .WORD DOVAR,0 ;/ initialised by CLD 57 | ; 58 | .BYTE 84H ;PREV 59 | .TEXT "PRE" 60 | .BYTE 'V'+$80 61 | .WORD USE-6 62 | PREV: .WORD DOVAR,0 ;/ initialised by CLD 63 | ; 64 | .BYTE 85H ;#BUFF 65 | .TEXT "#BUF" 66 | .BYTE 'F'+$80 67 | .WORD PREV-07H 68 | NOBUF: .WORD DOCON,NBUF 69 | ; 70 | .BYTE 8AH ;DISK-ERROR 71 | .TEXT "DISK-ERRO" 72 | .BYTE 'R'+$80 73 | .WORD NOBUF-08H 74 | DSKERR: .WORD DOVAR,0 75 | ; 76 | ; DISC INTERFACE HIGH LEVEL ROUTINES 77 | ; 78 | .BYTE 84H ;+BUF 79 | .TEXT "+BU" 80 | .BYTE 'F'+$80 81 | .WORD DSKERR-0DH 82 | PBUF: .WORD DOCOL 83 | .WORD LIT,CO 84 | .WORD PLUS,DUP 85 | .WORD LIMIT,EQUAL 86 | .WORD ZBRAN 87 | .WORD PBUF1-$ 88 | .WORD DROP,FIRST 89 | PBUF1: .WORD DUP,PREV 90 | .WORD AT,SUBB 91 | .WORD SEMIS 92 | ; 93 | .BYTE 86H ;UPDATE 94 | .TEXT "UPDAT" 95 | .BYTE 'E'+$80 96 | .WORD PBUF-07H 97 | UPDAT: .WORD DOCOL,PREV 98 | .WORD AT,AT 99 | .WORD LIT,8000H 100 | .WORD ORR 101 | .WORD PREV,AT 102 | .WORD STORE,SEMIS 103 | ; 104 | .BYTE 8DH ;EMPTY-BUFFERS 105 | .TEXT "EMPTY-BUFFER" 106 | .BYTE 'S'+$80 107 | .WORD UPDAT-9 108 | MTBUF: .WORD DOCOL,FIRST 109 | .WORD LIMIT,OVER 110 | .WORD SUBB,ERASEE 111 | .WORD SEMIS 112 | ; 113 | .BYTE 83H ;DR0 114 | .TEXT "DR" 115 | .BYTE '0'+$80 116 | .WORD MTBUF-10H 117 | DRZER: .WORD DOCOL 118 | .WORD ZERO 119 | .WORD OFSET,STORE 120 | .WORD SEMIS 121 | ; 122 | .BYTE 83H ;DR1 123 | .TEXT "DR" 124 | .BYTE '1'+$80 125 | .WORD DRZER-6 126 | DRONE: .WORD DOCOL 127 | .WORD LIT,1600 ;Osborne DD 128 | DRON2: .WORD OFSET,STORE 129 | .WORD SEMIS 130 | ; 131 | .BYTE 86H ;BUFFER 132 | .TEXT "BUFFE" 133 | .BYTE 'R'+$80 134 | .WORD DRONE-6 135 | BUFFE: .WORD DOCOL,USE 136 | .WORD AT,DUP 137 | .WORD TOR 138 | BUFF1: .WORD PBUF ; won't work if single buffer 139 | .WORD ZBRAN 140 | .WORD BUFF1-$ 141 | .WORD USE,STORE 142 | .WORD RR,AT 143 | .WORD ZLESS 144 | .WORD ZBRAN 145 | .WORD BUFF2-$ 146 | .WORD RR,TWOP 147 | .WORD RR,AT 148 | .WORD LIT,7FFFH 149 | .WORD ANDD,ZERO 150 | .WORD RSLW 151 | BUFF2: .WORD RR,STORE 152 | .WORD RR,PREV 153 | .WORD STORE,FROMR 154 | .WORD TWOP,SEMIS 155 | ; 156 | .BYTE 85H ;BLOCK 157 | .TEXT "BLOC" 158 | .BYTE 'K'+$80 159 | .WORD BUFFE-9 160 | BLOCK: .WORD DOCOL,OFSET 161 | .WORD AT,PLUS 162 | .WORD TOR,PREV 163 | .WORD AT,DUP 164 | .WORD AT,RR 165 | .WORD SUBB 166 | .WORD DUP,PLUS 167 | .WORD ZBRAN 168 | .WORD BLOC1-$ 169 | BLOC2: .WORD PBUF,ZEQU 170 | .WORD ZBRAN 171 | .WORD BLOC3-$ 172 | .WORD DROP,RR 173 | .WORD BUFFE,DUP 174 | .WORD RR,ONE 175 | .WORD RSLW 176 | .WORD TWOMIN ;/ 177 | BLOC3: .WORD DUP,AT 178 | .WORD RR,SUBB 179 | .WORD DUP,PLUS 180 | .WORD ZEQU 181 | .WORD ZBRAN 182 | .WORD BLOC2-$ 183 | .WORD DUP,PREV 184 | .WORD STORE 185 | BLOC1: .WORD FROMR,DROP 186 | .WORD TWOP,SEMIS 187 | ; 188 | .BYTE 84H ;BDOS (CP/M function call) 189 | .TEXT "BDO" 190 | .BYTE 'S'+$80 191 | .WORD BLOCK-8 192 | BDOS: .WORD $+2 193 | EXX ;SAVE IP 194 | POP BC ;(C) <-- (S1)LB = CP/M function code 195 | POP DE ;(DE) <-- (S2) = parameter 196 | push ix ;/ 197 | push iy ;/ 198 | exx 199 | push bc ;/ save ip 200 | exx 201 | CALL BDOSS ;return value in A 202 | exx 203 | pop bc ;restore ip 204 | exx 205 | pop iy ;/ 206 | pop ix ;/ 207 | EXX ;restore IP 208 | LD L,A 209 | LD H,00H 210 | JHPUSH ;(S1) <-- (HL) = returned value 211 | ; 212 | .BYTE 83H ;R/W 213 | .TEXT "R/" 214 | .BYTE 'W'+$80 215 | .WORD BDOS-07H 216 | RSLW: .WORD DOCOL 217 | .WORD TOR ;store R/W flag 218 | .WORD RECADR,STORE 219 | .WORD ZERO,RECADR ;set record # 220 | .WORD TWOP,CSTOR 221 | .WORD LIT,SETDMA 222 | .WORD BDOS,DROP ;set DMA address 223 | .WORD LIT,WRTRND 224 | .WORD FROMR,SUBB ;select READ or WRITE 225 | .WORD FCB,SWAP 226 | .WORD BDOS ;do it 227 | .WORD DSKERR,STORE ;store return code 228 | .WORD SEMIS 229 | ; 230 | .BYTE 85H ;FLUSH 231 | .TEXT "FLUS" 232 | .BYTE 'H'+$80 233 | .WORD RSLW-6 234 | FLUSH: .WORD DOCOL 235 | .WORD NOBUF,ONEP 236 | .WORD ZERO,XDO 237 | FLUS1: .WORD ZERO,BUFFE 238 | .WORD DROP 239 | .WORD XLOOP 240 | .WORD FLUS1-$ 241 | .WORD SEMIS 242 | ; 243 | .BYTE 86h ;/ EXTEND 244 | .TEXT "EXTEN" 245 | .BYTE 'D'+$80 246 | .WORD FLUSH-08h 247 | EXTEND: 248 | .WORD DOCOL 249 | .WORD HERE ;/ fill with b/buf blanks 250 | .WORD BBUF 251 | .WORD BLANK 252 | .WORD LIT 253 | .WORD 0008h 254 | .WORD STAR 255 | .WORD ZERO 256 | EXTND1: 257 | .WORD ONEP ; begin 258 | .WORD HERE ;/ was lit,f000h (Osborne video ram) 259 | .WORD OVER 260 | .WORD ONE 261 | .WORD RSLW 262 | .WORD DSKERR 263 | .WORD AT 264 | .WORD ZBRAN 265 | .WORD EXTND1-$ ; until 266 | .WORD SWAP 267 | .WORD OVER 268 | .WORD PLUS 269 | .WORD SWAP 270 | .WORD XDO ; do 271 | EXTND2: 272 | .WORD HERE ;/ was lit,f000h (Osborne video ram) 273 | .WORD IDO 274 | .WORD ZERO 275 | .WORD RSLW 276 | .WORD XLOOP 277 | .WORD EXTND2-$ ; loop 278 | .WORD FCB 279 | .WORD LIT 280 | .WORD CLSFIL 281 | .WORD BDOS ; close file 282 | .WORD DROP ; discard return code 283 | .WORD FOPEN 284 | .WORD DROP 285 | .WORD SEMIS 286 | ; 287 | .WORD 85H 288 | .TEXT "FOPE" ; FOPEN ( --- f ) 289 | .BYTE 'N'+$80 ; Opens a file that currently exists in the 290 | .WORD EXTEND-9 ; disk directory for the currently active 291 | FOPEN .WORD DOCOL ; user number. A true flag indicates failure. 292 | .WORD FCB 293 | .WORD LIT,OPNFIL ; open file 294 | .WORD BDOS 295 | .WORD LIT,0FFH ; check for error 296 | .WORD EQUAL 297 | .WORD DUP 298 | .WORD ZEQU 299 | .WORD WARN,STORE ; set WARNING variable 300 | .WORD SEMIS 301 | ; 302 | .BYTE 85H 303 | .TEXT "FTYP" ; FTYPE ( --- addr ) 304 | .BYTE 'E'+$80 ; Returns address of file type used 305 | .WORD FOPEN-8 ; with FILE. 306 | FTYPE .WORD DOCON,DEFFT 307 | DEFFT .TEXT "FTH" ; default file type 308 | ; 309 | .BYTE 84H ; FILE used in the form 310 | .TEXT "FIL" ; FILE cccc 311 | .BYTE 'E'+$80 ; Closes the current file and attempts 312 | .WORD FTYPE-08H ; to open the file with the given name. 313 | FILE: .WORD DOCOL ; The file type is determined by FTYPE. 314 | .WORD FCB 315 | .WORD LIT,CLSFIL ; close existing file 316 | .WORD BDOS 317 | .WORD DROP 318 | .WORD MTBUF ; clear buffer 319 | .WORD FCB ; clear FCB 320 | .WORD LIT,10H 321 | .WORD ZERO 322 | .WORD FILL 323 | .WORD BL,WORD ; get filename 324 | .WORD HERE 325 | .WORD COUNT 326 | .WORD LIT,MAXLEN 327 | .WORD MIN ; truncate filename if required 328 | .WORD FCB 329 | .WORD ONEP 330 | .WORD DUP 331 | .WORD LIT,MAXLEN 332 | .WORD BLANK ; blank filename in fcb 333 | .WORD FTYPE 334 | .WORD OVER 335 | .WORD LIT,MAXLEN 336 | .WORD PLUS 337 | .WORD LIT,FTLEN 338 | .WORD CMOVE ; set file type 339 | .WORD SWAP 340 | .WORD CMOVE 341 | .WORD FOPEN 342 | .WORD LIT,8 343 | .WORD QERR 344 | .WORD SEMIS 345 | ; 346 | .BYTE 84H ;LOAD 347 | .TEXT "LOA" 348 | .BYTE 'D'+$80 349 | .WORD FILE-07H 350 | LOAD: .WORD DOCOL,BLK 351 | .WORD AT,TOR 352 | .WORD INN,AT 353 | .WORD TOR,ZERO 354 | .WORD INN,STORE 355 | .WORD BSCR,STAR 356 | .WORD BLK,STORE ;BLK <-- SCR * B/SCR 357 | .WORD INTER ;INTERPRET FROM OTHER SCREEN 358 | .WORD FROMR,INN 359 | .WORD STORE 360 | .WORD FROMR,BLK 361 | .WORD STORE,SEMIS 362 | ; 363 | .BYTE 0C3H ;--> 364 | .TEXT "--" 365 | .BYTE '>'+$80 366 | .WORD LOAD-7 367 | ARROW: .WORD DOCOL,QLOAD 368 | .WORD ZERO 369 | .WORD INN,STORE 370 | .WORD BSCR,BLK 371 | .WORD AT,OVER 372 | .WORD MODD,SUBB 373 | .WORD BLK,PSTOR 374 | .WORD SEMIS 375 | ; 376 | ; 377 | ; 378 | -------------------------------------------------------------------------------- /docs/editor.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage[letterpaper, total={7.5in, 9in}]{geometry} 3 | \usepackage{multicol} 4 | \usepackage{enumitem} 5 | \title{EDITOR USER MANUAL} 6 | \author{Bill Stoddart\\of FIG, United Kingdom} % Formatted in LaTEX by DT 20230828 7 | \date{} % Nov 1984? 8 | \newcommand{\n}{\textit{n}} 9 | \setlist[description]{% 10 | align=left, 11 | leftmargin=2.5em, 12 | labelwidth=2em, 13 | font={\bfseries\ttfamily}, 14 | } 15 | \begin{document} 16 | \maketitle 17 | %\tableofcontents 18 | \begin{multicols*}{2}[] 19 | \setlength{\parskip}{.5em} 20 | \setlength\parindent{0pt} 21 | \section{Introduction} 22 | FORTH organizes its mass storage into ``screens'' of 1024 characters. 23 | If, for example, a diskette of 250k byte capacity is used entirely 24 | for storing text, it will appear to the user as 250 screens 25 | numbered 0 to 249. 26 | 27 | Each screen is organized as 16 lines with 64 characters per line. 28 | The FORTH screens are merely an arrangement of virtual memory and 29 | need not correspond exactly with the screen format of a particular 30 | terminal. 31 | 32 | \section{Selecting a Screen and Input of Text} 33 | 34 | To start an editing session the user types \verb|EDITOR| to invoke the 35 | appropriate vocabulary. 36 | 37 | The screen to be edited is then selected, using either: 38 | \begin{description} 39 | \item[n LIST] 40 | list screen \n{} and select it for editing, \textit{or} 41 | \item[n CLEAR] 42 | clear screen \n{} and select for editing. 43 | \end{description} 44 | 45 | To input new text to screen \n{} after \verb|LIST| or \verb|CLEAR| 46 | the \verb|P| (put) command is used. 47 | 48 | Example: 49 | \begin{verbatim} 50 | O P THIS IS HOW 51 | 1 P TO INPUT TEXT 52 | 2 P TO LINES O, 1, AND 2 OF THE SELECTED SCREEN. 53 | \end{verbatim} 54 | 55 | \section{Line Editing} 56 | 57 | During this description of the editor, reference is made to \verb|PAD|. 58 | This is a text buffer which may hold a line of text used by or 59 | saved with a line editing command, or a text string to be found or 60 | deleted by a string editing command. 61 | 62 | \verb|PAD| can be used to transfer a line from one screen to another, 63 | as well as to perform edit operations within a single screen. 64 | 65 | \subsection{Line Editor Commands} 66 | \begin{description} 67 | \item[n H] 68 | Hold line \n{} at \verb|PAD| 69 | (used by system more often than by user). 70 | \item[n D] 71 | Delete line \n{} but hold it in \verb|PAD|. 72 | Line 15 becomes blank as lines \n{}+1 to 15 move up 1 line. 73 | \item[n T] 74 | Type line \n{} and save it in \verb|PAD|. 75 | \item[n R] 76 | Replace line \n{} with the text in \verb|PAD|. 77 | \item[n I] 78 | Insert the text from \verb|PAD| at line \n{}, 79 | moving the old line \n{} and following lines down. 80 | Line 15 is lost. 81 | \item[n E] 82 | Erase line \n{} with blanks. 83 | \item[n S] 84 | Spread at line \n{}. \n{} and subsequent lines 85 | move down 1 line. Line \n{} becomes blank. 86 | Line 15 is lost. 87 | \end{description} 88 | 89 | \section{Cursor Control and String Editing} 90 | 91 | The screen of text being edited resides in a buffer area of 92 | storage. The editing cursor is a variable holding an offset into 93 | this buffer area. Commands are provided for the user to position 94 | the cursor, either directly or by searching for a string of buffer 95 | text, and to insert or delete text at the cursor position. 96 | 97 | \subsection{Commands to Position the Cursor} 98 | \begin{description} 99 | \item[TOP] 100 | Position the cursor at the start of the screen. 101 | \item[n M] 102 | Move the cursor by a signed amount \n{} and 103 | print the cursor line. The position of the cursor on 104 | its line is shown by a \verb|_| (underline). 105 | \end{description} 106 | 107 | \subsection{String Editing Commands} 108 | \begin{description} 109 | \item[F text] 110 | Search forward from the current cursor position 111 | until string `\textit{text}' is found. The cursor is left at 112 | the end of the text string, and the cursor line is printed. 113 | If the string is not found an error message is given 114 | and the cursor is repositioned at the top of screen. 115 | \item[B] 116 | Used after \verb|F| to back up the cursor by the length 117 | of the most recent text. 118 | \item[N] 119 | Find the next occurrence of the string found by an 120 | \verb|F| command. 121 | \item[X text] 122 | Find and delete the string `\textit{text}'. 123 | \item[C text] 124 | Copy in text to the cursor line at the cursor position 125 | \item[TILL text] 126 | Delete on the cursor line from the cursor till the 127 | end of the text string `\textit{text}'. 128 | \end{description} 129 | \textbf{NOTE:} Typing \verb|C| with no text will copy a \verb|NULL| character 130 | into the text at the cursor position. This will abruptly stop subsequent 131 | compilation! To delete this error type \verb|TOP X| `return'. 132 | 133 | \subsection{Screen Editing Commands} 134 | \begin{description} 135 | \item[n LIST] 136 | List screen \n{} and select it for editing 137 | \item[n CLEAR] 138 | Clear screen \n{} with blanks and select it for editing 139 | \item[n1 n2 COPY] 140 | Copy screen \textit{n1} to screen \textit{n2}. 141 | \item[L] 142 | List the current screen. The cursor line is relisted 143 | after the screen listing, to show the cursor position. 144 | \item[FLUSH] 145 | Used at the end of an editing session to ensure that 146 | all entries and updates of text have been transferred 147 | to disk. 148 | \end{description} 149 | 150 | \section{Editor Glossary} 151 | \begin{description} 152 | \item[TEXT]\texttt{c ---}\\ 153 | Accept following text to pad. \textit{c} is text delimiter. 154 | \item[LINE]\texttt{n --- addr}\\ 155 | Leave address of line \n{} of current screen. This address will 156 | be in the disc buffer area. 157 | \item[WHERE]\texttt{n1 n2 ---}\\ 158 | \textit{n2} is the block no., \textit{n1} is offset into block. 159 | If an error is found in the source when loading from disc, the 160 | recovery routine \verb|ERROR| leaves these values on the stack 161 | to help the user locate the error. \verb|WHERE| uses these to 162 | print the screen and line nos. and a picture of where the error 163 | occurred. 164 | \item[R\#]\texttt{--- addr}\\ 165 | A user variable which contains the offset of the editing cursor 166 | from the start of the screen. 167 | \item[\#LOCATE]\texttt{--- n1 n2}\\ 168 | From the cursor position determine the line-no \textit{n2} and 169 | the offset into the line \textit{n1}. 170 | \item[\#LEAD]\texttt{--- line-address offset-to-cursor} 171 | \item[\#LAG]\texttt{--- cursor-address}\\\texttt{count-after-cursor-till-EOL} 172 | \item[-MOVE]\texttt{addr line-no ---}\\ 173 | Move a line of text from \textit{addr} to \textit{line-no} of 174 | current screen. 175 | \item[H]\texttt{n ---}\\ 176 | Hold numbered line at \verb|PAD|. 177 | \item[E]\texttt{n ---}\\ 178 | Erase line \n{} with blanks. 179 | \item[S]\texttt{n ---}\\ 180 | Spread. Lines \n{} and following move down. \n{} becomes blank. 181 | \item[D]\texttt{n ---}\\ 182 | Delete line \n{}, but hold in \verb|PAD|. 183 | \item[M]\texttt{n ---}\\ 184 | Move cursor by a signed amount and print its line. 185 | \item[T]\texttt{n ---}\\ 186 | Type line \n{} and save in \verb|PAD|. 187 | \item[L]\texttt{---}\\ 188 | List the current screen. 189 | \item[R]\texttt{n ---}\\ 190 | Replace line \n{} with the text in \verb|PAD|. 191 | \item[P]\texttt{n ---}\\ 192 | Put the following text on line \n{}. 193 | \item[I]\texttt{n ---}\\ 194 | Spread at line \n{} and insert text from \verb|PAD|. 195 | \item[TOP]\texttt{---}\\ 196 | Position editing cursor at top of screen. 197 | \item[CLEAR]\texttt{n ---}\\ 198 | Clear screen \n{}, can be used to select screen \n{} 199 | for editing. 200 | \item[FLUSH]\texttt{---}\\ 201 | Write all updated buffers to disk. This has been modified to 202 | cope with an error in the Micropolis CP/M disk drivers. 203 | \item[COPY]\texttt{n1 n2 ---}\\ 204 | Copy screen \textit{n1} to screen \textit{n2}. 205 | \item[-TEXT]\texttt{addr1 count addr2 -- boolean}\\ 206 | True if strings exactly match. 207 | \item[MATCH]\texttt{cursor-addr bytes-left-till-EOL str-addr str-count 208 | \\--- tf cursor-advance-till-end-of-matching-text 209 | \\--- ff bytes-left-till-EOL}\\ 210 | Match the string at \textit{str-addr} with all strings on the 211 | cursor line forward from the cursor. The arguments left allow 212 | the cursor \verb|R\#| to be updated either to the end of the 213 | matching text or to the start of the next line. 214 | \item[1LINE]\texttt{--- f}\\ 215 | Scan the cursor line for a match to \verb|PAD| text. Return 216 | flag and update the cursor \verb|R\#| to the end of matching 217 | text, or to the start of the next line if no match is found. 218 | \item[FIND]\texttt{---}\\ 219 | Search for a match to the string at \verb|PAD|, from the 220 | cursor position till the end of screen. If no match found 221 | issue an error message and reposition the cursor at the top 222 | of screen. 223 | \item[DELETE]\texttt{n ---}\\ 224 | Delete \n{} characters prior to the cursor. 225 | \item[N]\texttt{---}\\ 226 | Find next occurrence of \verb|PAD| text. 227 | \item[F]\texttt{---}\\ 228 | Input following text to \verb|PAD| and search for match from 229 | cursor position till end of screen. 230 | \item[B]\texttt{---}\\ 231 | Backup cursor by text in \verb|PAD|. 232 | \item[X]\texttt{---}\\ 233 | Delete next occurrence of following text. 234 | \item[TILL]\texttt{---}\\ 235 | Delete on cursor line from cursor to end of the following text. 236 | \item[C]\texttt{---}\\ 237 | Spread at cursor and copy the following text into the cursor 238 | line. 239 | \end{description} 240 | 241 | \end{multicols*} 242 | \textbf{} 243 | \end{document} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /figforth.asm: -------------------------------------------------------------------------------- 1 | .TITLE Z80 fig-FORTH 1.3 2 | ; 3 | ; 4 | ; Modified frm FIG document keyed by Dennis L. Wilson 800907 5 | ; Converted frm "8080 FIG-FORTH VERSION A0 15SEP79" 6 | ; 7 | ; fig-FORTH release 1.1 for the 8080 processor. 8 | ; 9 | ; ALL PUBLICATIONS OF THE FORTH INTEREST GROUP 10 | ; ARE PUBLIC DOMAIN. THEY MAY BE FURTHER 11 | ; DISTRIBUTED BY THE INCLUSION OF THIS CREDIT NOTICE: 12 | ; 13 | ; This publication has been made available by the 14 | ; Forth Interest Group 15 | ; P.O.Box 1105 16 | ; San Carlos, CA 94070 17 | ; U.S.A. 18 | ; 19 | ; Implementation on 8080 by: 20 | ; John Cassady 21 | ; 339 15th Street 22 | ; Oakland, CA 94612 23 | ; U.S.A 24 | ; on 790528 25 | ; Modified by: 26 | ; Kim Harris 27 | ; Acknowledgements: 28 | ; George Flammer 29 | ; Robt. D. Villwock 30 | ; ---------------------------------------------------------------------- 31 | ; Z80 Version for Cromemco CDOS & Digital Research CP/M by: 32 | ; Dennis Lee Wilson c/o 33 | ; Aristotelian Logicians 34 | ; 2631 East Pinchot Avenue 35 | ; Phoenix, AZ 85016 36 | ; U.S.A. 37 | ; ---------------------------------------------------------------------- 38 | ; The 2 byte Z80 code for Jump Relative (JR) has been substituted for 39 | ; the 3 byte Jump (JP) wherever practical. The port I/O words P@ & P! 40 | ; have been made ROMable by use of Z80 instructions. 41 | ; ---------------------------------------------------------------------- 42 | ; Further modifications (marked ;/) by: 43 | ; Edmund Ramm 44 | ; Anderheitsallee 24 45 | ; 2000 Hamburg 71 46 | ; Fed. Rep. of Germany 840418 47 | ; ---------------------------------------------------------------------- 48 | ; Disc I/O has been modified a la Albert van der Horst (HCCH) to employ 49 | ; CP/M 2.x's random access feature. 50 | ; ---------------------------------------------------------------------- 51 | ; Adaptive version by EHR 52 | ; ---------------------------------------------------------------------- 53 | ; Upgraded to v1.3 by Dimitri Theulings - 11/2020 - changes marked 1.3 54 | ; Changes are based on '8080 FIG-FORTH 1.3 VERSION 0 18JUL81' 55 | ; ---------------------------------------------------------------------- 56 | ; Added CASE statement as proposed by Charles Eaker, FD II/3, 37-40 - DT 57 | ; ---------------------------------------------------------------------- 58 | ; 59 | ; Release & Version numbers 60 | ; 61 | FIGREL .EQU 1 ;FIG RELEASE # 62 | FIGREV .EQU 3 ;FIG REVISION # 63 | USRVER .EQU 63H ;USER VERSION # DT - 2021/01/17 64 | ; 65 | ;Console & printer drivers are in external source named 66 | ;CONPRTIO.FTH & disc drivers in DISCIO.FTH. It has 4 screen 67 | ;buffers & end of memory is set to FBASE from locn. 0007H. 68 | .EJECT 69 | ; ASCII characters used 70 | ; 71 | ABL .EQU 20H ;BLANK 72 | ACR .EQU 0DH ;CR 73 | ADOT .EQU 2EH ;. 74 | BELL .EQU 07H ;^G 75 | BSIN .EQU 08H ;backspace chr = ^H 76 | BSOUT .EQU 08H 77 | HT .EQU 09H ;^T 78 | DLE .EQU 10H ;^P 79 | LF .EQU 0AH ;^J 80 | FF .EQU 0CH ;^L 81 | ; 82 | ; Memory allocation 83 | ; 84 | BDOSS .EQU 0005H ;/ system entry 85 | NSCR .EQU 4 ; # of 1024 byte screens 86 | KBBUF .EQU 128 ; bytes/disc buffer 87 | US .EQU 40H ; user variables space 88 | RTS .EQU 400H ; Return Stack & term buff space 89 | CO .EQU KBBUF+4 ; Disc buff + 2 header + 2 tail 90 | NBUF .EQU NSCR*400H/KBBUF ; # of buffers 91 | BUFSIZ .EQU CO*NBUF ;/ total disc buffer size 92 | .EJECT 93 | ;ABS 94 | ; 95 | .ORG 0100H 96 | ORIG: NOP 97 | JP CLD ;VECTOR TO COLD START 98 | NOP 99 | JP WRM ;VECTOR TO WARM START 100 | .BYTE FIGREL ;FIG RELEASE # 101 | .BYTE FIGREV ;FIG REVISION # 102 | .BYTE USRVER ;USER VERSION # 103 | .BYTE 0EH ;IMPLEMENTATION ATTRIBUTES 104 | ; 105 | ; 106 | ; 107 | ; 0EH = 0000:1110 108 | ; --------- 109 | ; B +ORIGIN ...W:IEBA 110 | ; 111 | ; W: 0=above sufficient 112 | ; 1=other differences exist 113 | ; I: Interpreter is 0=pre- 114 | ; 1=post incrementing 115 | ; E: Addr must be even: 0 yes 116 | ; 1 no 117 | ; B: High byte @ 0=low addr. 118 | ; 1=high addr. 119 | ; A: CPU Addr. 0=BYTE 120 | ; 1=WORD 121 | ; 122 | ; 123 | ; 124 | .WORD TASK-7 ; TOPMOST WORD IN FORTH VOCABULARY 125 | .WORD BSIN ; BACKSPACE CHR 126 | UPINIT: .WORD 0 ;/ INIT (UP) 127 | ; 128 | ; * FOLLOWING USED BY COLD; MUST BE IN SAME ORDER AS USER VARIABLES * 129 | ; 130 | S0INIT: .WORD 0 ;/ INIT (S0) 131 | R0INIT: .WORD 0 ;/ INIT (R0) 132 | TIBINI: .WORD 0 ;/ INIT (TIB) 133 | .WORD 1FH ; INIT (WIDTH) 134 | .WORD 0 ; INIT (WARNING) 135 | .WORD INITDP ; INIT (FENCE) 136 | .WORD INITDP ; INIT (DP) 137 | .WORD FORTH+8 ; INIT (VOC-LINK) 138 | ; 139 | ; * END DATA USED BY COLD * 140 | ; 141 | .WORD 0H,0B250H ;Z80 CPU NAME (HW,LW) 142 | ;(32 BIT BASE 36 INTEGER) 143 | #IFDEF ROMWBW 144 | .WORD 0 ;VIDEO DEVICE ID 145 | .WORD 0,0,0 ;RTC DATE/TIME 146 | #ENDIF 147 | .EJECT 148 | ; REGISTERS 149 | ; 150 | ; FORTH Z80 FORTH PRESERVATION RULES 151 | ; ----- --- ----------------------- 152 | ; IP BC should be preserved 153 | ; accross FORTH words. 154 | ; W DE sometimes output from 155 | ; NEXT, may be altered 156 | ; b4 JP'ing to NEXT, 157 | ; input only when 158 | ; "DPUSH" called. 159 | ; SP SP should be used only as 160 | ; Data Stack accross 161 | ; FORTH words, may be 162 | ; used within FORTH 163 | ; words if restored 164 | ; b4 "NEXT" 165 | ; HL Never output frm NEXT 166 | ; input only when 167 | ; "HPUSH" called 168 | ; 169 | ; 170 | UP: .WORD 0 ;/ USER AREA PTR 171 | RPP: .WORD 0 ;/ RETURN STACK PTR 172 | BUF1: .WORD 0 ;/ address of 1st disc buffer 173 | ; 174 | ; 175 | ; COMMENT CONVENTIONS: 176 | ; 177 | ; = MEANS "IS EQUAL TO" 178 | ; <-- MEANS ASSIGNMENT 179 | ; NAME = ADDR OF NAME 180 | ; (NAME) = CONTENTS @ NAME 181 | ; ((NAME))= INDIRECT CONTENTS 182 | ; CFA = CODE FIELD ADDR 183 | ; LFA = LINK FIELD ADDR 184 | ; NFA = NAME FIELD ADDR 185 | ; PFA = PARAMETER FIELD ADDR 186 | ; S1 = ADDR OF 1st WORD OF PARAMETER STACK 187 | ; S2 = -"- OF 2nd -"- OF -"- -"- 188 | ; R1 = -"- OF 1st -"- OF RETURN STACK 189 | ; R2 = -"- OF 2nd -"- OF -"- -"- 190 | ; ( above Stack posn. valid b4 & after execution of any word, not during) 191 | ; 192 | ; LSB = LEAST SIGNIFICANT BIT 193 | ; MSB = MOST SIGNIFICANT BIT 194 | ; LB = LOW BYTE 195 | ; HB = HIGH BYTE 196 | ; LW = LOW WORD 197 | ; HW = HIGH WORD 198 | ; (May be used as suffix to above names) 199 | .EJECT 200 | ; FORTH ADDRESS INTERPRETER 201 | ; POST INCREMENTING VERSION 202 | ; 203 | DPUSH: PUSH DE 204 | HPUSH: PUSH HL ; IY points here 205 | NEXT: LD A,(BC) ;(W)<--((IP)) IX points here 206 | LD L,A 207 | INC BC ;INC IP 208 | LD A,(BC) 209 | LD H,A ;(HL)<--CFA 210 | INC BC ;INC IP 211 | NEXT1: LD E,(HL) ;(PC)<--((W)) 212 | INC HL 213 | LD D,(HL) 214 | EX DE,HL 215 | JP (HL) ;NOTE: (DE)=CFA+1 216 | ; 217 | ; 218 | #DEFINE JNEXT JP (IX) 219 | ; 220 | ; 221 | #DEFINE JHPUSH JP (IY) 222 | ; 223 | ; 224 | .EJECT 225 | ; FORTH DICTIONARY 226 | ; DICTIONARY FORMAT: 227 | ; 228 | ; BYTE 229 | ; ADDRESS NAME CONTENTS 230 | ; ------- ---- -------- 231 | ; (MSB=1 232 | ; (P=PRECEDENCE BIT 233 | ; (S=SMUDGE BIT 234 | ; NFA NAME FIELD 1PS MSB=0, NAME'S 1st CHAR 236 | ; 0<2CHAR> 237 | ; ... 238 | ; 1 MSB=1, NAME'S LAST CHAR 239 | ; LFA LINK FIELD =PREVIOUS WORD'S NFA 240 | ; 241 | ;LABEL: CFA CODE FIELD =ADDR CPU CODE 242 | ; 243 | ; PFA PARAMETER <1PARAM> 1st PARAMETER BYTE 244 | ; FIELD <2PARAM> 245 | ; ... 246 | ; 247 | ; 248 | ; 249 | DP0: .BYTE 83H ;LIT 250 | .TEXT "LI" 251 | .BYTE 'T'+$80 252 | .WORD 0 ;(LFA)=0 MARKS END OF DICTIONARY 253 | LIT: .WORD $+2 ;(S1)<--((IP)) 254 | LD A,(BC) ;(HL)<--((IP))=LITERAL 255 | INC BC ;(IP)<--(IP)+2 256 | LD L,A ;LB 257 | LD A,(BC) ;HB 258 | INC BC 259 | LD H,A 260 | JHPUSH ;(S1)<--(HL) 261 | ; 262 | .BYTE 87H ;EXECUTE 263 | .TEXT "EXECUT" 264 | .BYTE 'E'+$80 265 | .WORD LIT-6 266 | EXEC: .WORD $+2 267 | POP HL 268 | JP NEXT1 269 | ; 270 | .BYTE 86H ;BRANCH 271 | .TEXT "BRANC" 272 | .BYTE 'H'+$80 273 | .WORD EXEC-0AH 274 | BRAN: .WORD $+2 ;(IP)<--(IP)+((IP)) 275 | BRAN1: LD H,B ;(HL)<--(IP) 276 | LD L,C 277 | LD E,(HL) ;(DE)<--((IP))=BRANCH OFFSET 278 | INC HL 279 | LD D,(HL) 280 | DEC HL 281 | ADD HL,DE ;(HL)<--(HL)+((IP)) 282 | LD C,L ;(IP)<--(HL) 283 | LD B,H 284 | JNEXT 285 | ; 286 | .BYTE 87H ;0BRANCH 287 | .TEXT "0BRANC" 288 | .BYTE 'H'+$80 289 | .WORD BRAN-9 290 | ZBRAN: .WORD $+2 291 | POP HL 292 | LD A,L 293 | OR H 294 | JR Z,BRAN1 ;IF (S1)=0 THEN BRANCH 295 | INC BC ;ELSE SKIP BRANCH OFFSET 296 | INC BC 297 | JNEXT 298 | ; 299 | .BYTE 86H ;(LOOP) 300 | .TEXT "(LOOP" 301 | .BYTE ')'+$80 302 | .WORD ZBRAN-0AH 303 | XLOOP: .WORD $+2 304 | LD HL,(RPP) ; ((HL))=INDEX=(R1) 305 | inc (hl) ;/ index(lb) += 1 306 | LD E,(HL) ;/ 307 | INC HL ;/ (hl)-->index(hb) 308 | jr nz,xloop1 ;/ jump if ((hl)) < 256 309 | inc (hl) ;/ else index(hb) += 1 310 | xloop1: LD D,(HL) ;/ (DE)<-- new INDEX 311 | INC HL ;/ ((HL))=LIMIT 312 | LD A,E 313 | SUB (HL) 314 | LD A,D 315 | INC HL 316 | SBC A,(HL) ; INDEX0 344 | LD A,E 345 | SUB (HL) ;THEN (A)<--INDEX - LIMIT 346 | LD A,D 347 | INC HL 348 | SBC A,(HL) 349 | JP XLOO3 350 | XLOO2: LD A,(HL) ;ELSE (A)<--LIMIT - INDEX 351 | SUB E 352 | INC HL 353 | LD A,(HL) 354 | SBC A,D 355 | ; ;IF (A)<0 356 | XLOO3: JP M,BRAN1 ;THEN LOOP AGN 357 | INC HL ;ELSE DONE 358 | LD (RPP),HL ;DISCARD R1 & R2 359 | INC BC ;SKIP BRANCH OFFSET 360 | INC BC 361 | JNEXT 362 | ; 363 | .BYTE 84H ; (DO) 364 | .TEXT "(DO" 365 | .BYTE ')'+$80 366 | .WORD XPLOO-0AH 367 | XDO: .WORD $+2 368 | EXX ;/ SAVE IP 369 | POP DE ; (DE)<--INITIAL INDEX 370 | POP BC ;/ (BC)<--LIMIT 371 | LD HL,(RPP) ; (HL)<--(RP) 372 | DEC HL 373 | LD (HL),B 374 | DEC HL 375 | LD (HL),C ;/ (R2)<--LIMIT 376 | DEC HL 377 | LD (HL),D 378 | DEC HL 379 | LD (HL),E ; (R1)<--INITIAL INDEX 380 | LD (RPP),HL ; (RP)<--(RP)-4 381 | EXX ;/ RESTORE IP 382 | JNEXT 383 | ; 384 | .BYTE 81H ;I 385 | .BYTE 'I'+$80 386 | .WORD XDO-7 387 | IDO: .WORD $+2 ;(S1)<--(R1), (R1) UNCHANGED 388 | LD HL,(RPP) 389 | IDO1: LD E,(HL) ;(DE)<--(R1) 390 | INC HL 391 | LD D,(HL) 392 | PUSH DE ;(S1)<--(DE) 393 | JNEXT 394 | ; 395 | .BYTE 82H ; I' 1.3 396 | .BYTE 'I' 397 | .BYTE $27+$80 398 | .WORD IDO-4 399 | IPRIM .DW $+2 400 | LD HL,(RPP) 401 | INC HL 402 | INC HL ; ((HL)) = (R2) 403 | JR IDO1 404 | ; 405 | .BYTE 81H ; J 1.3 406 | .BYTE 'J'+$80 407 | .WORD IPRIM-5 408 | J .WORD $+2 409 | LD HL,(RPP) 410 | INC HL 411 | INC HL 412 | INC HL 413 | INC HL ; ((HL)) = (R3) 414 | JR IDO1 415 | ; 416 | .BYTE 85H ;DIGIT 417 | .TEXT "DIGI" 418 | .BYTE 'T'+$80 419 | .WORD J-4 420 | DIGIT: .WORD $+2 421 | POP HL ;(L)<--(S1)LB = BASE VALUE 422 | POP DE ;(E)<--(S2)LB = ASCII CHR TO BE CONVERTED 423 | LD A,E ;ACCU<--CHR 424 | SUB '0' ;>=0? 425 | JR C,DIGI2 ;/ <0 IS INVALID 426 | CP 0AH ;>9? 427 | JR C,DIGI1 ;/ NO, TEST BASE VALUE 428 | SUB 07H ;GAP BETWEEN "9" & "A", NW "A"=0AH 429 | CP 0AH ;>="A"? 430 | JR C,DIGI2 ;/ CHRs BETWEEN "9" & "A" ARE INVALID 431 | DIGI1: CP L ;CMOVE 1.3 583 | .TEXT ">CMOV" 584 | .BYTE 'E'+$80 585 | .WORD CMOVE-8 586 | GCMOV .WORD $+2 587 | EXX ; SAVE IP 588 | POP BC ; (BC)<--(S1)= #CHRs 589 | POP DE ; (DE)<--(S2)= DEST ADDR 590 | POP HL ; (HL)<--(S3)= SOURCE ADDR 591 | ADD HL,BC ; (HL) <- END SOURCE ADDR 592 | EX DE,HL 593 | ADD HL,BC ; (DE) <- END DEST ADDR 594 | EX DE,HL 595 | LD A,B 596 | OR C ; BC=0? 597 | JR Z,EXCMOV ; YES, DON'T MOVE ANYTHING 598 | LDDR ; REVERSE XFER STRING 599 | JR EXCMOV ; 600 | ; 601 | .BYTE 82H ;U* 16*16 unsigned multiply 602 | .BYTE 'U' ;994 T cycles average (8080) 603 | .BYTE '*'+$80 604 | .WORD GCMOV-9 605 | USTAR: .WORD $+2 606 | POP DE ;(DE)<--MPLIER 607 | POP HL ;(HL)<--MPCAND 608 | PUSH BC ;SAVE IP 609 | LD B,H 610 | LD A,L ;(BA)<--MPCAND 611 | CALL MPYX ;(AHL)1<--MPCAND.LB*MPLIER 612 | ; 1st PARTIAL PRODUCT 613 | PUSH HL ;SAVE (HL)1 614 | LD H,A 615 | LD A,B 616 | LD B,H ;SAVE (A)1 617 | CALL MPYX ;(AHL)2<--MPCAND.HB*MPLIER 618 | ; 2nd PARTIAL PRODUCT 619 | POP DE ;(DE)<--(HL)1 620 | LD C,D ;(BC)<--(AH)1 621 | ; FORM SUM OF PARTIALS: 622 | ; ; (AHL)1 623 | ; ;+(AHL)2 624 | ; ;------- 625 | ; ; (AHLE) 626 | ADD HL,BC ;(HL)<--(HL)2+(AH)1 627 | ADC A,00H ;(AHLE)<--(BA)*(DE) 628 | LD D,L 629 | LD L,H 630 | LD H,A ;(HLDE)<--MPLIER*MPCAND 631 | POP BC ;RESTORE IP 632 | PUSH DE ;(S2)<--PRODUCT.LW 633 | JHPUSH ;(S1)<--PRODUCT.HW 634 | ; 635 | ; MULTIPLY PRIMITIVE 636 | ; (AHL)<--(A)*(DE) 637 | ; #BITS: 24 8 16 638 | ; 639 | MPYX: LD HL,0 ;(HL)<--0=PARTIAL PRODUCT.LW 640 | LD C,08H ;LOOP COUNTER 641 | MPYX1: ADD HL,HL ;LEFT SHIFT (AHL) 24 BITS 642 | RLA 643 | JR NC,MPYX2 ;IF NEXT MPLIER BIT = 1 644 | ADD HL,DE ;THEN ADD MPCAND 645 | ADC A,0 646 | MPYX2: DEC C ;LAST MPLIER BIT? 647 | JR NZ,MPYX1 ;NO, LOOP AGN 648 | RET ;YES, DONE 649 | ; 650 | .BYTE 82H ;U/ 651 | .BYTE 'U' 652 | .BYTE '/'+$80 653 | .WORD USTAR-5 654 | USLAS: .WORD $+2 655 | LD HL,0004H 656 | ADD HL,SP ;((HL))<--NUMERATOR.LW 657 | LD E,(HL) ;(DE)<--NUMER.LW 658 | LD (HL),C ;SAVE IP ON STACK 659 | INC HL 660 | LD D,(HL) 661 | LD (HL),B 662 | POP BC ;(BC)<--DENOMINATOR 663 | POP HL ;(HL)<--NUMER.HW 664 | LD A,L 665 | SUB C 666 | LD A,H 667 | SBC A,B ;NUMER >= DENOM? 668 | JR C,USLA1 ;NO, GO AHEAD 669 | LD HL,0FFFFH ;YES, OVERFLOW 670 | LD D,H 671 | LD E,L ;/ SET REM & QUOT TO MAX 672 | JP USLA7 673 | USLA1: LD A,10H ;LOOP COUNTER 674 | USLA2: ADD HL,HL ;LEFT SHIFT (HLDE) THRU CARRY 675 | RLA ;ROT CARRY INTO ACCU BIT 0 676 | EX DE,HL 677 | ADD HL,HL 678 | JR NC,USLA3 679 | INC DE ;ADD CARRY 680 | AND A ;RESET CARRY 681 | USLA3: EX DE,HL ;SHIFT DONE 682 | RRA ;RESTORE 1st CARRY & COUNTER 683 | JR NC,USLA4 ;IF CARRY=1 684 | OR A ;/ RESET CARRY 685 | SBC HL,BC ;/ THEN (HL)<--(HL)-(BC) 686 | JP USLA5 687 | USLA4: SBC HL,BC ;/ (HL)<--PARTIAL REMAINDER 688 | JR NC,USLA5 689 | ADD HL,BC ;UNDERFLOW, RESTORE 690 | DEC DE 691 | USLA5: INC DE ;INC QUOT 692 | DEC A ;COUNTER=0? 693 | JP NZ,USLA2 ;NO, LOOP AGN 694 | USLA7: POP BC ;RESTORE IP 695 | PUSH HL ;(S2)<--REMAINDER 696 | PUSH DE ;(S1)<--QUOTIENT 697 | JNEXT 698 | ; 699 | .BYTE 85H ; U/MOD 1.3 700 | .TEXT "U/MO" ; SAME AS U/ 701 | .BYTE 'D'+80H 702 | .WORD USLAS-5 703 | USLMD .WORD USLAS+2 704 | ; 705 | .BYTE 83H ;AND 706 | .TEXT "AN" 707 | .BYTE 'D'+$80 708 | .WORD USLMD-8 709 | ANDD: .WORD $+2 ;(S1)<--(S1) AND (S2) 710 | POP DE 711 | POP HL 712 | LD A,E 713 | AND L 714 | LD L,A 715 | LD A,D 716 | AND H 717 | LD H,A 718 | JHPUSH 719 | ; 720 | .BYTE 82H ;OR 721 | .BYTE 'O' 722 | .BYTE 'R'+$80 723 | .WORD ANDD-6 724 | ORR: .WORD $+2 ;(S1)<--(S1) OR (S2) 725 | POP DE 726 | POP HL 727 | LD A,E 728 | OR L 729 | LD L,A 730 | LD A,D 731 | OR H 732 | LD H,A 733 | JHPUSH 734 | ; 735 | .BYTE 83H ;XOR 736 | .TEXT "XO" 737 | .BYTE 'R'+$80 738 | .WORD ORR-5 739 | XORR: .WORD $+2 ;(S1)<--(S1) XOR (S2) 740 | POP DE 741 | POP HL 742 | LD A,E 743 | XOR L 744 | LD L,A 745 | LD A,D 746 | XOR H 747 | LD H,A 748 | JHPUSH 749 | ; 750 | .BYTE 83H ;SP@ 751 | .TEXT "SP" 752 | .BYTE '@'+$80 753 | .WORD XORR-6 754 | SPAT: .WORD $+2 ;(S1)<--(SP) 755 | LD HL,0 756 | ADD HL,SP ;(HL)<--(SP) 757 | JHPUSH 758 | ; 759 | .BYTE 83H ;SP! 760 | .TEXT "SP" 761 | .BYTE '!'+$80 762 | .WORD SPAT-6 763 | SPSTO: .WORD $+2 ;(SP)<--(S0) (USER VARIABLE) 764 | LD HL,(UP) ;(HL)<--USER VAR BASE ADDR 765 | LD DE,0006H 766 | ADD HL,DE ;(HL)<--S0 767 | LD E,(HL) 768 | INC HL 769 | LD D,(HL) ;(DE)<--(S0) 770 | EX DE,HL 771 | LD SP,HL ;(SP)<--(S0) 772 | JNEXT 773 | ; 774 | .BYTE 83H ;RP@ 775 | .TEXT "RP" 776 | .BYTE '@'+$80 777 | .WORD SPSTO-6 778 | RPAT: .WORD $+2 ;(S1)<--(RP) 779 | LD HL,(RPP) 780 | JHPUSH 781 | ; 782 | .BYTE 83H ;RP! 783 | .TEXT "RP" 784 | .BYTE '!'+$80 785 | .WORD RPAT-6 786 | RPSTO: .WORD $+2 ;(RP)<--(R0) (USER VARIABLE) 787 | LD HL,(UP) ;(HL)<--USER VAR BASE ADDR 788 | LD DE,0008H 789 | ADD HL,DE ;(HL)<--R0 790 | LD E,(HL) 791 | INC HL 792 | LD D,(HL) ;(DE)<--(R0) 793 | LD (RPP),DE ;/ (RP)<--(R0) 794 | JNEXT 795 | ; 796 | .BYTE 82H ; ;S 797 | .BYTE ';' 798 | .BYTE 'S'+$80 799 | .WORD RPSTO-6 800 | SEMIS: .WORD $+2 ;(IP)<--(R1) 801 | LD HL,(RPP) 802 | LD C,(HL) 803 | INC HL 804 | LD B,(HL) ;(BC)<--(R1) 805 | INC HL 806 | LD (RPP),HL ;(RP)<--(RP)+2 807 | JNEXT 808 | ; 809 | .BYTE 84H ; EXIT 1.3 810 | .TEXT "EXI" 811 | .BYTE 'T'+80H 812 | .WORD SEMIS-5 813 | EXIT .WORD SEMIS+2 814 | ; 815 | .BYTE 85H ;LEAVE 816 | .TEXT "LEAV" 817 | .BYTE 'E'+$80 818 | .WORD EXIT-7 819 | LEAVE: .WORD $+2 ;LIMIT<--INDEX 820 | LD HL,(RPP) 821 | LD E,(HL) 822 | INC HL 823 | LD D,(HL) ;(DE)<--(R1)=INDEX 824 | INC HL 825 | LD (HL),E 826 | INC HL 827 | LD (HL),D ;(R2)<--(DE)=LIMIT 828 | JNEXT 829 | ; 830 | .BYTE 82H ;>R 831 | .BYTE '>' 832 | .BYTE 'R'+$80 833 | .WORD LEAVE-8 834 | TOR: .WORD $+2 835 | POP DE 836 | LD HL,(RPP) 837 | DEC HL 838 | LD (HL),D 839 | DEC HL 840 | LD (HL),E ;/ (R1)<--(DE) 841 | LD (RPP),HL ; (RP)<--(RP) 842 | JNEXT 843 | ; 844 | .BYTE 82H ;R> 845 | .BYTE 'R' 846 | .BYTE '>'+$80 847 | .WORD TOR-5 848 | FROMR: .WORD $+2 849 | LD HL,(RPP) 850 | LD E,(HL) 851 | INC HL 852 | LD D,(HL) 853 | INC HL 854 | LD (RPP),HL 855 | PUSH DE ;(S1)<--(R1) 856 | JNEXT 857 | ; 858 | .BYTE 81H ;R 859 | .BYTE 'R'+$80 860 | .WORD FROMR-5 861 | RR: .WORD IDO+2 862 | ; 863 | .BYTE 82H ; R@ 1.3 864 | .BYTE 'R' 865 | .BYTE '@'+$80 866 | .WORD RR-4 867 | RAT .WORD IDO+2 868 | ; 869 | .BYTE 82H ;0= 870 | .BYTE '0' 871 | .BYTE '='+$80 872 | .WORD RAT-5 873 | ZEQU: .WORD $+2 874 | POP HL 875 | LD A,L 876 | OR H 877 | LD HL,0 878 | JR NZ,ZEQU1 879 | INC L ;(HL)<--TRUE 880 | ZEQU1: JHPUSH 881 | ; 882 | .BYTE 82H ;0< 883 | .BYTE '0' 884 | .BYTE '<'+$80 885 | .WORD ZEQU-5 886 | ZLESS: .WORD $+2 887 | POP AF ;/ (A)<--(S1)H 888 | RLA ;/ (CARRY)<--BIT 7 889 | LD HL,0 ; (HL)<--FALSE 890 | JR NC,ZLES1 891 | INC L ; (HL)<--TRUE 892 | ZLES1: JHPUSH 893 | ; 894 | .BYTE 81H ;+ 895 | .BYTE '+'+$80 896 | .WORD ZLESS-5 897 | PLUS: .WORD $+2 898 | POP DE 899 | POP HL 900 | ADD HL,DE 901 | JHPUSH 902 | ; 903 | .BYTE 82H ;D+ ( d1L d1H d2L d2h -- d3L d3H) 904 | .BYTE 'D' 905 | .BYTE '+'+$80 906 | .WORD PLUS-4 907 | DPLUS: .WORD $+2 908 | EXX ;/ SAVE IP 909 | POP BC ; (BC)<--d2H 910 | POP HL ; (HL)<--d2L 911 | POP AF ;d (AF)<--d1H 912 | POP DE ; (DE)<--d1L 913 | PUSH AF ;/ (S1)<--d1H 914 | ADD HL,DE ; (HL)<--d2L+d1L=d3L 915 | EX DE,HL ; (DE)<--d3L 916 | POP HL ; (HL)<--d1H 917 | ADC HL,BC ;/ (HL)<--d1H+d2H+CARRY=d3H 918 | PUSH DE ; (S2)<--d3L 919 | PUSH HL ;/ (S1)<--d3H 920 | EXX ;/ RESTORE IP 921 | JNEXT 922 | ; 923 | .BYTE 85H ;MINUS 924 | .TEXT "MINU" 925 | .BYTE 'S'+$80 926 | .WORD DPLUS-5 927 | MINUS: .WORD $+2 928 | POP DE ;/ 929 | XOR A ;/ RESET CARRY, (A)<--0 930 | LD H,A ;/ 931 | LD L,A ;/ LD HL,0 932 | SBC HL,DE ;/ (HL)<--(DE)2's COMPL. 933 | JHPUSH 934 | ; 935 | .BYTE 86H ; NEGATE 1.3 936 | .TEXT "NEGAT" 937 | .BYTE 'E'+$80 938 | .WORD MINUS-8 939 | NEG .WORD MINUS+2 940 | ; 941 | .BYTE 86H ;DMINUS 942 | .TEXT "DMINU" 943 | .BYTE 'S'+$80 944 | .WORD NEG-9 945 | DMINU: .WORD $+2 946 | POP HL ;(HL)<--d1H 947 | POP DE ;(DE)<--d1L 948 | SUB A ;(A)<--0 949 | SUB E 950 | LD E,A ;(E)<--NEG(E) 951 | LD A,00H 952 | SBC A,D 953 | LD D,A ;(D)<--NEG(D) 954 | LD A,00H 955 | SBC A,L 956 | LD L,A ;(L)<--NEG(L) 957 | LD A,00H 958 | SBC A,H 959 | LD H,A ;(H)<--NEG(H) 960 | JP DPUSH ;(S2)<--d2L, (S1)<--d2H 961 | ; 962 | .BYTE 84H ;OVER 963 | .TEXT "OVE" 964 | .BYTE 'R'+$80 965 | .WORD DMINU-9 966 | OVER: .WORD $+2 967 | POP DE 968 | POP HL 969 | PUSH HL 970 | JP DPUSH 971 | ; 972 | .BYTE 84H ;DROP 973 | .TEXT "DRO" 974 | .BYTE 'P'+$80 975 | .WORD OVER-7 976 | DROP: .WORD $+2 977 | POP HL 978 | JNEXT 979 | ; 980 | .BYTE 84H ;SWAP 981 | .TEXT "SWA" 982 | .BYTE 'P'+$80 983 | .WORD DROP-7 984 | SWAP: .WORD $+2 985 | POP HL 986 | EX (SP),HL 987 | JHPUSH 988 | ; 989 | .BYTE 83H ;DUP 990 | .TEXT "DU" 991 | .BYTE 'P'+$80 992 | .WORD SWAP-7 993 | DUP: .WORD $+2 994 | POP HL 995 | PUSH HL 996 | JHPUSH 997 | ; 998 | .BYTE 84H ;2DUP 999 | .TEXT "2DU" 1000 | .BYTE 'P'+$80 1001 | .WORD DUP-6 1002 | TDUP: .WORD $+2 1003 | POP HL 1004 | POP DE 1005 | PUSH DE 1006 | PUSH HL 1007 | JP DPUSH 1008 | ; 1009 | .BYTE 85H ; 2DROP 1.3 1010 | .TEXT "2DRO" 1011 | .BYTE 'P'+$80 1012 | .WORD TDUP-7 1013 | TDROP .WORD $+2 1014 | POP HL 1015 | POP HL 1016 | JNEXT 1017 | ; 1018 | .BYTE 85H ; 2SWAP 1.3 1019 | .TEXT "2SWA" 1020 | .BYTE 'P'+80H 1021 | .WORD TDROP-8 1022 | TSWAP .WORD $+2 ; NOTE: THIS WON'T WORK WITH INTERRUPTS 1023 | POP HL ; (HL) <- (S1) 1024 | POP DE ; (DE) <- (S2) 1025 | EX (SP),HL ; (HL) <- (S3) 1026 | ; ; (S3) <- (HL) 1027 | EX DE,HL ; (DE) <- (HL) 1028 | ; ; (HL) <- (DE) 1029 | INC SP 1030 | INC SP 1031 | EX (SP),HL ; (HL) <- (S4) 1032 | ; ; (S4) <- (HL) 1033 | DEC SP 1034 | DEC SP 1035 | EX DE,HL ; (DE) <- (HL) 1036 | ; ; (HL) <- (DE) 1037 | JP DPUSH ; (S1) <- (HL) 1038 | ; ; (S2) <- (DE) 1039 | ; 1040 | .BYTE 85H ; 2OVER 1.3 1041 | .DB "2OVE" 1042 | .BYTE 'R'+80H 1043 | .WORD TSWAP-8 1044 | TOVER .WORD $+2 ; NOTE: THIS WON'T WORK WITH INTERRUPTS 1045 | INC SP 1046 | INC SP 1047 | INC SP 1048 | INC SP 1049 | POP HL ; (HL) <- (S3) 1050 | PUSH HL 1051 | INC SP 1052 | INC SP 1053 | POP DE ; (DE) <- (S4) 1054 | PUSH DE 1055 | DEC SP 1056 | DEC SP 1057 | DEC SP 1058 | DEC SP 1059 | DEC SP 1060 | DEC SP 1061 | JP DPUSH ; (S1) <- (HL) 1062 | ; ; (S2) <- (DE) 1063 | ; 1064 | .BYTE 82H ;+! 1065 | .BYTE '+' 1066 | .BYTE '!'+$80 1067 | .WORD TOVER-8 1068 | PSTOR: .WORD $+2 1069 | POP HL ;(HL)<--VAR ADDR 1070 | POP DE ;(DE)<--NUMBER 1071 | LD A,(HL) 1072 | ADD A,E 1073 | LD (HL),A 1074 | INC HL 1075 | LD A,(HL) 1076 | ADC A,D 1077 | LD (HL),A ;((HL))<--((HL))+NUMBER 1078 | JNEXT 1079 | ; 1080 | .BYTE 86H ;TOGGLE 1081 | .TEXT "TOGGL" 1082 | .BYTE 'E'+$80 1083 | .WORD PSTOR-5 1084 | TOGGL: .WORD $+2 1085 | POP DE ;(E)<--BIT PATTERN 1086 | POP HL ;(HL)<--ADDR 1087 | LD A,(HL) 1088 | XOR E 1089 | LD (HL),A 1090 | JNEXT 1091 | ; 1092 | .BYTE 81H ;@ 1093 | .BYTE '@'+$80 1094 | .WORD TOGGL-9 1095 | AT: .WORD $+2 1096 | POP HL 1097 | LD E,(HL) 1098 | INC HL 1099 | LD D,(HL) 1100 | PUSH DE 1101 | JNEXT 1102 | ; 1103 | .BYTE 82H ;C@ 1104 | .BYTE 'C' 1105 | .BYTE '@'+$80 1106 | .WORD AT-4 1107 | CAT: .WORD $+2 1108 | POP HL 1109 | LD L,(HL) 1110 | LD H,0 1111 | JHPUSH 1112 | ; 1113 | .BYTE 82H ;2@ 1114 | .BYTE '2' 1115 | .BYTE '@'+$80 1116 | .WORD CAT-5 1117 | TAT: .WORD $+2 1118 | EXX ;/ SAVE IP 1119 | POP HL ; (HL)<--ADDR 1120 | LD C,(HL) 1121 | INC HL 1122 | LD B,(HL) ;/ (BC)<--dH 1123 | INC HL 1124 | LD E,(HL) 1125 | INC HL 1126 | LD D,(HL) ; (DE)<--dL 1127 | PUSH DE ; (S2)<--dL 1128 | PUSH BC ;/ (S1)<--dH 1129 | EXX ;/ RESTORE IP 1130 | JNEXT 1131 | ; 1132 | .BYTE 81H ;! 1133 | .BYTE '!'+$80 1134 | .WORD TAT-5 1135 | STORE: .WORD $+2 1136 | POP HL 1137 | POP DE 1138 | LD (HL),E 1139 | INC HL 1140 | LD (HL),D 1141 | JNEXT 1142 | ; 1143 | .BYTE 82H ;C! 1144 | .BYTE 'C' 1145 | .BYTE '!'+$80 1146 | .WORD STORE-4 1147 | CSTOR: .WORD $+2 1148 | POP HL 1149 | POP DE 1150 | LD (HL),E 1151 | JNEXT 1152 | ; 1153 | .BYTE 82H ;2! 1154 | .BYTE '2' 1155 | .BYTE '!'+$80 1156 | .WORD CSTOR-5 1157 | TSTOR: .WORD $+2 1158 | POP HL 1159 | POP DE 1160 | LD (HL),E 1161 | INC HL 1162 | LD (HL),D 1163 | INC HL 1164 | POP DE 1165 | LD (HL),E 1166 | INC HL 1167 | LD (HL),D 1168 | JNEXT 1169 | ; 1170 | .BYTE 0C1H ; : 1171 | .BYTE ':'+$80 1172 | .WORD TSTOR-5 1173 | COLON: .WORD DOCOL 1174 | .WORD QEXEC 1175 | .WORD SCSP 1176 | .WORD CURR 1177 | .WORD AT 1178 | .WORD CONT 1179 | .WORD STORE 1180 | .WORD CREAT 1181 | .WORD RBRAC 1182 | .WORD PSCOD 1183 | DOCOL: LD HL,(RPP) 1184 | DEC HL 1185 | LD (HL),B 1186 | DEC HL 1187 | LD (HL),C 1188 | LD (RPP),HL 1189 | INC DE 1190 | LD C,E 1191 | LD B,D 1192 | JNEXT 1193 | ; 1194 | .BYTE 0C1H ; ; 1195 | .BYTE ';'+$80 1196 | .WORD COLON-4 1197 | SEMI: .WORD DOCOL 1198 | .WORD QCSP 1199 | .WORD COMP 1200 | .WORD SEMIS 1201 | .WORD SMUDG 1202 | .WORD LBRAC 1203 | .WORD SEMIS 1204 | ; 1205 | .BYTE 84H ;NOOP 1206 | .TEXT "NOO" 1207 | .BYTE 'P'+$80 1208 | .WORD SEMI-4 1209 | NOOP: .WORD DOCOL 1210 | .WORD SEMIS 1211 | ; 1212 | .BYTE 88H ;CONSTANT 1213 | .TEXT "CONSTAN" 1214 | .BYTE 'T'+$80 1215 | .WORD NOOP-7 1216 | CON: .WORD DOCOL 1217 | .WORD CREAT 1218 | .WORD SMUDG 1219 | .WORD COMMA 1220 | .WORD PSCOD 1221 | DOCON: INC DE 1222 | EX DE,HL 1223 | LD E,(HL) 1224 | INC HL 1225 | LD D,(HL) 1226 | PUSH DE 1227 | JNEXT 1228 | ; 1229 | .BYTE 88H ;VARIABLE 1230 | .TEXT "VARIABL" 1231 | .BYTE 'E'+$80 1232 | .WORD CON-0BH 1233 | VAR: .WORD DOCOL 1234 | .WORD CON 1235 | .WORD PSCOD 1236 | DOVAR: INC DE 1237 | PUSH DE 1238 | JNEXT 1239 | ; 1240 | .BYTE 84H ;USER 1241 | .TEXT "USE" 1242 | .BYTE 'R'+$80 1243 | .WORD VAR-0BH 1244 | USER: .WORD DOCOL 1245 | .WORD CON 1246 | .WORD PSCOD 1247 | DOUSE: INC DE 1248 | EX DE,HL 1249 | LD E,(HL) 1250 | LD D,00H 1251 | LD HL,(UP) 1252 | ADD HL,DE 1253 | JHPUSH 1254 | ; 1255 | .BYTE 81H ;0 1256 | .BYTE '0'+$80 1257 | .WORD USER-7 1258 | ZERO: .WORD $+2 ;/ 1259 | LD HL,0 ;/ 1260 | JHPUSH ;/ 1261 | ; 1262 | .BYTE 81H ;1 1263 | .BYTE '1'+$80 1264 | .WORD ZERO-4 1265 | ONE: .WORD $+2 ;/ 1266 | LD HL,1 ;/ 1267 | JHPUSH ;/ 1268 | ; 1269 | .BYTE 81H ;2 1270 | .BYTE '2'+$80 1271 | .WORD ONE-4 1272 | TWO: .WORD $+2 ;/ 1273 | LD HL,2 ;/ 1274 | JHPUSH ;/ 1275 | ; 1276 | .BYTE 81H ;3 1277 | .BYTE '3'+$80 1278 | .WORD TWO-4 1279 | THREE: .WORD $+2 ;/ 1280 | LD HL,3 ;/ 1281 | JHPUSH ;/ 1282 | ; 1283 | .BYTE 82H ;BL 1284 | .BYTE 'B' 1285 | .BYTE 'L'+$80 1286 | .WORD THREE-4 1287 | BL: .WORD DOCON 1288 | .WORD 20H 1289 | ; 1290 | .BYTE 83H ;C/L 1291 | .TEXT "C/" 1292 | .BYTE 'L'+$80 1293 | .WORD BL-5 1294 | CSLL: .WORD DOCON 1295 | .WORD 64 1296 | ; 1297 | .BYTE 85H ;FIRST 1298 | .TEXT "FIRS" 1299 | .BYTE 'T'+$80 1300 | .WORD CSLL-6 1301 | FIRST: .WORD DOCON 1302 | .WORD 0 ;/ set by CLD 1303 | ; 1304 | .BYTE 85H ;LIMIT 1305 | .TEXT "LIMI" 1306 | .BYTE 'T'+$80 1307 | .WORD FIRST-8 1308 | LIMIT: .WORD DOCON 1309 | .WORD 0 ;/ set by CLD 1310 | ; 1311 | .BYTE 85H ;B/BUF 1312 | .TEXT "B/BU" 1313 | .BYTE 'F'+$80 1314 | .WORD LIMIT-8 1315 | BBUF: .WORD DOCON 1316 | .WORD KBBUF 1317 | ; 1318 | .BYTE 85H ;B/SCR 1319 | .TEXT "B/SC" 1320 | .BYTE 'R'+$80 1321 | .WORD BBUF-8 1322 | BSCR: .WORD DOCON 1323 | .WORD 400H/KBBUF 1324 | ; 1325 | .BYTE 87H ;+ORIGIN 1326 | .TEXT "+ORIGI" 1327 | .BYTE 'N'+$80 1328 | .WORD BSCR-8 1329 | PORIG: .WORD DOCOL 1330 | .WORD LIT 1331 | .WORD ORIG 1332 | .WORD PLUS 1333 | .WORD SEMIS 1334 | ; 1335 | ; USER VARIABLES 1336 | ; 1337 | .BYTE 82H ;S0 1338 | .BYTE 'S' 1339 | .BYTE '0'+$80 1340 | .WORD PORIG-0AH 1341 | SZERO: .WORD DOUSE 1342 | .WORD 6 1343 | ; 1344 | .BYTE 82H ;R0 1345 | .BYTE 'R' 1346 | .BYTE '0'+$80 1347 | .WORD SZERO-5 1348 | RZERO: .WORD DOUSE 1349 | .WORD 8 1350 | ; 1351 | .BYTE 83H ;TIB 1352 | .TEXT "TI" 1353 | .BYTE 'B'+$80 1354 | .WORD RZERO-5 1355 | TIB: .WORD DOUSE 1356 | .BYTE 0AH 1357 | ; 1358 | .BYTE 85H ;WIDTH 1359 | .TEXT "WIDT" 1360 | .BYTE 'H'+$80 1361 | .WORD TIB-6 1362 | WIDTH: .WORD DOUSE 1363 | .BYTE 0CH 1364 | ; 1365 | .BYTE 87H ;WARNING 1366 | .TEXT "WARNIN" 1367 | .BYTE 'G'+$80 1368 | .WORD WIDTH-8 1369 | WARN: .WORD DOUSE 1370 | .BYTE 0EH 1371 | ; 1372 | .BYTE 85H ;FENCE 1373 | .TEXT "FENC" 1374 | .BYTE 'E'+$80 1375 | .WORD WARN-0AH 1376 | FENCE: .WORD DOUSE 1377 | .BYTE 10H 1378 | ; 1379 | .BYTE 82H ;DP 1380 | .BYTE 'D' 1381 | .BYTE 'P'+$80 1382 | .WORD FENCE-8 1383 | DP: .WORD DOUSE 1384 | .BYTE 12H 1385 | ; 1386 | .BYTE 88H ;VOC-LINK 1387 | .TEXT "VOC-LIN" 1388 | .BYTE 'K'+$80 1389 | .WORD DP-5 1390 | VOCL: .WORD DOUSE 1391 | .WORD 14H 1392 | ; 1393 | .BYTE 83H ;BLK 1394 | .TEXT "BL" 1395 | .BYTE 'K'+$80 1396 | .WORD VOCL-0BH 1397 | BLK: .WORD DOUSE 1398 | .BYTE 16H 1399 | ; 1400 | .BYTE 82H ;IN 1401 | .BYTE 'I' 1402 | .BYTE 'N'+$80 1403 | .WORD BLK-6 1404 | INN: .WORD DOUSE 1405 | .BYTE 18H 1406 | ; 1407 | .BYTE 83H ;OUT 1408 | .TEXT "OU" 1409 | .BYTE 'T'+$80 1410 | .WORD INN-5 1411 | OUTT: .WORD DOUSE 1412 | .BYTE 1AH 1413 | ; 1414 | .BYTE 83H ;SCR 1415 | .TEXT "SC" 1416 | .BYTE 'R'+$80 1417 | .WORD OUTT-6 1418 | SCR: .WORD DOUSE 1419 | .BYTE 1CH 1420 | ; 1421 | .BYTE 86H ;OFFSET 1422 | .TEXT "OFFSE" 1423 | .BYTE 'T'+$80 1424 | .WORD SCR-6 1425 | OFSET: .WORD DOUSE 1426 | .BYTE 1EH 1427 | ; 1428 | .BYTE 87H ;CONTEXT 1429 | .TEXT "CONTEX" 1430 | .BYTE 'T'+$80 1431 | .WORD OFSET-9 1432 | CONT: .WORD DOUSE 1433 | .BYTE 20H 1434 | ; 1435 | .BYTE 87H ;CURRENT 1436 | .TEXT "CURREN" 1437 | .BYTE 'T'+$80 1438 | .WORD CONT-0AH 1439 | CURR: .WORD DOUSE 1440 | .BYTE 22H 1441 | ; 1442 | .BYTE 85H ;STATE 1443 | .TEXT "STAT" 1444 | .BYTE 'E'+$80 1445 | .WORD CURR-0AH 1446 | STATE: .WORD DOUSE 1447 | .BYTE 24H 1448 | ; 1449 | .BYTE 84H ;BASE 1450 | .TEXT "BAS" 1451 | .BYTE 'E'+$80 1452 | .WORD STATE-8 1453 | BASE: .WORD DOUSE 1454 | .BYTE 26H 1455 | ; 1456 | .BYTE 83H ;DPL 1457 | .TEXT "DP" 1458 | .BYTE 'L'+$80 1459 | .WORD BASE-7 1460 | DPL: .WORD DOUSE 1461 | .BYTE 28H 1462 | ; 1463 | .BYTE 83H ;FLD 1464 | .TEXT "FL" 1465 | .BYTE 'D'+$80 1466 | .WORD DPL-6 1467 | FLD: .WORD DOUSE 1468 | .BYTE 2AH 1469 | ; 1470 | .BYTE 83H ;CSP 1471 | .TEXT "CS" 1472 | .BYTE 'P'+$80 1473 | .WORD FLD-6 1474 | CSPP: .WORD DOUSE 1475 | .BYTE 2CH 1476 | ; 1477 | .BYTE 82H ;R# 1478 | .BYTE 'R' 1479 | .BYTE '#'+$80 1480 | .WORD CSPP-6 1481 | RNUM: .WORD DOUSE 1482 | .BYTE 2EH 1483 | ; 1484 | .BYTE 83H ;HLD 1485 | .TEXT "HL" 1486 | .BYTE 'D'+$80 1487 | .WORD RNUM-5 1488 | HLD: .WORD DOUSE 1489 | .WORD 30H 1490 | ; 1491 | ; END OF USER VARIABLES 1492 | ; 1493 | .BYTE 82H ;1+ 1494 | .BYTE '1' 1495 | .BYTE '+'+$80 1496 | .WORD HLD-6 1497 | ONEP: .WORD $+2 ;/ 1498 | POP HL ;/ 1499 | INC HL ;/ 1500 | JHPUSH ;/ 1501 | ; 1502 | .BYTE 82H ;2+ 1503 | .BYTE '2' 1504 | .BYTE '+'+$80 1505 | .WORD ONEP-5 1506 | TWOP: .WORD $+2 ;/ 1507 | POP HL ;/ 1508 | INC HL ;/ 1509 | INC HL ;/ 1510 | JHPUSH ;/ 1511 | ; 1512 | .BYTE 82H ;/ 1- 1513 | .BYTE '1' 1514 | .BYTE '-'+$80 ;/ 1515 | .WORD TWOP-5 ;/ 1516 | ONEMIN: .WORD $+2 ;/ 1517 | POP HL ;/ 1518 | DEC HL ;/ 1519 | JHPUSH ;/ 1520 | ; 1521 | .BYTE 82H ;/ 2- 1522 | .BYTE '2' 1523 | .BYTE '-'+$80 ;/ 1524 | .WORD ONEMIN-5 ;/ 1525 | TWOMIN: .WORD $+2 ;/ 1526 | POP HL ;/ 1527 | DEC HL ;/ 1528 | DEC HL ;/ 1529 | JHPUSH ;/ 1530 | ; 1531 | .BYTE 82H ;/ 2* 1532 | .BYTE '2' 1533 | .BYTE '*'+$80 ;/ 1534 | .WORD TWOMIN-5 ;/ 1535 | TWOSTA: .WORD $+2 ;/ 1536 | POP HL ;/ 1537 | ADD HL,HL ;/ ASL HL 1538 | JHPUSH ;/ 1539 | ; 1540 | .BYTE 82H ;/ 2/ 1541 | .BYTE '2' 1542 | .BYTE '/'+$80 ;/ 1543 | .WORD TWOSTA-5 ;/ 1544 | TWOSLA: .WORD $+2 ;/ 1545 | POP HL ;/ 1546 | BIT 7,H ;/ 1547 | JR Z,TWOSL1 ;/ 1548 | INC HL ;/ 1549 | TWOSL1: SRA H ;/ 1550 | RR L ;/ ASR HL 1551 | JHPUSH ;/ 1552 | ; 1553 | .BYTE 84H ;HERE 1554 | .TEXT "HER" 1555 | .BYTE 'E'+$80 1556 | .WORD TWOSLA-5 1557 | HERE: .WORD DOCOL 1558 | .WORD DP 1559 | .WORD AT 1560 | .WORD SEMIS 1561 | ; 1562 | .BYTE 85H ;ALLOT 1563 | .TEXT "ALLO" 1564 | .BYTE 'T'+$80 1565 | .WORD HERE-7 1566 | ALLOT: .WORD DOCOL 1567 | .WORD DP 1568 | .WORD PSTOR 1569 | .WORD SEMIS 1570 | ; 1571 | .BYTE 81H ; , 1572 | .BYTE ','+$80 1573 | .WORD ALLOT-8 1574 | COMMA: .WORD DOCOL 1575 | .WORD HERE 1576 | .WORD STORE 1577 | .WORD TWO 1578 | .WORD ALLOT 1579 | .WORD SEMIS 1580 | ; 1581 | .BYTE 82H ;C, 1582 | .BYTE 'C' 1583 | .BYTE ','+$80 1584 | .WORD COMMA-4 1585 | CCOMM: .WORD DOCOL 1586 | .WORD HERE 1587 | .WORD CSTOR 1588 | .WORD ONE 1589 | .WORD ALLOT 1590 | .WORD SEMIS 1591 | ; 1592 | .BYTE 81H ;- 1593 | .BYTE '-'+$80 1594 | .WORD CCOMM-5 1595 | SUBB: .WORD $+2 1596 | POP DE 1597 | POP HL 1598 | OR A ;/ RESET CARRY 1599 | SBC HL,DE ;/ 1600 | JHPUSH 1601 | ; 1602 | .BYTE 81H ;= 1603 | .BYTE '='+$80 1604 | .WORD SUBB-4 1605 | EQUAL: .WORD $+2 ;/ 1606 | POP DE ;/ 1607 | POP HL ;/ 1608 | XOR A ;/ RESET CARRY 1609 | SBC HL,DE ;/ 1610 | LD H,A ;/ 1611 | LD L,A ;/ LD HL,0000H 1612 | JR NZ,EXEQU ;/ FALSE 1613 | INC L ;/ TRUE 1614 | EXEQU: JHPUSH ;/ 1615 | ; 1616 | .BYTE 82H ; <> 1.3 1617 | .BYTE '<' 1618 | .BYTE '>'+$80 1619 | .WORD EQUAL-4 1620 | NEQU .WORD DOCOL 1621 | .WORD SUBB 1622 | .WORD ZEQU 1623 | .WORD ZEQU 1624 | .WORD SEMIS 1625 | ; 1626 | .BYTE 84H ; =NOT 1.3 1627 | .TEXT "=NO" 1628 | .BYTE 'T'+$80 1629 | .WORD NEQU-5 1630 | ENOT .WORD DOCOL 1631 | .WORD NEQU 1632 | .WORD SEMIS 1633 | ; 1634 | .BYTE 81H ; < 1635 | .BYTE '<'+$80 1636 | .WORD ENOT-7 1637 | LESS: .WORD $+2 1638 | POP DE 1639 | POP HL ; (HL) (DE) < 1640 | LD A,D 1641 | XOR H ; ONE OF THEM NEGATIVE? 1642 | JP M,LES1 ; YES, DETERMINE WHICH 1643 | OR A ;/ CLR CARRY 1644 | SBC HL,DE ;/ 1645 | LES1: BIT 7,H ;/ (H) NEGATIVE? 1646 | LD HL,0 1647 | JR Z,EXLESS ;/ NO, FALSE 1648 | INC L ;/ TRUE 1649 | EXLESS: JHPUSH 1650 | ; 1651 | .BYTE 82H ;U< 1652 | .BYTE 'U' 1653 | .BYTE '<'+$80 1654 | .WORD LESS-4 1655 | ULESS: .WORD $+2 ;/ 1656 | POP DE 1657 | POP HL ;/ (HL) (DE) U< 1658 | XOR A ;/ 1659 | SBC HL,DE ;/ 1660 | LD H,A ;/ 1661 | LD L,A ;/ LD HL,0000H 1662 | JR NC,EXULES ;/ FALSE 1663 | INC L ;/ TRUE 1664 | EXULES: JHPUSH 1665 | ; 1666 | .BYTE 81H ;> 1667 | .BYTE '>'+$80 1668 | .WORD ULESS-5 1669 | GREAT: .WORD $+2 1670 | POP HL ;/ 1671 | POP DE ;/ (HL) (DE) > = (DE) (HL) < 1672 | LD A,D 1673 | XOR H ; ONE OF THEM NEGATIVE? 1674 | JP M,GREAT1 ; YES, DETERMINE WHICH 1675 | OR A ;/ CLR CARRY 1676 | SBC HL,DE ;/ 1677 | GREAT1: BIT 7,H ;/ (H) NEGATIVE? 1678 | LD HL,0 ; (HL)<--FALSE 1679 | JR Z,GREAT2 ;/ NO, FALSE 1680 | INC L ;/ (HL)<--TRUE 1681 | GREAT2: JHPUSH 1682 | ; 1683 | .BYTE 82H ; 0> 1.3 1684 | .BYTE '0' 1685 | .BYTE '>'+$80 1686 | .WORD GREAT-4 1687 | ZGREA: .WORD DOCOL 1688 | .WORD ZERO,GREAT 1689 | .WORD SEMIS 1690 | ; 1691 | .BYTE 83H ;ROT 1692 | .TEXT "RO" 1693 | .BYTE 'T'+$80 1694 | .WORD ZGREA-5 1695 | ROT: .WORD $+2 1696 | POP DE 1697 | POP HL 1698 | EX (SP),HL 1699 | JP DPUSH 1700 | ; 1701 | .BYTE 84H ; -ROT 1.3 1702 | .TEXT "-RO" 1703 | .BYTE 'T'+$80 1704 | .WORD ROT-6 1705 | DROT .WORD DOCOL 1706 | .WORD ROT,ROT 1707 | .WORD SEMIS 1708 | ; 1709 | .BYTE 85H ;SPACE 1710 | .TEXT "SPAC" 1711 | .BYTE 'E'+$80 1712 | .WORD DROT-7 1713 | SPACE: .WORD DOCOL 1714 | .WORD BL 1715 | .WORD EMIT 1716 | .WORD SEMIS 1717 | ; 1718 | .BYTE 84H ;-DUP 1719 | .TEXT "-DU" 1720 | .BYTE 'P'+$80 1721 | .WORD SPACE-8 1722 | DDUP: .WORD $+2 ;/ 1723 | POP HL ;/ 1724 | LD A,H ;/ 1725 | OR L ;/ (HL)=0? 1726 | JR Z,EXDDUP ;/ YES, DON'T DUP 1727 | PUSH HL ;/ 1728 | EXDDUP: JHPUSH 1729 | ; 1730 | .BYTE 84H ; ?DUP 1.3 1731 | .TEXT "?DU" 1732 | .BYTE 'P'+$80 1733 | .WORD DDUP-7 1734 | QDUP .WORD DDUP+2 1735 | ; 1736 | .BYTE 88H ;TRAVERSE 1737 | .TEXT "TRAVERS" 1738 | .BYTE 'E'+$80 1739 | .WORD QDUP-7 1740 | TRAV: .WORD DOCOL 1741 | .WORD SWAP 1742 | TRAV1: .WORD OVER ;BEGIN 1743 | .WORD PLUS 1744 | .WORD LIT 1745 | .WORD 7FH 1746 | .WORD OVER 1747 | .WORD CAT 1748 | .WORD LESS 1749 | .WORD ZBRAN ;UNTIL 1750 | .WORD TRAV1-$ 1751 | .WORD SWAP 1752 | .WORD DROP 1753 | .WORD SEMIS 1754 | ; 1755 | .BYTE 86H ;LATEST 1756 | .TEXT "LATES" 1757 | .BYTE 'T'+$80 1758 | .WORD TRAV-0BH 1759 | LATES: .WORD DOCOL 1760 | .WORD CURR 1761 | .WORD AT 1762 | .WORD AT 1763 | .WORD SEMIS 1764 | ; 1765 | .BYTE 83H ;LFA 1766 | .TEXT "LF" 1767 | .BYTE 'A'+$80 1768 | .WORD LATES-9 1769 | LFA: .WORD $+2 ;/ 1770 | POP HL ;/ (HL)<--PFA 1771 | DEC HL ;/ 1772 | DEC HL ;/ 1773 | DEC HL ;/ 1774 | DEC HL ;/ (HL)<--(HL)-4 = LFA 1775 | JHPUSH ;/ 1776 | ; 1777 | .BYTE 83H ;CFA 1778 | .TEXT "CF" 1779 | .BYTE 'A'+$80 1780 | .WORD LFA-6 1781 | CFA: .WORD DOCOL 1782 | .WORD TWOMIN ;/ 1783 | .WORD SEMIS 1784 | ; 1785 | .BYTE 83H ;NFA 1786 | .TEXT "NF" 1787 | .BYTE 'A'+$80 1788 | .WORD CFA-6 1789 | NFA: .WORD DOCOL 1790 | .WORD LIT 1791 | .WORD 5 1792 | .WORD SUBB 1793 | .WORD LIT 1794 | .WORD -1 1795 | .WORD TRAV 1796 | .WORD SEMIS 1797 | ; 1798 | .BYTE 83H ;PFA 1799 | .TEXT "PF" 1800 | .BYTE 'A'+$80 1801 | .WORD NFA-6 1802 | PFA: .WORD DOCOL 1803 | .WORD ONE 1804 | .WORD TRAV 1805 | .WORD LIT 1806 | .WORD 5 1807 | .WORD PLUS 1808 | .WORD SEMIS 1809 | ; 1810 | .BYTE 84H ;!CSP 1811 | .TEXT "!CS" 1812 | .BYTE 'P'+$80 1813 | .WORD PFA-6 1814 | SCSP: .WORD DOCOL 1815 | .WORD SPAT 1816 | .WORD CSPP 1817 | .WORD STORE 1818 | .WORD SEMIS 1819 | ; 1820 | .BYTE 86H ;?ERROR 1821 | .TEXT "?ERRO" 1822 | .BYTE 'R'+$80 1823 | .WORD SCSP-7 1824 | QERR: .WORD DOCOL 1825 | .WORD SWAP 1826 | .WORD ZBRAN ;IF 1827 | .WORD QERR1-$ 1828 | .WORD ERROR 1829 | .WORD BRAN ;ELSE 1830 | .WORD QERR2-$ 1831 | QERR1: .WORD DROP ;ENDIF 1832 | QERR2: .WORD SEMIS 1833 | ; 1834 | .BYTE 85H ;?COMP 1835 | .TEXT "?COM" 1836 | .BYTE 'P'+$80 1837 | .WORD QERR-9 1838 | QCOMP: .WORD DOCOL 1839 | .WORD STATE 1840 | .WORD AT 1841 | .WORD ZEQU 1842 | .WORD LIT 1843 | .WORD 11H 1844 | .WORD QERR 1845 | .WORD SEMIS 1846 | ; 1847 | .BYTE 85H ;?EXEC 1848 | .TEXT "?EXE" 1849 | .BYTE 'C'+$80 1850 | .WORD QCOMP-8 1851 | QEXEC: .WORD DOCOL 1852 | .WORD STATE 1853 | .WORD AT 1854 | .WORD LIT 1855 | .WORD 12H 1856 | .WORD QERR 1857 | .WORD SEMIS 1858 | ; 1859 | .BYTE 86H ;?PAIRS 1860 | .TEXT "?PAIR" 1861 | .BYTE 'S'+$80 1862 | .WORD QEXEC-8 1863 | QPAIR: .WORD DOCOL 1864 | .WORD SUBB 1865 | .WORD LIT 1866 | .WORD 13H 1867 | .WORD QERR 1868 | .WORD SEMIS 1869 | ; 1870 | .BYTE 84H ;?CSP 1871 | .TEXT "?CS" 1872 | .BYTE 'P'+$80 1873 | .WORD QPAIR-9 1874 | QCSP: .WORD DOCOL 1875 | .WORD SPAT 1876 | .WORD CSPP 1877 | .WORD AT 1878 | .WORD SUBB 1879 | .WORD LIT 1880 | .WORD 14H 1881 | .WORD QERR 1882 | .WORD SEMIS 1883 | ; 1884 | .BYTE 88H ;?LOADING 1885 | .TEXT "?LOADIN" 1886 | .BYTE 'G'+$80 1887 | .WORD QCSP-7 1888 | QLOAD: .WORD DOCOL 1889 | .WORD BLK 1890 | .WORD AT 1891 | .WORD ZEQU 1892 | .WORD LIT 1893 | .WORD 16H 1894 | .WORD QERR 1895 | .WORD SEMIS 1896 | ; 1897 | .BYTE 87H ;COMPILE 1898 | .TEXT "COMPIL" 1899 | .BYTE 'E'+$80 1900 | .WORD QLOAD-0BH 1901 | COMP: .WORD DOCOL 1902 | .WORD QCOMP 1903 | .WORD FROMR 1904 | .WORD DUP 1905 | .WORD TWOP 1906 | .WORD TOR 1907 | .WORD AT 1908 | .WORD COMMA 1909 | .WORD SEMIS 1910 | ; 1911 | .BYTE 0C1H ;[ 1912 | .BYTE '['+$80 1913 | .WORD COMP-0AH 1914 | LBRAC: .WORD DOCOL 1915 | .WORD ZERO 1916 | .WORD STATE 1917 | .WORD STORE 1918 | .WORD SEMIS 1919 | ; 1920 | .BYTE 81H ;] 1921 | .BYTE ']'+$80 1922 | .WORD LBRAC-4 1923 | RBRAC: .WORD DOCOL 1924 | .WORD LIT,0C0H 1925 | .WORD STATE,STORE 1926 | .WORD SEMIS 1927 | ; 1928 | .BYTE 86H ;SMUDGE 1929 | .TEXT "SMUDG" 1930 | .BYTE 'E'+$80 1931 | .WORD RBRAC-4 1932 | SMUDG: .WORD DOCOL 1933 | .WORD LATES 1934 | .WORD LIT 1935 | .WORD 20H 1936 | .WORD TOGGL 1937 | .WORD SEMIS 1938 | ; 1939 | .BYTE 83H ;HEX 1940 | .TEXT "HE" 1941 | .BYTE 'X'+$80 1942 | .WORD SMUDG-9 1943 | HEX: .WORD DOCOL 1944 | .WORD LIT 1945 | .WORD 10H 1946 | .WORD BASE 1947 | .WORD STORE 1948 | .WORD SEMIS 1949 | ; 1950 | .BYTE 87H ;DECIMAL 1951 | .TEXT "DECIMA" 1952 | .BYTE 'L'+$80 1953 | .WORD HEX-6 1954 | DEC: .WORD DOCOL 1955 | .WORD LIT 1956 | .WORD 0AH 1957 | .WORD BASE 1958 | .WORD STORE 1959 | .WORD SEMIS 1960 | ; 1961 | .BYTE 86H ; BINARY 1.3 1962 | .TEXT "BINAR" 1963 | .BYTE 'Y'+$80 1964 | .WORD DEC-10 1965 | BIN .WORD DOCOL 1966 | .WORD LIT,2 1967 | .WORD BASE,STORE 1968 | .WORD SEMIS 1969 | ; 1970 | .BYTE 87H ;(;CODE) 1971 | .TEXT "(;CODE" 1972 | .BYTE ')'+$80 1973 | .WORD BIN-9 1974 | PSCOD: .WORD DOCOL 1975 | .WORD FROMR 1976 | .WORD LATES 1977 | .WORD PFA 1978 | .WORD CFA 1979 | .WORD STORE 1980 | .WORD SEMIS 1981 | ; 1982 | .BYTE 0C5H ; ;CODE 1983 | .TEXT ";COD" 1984 | .BYTE 'E'+$80 1985 | .WORD PSCOD-0AH 1986 | SEMIC: .WORD DOCOL 1987 | .WORD QCSP 1988 | .WORD COMP 1989 | .WORD PSCOD 1990 | .WORD LBRAC 1991 | SEMI1: .WORD NOOP ;ASSEMBLER 1992 | .WORD SEMIS 1993 | ; 1994 | .BYTE 87H ; 2004 | .TEXT "DOES" 2005 | .BYTE '>'+$80 2006 | .WORD BUILD-0AH 2007 | DOES: .WORD DOCOL 2008 | .WORD FROMR 2009 | .WORD LATES 2010 | .WORD PFA 2011 | .WORD STORE 2012 | .WORD PSCOD 2013 | DODOE: LD HL,(RPP) 2014 | DEC HL 2015 | LD (HL),B 2016 | DEC HL 2017 | LD (HL),C 2018 | LD (RPP),HL 2019 | INC DE 2020 | EX DE,HL 2021 | LD C,(HL) 2022 | INC HL 2023 | LD B,(HL) 2024 | INC HL 2025 | JHPUSH 2026 | ; 2027 | .BYTE 85H ;COUNT 2028 | .TEXT "COUN" 2029 | .BYTE 'T'+$80 2030 | .WORD DOES-8 2031 | COUNT: .WORD DOCOL 2032 | .WORD DUP 2033 | .WORD ONEP 2034 | .WORD SWAP 2035 | .WORD CAT 2036 | .WORD SEMIS 2037 | ; 2038 | .BYTE 84H ;TYPE 2039 | .TEXT "TYP" 2040 | .BYTE 'E'+$80 2041 | .WORD COUNT-8 2042 | TYPE: .WORD DOCOL 2043 | .WORD DDUP 2044 | .WORD ZBRAN ;IF 2045 | .WORD TYPE1-$ 2046 | .WORD OVER 2047 | .WORD PLUS 2048 | .WORD SWAP 2049 | .WORD XDO ;DO 2050 | TYPE2: .WORD IDO 2051 | .WORD CAT 2052 | .WORD EMIT 2053 | .WORD XLOOP ;LOOP 2054 | .WORD TYPE2-$ 2055 | .WORD BRAN ;ELSE 2056 | .WORD TYPE3-$ 2057 | TYPE1: .WORD DROP ;ENDIF 2058 | TYPE3: .WORD SEMIS 2059 | ; 2060 | .BYTE 89H ;-TRAILING 2061 | .TEXT "-TRAILIN" 2062 | .BYTE 'G'+$80 2063 | .WORD TYPE-7 2064 | DTRAI: .WORD DOCOL 2065 | .WORD DUP 2066 | .WORD ZERO 2067 | .WORD XDO ;DO 2068 | DTRA1: .WORD TDUP ;/ 2069 | .WORD PLUS 2070 | .WORD ONEMIN ;/ 2071 | .WORD CAT 2072 | .WORD BL 2073 | .WORD SUBB 2074 | .WORD ZBRAN ;IF 2075 | .WORD DTRA2-$ 2076 | .WORD LEAVE 2077 | .WORD BRAN ;ELSE 2078 | .WORD DTRA3-$ 2079 | DTRA2: .WORD ONEMIN ;/ 2080 | DTRA3: .WORD XLOOP ;LOOP 2081 | .WORD DTRA1-$ 2082 | .WORD SEMIS 2083 | ; 2084 | .BYTE 84H ;(.") 2085 | .TEXT "(.\"" 2086 | .BYTE ')'+$80 2087 | .WORD DTRAI-0CH 2088 | PDOTQ: .WORD DOCOL 2089 | .WORD RR 2090 | .WORD COUNT 2091 | .WORD DUP 2092 | .WORD ONEP 2093 | .WORD FROMR 2094 | .WORD PLUS 2095 | .WORD TOR 2096 | .WORD TYPE 2097 | .WORD SEMIS 2098 | ; 2099 | .BYTE 0C2H ;." 2100 | .BYTE '.' 2101 | .BYTE '"'+$80 2102 | .WORD PDOTQ-7 2103 | DOTQ: .WORD DOCOL 2104 | .WORD LIT 2105 | .WORD 22H 2106 | .WORD STATE 2107 | .WORD AT 2108 | .WORD ZBRAN ;IF 2109 | .WORD DOTQ1-$ 2110 | .WORD COMP 2111 | .WORD PDOTQ 2112 | .WORD WORD 2113 | .WORD HERE 2114 | .WORD CAT 2115 | .WORD ONEP 2116 | .WORD ALLOT 2117 | .WORD BRAN ;ELSE 2118 | .WORD DOTQ2-$ 2119 | DOTQ1: .WORD WORD 2120 | .WORD HERE 2121 | .WORD COUNT 2122 | .WORD TYPE ;ENDIF 2123 | DOTQ2: .WORD SEMIS 2124 | ; 2125 | .BYTE 86H ;EXPECT 2126 | .TEXT "EXPEC" 2127 | .BYTE 'T'+$80 2128 | .WORD DOTQ-5 2129 | EXPEC: .WORD DOCOL 2130 | .WORD OVER 2131 | .WORD PLUS 2132 | .WORD OVER 2133 | .WORD XDO ;DO 2134 | EXPE1: .WORD KEY 2135 | .WORD DUP 2136 | .WORD LIT 2137 | .WORD 0EH 2138 | .WORD PORIG 2139 | .WORD AT 2140 | .WORD EQUAL 2141 | .WORD ZBRAN ;IF 2142 | .WORD EXPE2-$ 2143 | .WORD DROP 2144 | .WORD DUP 2145 | .WORD IDO 2146 | .WORD EQUAL 2147 | .WORD DUP 2148 | .WORD FROMR 2149 | .WORD TWOMIN ;/ 2150 | .WORD PLUS 2151 | .WORD TOR 2152 | .WORD ZBRAN ;IF 2153 | .WORD EXPE6-$ 2154 | .WORD LIT 2155 | .WORD BELL 2156 | .WORD BRAN ;ELSE 2157 | .WORD EXPE7-$ 2158 | EXPE6: .WORD LIT 2159 | .WORD BSOUT ;ENDIF 2160 | EXPE7: .WORD BRAN ;ELSE 2161 | .WORD EXPE3-$ 2162 | EXPE2: .WORD DUP 2163 | .WORD LIT 2164 | .WORD ACR ;/ 2165 | .WORD EQUAL 2166 | .WORD ZBRAN ;IF 2167 | .WORD EXPE4-$ 2168 | .WORD LEAVE 2169 | .WORD DROP 2170 | .WORD BL 2171 | .WORD ZERO 2172 | .WORD BRAN ;ELSE 2173 | .WORD EXPE5-$ 2174 | EXPE4: .WORD DUP ;ENDIF 2175 | EXPE5: .WORD IDO 2176 | .WORD CSTOR 2177 | .WORD ZERO 2178 | .WORD IDO 2179 | .WORD ONEP 2180 | .WORD STORE ;ENDIF 2181 | EXPE3: .WORD EMIT 2182 | .WORD XLOOP ;LOOP 2183 | .WORD EXPE1-$ 2184 | .WORD DROP 2185 | .WORD SEMIS 2186 | ; 2187 | .BYTE 85H ;QUERY 2188 | .TEXT "QUER" 2189 | .BYTE 'Y'+$80 2190 | .WORD EXPEC-9 2191 | QUERY: .WORD DOCOL 2192 | .WORD TIB 2193 | .WORD AT 2194 | .WORD LIT 2195 | .WORD 50H 2196 | .WORD EXPEC 2197 | .WORD ZERO 2198 | .WORD INN 2199 | .WORD STORE 2200 | .WORD SEMIS 2201 | ; 2202 | .BYTE 0C1H ;NULL 2203 | .BYTE 80H 2204 | .WORD QUERY-8 2205 | NULL: .WORD DOCOL 2206 | .WORD BLK 2207 | .WORD AT 2208 | .WORD ZBRAN ;IF 2209 | .WORD NULL1-$ 2210 | .WORD ONE 2211 | .WORD BLK 2212 | .WORD PSTOR 2213 | .WORD ZERO 2214 | .WORD INN 2215 | .WORD STORE 2216 | .WORD BLK 2217 | .WORD AT 2218 | .WORD BSCR 2219 | .WORD ONEMIN ;/ 2220 | .WORD ANDD 2221 | .WORD ZEQU 2222 | .WORD ZBRAN ;IF 2223 | .WORD NULL2-$ 2224 | .WORD QEXEC 2225 | .WORD FROMR 2226 | .WORD DROP ;ENDIF 2227 | NULL2: .WORD BRAN ;ELSE 2228 | .WORD NULL3-$ 2229 | NULL1: .WORD FROMR 2230 | .WORD DROP ;ENDIF 2231 | NULL3: .WORD SEMIS 2232 | ; 2233 | .BYTE 84H ;FILL 2234 | .TEXT "FIL" 2235 | .BYTE 'L'+$80 2236 | .WORD NULL-4 2237 | FILL: .WORD $+2 2238 | EXX ;/ SAVE IP 2239 | POP DE ;/ (E)<--BYTE 2240 | POP BC ; (BC)<--QUANTITY 2241 | POP HL ;/ (HL)<--ADDR 2242 | FILL1: LD A,B 2243 | OR C ; QTY=0? 2244 | JR Z,FILL2 ; YES 2245 | LD (HL),E ;/ ((HL))<--BYTE 2246 | INC HL ; INC POINTER 2247 | DEC BC ; DEC COUNTER 2248 | JP FILL1 ;/ 2249 | FILL2: EXX ;/ RESTORE IP 2250 | JNEXT 2251 | ; 2252 | .BYTE 85H ;ERASE 2253 | .TEXT "ERAS" 2254 | .BYTE 'E'+$80 2255 | .WORD FILL-7 2256 | ERASEE: .WORD DOCOL 2257 | .WORD ZERO 2258 | .WORD FILL 2259 | .WORD SEMIS 2260 | ; 2261 | .BYTE 86H ;BLANKS 2262 | .TEXT "BLANK" 2263 | .BYTE 'S'+$80 2264 | .WORD ERASEE-8 2265 | BLANK: .WORD DOCOL 2266 | .WORD BL 2267 | .WORD FILL 2268 | .WORD SEMIS 2269 | ; 2270 | .BYTE 84H ;HOLD 2271 | .TEXT "HOL" 2272 | .BYTE 'D'+$80 2273 | .WORD BLANK-9 2274 | HOLD: .WORD DOCOL 2275 | .WORD LIT 2276 | .WORD -1 2277 | .WORD HLD 2278 | .WORD PSTOR 2279 | .WORD HLD 2280 | .WORD AT 2281 | .WORD CSTOR 2282 | .WORD SEMIS 2283 | ; 2284 | .BYTE 83H ;PAD 2285 | .TEXT "PA" 2286 | .BYTE 'D'+$80 2287 | .WORD HOLD-7 2288 | PAD: .WORD DOCOL 2289 | .WORD HERE 2290 | .WORD LIT 2291 | .WORD 44H 2292 | .WORD PLUS 2293 | .WORD SEMIS 2294 | ; 2295 | .BYTE 84H ;WORD 2296 | .TEXT "WOR" 2297 | .BYTE 'D'+$80 2298 | .WORD PAD-6 2299 | WORD: .WORD DOCOL 2300 | .WORD BLK 2301 | .WORD AT 2302 | .WORD ZBRAN ;IF 2303 | .WORD WORD1-$ 2304 | .WORD BLK 2305 | .WORD AT 2306 | .WORD BLOCK 2307 | .WORD BRAN ;ELSE 2308 | .WORD WORD2-$ 2309 | WORD1: .WORD TIB 2310 | .WORD AT ;ENDIF 2311 | WORD2: .WORD INN 2312 | .WORD AT 2313 | .WORD PLUS 2314 | .WORD SWAP 2315 | .WORD ENCL 2316 | .WORD HERE 2317 | .WORD LIT 2318 | .WORD 22H 2319 | .WORD BLANK 2320 | .WORD INN 2321 | .WORD PSTOR 2322 | .WORD OVER 2323 | .WORD SUBB 2324 | .WORD TOR 2325 | .WORD RR 2326 | .WORD HERE 2327 | .WORD CSTOR 2328 | .WORD PLUS 2329 | .WORD HERE 2330 | .WORD ONEP 2331 | .WORD FROMR 2332 | .WORD CMOVE 2333 | .WORD SEMIS 2334 | ; 2335 | .BYTE 88H ;(NUMBER) 2336 | .TEXT "(NUMBER" 2337 | .BYTE ')'+$80 2338 | .WORD WORD-7 2339 | PNUMB: .WORD DOCOL 2340 | PNUM1: .WORD ONEP ;BEGIN 2341 | .WORD DUP 2342 | .WORD TOR 2343 | .WORD CAT 2344 | .WORD BASE 2345 | .WORD AT 2346 | .WORD DIGIT 2347 | .WORD ZBRAN ;WHILE 2348 | .WORD PNUM2-$ 2349 | .WORD SWAP 2350 | .WORD BASE 2351 | .WORD AT 2352 | .WORD USTAR 2353 | .WORD DROP 2354 | .WORD ROT 2355 | .WORD BASE 2356 | .WORD AT 2357 | .WORD USTAR 2358 | .WORD DPLUS 2359 | .WORD DPL 2360 | .WORD AT 2361 | .WORD ONEP 2362 | .WORD ZBRAN ;IF 2363 | .WORD PNUM3-$ 2364 | .WORD ONE 2365 | .WORD DPL 2366 | .WORD PSTOR ;ENDIF 2367 | PNUM3: .WORD FROMR 2368 | .WORD BRAN ;REPEAT 2369 | .WORD PNUM1-$ 2370 | PNUM2: .WORD FROMR 2371 | .WORD SEMIS 2372 | ; 2373 | .BYTE 86H ;NUMBER 2374 | .TEXT "NUMBE" 2375 | .BYTE 'R'+$80 2376 | .WORD PNUMB-0BH 2377 | NUMB: .WORD DOCOL 2378 | .WORD ZERO 2379 | .WORD ZERO 2380 | .WORD ROT 2381 | .WORD DUP 2382 | .WORD ONEP 2383 | .WORD CAT 2384 | .WORD LIT 2385 | .WORD 2DH 2386 | .WORD EQUAL 2387 | .WORD DUP 2388 | .WORD TOR 2389 | .WORD PLUS 2390 | .WORD LIT 2391 | .WORD -1 2392 | NUMB1: .WORD DPL ;BEGIN 2393 | .WORD STORE 2394 | .WORD PNUMB 2395 | .WORD DUP 2396 | .WORD CAT 2397 | .WORD BL 2398 | .WORD SUBB 2399 | .WORD ZBRAN ;WHILE 2400 | .WORD NUMB2-$ 2401 | .WORD DUP 2402 | .WORD CAT 2403 | .WORD LIT 2404 | .WORD 2EH 2405 | .WORD SUBB 2406 | .WORD ZERO 2407 | .WORD QERR 2408 | .WORD ZERO 2409 | .WORD BRAN ;REPEAT 2410 | .WORD NUMB1-$ 2411 | NUMB2: .WORD DROP 2412 | .WORD FROMR 2413 | .WORD ZBRAN ;IF 2414 | .WORD NUMB3-$ 2415 | .WORD DMINU ;ENDIF 2416 | NUMB3: .WORD SEMIS 2417 | ; 2418 | .BYTE 85H ;-FIND (0-3) SUCCESS 2419 | .TEXT "-FIN" ; (0-1) FAILURE 2420 | .BYTE 'D'+$80 2421 | .WORD NUMB-9 2422 | DFIND: .WORD DOCOL 2423 | .WORD BL 2424 | .WORD WORD 2425 | .WORD HERE 2426 | .WORD CONT 2427 | .WORD AT 2428 | .WORD AT 2429 | .WORD PFIND 2430 | .WORD DUP 2431 | .WORD ZEQU 2432 | .WORD ZBRAN ;IF 2433 | .WORD DFIN1-$ 2434 | .WORD DROP 2435 | .WORD HERE 2436 | .WORD LATES 2437 | .WORD PFIND ;ENDIF 2438 | DFIN1: .WORD SEMIS 2439 | ; 2440 | .BYTE 87H ;(ABORT) 2441 | .TEXT "(ABORT" 2442 | .BYTE ')'+$80 2443 | .WORD DFIND-8 2444 | PABOR: .WORD DOCOL 2445 | .WORD ABORT 2446 | .WORD SEMIS 2447 | ; 2448 | .BYTE 85H ;ERROR 2449 | .TEXT "ERRO" 2450 | .BYTE 'R'+$80 2451 | .WORD PABOR-0AH 2452 | ERROR: .WORD DOCOL 2453 | .WORD WARN 2454 | .WORD AT 2455 | .WORD ZLESS 2456 | .WORD ZBRAN ;IF 2457 | .WORD ERRO1-$ 2458 | .WORD PABOR ;ENDIF 2459 | ERRO1: .WORD HERE 2460 | .WORD COUNT 2461 | .WORD TYPE 2462 | .WORD PDOTQ 2463 | .BYTE 2 2464 | .TEXT "? " 2465 | .WORD MESS 2466 | .WORD SPSTO 2467 | ; CHANGE FROM fig MODEL 2468 | ; .WORD INN,AT,BLK,AT 2469 | .WORD BLK,AT 2470 | .WORD DDUP 2471 | .WORD ZBRAN 2472 | .WORD ERRO2-$ ;IF 2473 | .WORD INN,AT 2474 | .WORD SWAP ;ENDIF 2475 | ERRO2: .WORD QUIT 2476 | ; 2477 | .BYTE 83H ;ID. 2478 | .TEXT "ID" 2479 | .BYTE '.'+$80 2480 | .WORD ERROR-8 2481 | IDDOT: .WORD DOCOL 2482 | .WORD PAD 2483 | .WORD LIT 2484 | .WORD 20H 2485 | .WORD BLANK ;/ 2486 | .WORD DUP 2487 | .WORD PFA 2488 | .WORD LFA 2489 | .WORD OVER 2490 | .WORD SUBB 2491 | .WORD DUP ;/ change frm MODEL 2492 | .WORD TOR ;/ to suppress BIT 7 2493 | .WORD PAD 2494 | .WORD SWAP 2495 | .WORD CMOVE 2496 | .WORD PAD 2497 | .WORD FROMR ;/ for terminals 2498 | .WORD PAD ;/ with an 8 bit 2499 | .WORD PLUS ;/ ASCCI character set. 2500 | .WORD ONEMIN ;/ 2501 | .WORD DUP ;/ 2502 | .WORD AT ;/ 2503 | .WORD LIT ;/ 2504 | .WORD 7FH ;/ 2505 | .WORD ANDD ;/ 2506 | .WORD SWAP ;/ 2507 | .WORD STORE ;/ 2508 | .WORD COUNT 2509 | .WORD LIT 2510 | .WORD 1FH ; WIDTH 2511 | .WORD ANDD 2512 | .WORD TYPE 2513 | .WORD SPACE 2514 | .WORD SEMIS 2515 | ; 2516 | .BYTE 86H ;CREATE 2517 | .TEXT "CREAT" 2518 | .BYTE 'E'+$80 2519 | .WORD IDDOT-6 2520 | CREAT: .WORD DOCOL 2521 | .WORD DFIND 2522 | .WORD ZBRAN ;IF 2523 | .WORD CREA1-$ 2524 | .WORD DROP 2525 | .WORD NFA 2526 | .WORD IDDOT 2527 | .WORD LIT 2528 | .WORD 4 2529 | .WORD MESS 2530 | .WORD SPACE ;ENDIF 2531 | CREA1: .WORD HERE 2532 | .WORD DUP 2533 | .WORD CAT 2534 | .WORD WIDTH 2535 | .WORD AT 2536 | .WORD MIN 2537 | .WORD ONEP 2538 | .WORD ALLOT 2539 | .WORD DUP 2540 | .WORD LIT 2541 | .WORD 0A0H 2542 | .WORD TOGGL 2543 | .WORD HERE 2544 | .WORD ONEMIN 2545 | .WORD LIT 2546 | .WORD 80H 2547 | .WORD TOGGL 2548 | .WORD LATES 2549 | .WORD COMMA 2550 | .WORD CURR 2551 | .WORD AT 2552 | .WORD STORE 2553 | .WORD HERE 2554 | .WORD TWOP 2555 | .WORD COMMA 2556 | .WORD SEMIS 2557 | ; 2558 | .BYTE 0C9H ;[COMPILE] 2559 | .TEXT "[COMPILE" 2560 | .BYTE ']'+$80 2561 | .WORD CREAT-9 2562 | BCOMP: .WORD DOCOL 2563 | .WORD DFIND 2564 | .WORD ZEQU 2565 | .WORD ZERO 2566 | .WORD QERR 2567 | .WORD DROP 2568 | .WORD CFA 2569 | .WORD COMMA 2570 | .WORD SEMIS 2571 | ; 2572 | .BYTE 0C7H ;LITERAL 2573 | .TEXT "LITERA" 2574 | .BYTE 'L'+$80 2575 | .WORD BCOMP-0CH 2576 | LITER: .WORD DOCOL 2577 | .WORD STATE 2578 | .WORD AT 2579 | .WORD ZBRAN ;IF 2580 | .WORD LITE1-$ 2581 | .WORD COMP 2582 | .WORD LIT 2583 | .WORD COMMA ;ENDIF 2584 | LITE1: .WORD SEMIS 2585 | ; 2586 | .BYTE 0C8H ;DLITERAL 2587 | .TEXT "DLITERA" 2588 | .BYTE 'L'+$80 2589 | .WORD LITER-0AH 2590 | DLITE: .WORD DOCOL 2591 | .WORD STATE 2592 | .WORD AT 2593 | .WORD ZBRAN ;IF 2594 | .WORD DLIT1-$ 2595 | .WORD SWAP 2596 | .WORD LITER 2597 | .WORD LITER ;ENDIF 2598 | DLIT1: .WORD SEMIS 2599 | ; 2600 | .BYTE 86H ;?STACK 2601 | .TEXT "?STAC" 2602 | .BYTE 'K'+$80 2603 | .WORD DLITE-0BH 2604 | QSTAC: .WORD DOCOL 2605 | .WORD SPAT 2606 | .WORD SZERO 2607 | .WORD AT 2608 | .WORD SWAP 2609 | .WORD ULESS 2610 | .WORD ONE 2611 | .WORD QERR 2612 | .WORD SPAT 2613 | .WORD HERE 2614 | .WORD LIT 2615 | .WORD 80H 2616 | .WORD PLUS 2617 | .WORD ULESS 2618 | .WORD LIT 2619 | .WORD 7 2620 | .WORD QERR 2621 | .WORD SEMIS 2622 | ; 2623 | .BYTE 89H ;INTERPRET 2624 | .TEXT "INTERPRE" 2625 | .BYTE 'T'+$80 2626 | .WORD QSTAC-9 2627 | INTER: .WORD DOCOL 2628 | INTE1: .WORD DFIND ;BEGIN 2629 | .WORD ZBRAN ;IF 2630 | .WORD INTE2-$ 2631 | .WORD STATE 2632 | .WORD AT 2633 | .WORD LESS 2634 | .WORD ZBRAN ;IF 2635 | .WORD INTE3-$ 2636 | .WORD CFA 2637 | .WORD COMMA 2638 | .WORD BRAN ;ELSE 2639 | .WORD INTE4-$ 2640 | INTE3: .WORD CFA 2641 | .WORD EXEC ;ENDIF 2642 | INTE4: .WORD QSTAC 2643 | .WORD BRAN ;ELSE 2644 | .WORD INTE5-$ 2645 | INTE2: .WORD HERE 2646 | .WORD NUMB 2647 | .WORD DPL 2648 | .WORD AT 2649 | .WORD ONEP 2650 | .WORD ZBRAN ;IF 2651 | .WORD INTE6-$ 2652 | .WORD DLITE 2653 | .WORD BRAN ;ELSE 2654 | .WORD INTE7-$ 2655 | INTE6: .WORD DROP 2656 | .WORD LITER ;ENDIF 2657 | INTE7: .WORD QSTAC ;ENDIF 2658 | INTE5: .WORD BRAN ;AGAIN 2659 | .WORD INTE1-$ 2660 | ; 2661 | .BYTE 89H ;IMMEDIATE 2662 | .TEXT "IMMEDIAT" 2663 | .BYTE 'E'+$80 2664 | .WORD INTER-0CH 2665 | IMMED: .WORD DOCOL 2666 | .WORD LATES 2667 | .WORD LIT 2668 | .WORD 40H 2669 | .WORD TOGGL 2670 | .WORD SEMIS 2671 | ; 2672 | .BYTE 8AH ;VOCABULARY 2673 | .TEXT "VOCABULAR" 2674 | .BYTE 'Y'+$80 2675 | .WORD IMMED-0CH 2676 | VOCAB: .WORD DOCOL 2677 | .WORD BUILD 2678 | .WORD LIT 2679 | .WORD 0A081H 2680 | .WORD COMMA 2681 | .WORD CURR 2682 | .WORD AT 2683 | .WORD CFA 2684 | .WORD COMMA 2685 | .WORD HERE 2686 | .WORD VOCL 2687 | .WORD AT 2688 | .WORD COMMA 2689 | .WORD VOCL 2690 | .WORD STORE 2691 | .WORD DOES 2692 | DOVOC: .WORD TWOP 2693 | .WORD CONT 2694 | .WORD STORE 2695 | .WORD SEMIS 2696 | ; 2697 | .BYTE 0C5H ;FORTH 2698 | .TEXT "FORT" 2699 | .BYTE 'H'+$80 2700 | .WORD VOCAB-0DH 2701 | FORTH: .WORD DODOE 2702 | .WORD DOVOC 2703 | .WORD 0A081H 2704 | .WORD TASK-7 ;COLD START VALUE ONLY. 2705 | ; CHANGED EACH TIME A DEF IS APPENDED 2706 | ; TO THE FORTH VOCABULARY 2707 | .WORD 0 ;END OF VOCABULARY LIST 2708 | ; 2709 | .BYTE 8BH ;DEFINITIONS 2710 | .TEXT "DEFINITION" 2711 | .BYTE 'S'+$80 2712 | .WORD FORTH-8 2713 | DEFIN: .WORD DOCOL 2714 | .WORD CONT 2715 | .WORD AT 2716 | .WORD CURR 2717 | .WORD STORE 2718 | .WORD SEMIS 2719 | ; 2720 | .BYTE 0C1H ;( 2721 | .BYTE '('+$80 2722 | .WORD DEFIN-0EH 2723 | PAREN: .WORD DOCOL 2724 | .WORD LIT 2725 | .WORD 29H 2726 | .WORD WORD 2727 | .WORD SEMIS 2728 | ; 2729 | .BYTE 84H ;QUIT 2730 | .TEXT "QUI" 2731 | .BYTE 'T'+$80 2732 | .WORD PAREN-4 2733 | QUIT: .WORD DOCOL 2734 | .WORD ZERO 2735 | .WORD BLK 2736 | .WORD STORE 2737 | .WORD LBRAC 2738 | QUIT1: .WORD RPSTO ;BEGIN 2739 | .WORD CR 2740 | .WORD QUERY 2741 | .WORD INTER 2742 | .WORD STATE 2743 | .WORD AT 2744 | .WORD ZEQU 2745 | .WORD ZBRAN ;IF 2746 | .WORD QUIT2-$ 2747 | .WORD PDOTQ 2748 | .BYTE 2 2749 | .TEXT "ok" ;ENDIF 2750 | QUIT2: .WORD BRAN ;AGAIN 2751 | .WORD QUIT1-$ 2752 | ; 2753 | .BYTE 85H ;ABORT 2754 | .TEXT "ABOR" 2755 | .BYTE 'T'+$80 2756 | .WORD QUIT-7 2757 | ABORT: .WORD DOCOL 2758 | .WORD SPSTO 2759 | .WORD DEC 2760 | .WORD QSTAC 2761 | .WORD CR 2762 | .WORD DOTCPU 2763 | .WORD PDOTQ 2764 | .BYTE 0EH ;count of CHRs to follow 2765 | .TEXT "fig-FORTH " 2766 | .BYTE FIGREL+30H,ADOT,FIGREV+30H,USRVER 2767 | .WORD FORTH 2768 | .WORD DEFIN 2769 | .WORD QUIT 2770 | ; 2771 | WRM: LD BC,WRM1 2772 | JNEXT 2773 | WRM1: .WORD WARM 2774 | ; 2775 | .BYTE 84H ;WARM 2776 | .TEXT "WAR" 2777 | .BYTE 'M'+$80 2778 | .WORD ABORT-8 2779 | WARM: .WORD DOCOL 2780 | .WORD MTBUF 2781 | .WORD ABORT 2782 | ; 2783 | CLD: LD HL,(BDOSS+1) ;/ 2784 | LD L,0 ;/ (HL)<--FBASE 2785 | LD (LIMIT+2),HL ;/ set LIMIT 2786 | LD DE,BUFSIZ ;/ (DE)<--total disc buffer size 2787 | OR A ;/ clr carry 2788 | SBC HL,DE ;/ (HL)<--addr. of 1st disc buffer 2789 | LD (FIRST+2),HL ;/ set FIRST 2790 | LD (USE+2),HL ;/ set USE 2791 | LD (PREV+2),HL ;/ set PREV 2792 | LD (BUF1),HL ;/ 2793 | LD DE,US ;/ (DE)<--user variable space 2794 | SBC HL,DE ;/ (HL)<--INITR0 2795 | LD (UPINIT),HL ;/ 2796 | LD (R0INIT),HL ;/ 2797 | LD (UP),HL ;/ 2798 | LD (RPP),HL ;/ 2799 | LD DE,RTS ;/ (DE)<--return stack & terminal buffer space 2800 | SBC HL,DE ;/ (HL)<--INITS0 2801 | LD (S0INIT),HL ;/ 2802 | LD (TIBINI),HL ;/ 2803 | LD SP,HL ;/ 2804 | LD BC,CLD1 2805 | LD IX,NEXT ; POINTER TO NEXT 2806 | LD IY,HPUSH ; POINTER TO HPUSH 2807 | JNEXT 2808 | ; 2809 | CLD1: .WORD COLD 2810 | ; 2811 | .BYTE 84H ;COLD 2812 | .TEXT "COL" 2813 | .BYTE 'D'+$80 2814 | .WORD WARM-7 2815 | COLD: .WORD DOCOL 2816 | .WORD MTBUF 2817 | .WORD ONE,RECADR ;AvdH 2818 | .WORD STORE 2819 | .WORD LIT,BUF1 2820 | .WORD AT ;/ 2821 | .WORD USE,STORE 2822 | .WORD LIT,BUF1 2823 | .WORD AT ;/ 2824 | .WORD PREV,STORE 2825 | .WORD DRZER 2826 | .WORD ZERO ;/ 2827 | .WORD LIT,EPRINT 2828 | .WORD CSTOR ;/ 2829 | ; 2830 | .WORD LIT 2831 | .WORD ORIG+12H 2832 | .WORD LIT 2833 | .WORD UP 2834 | .WORD AT 2835 | .WORD LIT 2836 | .WORD 6 2837 | .WORD PLUS 2838 | .WORD LIT 2839 | .WORD 10H 2840 | .WORD CMOVE 2841 | .WORD LIT 2842 | .WORD ORIG+0CH 2843 | .WORD AT 2844 | .WORD LIT 2845 | .WORD FORTH+6 2846 | .WORD STORE 2847 | .WORD FOPEN 2848 | .WORD FCB 2849 | .WORD ONEP 2850 | .WORD CAT 2851 | .WORD BL 2852 | .WORD NEQU 2853 | .WORD ANDD 2854 | .WORD ZBRAN 2855 | .WORD CLD2-$ 2856 | .WORD PDOTQ 2857 | .BYTE 7 2858 | .TEXT "No File" 2859 | .WORD BYE 2860 | CLD2: .WORD ABORT 2861 | ; 2862 | .BYTE 84H ;S->D 2863 | .TEXT "S->" 2864 | .BYTE 'D'+$80 2865 | .WORD COLD-7 2866 | STOD: .WORD $+2 2867 | POP DE 2868 | LD HL,0 2869 | BIT 7,D ;/ # NEGATIVE? 2870 | JR Z,STOD1 ; NO 2871 | DEC HL ; YES, EXTEND SIGN 2872 | STOD1: JP DPUSH ; ( n1--d1L d1H) 2873 | ; 2874 | .BYTE 82H ;+- 2875 | .BYTE '+' 2876 | .BYTE '-'+$80 2877 | .WORD STOD-7 2878 | PM: .WORD DOCOL 2879 | .WORD ZLESS 2880 | .WORD ZBRAN ;IF 2881 | .WORD PM1-$ 2882 | .WORD MINUS ;ENDIF 2883 | PM1: .WORD SEMIS 2884 | ; 2885 | .BYTE 83H ;D+- 2886 | .TEXT "D+" 2887 | .BYTE '-'+$80 2888 | .WORD PM-5 2889 | DPM: .WORD DOCOL 2890 | .WORD ZLESS 2891 | .WORD ZBRAN ;IF 2892 | .WORD DPM1-$ 2893 | .WORD DMINU ;ENDIF 2894 | DPM1: .WORD SEMIS 2895 | ; 2896 | .BYTE 83H ;ABS 2897 | .TEXT "AB" 2898 | .BYTE 'S'+$80 2899 | .WORD DPM-6 2900 | ABS: .WORD DOCOL 2901 | .WORD DUP 2902 | .WORD PM 2903 | .WORD SEMIS 2904 | ; 2905 | .BYTE 84H ;DABS 2906 | .TEXT "DAB" 2907 | .BYTE 'S'+$80 2908 | .WORD ABS-6 2909 | DABS: .WORD DOCOL 2910 | .WORD DUP 2911 | .WORD DPM 2912 | .WORD SEMIS 2913 | ; 2914 | .BYTE 83H ;MIN 2915 | .TEXT "MI" 2916 | .BYTE 'N'+$80 2917 | .WORD DABS-7 2918 | MIN: .WORD DOCOL,TDUP 2919 | .WORD GREAT 2920 | .WORD ZBRAN ;IF 2921 | .WORD MIN1-$ 2922 | .WORD SWAP ;ENDIF 2923 | MIN1: .WORD DROP 2924 | .WORD SEMIS 2925 | ; 2926 | .BYTE 83H ;MAX 2927 | .TEXT "MA" 2928 | .BYTE 'X'+$80 2929 | .WORD MIN-6 2930 | MAX: .WORD DOCOL 2931 | .WORD TDUP 2932 | .WORD LESS 2933 | .WORD ZBRAN ;IF 2934 | .WORD MAX1-$ 2935 | .WORD SWAP ;ENDIF 2936 | MAX1: .WORD DROP 2937 | .WORD SEMIS 2938 | ; 2939 | .BYTE 82H ;M* 2940 | .BYTE 'M' 2941 | .BYTE '*'+$80 2942 | .WORD MAX-6 2943 | MSTAR: .WORD DOCOL,TDUP 2944 | .WORD XORR 2945 | .WORD TOR 2946 | .WORD ABS 2947 | .WORD SWAP 2948 | .WORD ABS 2949 | .WORD USTAR 2950 | .WORD FROMR 2951 | .WORD DPM 2952 | .WORD SEMIS 2953 | ; 2954 | .BYTE 82H ;M/ 2955 | .BYTE 'M' 2956 | .BYTE '/'+$80 2957 | .WORD MSTAR-5 2958 | MSLAS: .WORD DOCOL 2959 | .WORD OVER 2960 | .WORD TOR 2961 | .WORD TOR 2962 | .WORD DABS 2963 | .WORD RR 2964 | .WORD ABS 2965 | .WORD USLAS 2966 | .WORD FROMR 2967 | .WORD RR 2968 | .WORD XORR 2969 | .WORD PM 2970 | .WORD SWAP 2971 | .WORD FROMR 2972 | .WORD PM 2973 | .WORD SWAP 2974 | .WORD SEMIS 2975 | ; 2976 | .BYTE 81H ; * 2977 | .BYTE '*'+$80 2978 | .WORD MSLAS-5 2979 | STAR: .WORD $+2 2980 | EXX ;/ SAVE IP 2981 | POP HL 2982 | POP DE 2983 | LD A,L ;/ 2984 | LD C,H ;/ 2985 | LD B,10H ;/ 2986 | LD HL,0 ;/ 2987 | STAR1: SRL C ;/ 2988 | RRA ;/ SRL CA (MPCATOR) 2989 | JR NC,STAR2 ;/ LSB (CA)=0? 2990 | ADD HL,DE ;/ NO, ADD MPCANT TO HL 2991 | STAR2: SLA E ;/ 2992 | RL D ;/ SLA DE (MPCANT 2 *) 2993 | DJNZ STAR1 ;/ DO ALL 16 BITS 2994 | PUSH HL ;/ (S1)<--PRODUCT 2995 | EXX ;/ RESTORE IP 2996 | JNEXT 2997 | ; 2998 | .BYTE 84H ; /MOD 2999 | .TEXT "/MO" 3000 | .BYTE 'D'+$80 3001 | .WORD STAR-4 3002 | SLMOD: .WORD $+2 3003 | POP DE ;/ DIVISOR 3004 | POP HL ;/ DIVIDEND 3005 | PUSH BC ;/ SAVE IP 3006 | XOR A ;/ RESET NEGATE FLAG 3007 | EX AF,AF' ;/ ALT SET 3008 | LD A,D ;/ 3009 | OR E ;/ DIV BY 0? 3010 | JR NZ,SLMOD1 ;/ 3011 | LD HL,-1 ;/ YES 3012 | LD D,H ;/ 3013 | LD E,L ;/ QUOT & REM <-- -1 3014 | JR SLMOD7 ;/ EXIT 3015 | SLMOD1: BIT 7,D ;/ DIVISOR NEGATIVE? 3016 | JR Z,SLMOD2 ;/ 3017 | LD A,E ;/ YES 3018 | CPL ;/ 3019 | LD E,A ;/ 3020 | LD A,D ;/ 3021 | CPL ;/ 3022 | LD D,A ;/ 3023 | INC DE ;/ (DE)<--(DE)'s 2's COMPLEMENT 3024 | EX AF,AF' ;/ STD SET 3025 | SCF ;/ SET NEGATE FLAG 3026 | EX AF,AF' ;/ ALT SET 3027 | SLMOD2: BIT 7,H ;/ DIVIDEND NEGATIVE? 3028 | JR Z,SLMOD3 ;/ 3029 | LD A,L ;/ YES 3030 | CPL ;/ 3031 | LD L,A ;/ 3032 | LD A,H ;/ 3033 | CPL ;/ 3034 | LD H,A ;/ 3035 | INC HL ;/ (HL)<--(HL)'s 2's COMPLEMENT 3036 | EX AF,AF' ;/ STD SET 3037 | CCF ;/ NEGATE FLAG 3038 | INC A ;/ DIVIDEND SIGN FLAG 3039 | EX AF,AF' ;/ ALT SET 3040 | SLMOD3: LD A,L ;/ 3041 | LD C,H ;/ (CA)<--DIVIDEND 3042 | LD HL,0 ;/ PRIME REMAINDER 3043 | LD B,10H ;/ LOOP COUNTER 3044 | SLMOD4: RLA ;/ 3045 | RL C ;/ RL CA 3046 | ADC HL,HL ;/ (HL)<--(HL) 2 * CARRY + 3047 | SBC HL,DE ;/ UNDERFLOW? 3048 | JR NC,SLMOD5 ;/ NO 3049 | ADD HL,DE ;/ YES, RESTORE REMAINDER 3050 | SLMOD5: CCF ;/ 3051 | DJNZ SLMOD4 ;/ DO ALL 16 BITS 3052 | RLA ;/ 3053 | RL C ;/ RL CA 3054 | LD E,A ;/ 3055 | LD D,C ;/ (DE)<--QUOTIENT 3056 | EX AF,AF' ;/ STD SET 3057 | JR Z,SLMOD6 ;/ DIVIDEND POSITIVE 3058 | LD A,L ;/ 3059 | CPL ;/ 3060 | LD L,A ;/ 3061 | LD A,H ;/ 3062 | CPL ;/ 3063 | LD H,A ;/ 3064 | INC HL ;/ REM GETS DIVIDEND'S SIGN 3065 | SLMOD6: JR NC,SLMOD7 ;/ QUOTIENT POSITIVE 3066 | LD A,E ;/ 3067 | CPL ;/ 3068 | LD E,A ;/ 3069 | LD A,D ;/ 3070 | CPL ;/ 3071 | LD D,A ;/ 3072 | INC DE ;/ NEGATIVE QUOTIENT 3073 | SLMOD7: POP BC ;/ RESTORE IP 3074 | EX DE,HL ;/ (S2)<--REMAINDER 3075 | JP DPUSH ;/ (S1)<--QUOTIENT 3076 | ; 3077 | .BYTE 81H ; / 3078 | .BYTE '/'+$80 3079 | .WORD SLMOD-7 3080 | SLASH: .WORD $+2 3081 | POP DE ;/ DIVISOR 3082 | POP HL ;/ DIVIDEND 3083 | PUSH BC ;/ SAVE IP 3084 | XOR A ;/ RESET NEG. FLAG 3085 | EX AF,AF' ;/ ALT SET 3086 | LD A,D ;/ 3087 | OR E ;/ DIV BY 0? 3088 | JR NZ,SLASH1 ;/ 3089 | LD HL,-1 ;/ YES, SET QUOTIENT TO -1 3090 | JR SLASH6 ;/ EXIT 3091 | SLASH1: BIT 7,D ;/ DIVISOR NEGATIVE? 3092 | JR Z,SLASH2 ;/ 3093 | LD A,E ;/ YES 3094 | CPL ;/ 3095 | LD E,A ;/ 3096 | LD A,D ;/ 3097 | CPL ;/ 3098 | LD D,A ;/ 3099 | INC DE ;/ (DE)<--(DE)'s 2's COMPLEMENT 3100 | EX AF,AF' ;/ STD SET 3101 | SCF ;/ SET NEG. FLAG 3102 | EX AF,AF' ;/ ALT SET 3103 | SLASH2: BIT 7,H ;/ DIVIDEND NEGATIVE? 3104 | JR Z,SLASH3 ;/ 3105 | LD A,L ;/ YES 3106 | CPL ;/ 3107 | LD L,A ;/ 3108 | LD A,H ;/ 3109 | CPL ;/ 3110 | LD H,A ;/ 3111 | INC HL ;/ (HL)<--(HL)'s 2's COMPLEMENT 3112 | EX AF,AF' ;/ STD SET 3113 | CCF ;/ NEG. FLAG 3114 | EX AF,AF' ;/ ALT SET 3115 | SLASH3: LD A,L ;/ 3116 | LD C,H ;/ (CA)<--DIVIDEND 3117 | LD HL,0 ;/ 3118 | LD B,10H ;/ LOOP COUNTER 3119 | SLASH4: RLA ;/ 3120 | RL C ;/ RL CA 3121 | ADC HL,HL ;/ (HL)<--(HL) 2 * CARRY + 3122 | SBC HL,DE ;/ UNDERFLOW? 3123 | JR NC,SLASH5 ;/ NO 3124 | ADD HL,DE ;/ YES, RESTORE REMAINDER 3125 | SLASH5: CCF ;/ 3126 | DJNZ SLASH4 ;/ DO ALL 16 BITS 3127 | RLA ;/ 3128 | RL C ;/ RL CA 3129 | LD L,A ;/ 3130 | LD H,C ;/ (HL)<--QUOTIENT 3131 | EX AF,AF' ;/ STD SET 3132 | JR NC,SLASH6 ;/ POSITIVE QUOTIENT 3133 | LD A,L ;/ 3134 | CPL ;/ 3135 | LD L,A ;/ 3136 | LD A,H ;/ 3137 | CPL ;/ 3138 | LD H,A ;/ 3139 | INC HL ;/ NEGATIVE QUOTIENT 3140 | SLASH6: POP BC ;/ RESTORE IP 3141 | JHPUSH 3142 | ; 3143 | .BYTE 83H ; MOD 3144 | .TEXT "MO" 3145 | .BYTE 'D'+$80 3146 | .WORD SLASH-4 3147 | MODD: .WORD DOCOL 3148 | .WORD SLMOD 3149 | .WORD DROP 3150 | .WORD SEMIS 3151 | ; 3152 | .BYTE 85H ; */MOD 3153 | .TEXT "*/MO" 3154 | .BYTE 'D'+$80 3155 | .WORD MODD-6 3156 | SSMOD: .WORD DOCOL 3157 | .WORD TOR 3158 | .WORD MSTAR 3159 | .WORD FROMR 3160 | .WORD MSLAS 3161 | .WORD SEMIS 3162 | ; 3163 | .BYTE 82H ; */ 3164 | .BYTE '*' 3165 | .BYTE '/'+$80 3166 | .WORD SSMOD-8 3167 | SSLA: .WORD DOCOL 3168 | .WORD SSMOD 3169 | .WORD SWAP 3170 | .WORD DROP 3171 | .WORD SEMIS 3172 | ; 3173 | .BYTE 85H ; M/MOD 3174 | .TEXT "M/MO" 3175 | .BYTE 'D'+$80 3176 | .WORD SSLA-5 3177 | MSMOD: .WORD DOCOL 3178 | .WORD TOR 3179 | .WORD ZERO 3180 | .WORD RR 3181 | .WORD USLAS 3182 | .WORD FROMR 3183 | .WORD SWAP 3184 | .WORD TOR 3185 | .WORD USLAS 3186 | .WORD FROMR 3187 | .WORD SEMIS 3188 | ; 3189 | ; Block moved down 2 pages 3190 | ; 3191 | .BYTE 86H ; (LINE) 3192 | .TEXT "(LINE" 3193 | .BYTE ')'+$80 3194 | .WORD MSMOD-8 3195 | PLINE: .WORD DOCOL 3196 | .WORD TOR 3197 | .WORD LIT 3198 | .WORD 40H 3199 | .WORD BBUF 3200 | .WORD SSMOD 3201 | .WORD FROMR 3202 | .WORD BSCR 3203 | .WORD STAR 3204 | .WORD PLUS 3205 | .WORD BLOCK 3206 | .WORD PLUS 3207 | .WORD LIT 3208 | .WORD 40H 3209 | .WORD SEMIS 3210 | ; 3211 | .BYTE 85H ; .LINE 3212 | .TEXT ".LIN" 3213 | .BYTE 'E'+$80 3214 | .WORD PLINE-9 3215 | DLINE: .WORD DOCOL 3216 | .WORD PLINE 3217 | .WORD DTRAI 3218 | .WORD TYPE 3219 | .WORD SEMIS 3220 | ; 3221 | .BYTE 87H ;MESSAGE 3222 | .TEXT "MESSAG" 3223 | .BYTE 'E'+$80 3224 | .WORD DLINE-8 3225 | MESS: .WORD DOCOL 3226 | .WORD WARN 3227 | .WORD AT 3228 | .WORD ZBRAN ;IF 3229 | .WORD MESS1-$ 3230 | .WORD DDUP 3231 | .WORD ZBRAN ;IF 3232 | .WORD MESS2-$ 3233 | .WORD LIT 3234 | .WORD 4 ;1st MESSAGE SCREEN 3235 | .WORD OFSET 3236 | .WORD AT 3237 | .WORD BSCR 3238 | .WORD SLASH 3239 | .WORD SUBB 3240 | .WORD DLINE 3241 | .WORD SPACE ;ENDIF 3242 | MESS2: .WORD BRAN ;ELSE 3243 | .WORD MESS3-$ 3244 | MESS1: .WORD PDOTQ 3245 | .BYTE 6 3246 | .TEXT "MSG # " 3247 | .WORD DOT ;ENDIF 3248 | MESS3: .WORD SEMIS 3249 | ; 3250 | .BYTE 82H ;P@ 3251 | .BYTE 'P' 3252 | .BYTE '@'+$80 3253 | .WORD MESS-0AH 3254 | PTAT: .WORD $+2 3255 | EXX ;d SAVE REGISTERS 3256 | POP BC ;d (BC)<--PORT# 3257 | IN L,(C) ;d (L)<--DATA BYTE 3258 | LD H,0 3259 | PUSH HL 3260 | EXX ;d RESTORE REGISTERS 3261 | JNEXT 3262 | ; 3263 | .BYTE 82H ;P! 3264 | .BYTE 'P' 3265 | .BYTE '!' + $80 3266 | .WORD PTAT-5 3267 | PTSTO: .WORD $+2 3268 | EXX ;d SAVE REGISTERS 3269 | POP BC ;d (C)<--PORT# 3270 | POP HL ;d (L)<--DATA BYTE 3271 | OUT (C),L 3272 | EXX ;d RESTORE REGISTERS 3273 | JNEXT 3274 | ; 3275 | .EJECT 3276 | #INCLUDE "DISCIO.ASM" 3277 | .EJECT 3278 | #INCLUDE "CONPRTIO.ASM" 3279 | .EJECT 3280 | #IFDEF ROMWBW 3281 | #INCLUDE "ROMWBW.ASM" 3282 | PREVNFA .EQU BCD-5 3283 | #ELSE 3284 | PREVNFA .EQU ARROW-6 3285 | #ENDIF 3286 | .EJECT 3287 | ; 3288 | .BYTE 0C1H ; ' (tick) 3289 | .BYTE 0A7H 3290 | .WORD PREVNFA 3291 | TICK: .WORD DOCOL 3292 | .WORD DFIND 3293 | .WORD ZEQU 3294 | .WORD ZERO 3295 | .WORD QERR 3296 | .WORD DROP 3297 | .WORD LITER 3298 | .WORD SEMIS 3299 | ; 3300 | .BYTE 86H ;FORGET 3301 | .TEXT "FORGE" 3302 | .BYTE 'T'+$80 3303 | .WORD TICK-4 3304 | FORG: .WORD DOCOL 3305 | .WORD CURR 3306 | .WORD AT 3307 | .WORD CONT 3308 | .WORD AT 3309 | .WORD SUBB 3310 | .WORD LIT 3311 | .WORD 18H 3312 | .WORD QERR 3313 | .WORD TICK 3314 | .WORD DUP 3315 | .WORD FENCE 3316 | .WORD AT 3317 | .WORD ULESS ;/ FORGET >8000h nw o.k. 3318 | .WORD LIT 3319 | .WORD 15H 3320 | .WORD QERR 3321 | .WORD DUP 3322 | .WORD NFA 3323 | .WORD DP 3324 | .WORD STORE 3325 | .WORD LFA 3326 | .WORD AT 3327 | .WORD CONT 3328 | .WORD AT 3329 | .WORD STORE 3330 | .WORD SEMIS 3331 | ; 3332 | .BYTE 84H ;BACK 3333 | .TEXT "BAC" 3334 | .BYTE 'K'+$80 3335 | .WORD FORG-9 3336 | BACK: .WORD DOCOL 3337 | .WORD HERE 3338 | .WORD SUBB 3339 | .WORD COMMA 3340 | .WORD SEMIS 3341 | ; 3342 | .BYTE 0C5H ;BEGIN 3343 | .TEXT "BEGI" 3344 | .BYTE 'N'+$80 3345 | .WORD BACK-7 3346 | BEGIN: .WORD DOCOL 3347 | .WORD QCOMP 3348 | .WORD HERE 3349 | .WORD ONE 3350 | .WORD SEMIS 3351 | ; 3352 | .BYTE 0C5H ;ENDIF 3353 | .TEXT "ENDI" 3354 | .BYTE 'F'+$80 3355 | .WORD BEGIN-8 3356 | ENDIFF: .WORD DOCOL 3357 | .WORD QCOMP 3358 | .WORD TWO 3359 | .WORD QPAIR 3360 | .WORD HERE 3361 | .WORD OVER 3362 | .WORD SUBB 3363 | .WORD SWAP 3364 | .WORD STORE 3365 | .WORD SEMIS 3366 | ; 3367 | .BYTE 0C4H ;THEN 3368 | .TEXT "THE" 3369 | .BYTE 'N'+$80 3370 | .WORD ENDIFF-8 3371 | THEN: .WORD DOCOL 3372 | .WORD ENDIFF 3373 | .WORD SEMIS 3374 | ; 3375 | .BYTE 0C2H ;DO 3376 | .BYTE 'D' 3377 | .BYTE 'O'+$80 3378 | .WORD THEN-7 3379 | DO: .WORD DOCOL 3380 | .WORD COMP 3381 | .WORD XDO 3382 | .WORD HERE 3383 | .WORD THREE 3384 | .WORD SEMIS 3385 | ; 3386 | .BYTE 0C4H ;LOOP 3387 | .TEXT "LOO" 3388 | .BYTE 'P'+$80 3389 | .WORD DO-5 3390 | LOOP: .WORD DOCOL 3391 | .WORD THREE 3392 | .WORD QPAIR 3393 | .WORD COMP 3394 | .WORD XLOOP 3395 | .WORD BACK 3396 | .WORD SEMIS 3397 | ; 3398 | .BYTE 0C5H ;+LOOP 3399 | .TEXT "+LOO" 3400 | .BYTE 'P'+$80 3401 | .WORD LOOP-7 3402 | PLOOP: .WORD DOCOL 3403 | .WORD THREE 3404 | .WORD QPAIR 3405 | .WORD COMP 3406 | .WORD XPLOO 3407 | .WORD BACK 3408 | .WORD SEMIS 3409 | ; 3410 | .BYTE 0C5H ;UNTIL 3411 | .TEXT "UNTI" 3412 | .BYTE 'L'+$80 3413 | .WORD PLOOP-8 3414 | UNTIL: .WORD DOCOL 3415 | .WORD ONE 3416 | .WORD QPAIR 3417 | .WORD COMP 3418 | .WORD ZBRAN 3419 | .WORD BACK 3420 | .WORD SEMIS 3421 | ; 3422 | .BYTE 0C3H ;END 3423 | .TEXT "EN" 3424 | .BYTE 'D'+$80 3425 | .WORD UNTIL-8 3426 | ENDD: .WORD DOCOL 3427 | .WORD UNTIL 3428 | .WORD SEMIS 3429 | ; 3430 | .BYTE 0C5H ;AGAIN 3431 | .TEXT "AGAI" 3432 | .BYTE 'N'+$80 3433 | .WORD ENDD-6 3434 | AGAIN: .WORD DOCOL 3435 | .WORD ONE 3436 | .WORD QPAIR 3437 | .WORD COMP 3438 | .WORD BRAN 3439 | .WORD BACK 3440 | .WORD SEMIS 3441 | ; 3442 | .BYTE 0C6H ;REPEAT 3443 | .TEXT "REPEA" 3444 | .BYTE 'T'+$80 3445 | .WORD AGAIN-8 3446 | REPEA: .WORD DOCOL 3447 | .WORD TOR 3448 | .WORD TOR 3449 | .WORD AGAIN 3450 | .WORD FROMR 3451 | .WORD FROMR 3452 | .WORD TWOMIN ;/ 3453 | .WORD ENDIFF 3454 | .WORD SEMIS 3455 | ; 3456 | .BYTE 0C2H ;IF 3457 | .BYTE 'I' 3458 | .BYTE 'F'+$80 3459 | .WORD REPEA-9 3460 | IFF: .WORD DOCOL 3461 | .WORD COMP 3462 | .WORD ZBRAN 3463 | .WORD HERE 3464 | .WORD ZERO 3465 | .WORD COMMA 3466 | .WORD TWO 3467 | .WORD SEMIS 3468 | ; 3469 | .BYTE 0C4H ;ELSE 3470 | .TEXT "ELS" 3471 | .BYTE 'E'+$80 3472 | .WORD IFF-5 3473 | ELSEE: .WORD DOCOL 3474 | .WORD TWO 3475 | .WORD QPAIR 3476 | .WORD COMP 3477 | .WORD BRAN 3478 | .WORD HERE 3479 | .WORD ZERO 3480 | .WORD COMMA 3481 | .WORD SWAP 3482 | .WORD TWO 3483 | .WORD ENDIFF 3484 | .WORD TWO 3485 | .WORD SEMIS 3486 | ; 3487 | .BYTE 0C5H ;WHILE 3488 | .TEXT "WHIL" 3489 | .BYTE 'E'+$80 3490 | .WORD ELSEE-7 3491 | WHILE: .WORD DOCOL 3492 | .WORD IFF 3493 | .WORD TWOP 3494 | .WORD SEMIS 3495 | ; 3496 | .BYTE 0C4H ;CASE 3497 | .TEXT "CAS" 3498 | .BYTE 'E'+$80 3499 | .WORD WHILE-8 3500 | CASE: .WORD DOCOL 3501 | .WORD QCOMP 3502 | .WORD CSPP 3503 | .WORD AT 3504 | .WORD SCSP 3505 | .WORD LIT 3506 | .WORD 4 3507 | .WORD SEMIS 3508 | ; 3509 | .BYTE 0C4H ;(OF) 3510 | .TEXT "(OF" 3511 | .BYTE ')'+$80 3512 | .WORD CASE-7 3513 | POF: .WORD $+2 3514 | POP HL 3515 | POP DE 3516 | OR A 3517 | SBC HL,DE 3518 | LD A,L 3519 | OR H 3520 | JP NZ,POF1 3521 | INC BC 3522 | INC BC 3523 | JP (IX) 3524 | POF1: PUSH DE 3525 | JP BRAN1 3526 | ; 3527 | .BYTE 0C2H ;OF 3528 | .BYTE 'O' 3529 | .BYTE 'F'+$80 3530 | .WORD POF-7 3531 | OFF: .WORD DOCOL 3532 | .WORD LIT 3533 | .WORD 04H 3534 | .WORD QPAIR 3535 | .WORD COMP 3536 | .WORD POF 3537 | .WORD HERE 3538 | .WORD ZERO 3539 | .WORD COMMA 3540 | .WORD LIT 3541 | .WORD 5 3542 | .WORD SEMIS 3543 | ; 3544 | .BYTE 0C5H ;ENDOF 3545 | .TEXT "ENDO" 3546 | .BYTE 'F'+$80 3547 | .WORD OFF-5 3548 | ENDOF: .WORD DOCOL 3549 | .WORD LIT 3550 | .WORD 5 3551 | .WORD QPAIR 3552 | .WORD COMP 3553 | .WORD BRAN 3554 | .WORD HERE 3555 | .WORD ZERO 3556 | .WORD COMMA 3557 | .WORD SWAP 3558 | .WORD TWO 3559 | .WORD THEN 3560 | .WORD LIT 3561 | .WORD 4 3562 | .WORD SEMIS 3563 | ; 3564 | .BYTE 0C7H ;ENDCASE 3565 | .TEXT "ENDCAS" 3566 | .BYTE 'E'+$80 3567 | .WORD ENDOF-8 3568 | ECASE: .WORD DOCOL 3569 | .WORD LIT 3570 | .WORD 4 3571 | .WORD QPAIR 3572 | .WORD COMP 3573 | .WORD DROP 3574 | ECAS1: .WORD SPAT 3575 | .WORD CSPP 3576 | .WORD AT 3577 | .WORD EQUAL 3578 | .WORD ZEQU 3579 | .WORD ZBRAN 3580 | .WORD ECAS2-$ 3581 | .WORD TWO 3582 | .WORD THEN 3583 | .WORD BRAN 3584 | .WORD ECAS1-$ 3585 | ECAS2: .WORD CSPP 3586 | .WORD STORE 3587 | .WORD SEMIS 3588 | ; 3589 | .BYTE 86H ;SPACES 3590 | .TEXT "SPACE" 3591 | .BYTE 'S'+$80 3592 | .WORD ECASE-10 3593 | SPACS: .WORD DOCOL 3594 | .WORD ZERO 3595 | .WORD MAX 3596 | .WORD DDUP 3597 | .WORD ZBRAN ;IF 3598 | .WORD SPAX1-$ 3599 | .WORD ZERO 3600 | .WORD XDO ;DO 3601 | SPAX2: .WORD SPACE 3602 | .WORD XLOOP ;LOOP ENDIF 3603 | .WORD SPAX2-$ 3604 | SPAX1: .WORD SEMIS 3605 | ; 3606 | .BYTE 82H ;<# 3607 | .BYTE '<' 3608 | .BYTE '#'+$80 3609 | .WORD SPACS-9 3610 | BDIGS: .WORD DOCOL 3611 | .WORD PAD 3612 | .WORD HLD 3613 | .WORD STORE 3614 | .WORD SEMIS 3615 | ; 3616 | .BYTE 82H ;#> 3617 | .BYTE '#' 3618 | .BYTE '>'+$80 3619 | .WORD BDIGS-5 3620 | EDIGS: .WORD DOCOL 3621 | .WORD DROP 3622 | .WORD DROP 3623 | .WORD HLD 3624 | .WORD AT 3625 | .WORD PAD 3626 | .WORD OVER 3627 | .WORD SUBB 3628 | .WORD SEMIS 3629 | ; 3630 | .BYTE 84H ;SIGN 3631 | .TEXT "SIG" 3632 | .BYTE 'N'+$80 3633 | .WORD EDIGS-5 3634 | SIGN: .WORD DOCOL 3635 | .WORD ROT 3636 | .WORD ZLESS 3637 | .WORD ZBRAN ;IF 3638 | .WORD SIGN1-$ 3639 | .WORD LIT 3640 | .WORD 2DH 3641 | .WORD HOLD ;ENDIF 3642 | SIGN1: .WORD SEMIS 3643 | ; 3644 | .BYTE 81H ;# 3645 | .BYTE '#'+$80 3646 | .WORD SIGN-7 3647 | DIG: .WORD DOCOL 3648 | .WORD BASE 3649 | .WORD AT 3650 | .WORD MSMOD 3651 | .WORD ROT 3652 | .WORD LIT 3653 | .WORD 9 3654 | .WORD OVER 3655 | .WORD LESS 3656 | .WORD ZBRAN ;IF 3657 | .WORD DIG1-$ 3658 | .WORD LIT 3659 | .WORD 7 3660 | .WORD PLUS ;ENDIF 3661 | DIG1: .WORD LIT 3662 | .WORD 30H 3663 | .WORD PLUS 3664 | .WORD HOLD 3665 | .WORD SEMIS 3666 | ; 3667 | .BYTE 82H ;#S 3668 | .BYTE '#' 3669 | .BYTE 'S'+$80 3670 | .WORD DIG-4 3671 | DIGS: .WORD DOCOL 3672 | DIGS1: .WORD DIG ;BEGIN 3673 | .WORD TDUP ;/ 3674 | .WORD ORR 3675 | .WORD ZEQU 3676 | .WORD ZBRAN ;UNTIL 3677 | .WORD DIGS1-$ 3678 | .WORD SEMIS 3679 | ; 3680 | .BYTE 83H ;D.R 3681 | .TEXT "D." 3682 | .BYTE 'R'+$80 3683 | .WORD DIGS-5 3684 | DDOTR: .WORD DOCOL 3685 | .WORD TOR 3686 | .WORD SWAP 3687 | .WORD OVER 3688 | .WORD DABS 3689 | .WORD BDIGS 3690 | .WORD DIGS 3691 | .WORD SIGN 3692 | .WORD EDIGS 3693 | .WORD FROMR 3694 | .WORD OVER 3695 | .WORD SUBB 3696 | .WORD SPACS 3697 | .WORD TYPE 3698 | .WORD SEMIS 3699 | ; 3700 | .BYTE 82H ;.R 3701 | .BYTE '.' 3702 | .BYTE 'R'+$80 3703 | .WORD DDOTR-6 3704 | DOTR: .WORD DOCOL 3705 | .WORD TOR 3706 | .WORD STOD 3707 | .WORD FROMR 3708 | .WORD DDOTR 3709 | .WORD SEMIS 3710 | ; 3711 | .BYTE 82H ;D. 3712 | .BYTE 'D' 3713 | .BYTE '.'+$80 3714 | .WORD DOTR-5 3715 | DDOT: .WORD DOCOL 3716 | .WORD ZERO 3717 | .WORD DDOTR 3718 | .WORD SPACE 3719 | .WORD SEMIS 3720 | ; 3721 | .BYTE 81H ; . 3722 | .BYTE '.'+$80 3723 | .WORD DDOT-5 3724 | DOT: .WORD DOCOL 3725 | .WORD STOD 3726 | .WORD DDOT 3727 | .WORD SEMIS 3728 | ; 3729 | .BYTE 81H ;? 3730 | .BYTE '?'+$80 3731 | .WORD DOT-4 3732 | QUES: .WORD DOCOL 3733 | .WORD AT 3734 | .WORD DOT 3735 | .WORD SEMIS 3736 | ; 3737 | .BYTE 82H ;U. 3738 | .BYTE 'U' 3739 | .BYTE '.'+$80 3740 | .WORD QUES-4 3741 | UDOT: .WORD DOCOL 3742 | .WORD ZERO 3743 | .WORD DDOT 3744 | .WORD SEMIS 3745 | ; 3746 | .BYTE 85H ;VLIST 3747 | .TEXT "VLIS" 3748 | .BYTE 'T'+$80 3749 | .WORD UDOT-5 3750 | VLIST: .WORD DOCOL 3751 | .WORD LIT 3752 | .WORD 80H 3753 | .WORD OUTT 3754 | .WORD STORE 3755 | .WORD CONT 3756 | .WORD AT 3757 | .WORD AT 3758 | VLIS1: .WORD OUTT ;BEGIN 3759 | .WORD AT 3760 | .WORD CSLL 3761 | .WORD GREAT 3762 | .WORD ZBRAN ;IF 3763 | .WORD VLIS2-$ 3764 | .WORD CR 3765 | .WORD ZERO 3766 | .WORD OUTT 3767 | .WORD STORE ;ENDIF 3768 | VLIS2: .WORD DUP 3769 | .WORD IDDOT 3770 | .WORD SPACE 3771 | .WORD SPACE 3772 | .WORD PFA 3773 | .WORD LFA 3774 | .WORD AT 3775 | .WORD DUP 3776 | .WORD ZEQU 3777 | .WORD QTERM 3778 | .WORD ORR 3779 | .WORD ZBRAN ;UNTIL 3780 | .WORD VLIS1-$ 3781 | .WORD DROP 3782 | .WORD SEMIS 3783 | ; 3784 | .BYTE 83H ;BYE 3785 | .TEXT "BY" 3786 | .BYTE 'E'+$80 3787 | .WORD VLIST-8 3788 | BYE: .WORD DOCOL ;/A 3789 | .WORD FLUSH ;/A 3790 | .WORD FCB,LIT ;/E 3791 | .WORD 10H,BDOS ;/E close file 3792 | .WORD DROP ;/E discard directory code 3793 | .WORD ZERO,ZERO ;/A 3794 | .WORD BDOS ;/A return to CP/M 3795 | .WORD SEMIS ;/A won't get this far, just for pretty 3796 | ; 3797 | .BYTE 84H ; PAGE 1.3 3798 | .TEXT "PAG" 3799 | .BYTE 'E'+$80 3800 | .WORD BYE-6 3801 | PAG .WORD DOCOL 3802 | .WORD LIT,FF 3803 | .WORD EMIT,CR 3804 | .WORD SEMIS 3805 | ; 3806 | .BYTE 84H ;LIST 3807 | .TEXT "LIS" 3808 | .BYTE 'T'+$80 3809 | .WORD PAG-7 3810 | LIST: .WORD DOCOL,DEC 3811 | .WORD CR,DUP 3812 | .WORD SCR,STORE 3813 | .WORD PDOTQ 3814 | .BYTE 6 3815 | .TEXT "SCR # " 3816 | .WORD DOT 3817 | .WORD LIT,10H 3818 | .WORD ZERO,XDO 3819 | LIST1: .WORD CR,IDO 3820 | .WORD THREE ;/ WAS LIT,3 3821 | .WORD DOTR,SPACE 3822 | .WORD IDO,SCR 3823 | .WORD AT,DLINE 3824 | .WORD QTERM 3825 | .WORD ZBRAN 3826 | .WORD LIST2-$ ;IF 3827 | .WORD LEAVE 3828 | LIST2: .WORD XLOOP 3829 | .WORD LIST1-$ ;ENDIF 3830 | .WORD CR,SEMIS 3831 | ; 3832 | .BYTE 85H ;INDEX 3833 | .TEXT "INDE" 3834 | .BYTE 'X'+$80 3835 | .WORD LIST-7 3836 | INDEX: .WORD DOCOL 3837 | .WORD LIT,FF 3838 | .WORD EMIT,CR 3839 | .WORD ONEP,SWAP 3840 | .WORD XDO 3841 | INDE1: .WORD CR,IDO 3842 | .WORD THREE ;/ WAS LIT,3 3843 | .WORD DOTR,SPACE 3844 | .WORD ZERO,IDO 3845 | .WORD DLINE,QTERM 3846 | .WORD ZBRAN 3847 | .WORD INDE2-$ ; IF 3848 | .WORD LEAVE ;ENDIF 3849 | INDE2: .WORD XLOOP 3850 | .WORD INDE1-$ 3851 | .WORD SEMIS 3852 | ; 3853 | .BYTE 85H ;TRIAD 3854 | .TEXT "TRIA" 3855 | .BYTE 'D'+$80 3856 | .WORD INDEX-8 3857 | TRIAD: .WORD DOCOL 3858 | .WORD LIT,FF 3859 | .WORD EMIT 3860 | .WORD THREE ;/ WAS LIT,3 3861 | .WORD SLASH 3862 | .WORD THREE ;/ WAS LIT,3 3863 | .WORD STAR 3864 | .WORD THREE ;/ WAS LIT,3 3865 | .WORD OVER,PLUS 3866 | .WORD SWAP,XDO 3867 | TRIA1: .WORD CR,IDO 3868 | .WORD LIST 3869 | .WORD QTERM 3870 | .WORD ZBRAN 3871 | .WORD TRIA2-$ ; IF 3872 | .WORD LEAVE 3873 | TRIA2: .WORD XLOOP 3874 | .WORD TRIA1-$ ; ENDIF 3875 | .WORD CR 3876 | .WORD LIT,15 3877 | .WORD MESS,CR 3878 | .WORD SEMIS 3879 | ; 3880 | .BYTE 84H ; SHOW 1.3 3881 | .TEXT "SHO" 3882 | .BYTE 'W'+$80 3883 | .WORD TRIAD-8 3884 | SHOW .WORD DOCOL 3885 | .WORD ONEP,SWAP 3886 | .WORD XDO 3887 | SHOW1 .WORD PAG,IDO 3888 | .WORD TRIAD 3889 | .WORD LIT,3 3890 | .WORD XPLOO 3891 | .WORD SHOW1-$ 3892 | .WORD SEMIS 3893 | ; 3894 | .BYTE 84H ;.CPU 3895 | .TEXT ".CP" 3896 | .BYTE 'U'+$80 3897 | .WORD SHOW-7 3898 | DOTCPU: .WORD DOCOL 3899 | .WORD BASE,AT 3900 | .WORD LIT,36 3901 | .WORD BASE,STORE 3902 | .WORD LIT,22H 3903 | .WORD PORIG,TAT 3904 | .WORD DDOT 3905 | .WORD BASE,STORE 3906 | .WORD SEMIS 3907 | ; 3908 | .BYTE 84H ;TASK 3909 | .TEXT "TAS" 3910 | .BYTE 'K'+$80 3911 | .WORD DOTCPU-7 3912 | TASK: .WORD DOCOL 3913 | .WORD SEMIS 3914 | ; 3915 | INITDP: .FILL 95,0 3916 | ; 3917 | .END 3918 | --------------------------------------------------------------------------------