diff --git a/.Docs/Forth Words.md b/.Docs/Forth Words.md index 372c148c..e077a7ea 100644 --- a/.Docs/Forth Words.md +++ b/.Docs/Forth Words.md @@ -2,7 +2,7 @@ ## Description -This document lists all of the **Forth Words** supported in the A2osX implementation of **FigForth**. Note that not all **Words** are implemented at this time, please check the *Status* and *Comment* Columns. Currently only an interpreter is available (*../bin/forth*) | | | though a compiler is planned | +This document lists all of the **Forth Words** supported in the A2osX implementation of **FORTH-79**. Note that not all **Words** are implemented at this time, please check the *Status* and *Comment* Columns. Currently only an interpreter is available (*../bin/forth*) | | | though a compiler is planned | ## Word Notation @@ -75,12 +75,15 @@ The definitions are listed in ASCII alphabetical order in several groups con | Word | Syntax | I/C | Status | Description | Comment | |-|-|-|-|-|-| | DUP | n -- n n | I,C | Working | Duplicate top of stack | | -| ?DUP | n -- n n | I,C | impl. | duplicate n if non-zero | | +| ?DUP | n -- n n | I,C | Working | duplicate n if non-zero | | | DROP | n -- | I,C | Working | Drop top number from the stack | | | SWAP | n1 n2 -- n2 n1 | I,C | Working | Reverse top two stack items | | | OVER | n1 n2 -- n1 n2 n1 | I,C | Working | Leave a copy of the second number on the stack. | | - - +| ROT | n1 n2 n3 -- n2 n3 n1 | I,C | Working | Rotate the top three values, bringing the deepest to the top. | | +| DEPTH | -- n | | | Leave number of the quantity of 16-bit values contained in the data stack, before n added | | +| >R | n -- | C | | Move n to return stack | | +| R> | -- n | C | | Transfer n from the return stack to the data stack. | | +| R@ | -- n | C | | Copy the number on top of the return stack to the data stack. | | ## COMPARISON @@ -110,6 +113,18 @@ The definitions are listed in ASCII alphabetical order in several groups con | 2+ | n -- n+2 | | | Increment n by two | | | 2- | n -- n-2 | | | Decrement n by two | | | MOD | n1 n2 -- n3 | I,C | Working | Divide n1 by n2, leaving the remainder n3, with the same sign as n1. | | +| U* | un1 un2 -- ud3 | | | Perform an unsigned multiplication of un1 by un2, leaving the double number product ud3. All values are unsigned. | | +| U. | un -- | I,C | Working | Display un converted according to BASE as an unsigned number, in a free-field format, with one trailing blank. | | +| U/MOD | ud1 un2 -- un3 un4 | | | Perform the unsigned division of double number ud1 by un2, leaving the remainder un3, and the quotient un4. All values are unsigned. | | +| U< | un1 un2 -- flag | | | Leave the flag representing the magnitude comparison of un1 < un2 where un1 and un2 are treated as 16-bit unsigned integers. | | +| ABS | n1 -- n1 | I,C | Working | Absolute value of n1 | | +| MAX | n1 n2 -- n3 | I,C | Working | Leave the greater of two numbers. | | +| MIN | n1 n2 -- n3 | I,C | Working | Leave the lesser of two numbers. | | +| NEGATE | n -- -n | | | Leave the two's complement of a number, i.e., the difference of zero less n. | | +| DNEGATE | d -- -d | I,C | Working | Leave the two's complement of a double number. | | +| AND | n1 n2 -- n3 | I,C | Working | Leave Logical bitwise AND of n1 and n2 | | +| OR | n1 n2 -- n3 | I,C | Working | Leave the bitwise inclusive-or of two numbers. | | +| XOR | n1 n2 -- n3 | I,C | Working | Leave the bitwise exclusive-or of two numbers. | | ## MEMORY @@ -117,11 +132,16 @@ The definitions are listed in ASCII alphabetical order in several groups con |-|-|-|-|-|-| | @ | addr -- n | I,C | Working | Put on stack number at addr | | | ! | n addr -- | I,C | Working | Store second word at address on top | | +| C@ | addr -- byte | | Working | Leave on stack addr, with high bits set to 0 for 16-bit field | | +| C! | n addr -- | | Working | Store least significant of n in addr | | ## CONTROL STRUCTURES | Word | Syntax | I/C | Status | Description | Comment | |-|-|-|-|-|-| +| IFTRUE | flag -- | I | | Begin an
IFTRUE ... OTHERWISE ... IFEND
conditional sequence. These conditional words operate like
IF ... ELSE ... THEN
except that they cannot be nested, and are to be used only during interpretation. In conjunction with the words [ and ] they may be used within a colon-definition to control compilation, although they are not to be compiled. | | +| OTHERWISE | | I | | An interpreter-level conditional word. See IFTRUE. | | +| IFEND | | I | | Terminate a conditional interpretation sequence begun by IFTRUE. | | | DO | n1 n2 -- | C | Working | Used in a colon-definition:
DO ... LOOP or
DO ... +LOOP
Begin a loop which will terminate based on control parameters. The loop index begins at n2, and terminates based on the limit n1. At LOOP or +LOOP, the index is modified by a positive or negative value. The range of a DO-LOOP is determined by the terminating word. DO-LOOP may be nested. Capacity for three levels of nesting is specified as a minimum for standard systems. | | | LOOP | -- | C | Working |Increment the DO-LOOP index by one, terminating the loop if the new index is equal to or greater than the limit. The limit and index are signed numbers in the range {-32,768..32,767}. | | | +LOOP | n -- | C | Working | Increment index by n. Terminate loop if outside limit | | @@ -130,6 +150,7 @@ The definitions are listed in ASCII alphabetical order in several groups con | J | -- n | C | | Return the index of the next outer loop. May only be used within a nested DO-LOOP in the form:
DO ... DO ... J ... LOOP ... LOOP | | | IF | flag -- | C | Working | Used in a colon-definition in the form:
flag IF ... ELSE ... THEN or
flag IF ... THEN
If flag is true, the words following IF are executed and the words following ELSE are skipped. The ELSE part is optional. If flag is false, words between IF and ELSE, or between IF and THEN (when no ELSE is used), are skipped. IF-ELSE-THEN conditionals may be nested. | | | ELSE | -- | C | Working | Used in a colon-definition in the form:
IF ... ELSE ... THEN
ELSE executes after the true part following IF. ELSE forces execution to skip till just after THEN. It has no effect on the stack. (see IF) | | +| THEN | -- | C | Working | Used in a colon-definition in the form:
IF ... ELSE ... THEN or
IF ... THEN
THEN is the point where execution resumes after ELSE or IF (when no ELSE is present). | | | BEGIN | -- | C | Working | Used in a colon-definition in the form:
BEGIN ... flag UNTIL or
BEGIN ... flag WHILE ... REPEAT
BEGIN marks the start of a word sequence for repetitive execution. A BEGIN-UNTIL loop will be repeated until flag is true. A BEGIN-WHILE-REPEAT loop will be repeated until flag is false. The words after UNTIL or REPEAT will be executed when either loop is finished. flag is always dropped after being tested. | | | WHILE | flag -- | C | Working | Used in the form:
BEGIN ... flag WHILE ... REPEAT
Select conditional execution based on flag. On a true flag, continue execution through to REPEAT, which then returns back to just after BEGIN. On a false flag, skip execution to just after REPEAT, exiting the structure. | | | REPEAT | -- | C | Working | Used in a colon-definition in the form:
BEGIN ... WHILE ... REPEAT
At run-time, REPEAT returns to just after the corresponding BEGIN. | | @@ -158,7 +179,9 @@ The definitions are listed in ASCII alphabetical order in several groups con | <# | -- | | | Initialize pictured number output | | | #> | d -- addr n | | | Terminate output string for TYPE | | | BASE | -- addr | U | | Leave address of variable containing current input-output number conversion base. {{2..70} | | +| OCTAL | -- | | | Set the number base to 8. | | | DECIMAL | -- | | | Set input-output numeric conversation base to ten | | +| HEX | -- | | | Set the numeric input-output conversion base to sixteen. | | | CONVERT | d1 addr1 -- d2 addr2 | | | Convert to the equivalent stack number the text beginning at addr1+1 with regard to BASE. The new value is accumulated into double number d1, being left as d2. addr2 is the address of the first non-convertible character. | | ## MASS STORAGE INPUT-OUTPUT @@ -171,6 +194,16 @@ The definitions are listed in ASCII alphabetical order in several groups con | SAVE-BUFFERS | | | | Write all blocks to mass-storage that have been flagged as UPDATEd. An error condition results if mass-storage writing is not completed. | | | EMPTY-BUFFERS | | | | Mark all block buffers as empty, without necessarily affecting their actual contents. UPDATEd blocks are not written to mass storage. | | +## DEFINING WORDS +| Word | Syntax | I/C | Status | Description | Comment | +|-|-|-|-|-|-| +| : | -- | I | Working | Begin a colon definition | | +| ; | -- | C | Working | End of a colon definition | | +| CONSTANT | n -- | I,C | Working | A defining word used in the form:
n CONSTANT **name**
to create a dictionary entry for **name**, leaving n in its parameter field. When **name** is later executed, n will be left on the stack. | | +| VARIABLE | n -- | I,C | Working | A defining word executed in the form:
VARIABLE **name** to create a dictionary entry for **name** and allot two bytes for storage in the parameter field. The application must initialize the stored value. When **name** is later executed, it will place the storage address on the stack. | | + + + ## Words | Word | Syntax | I/C | Status | Description | Comment | @@ -183,28 +216,18 @@ The definitions are listed in ASCII alphabetical order in several groups con | . | n -- | I,C | Working | Print number | | | ." | -- | I,C | Working | Print message terminated by " | | | 79-STANDARD | | | | Returns Error if FORTH-79 Standard is not available| | -| : | -- | I | Working | Begin a colon definition | | -| ; | -- | C | Working | End of a colon definition | | | >IN | -- addr | U | | Leave addr of variable of char offset input stream {0,,1023}| | -| >R | n -- | C | | Move n to return stack | | | ? | addr -- | I,C | Working | Print contents of address | | | ABORT -- | | | | Clear data and return stacks | | -| ABS | n1 -- n1 | I,C | Working | Absolute value of n1 | | | ALLOT | n -- | I,C | Working | Add n bytes to parameter field of most recently defined word | | -| AND | n1 n2 -- n3 | I,C | Working | Leave Logical bitwise AND of n1 and n2 | | | BLK | -- addr | U | | Leave the address of a variable containing the number of the mass storage block being interpreted as the input stream. If the content is zero, the input stream is taken from the terminal.| | | BUFFER | n -- addr | | | Obtain next block buffer, assign to n | | -| C! | n addr -- | | Working | Store least significant of n in addr | | -| C@ | addr -- byte | | Working | Leave on stack addr, with high bits set to 0 for 16-bit field | | | CMOVE | addr1 addr2 n -- | | | Move n bytes at addr1 to addr2 | | | COMPILE | | C | | When a word containing COMPILE executes, the 16-bit value following the compilation address of COMPILE is copied (compiled) into the dictionary. i.e., COMPILE DUP will copy the compilation address of DUP.
COMPILE [ 0 , ] will copy zero. | | -| CONSTANT | n -- | I,C | Working | A defining word used in the form:
n CONSTANT **name**
to create a dictionary entry for **name**, leaving n in its parameter field. When **name** is later executed, n will be left on the stack. | | | CONTEXT | -- addr | U | | Leave the address of a variable specifying the vocabulary in which dictionary searches are to be made, during interpretation of the input stream. | | | CREATE | | | | A defining word used in the form:
CREATE **name**
to create a dictionary entry for , without allocating any parameter field memory. When **name** is subsequently executed, the address of the first byte of **name**'s parameter field is left on the stack. | | | CURRENT | -- addr | U | | Leave the address of a variable specifying the vocabulary into which new word definitions are to be entered. | | | DEFINITIONS | -- | | | Set current vocabulary to context vocabulary | | -| DEPTH | -- n | | | Leave number of the quantity of 16-bit values contained in the data stack, before n added | | -| DNEGATE | d -- -d | I,C | impl. | Leave the two's complement of a double number. | | | DOES | | I,C | | Define the run-time action of a word created by a high-level defining word. Used in the form:
: **name** ... CREATE ... DOES> ... ;
and then **namex name**
Marks the termination of the defining part of the defining word **name** and begins the defining of the run-time action for words that will later be defined by **name**. On execution of **namex** the sequence of words between DOES> and ; are executed, with the address of **namex**'s parameter field on the stack. | | | EXECUTE | addr -- | | | Execute the dictionary entry whose compilation address is on the stack. | | | EXIT | | C | | When compiled within a colon-definition, terminate execution of that definition, at that point. May not be used within a DO...LOOP. | | @@ -216,30 +239,16 @@ The definitions are listed in ASCII alphabetical order in several groups con | HOLD | char -- | | | Insert ASCII character into pictured output string. May only be used between <# and #>. | | | IMMEDIATE | | | | Marks the most recently made dictionary entry as a word which will be executed when encountered during compilation rather than compiled. | | | LITERAL | n -- | I | | f compiling, then compile the stack value n as a 16-bit literal, which when later executed, will leave n on the stack. | | -| MAX | n1 n2 -- n3 | I,C | Working | Leave the greater of two numbers. | | -| MIN | n1 n2 -- n3 | I,C | Working | Leave the lesser of two numbers. | | | MOVE | addr1 addr2 n -- | | | Move the specified quantity n of 16-bit memory cells beginning at addr1 into memory at addr2. The contents of addr1 is moved first. If n is negative or zero, nothing is moved. | | -| NEGATE | n -- -n | | | Leave the two's complement of a number, i.e., the difference of zero less n. | | | NOT | flag1 -- flag2 | | | Reverse the boolean value of flag1. This is identical to 0=. | | -| OR | n1 n2 -- n3 | I,C | Working | Leave the bitwise inclusive-or of two numbers. | | | PAD | -- addr | I,C | Working | The address of a scratch area used to hold character strings for intermediate processing. The minimum capacity of PAD is 64 characters (addr through addr+63). | | | PICK | n1 -- n2 | | | Return the contents of the n1-th stack value, not counting n1 itself. An error condition results for n less than one.
2 PICK is equivalent to OVER. {1..n} | | | QUIT | | | | Clear the return stack, setting execution mode, and return control to the terminal. No message is given. | | -| R> | -- n | C | | Transfer n from the return stack to the data stack. | | -| R@ | -- n | C | | Copy the number on top of the return stack to the data stack. | | | ROLL | n -- | | | Extract the n-th stack value to the top of the stack, not counting n itself, moving the remaining values into the vacated position. An error condition results for n less than one. {1..n}
3 ROLL = ROT
1 ROLL = null operation | | -| ROT | n1 n2 n3 -- n2 n3 n1 | I,C | Working | Rotate the top three values, bringing the deepest to the top. | | | SCR | -- addr | U | | Leave the address of a variable containing the number of the screen most recently listed. | | | SIGN | n -- | C | | Insert the ASCII "-" (minus sign) into the pictured numeric output string, if n is negative. | | | STATE | -- addr | U | | Leave the address of the variable containing the compilation state. A non-zero content indicates compilation is occurring, but the value itself may be installation dependent. | | -| THEN | | C | Working | Used in a colon-definition in the form:
IF ... ELSE ... THEN or
IF ... THEN
THEN is the point where execution resumes after ELSE or IF (when no ELSE is present). | | -| U* | un1 un2 -- ud3 | | | Perform an unsigned multiplication of un1 by un2, leaving the double number product ud3. All values are unsigned. | | -| U. | un -- | I,C | Working | Display un converted according to BASE as an unsigned number, in a free-field format, with one trailing blank. | | -| U/MOD | ud1 un2 -- un3 un4 | | | Perform the unsigned division of double number ud1 by un2, leaving the remainder un3, and the quotient un4. All values are unsigned. | | -| U< | un1 un2 -- flag | | | Leave the flag representing the magnitude comparison of un1 < un2 where un1 and un2 are treated as 16-bit unsigned integers. | | -| VARIABLE | n -- | I,C | Working | A defining word executed in the form:
VARIABLE **name** to create a dictionary entry for **name** and allot two bytes for storage in the parameter field. The application must initialize the stored value. When **name** is later executed, it will place the storage address on the stack. | | | VOCABULARY | -- | | | A defining word executed in the form:
VOCABULARY **name**
to create (in the CURRENT vocabulary) a dictionary entry for **name**, which specifies a new ordered list of word definitions. Subsequent execution of **name** will make it the CONTEXT vocabulary. When **name** becomes the CURRENT vocabulary (see DEFINITIONS), new definitions will be created in that list.
In lieu of any further specification, new vocabularies 'chain' to FORTH. That is, when a dictionary search through a vocabulary is exhausted, FORTH will be searched. | | -| XOR | n1 n2 -- n3 | I,C | Working | Leave the bitwise exclusive-or of two numbers. | | | [ | | I | | End the compilation mode. The text from the input stream is subsequently executed. See ] | | | [COMPILE] | | I,C | | Used in a colon-definition in the form:
[COMPILE] **name**
Forces compilation of the following word. This allows compilation of an IMMEDIATE word when it would otherwise be executed. | | | ] | | | | Sets the compilation mode. The text from the input stream is subsequently compiled. See [ | | @@ -259,17 +268,16 @@ DOUBLE NUMBER WORD SET | 2ROT | d1 d2 d3 -- d2 d3 d1 | | | Rotate the third double number to the top of the stack. | | | 2SWAP | d1 d2 -- d2 d1 | | | Exchange the top two double numbers on the stack. | | | 2VARIABLE | | | | A defining word used in the form:
2VARIABLE **name**
to create a dictionary entry of **name** and assign four bytes for storage in the parameter field. When **name** is later executed, it will leave the address of the first byte of its parameter field is placed on the stack. | | -| D+ | d1 d2 -- d3 | I,C | impl. | Leave the arithmetic sum of d1 and d2. | | -| D- | d1 d2 -- d3 | I,C | impl. | Subtract d2 from d1 and leave the difference d3. | | -| D. | d -- | I,C | impl. | Display d converted according to BASE in a free field format, with one trailing blank. Display the sign only if negative. | | +| D+ | d1 d2 -- d3 | I,C | Working | Leave the arithmetic sum of d1 and d2. | | +| D- | d1 d2 -- d3 | I,C | Working | Subtract d2 from d1 and leave the difference d3. | | +| D. | d -- | I,C | Working | Display d converted according to BASE in a free field format, with one trailing blank. Display the sign only if negative. | | | D.R | d n -- | | | Display d converted according to BASE, right aligned in an n character field. Display the sign only if negative. | | | D0= | d -- flag | | | Leave true if d is zero. | | | D< | d1 d2 -- flag | | | True if d1 is less than d2. | | | D= | d1 d2 -- flag | | | True if d1 equals d2. | | -| DABS | d1 -- d2 | I,C | impl. | Leave as a positive double number d2, the absolute value of a double number, d1. {0..2,147,483,647} | | +| DABS | d1 -- d2 | I,C | Working | Leave as a positive double number d2, the absolute value of a double number, d1. {0..2,147,483,647} | | | DMAX | d1 d2 -- d3 | | | Leave the larger of two double numbers. | | | DMIN | d1 d2 -- d3 | | | Leave the smaller of two double numbers. | | -| DNEGATE | d -- -d | I,C | impl. | Leave the double number two's complement of a double number, i.e., the difference 0 less d. | | | DU< | ud1 ud2 -- flag | | | rue if ud1 is less than ud2. Both numbers are unsigned. | | ## Assembler Word Set @@ -329,10 +337,7 @@ The Reference Word Set contain both Standard Word Definitions and uncontrolled | ERASE | addr n -- | | Working | Fill an area of memory over n bytes with zeros, starting at addr. If n is zero or less, take no action. | | | FLD | -- addr | | | A variable pointing to the field length reserved for a number during output conversion. | | | H. | n -- | | | Output n as a hexadecimal integer with one trailing blank. The current base is unchanged. | | -| HEX | -- | | | Set the numeric input-output conversion base to sixteen. | | | I' | -- n | C | | Used within a colon-definition executed only from within a DO-LOOP to return the corresponding loop index. | | -| IFEND | | | | Terminate a conditional interpretation sequence begun by IFTRUE. | | -| IFTRUE | flag -- | | | Begin an
IFTRUE ... OTHERWISE ... IFEND
conditional sequence. These conditional words operate like
IF ... ELSE ... THEN
except that they cannot be nested, and are to be used only during interpretation. In conjunction with the words [ and ] they may be used within a colon-definition to control compilation, although they are not to be compiled. | | | INDEX | n1 n2 -- | | | Print the first line of each screen over the range {n1..n2}. This displays the first line of each screen of source text, which conventionally contains a title. | | | INTERPRET | | | | Begin interpretation at the character indexed by the contents of >IN relative to the block number contained in BLK, continuing until the input stream is exhausted. If BLK contains zero, interpret characters from the terminal input buffer. | | | K | -- n | C | | Within a nested DO-LOOP, return the index of the second outer loop. | | @@ -347,9 +352,7 @@ The Reference Word Set contain both Standard Word Definitions and uncontrolled | NOR | n1 n2 -- n3 | | | The one's complement of the logical or of n1 and n2. | | | NUMBER | addr -- n | | | Convert the count and character string at addr, to a signed 32-bit integer, using the current base. If numeric conversion is not possible, an error condition exists. The string may contain a preceding negative sign. | | | O. | n -- | | | Print n in octal format with one trailing blank. The value in base is unaffected. | | -| OCTAL | | | | Set the number base to 8. | | | OFFSET | -- addr | | | A variable that contains the offset added to the block number on the stack by BLOCK to determine the actual physical block number. The user must add any desired offset when utilizing BUFFER. | | -| OTHERWISE | | | | An interpreter-level conditional word. See IFTRUE. | | | PAGE | | | | Clear the terminal screen or perform an action suitable to the output device currently active. | | | READ-MAP | | | | Read to the next file mark on tape constructing a correspondence table in memory (the map) relating physical block position to logical block number. The tape should normally be rewound to its load point before executing READ-MAP. | | | REMEMBER | | | | A defining word used in the form:
REMEMBER **name**
Defines a word which, when executed, will cause **name** and all subsequently defined words to be deleted from the dictionary. **name** may be compiled into and executed from a colon definition. The sequence
DISCARD REMEMBER DISCARD
provides a standardized preface to any group of transient word definitions. | | diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index 4b718936..64188a7f 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/BIN/EDIT.S.txt b/BIN/EDIT.S.txt index e3ed20d9..86a03efe 100644 --- a/BIN/EDIT.S.txt +++ b/BIN/EDIT.S.txt @@ -388,7 +388,7 @@ CharIn.Esc >STZ.G bEscMode clc rts *-------------------------------------- -* \e[xx;yyR +* \e[xxx;yyyR *-------------------------------------- .3 stz TmpByte diff --git a/BIN/MEMDUMP.S.txt b/BIN/MEMDUMP.S.txt index e5d299d5..d4f3634c 100644 --- a/BIN/MEMDUMP.S.txt +++ b/BIN/MEMDUMP.S.txt @@ -9,6 +9,8 @@ NEW .INB inc/a2osx.i .INB inc/kernel.i .INB inc/io.i +*-------------------------------------- +PAGE.LEN .EQ 23 *-------------------------------------- .DUMMY .OR ZPBIN @@ -55,6 +57,7 @@ L.MSG1.HEX .DA MSG1.HEX L.MSG1X .DA MSG1X L.MSG2 .DA MSG2 L.MSG3 .DA MSG3 +L.MSG.CRLF .DA MSG.CRLF .DA 0 *-------------------------------------- CS.INIT clc @@ -71,7 +74,7 @@ CS.RUN ldx #ZPCodeLen-1 >SYSCALL GetMemStat jsr CS.RUN.INIT - +*-------------------------------------- CS.RUN.LOOP inc MEM.COUNT skip slot 0 jsr CS.RUN.CheckStop @@ -95,9 +98,13 @@ CS.RUN.LOOP inc MEM.COUNT skip slot 0 bne CS.RUN.LOOP jsr CS.RUN.SUMMARY + + jsr CS.RUN.MSTAT + + jsr CS.RUN.PrintCRLF jsr CS.RUN.INIT - +*-------------------------------------- CS.RUN.LOOPX inc MEM.COUNT skip slot 0 jsr CS.RUN.CheckStop @@ -124,7 +131,6 @@ CS.RUN.LOOPX inc MEM.COUNT skip slot 0 jsr CS.RUN.SUMMARY - jsr CS.RUN.MSTAT jsr CS.RUN.XSTAT lda #0 @@ -142,13 +148,17 @@ CS.RUN.INIT >LDYAI Mem.Table+S.MEM skip slot 0 stz USED.COUNT rts *-------------------------------------- -CS.RUN.SUMMARY >PUSHW L.MSG2 +CS.RUN.SUMMARY jsr CS.RUN.PrintCRLF + + >PUSHW L.MSG2 >PUSHB USED.COUNT >PUSHB MEM.COUNT >PUSHBI 2 jmp CS.RUN.PrintF *-------------------------------------- -CS.RUN.MSTAT >PUSHW L.MSG3 +CS.RUN.MSTAT jsr CS.RUN.PrintCRLF + + >PUSHW L.MSG3 >PUSHW.G MemStat+S.MSTAT.MH >PUSHW.G MemStat+S.MSTAT.MF >PUSHW.G MemStat+S.MSTAT.ML @@ -163,7 +173,9 @@ CS.RUN.MSTAT >PUSHW L.MSG3 >PUSHBI 8 jmp CS.RUN.PrintF *-------------------------------------- -CS.RUN.XSTAT >PUSHW L.MSG3 +CS.RUN.XSTAT jsr CS.RUN.PrintCRLF + + >PUSHW L.MSG3 >PUSHW.G MemStat+S.MSTAT.XH >PUSHW.G MemStat+S.MSTAT.XF >PUSHW.G MemStat+S.MSTAT.XL @@ -234,6 +246,7 @@ CS.RUN.PRINTMEM >PUSHW L.MSG1 jsr CS.RUN.PrintINV .12 >PUSHBI 9 + >SYSCALL PrintF lda (ZPPTR1) @@ -270,8 +283,7 @@ CS.RUN.PRINTMEM.DATA >PUSHW ZPPTR2 String >PUSHBI 3 - jsr CS.RUN.PrintF - rts + jmp CS.RUN.PrintF .2 >PUSHW L.MSG1.HEX @@ -284,8 +296,7 @@ CS.RUN.PRINTMEM.DATA >PUSHBI 16 - jsr CS.RUN.PrintF - rts + jmp CS.RUN.PrintF CS.RUN.PRINTMEM.BIN >PUSHW L.MSG1.BIN @@ -295,8 +306,7 @@ CS.RUN.PRINTMEM.BIN >SYSCALL GetMemPtr >PUSHYA >PUSHBI 2 - jsr CS.RUN.PrintF - rts + jmp CS.RUN.PrintF *-------------------------------------- CS.RUN.PRINTMEMX >PUSHW L.MSG1X @@ -358,8 +368,8 @@ CS.RUN.PRINTMEMX jsr CS.RUN.PrintINV .12 >PUSHBI 9 - jsr CS.RUN.PrintF - rts + + jmp CS.RUN.PrintF *-------------------------------------- CS.RUN.CHECKPS ldx #0 @@ -419,16 +429,21 @@ CS.RUN.PrintINV >PUSHW L.MSG1.INV >SYSCALL PrintF rts *-------------------------------------- +CS.RUN.PrintCRLF + >PUSHW L.MSG.CRLF + >PUSHBI 0 + CS.RUN.PrintF >SYSCALL PrintF bcs .9 inc LINE.COUNT lda LINE.COUNT - cmp #22 + cmp #PAGE.LEN bcc .8 dec bSTOP stz LINE.COUNT + clc .8 .9 rts *-------------------------------------- @@ -448,15 +463,16 @@ ZPCodeLen .EQ *-ZPCode MSG0 .AZ "hMem Flags PID REF PTR LEN BINPATH/DATA\r\n" MSG1.INV .AZ "\e[7m" MSG1 .AZ "$%h %s %3d %3d $%H %5D " -MSG1.BIN .AZ "{%s}\e[0m\r\n" +MSG1.BIN .AZ "\e[7m%s\e[0m\r\n" MSG1.STR .AZ "[%03d:%s]\e[0m\r\n" MSG1.HEX .AZ "?HEX:%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h.%h%h\e[0m\r\n" MSG1X .AZ "$%h %s %3d %3d $%H %5D\e[0m\r\n" MSG2 .AZ "Allocated hMem:%d, Total:%d\r\n" -MSG3 .AS "\r\nHigh Memory: $%H\r\n" - .AS "Free ULimit: $%H\r\n" - .AS "Low Memory: $%H\r\n" - .AZ "Free Memory: %D Bytes.\r\n\r\n" +MSG3 .AS "High Memory: $%H, " + .AS "Free ULimit: $%H, " + .AS "Low : $%H, " + .AS "Free : %5D Bytes." +MSG.CRLF .AZ "\r\n" MSG.FLAGS .AS "UZXAfcds" MSG.FLAGSX .AS "UZXAidep" *-------------------------------------- diff --git a/BIN/PS.S.txt b/BIN/PS.S.txt index e263b098..586f6c20 100644 --- a/BIN/PS.S.txt +++ b/BIN/PS.S.txt @@ -86,9 +86,8 @@ CS.RUN lda #1 sec rts -.10 >PUSHW L.MSG0 - >PUSHBI 0 - >SYSCALL PrintF +.10 >LDYA L.MSG0 + >SYSCALL Puts ldx Index .1 lda PS.Table.hPS,x @@ -213,9 +212,8 @@ CS.RUN.PrintArgs inc ZPArgV+1 bra .1 -.8 >PUSHW L.MSG3 - >PUSHBI 0 - >SYSCALL PrintF +.8 >LDYA L.MSG3 + >SYSCALL Puts .9 rts *-------------------------------------- CS.DOEVENT sec @@ -225,10 +223,11 @@ CS.QUIT clc rts *-------------------------------------- CS.END -MSG0 .AS "\e[?7lhPS pPID PID cPID CPU\% Status Flags UID Cmd Line" -MSG3 .AZ "\r\n" +MSG0 .DA #C.ESC + .AZ "[?7lhPS pPID PID cPID CPU\% Status Flags UID Args" MSG1 .AZ "%3d %3d %3d %3d %3d\% %6s %s %3d" -MSG2 .AZ " %s" +MSG2 .AS " %s" +MSG3 .DA #0 MSG.FLAGS .AS "HS???XEN" MSG.INIT .AZ "Init" MSG.RUN .AZ "Run" diff --git a/BIN/TELNET.S.txt b/BIN/TELNET.S.txt index 84545a02..eb50bacc 100644 --- a/BIN/TELNET.S.txt +++ b/BIN/TELNET.S.txt @@ -51,7 +51,6 @@ L.MSG.IPKO .DA MSG.IPKO L.MSG.USAGE .DA MSG.USAGE L.MSG.UNKNOWN .DA MSG.UNKNOWN L.MSG.HOSTOK .DA MSG.HOSTOK -L.MSG.SKTKO .DA MSG.SKTKO L.MSG.SKTOK .DA MSG.SKTOK L.MSG.SKTERR .DA MSG.SKTERR L.MSG.IOERR .DA MSG.IOERR @@ -61,6 +60,7 @@ L.MSG.USER .DA MSG.USER CS.INIT >LDYA L.LIBTCPIP >SYSCALL LoadLib bcs .9 + sta hLIBTCPIP .9 rts @@ -80,8 +80,10 @@ CS.RUN.IPOK ldy #S.PS.ARGC lda (pPS),y cmp #1 bcc .9 + ldy #S.IPCFG.IP+3 ldx #3 + .1 lda (ZPIPCfgPtr),y sta SA.LOCAL+S.SOCKADDR.ADDR,x dey @@ -120,6 +122,7 @@ CS.RUN.IPOK ldy #S.PS.ARGC CS.RUN.HOSTOK lda #2 >SYSCALL ArgV bcs CS.RUN.PORTOK + >SYSCALL AToI >STYA SA.REMOTE+S.SOCKADDR.PORT @@ -144,19 +147,14 @@ CS.RUN.OPENSKT >PUSHBI S.SOCKET.T.STREAM >LIBCALL hLIBTCPIP,LIBTCPIP.Socket bcs .9 - sta hSocket +.1 sta hSocket >PUSHA >PUSHW L.SA.LOCAL >LIBCALL hLIBTCPIP,LIBTCPIP.Bind bcc .2 -.9 pha - >LDYA L.MSG.SKTKO - >SYSCALL PutS - pla - sec -.99 rts +.9 jmp CS.RUN.SKTERR .2 lda #TIMEOUT.MAX sta TimeOut @@ -177,78 +175,71 @@ CS.RUN.OPENSKT >PUSHBI S.SOCKET.T.STREAM lda #ERR.SKT.NOCONN bra .9 -.4 >PUSHW L.MSG.SKTOK - >PUSHBI 0 - >SYSCALL PrintF +.4 >LDYA L.MSG.SKTOK + >SYSCALL Puts >LDYAI BUFSIZE >SYSCALL GetMem - bcs .99 + bcc .5 - >STYA ZPBufPtr +.5 >STYA ZPBufPtr stx hBuf - +*-------------------------------------- CS.RUN.LOOP >SLEEP lda hSocket >LIBCALL hLIBTCPIP,LIBTCPIP.EOF - bcs .98 + bcs CS.RUN.SKTERR tay bne .2 EOF, no char - >PUSHB hSocket - >PUSHW ZPBufPtr - >PUSHWI BUFSIZE + lda hSocket + jsr CS.RUN.PushRead >LIBCALL hLIBTCPIP,LIBTCPIP.Read -.98 bcs .99 + bcs CS.RUN.SKTERR >STYA ZPBufLen ldy #S.PS.hStdOut lda (pPS),y - >PUSHA - >PUSHW ZPBufPtr - - >PUSHW ZPBufLen + jsr CS.RUN.PushWrite >SYSCALL FWrite - bcs .11 + bcs CS.RUN.IOERR .2 ldy #S.PS.hStdIn lda (pPS),y >SYSCALL FEOF - bcs .11 CS.RUN.IOERR + bcs CS.RUN.IOERR tay bne CS.RUN.LOOP EOF = true, no char from STDIN ldy #S.PS.hStdIn lda (pPS),y - >PUSHA - >PUSHW ZPBufPtr - >PUSHWI BUFSIZE + jsr CS.RUN.PushRead >SYSCALL FRead -.11 bcc .3 + bcs CS.RUN.IOERR - bra CS.RUN.IOERR -.99 bra CS.RUN.SKTERR - -.3 >STYA ZPBufLen + >STYA ZPBufLen lda (ZPBufPtr) cmp #$14 Ctrl-T - beq CS.RUN.USER + beq CS.RUN.USERINT - >PUSHB hSocket - >PUSHW ZPBufPtr - >PUSHW ZPBufLen + lda hSocket + jsr CS.RUN.PushWrite >LIBCALL hLIBTCPIP,LIBTCPIP.Write -.9 bcs CS.RUN.SKTERR + bcc CS.RUN.LOOP +*-------------------------------------- +CS.RUN.SKTERR ldx #0 - jmp CS.RUN.LOOP + bra CS.RUN.ERR *-------------------------------------- -CS.RUN.SKTERR pha - >PUSHW L.MSG.SKTERR +CS.RUN.IOERR ldx #2 + +CS.RUN.ERR pha + >PUSHW L.MSG.SKTERR,x pla pha >PUSHA @@ -258,28 +249,31 @@ CS.RUN.SKTERR pha sec rts *-------------------------------------- -CS.RUN.IOERR pha - >PUSHW L.MSG.IOERR - pla - pha - >PUSHA - >PUSHBI 1 - >SYSCALL PrintF - pla - sec - rts -*-------------------------------------- -CS.RUN.USER >LDYA L.MSG.USER +CS.RUN.USERINT >LDYA L.MSG.USER >SYSCALL PutS lda #0 sec rts *-------------------------------------- +CS.RUN.PushRead >PUSHA + >PUSHW ZPBufPtr + >PUSHWI BUFSIZE + rts +*-------------------------------------- +CS.RUN.PushWrite + >PUSHA + >PUSHW ZPBufPtr + >PUSHW ZPBufLen + rts +*-------------------------------------- CS.DOEVENT lda (pEvent) bpl .9 is it a TIMER event? + lda TimeOut beq .9 + dec TimeOut + .9 sec do not discard TIMER event rts *-------------------------------------- @@ -308,8 +302,7 @@ MSG.IPKO .AZ "TCP/IP Not Loaded/Configured." MSG.USAGE .AZ "Usage : TELNET [port]" MSG.UNKNOWN .AZ "%s: Unknown host\r\n" MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s)..." -MSG.SKTKO .AZ "Failed to Open Socket." -MSG.SKTOK .AZ "Connected\r\n(Exit key is Ctrl-T)\r\n" +MSG.SKTOK .AZ "Connected\r\n(Exit key is Ctrl-T)" MSG.SKTERR .AZ "Socket Error : $%h\r\n" MSG.IOERR .AZ "I/O Error : $%h\r\n" MSG.USER .AZ "User interrupt." @@ -327,8 +320,7 @@ SA.REMOTE .DA #AF.INET S.SOCKADDR.AF .DUMMY .OR 0 DS.START -DS.END - .ED +DS.END .ED *-------------------------------------- MAN SAVE usr/src/bin/telnet.s diff --git a/BIN/TUITEST.S.txt b/BIN/TUITEST.S.txt index 8d8db43a..9aa090ae 100644 --- a/BIN/TUITEST.S.txt +++ b/BIN/TUITEST.S.txt @@ -12,6 +12,9 @@ NEW .DUMMY .OR ZPBIN ZS.START +ZPPtr1 .BS 2 +hScreen .BS 1 +hListBox .BS 1 ZS.END .ED *-------------------------------------- * File Header (16 Bytes) @@ -33,6 +36,8 @@ CS.START cld .DA CS.DOEVENT .DA CS.QUIT L.LIBTUI .DA LIBTUI +L.LBOX1 .DA LBOX1 +L.MSG.Screen .DA MSG.Screen .DA 0 *-------------------------------------- CS.INIT >LDYA L.LIBTUI @@ -44,16 +49,54 @@ CS.INIT >LDYA L.LIBTUI .9 clc rts *-------------------------------------- -CS.RUN +CS.RUN >LIBCALL hLIBTUI,LIBTUI.Open + bcs .9 - lda #E.SYN - sec - rts + sta hScreen + >SYSCALL GetMemPtr + >STYA ZPPtr1 + + >PUSHW L.MSG.Screen + + ldy #S.OBJ.X1 + +.1 lda (ZPPtr1),y + >PUSHA + iny + cpy #S.OBJ.Y2+1 + bne .1 + + >PUSHBI 6 + >SYSCALL printf + + >PUSHB hScreen + >PUSHW L.LBOX1 + >LIBCALL hLIBTUI,LIBTUI.LBOXNew + bcs .9 + + sta hListBox + +.2 >SYSCALL GetChar + bcs .9 + + cmp #3 + beq .9 + + >SYSCALL putchar + bcc .2 + + +.9 rts *-------------------------------------- CS.DOEVENT sec do not discard TIMER event rts *-------------------------------------- -CS.QUIT lda hLIBTUI +CS.QUIT lda hScreen + beq .1 + + >LIBCALL hLIBTUI,LIBTUI.Close + +.1 lda hLIBTUI beq .8 >SYSCALL UnloadLib @@ -66,7 +109,11 @@ CS.END LIBTUI .AZ "libtui" hLIBTUI .BS 1 *-------------------------------------- -LBOX1 .DA #10 X1 +MSG.Screen .AZ "Screen : X1=%d, Y1=%d, W=%d, H=%d,X2=%d, Y2=%d\r\n" +*-------------------------------------- +LBOX1 .DA #S.OBJ.T.LBOX T + .BS 3 + .DA #10 X1 .DA #4 Y1 .DA #20 W .DA #10 H diff --git a/DRV/SSC.DRV.S.txt b/DRV/SSC.DRV.S.txt index 50980c96..590d2d15 100644 --- a/DRV/SSC.DRV.S.txt +++ b/DRV/SSC.DRV.S.txt @@ -6,6 +6,7 @@ SSCIRQ .EQ 0 *-------------------------------------- .INB inc/macros.i .INB inc/a2osx.i + .INB inc/kernel.i .INB inc/mli.e.i .INB inc/com.i .INB inc/com.6551.i diff --git a/DRV/SSC.I.DRV.S.txt b/DRV/SSC.I.DRV.S.txt index fe320a3b..db126d2d 100644 --- a/DRV/SSC.I.DRV.S.txt +++ b/DRV/SSC.I.DRV.S.txt @@ -6,6 +6,7 @@ SSCIRQ .EQ 1 *-------------------------------------- .INB inc/macros.i .INB inc/a2osx.i + .INB inc/kernel.i .INB inc/mli.e.i .INB inc/com.i .INB inc/com.6551.i diff --git a/INC/LIBTUI.I.txt b/INC/LIBTUI.I.txt index 580897c5..6e36d1a2 100644 --- a/INC/LIBTUI.I.txt +++ b/INC/LIBTUI.I.txt @@ -1,8 +1,9 @@ NEW AUTO 3,1 *-------------------------------------- -LIBTUI.Init .EQ 4 +LIBTUI.Open .EQ 4 LIBTUI.Close .EQ 6 +LIBTUI.LBOXNew .EQ 8 *-------------------------------------- S.OBJ.T .EQ 0 S.OBJ.T.SCRN .EQ 0 @@ -12,6 +13,8 @@ S.OBJ.F .EQ 2 S.OBJ.F.bTITLE .EQ %10000000 S.OBJ.F.bMENU .EQ %01000000 S.OBJ.F.bSTATUS .EQ %00100000 +S.OBJ.F.bHBorder .EQ %00010000 +S.OBJ.F.bVBorder .EQ %00001000 S.OBJ.S .EQ 3 S.OBJ.S.bVISIBLE .EQ %10000000 S.OBJ.S.bACTIVE .EQ %01000000 @@ -25,7 +28,21 @@ S.OBJ.pTITLE .EQ 10 S.OBJ.pMENU .EQ 12 S.OBJ.pSTATUS .EQ 14 * -S.OBJ .EQ 16 +S.OBJ.InnerX .EQ 16 +S.OBJ.InnerY .EQ 17 +S.OBJ.InnerW .EQ 18 +S.OBJ.InnerH .EQ 19 +* +S.OBJ.Childs .EQ 32 +* +S.OBJ .EQ 48 +*-------------------------------------- +S.SCRN.bEscMode .EQ S.OBJ +S.SCRN.InBufPtr .EQ S.OBJ+1 +S.SCRN.InBuf .EQ S.OBJ+2 +S.SCRN.EndBuf .EQ S.OBJ+15 +* +S.SCRN .EQ S.OBJ+16 *-------------------------------------- S.LBOX.pL .EQ S.OBJ+0 S.LBOX.Idx .EQ S.OBJ+2 diff --git a/INC/NET.TELNET.I.txt b/INC/NET.TELNET.I.txt index ae516a73..362ed54b 100644 --- a/INC/NET.TELNET.I.txt +++ b/INC/NET.TELNET.I.txt @@ -1,6 +1,5 @@ NEW -PREFIX -AUTO 4,1 + AUTO 3,1 *-------------------------------------- * https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/+/jb-dev/sysroot/usr/include/arpa/telnet.h * https://web.maths.unsw.edu.au/~lafaye/CCM/internet/telnet.htm diff --git a/LIB/LIBTUI.S.txt b/LIB/LIBTUI.S.txt index 2a4f9c60..10a74f3f 100644 --- a/LIB/LIBTUI.S.txt +++ b/LIB/LIBTUI.S.txt @@ -7,14 +7,14 @@ NEW *-------------------------------------- .INB inc/macros.i .INB inc/a2osx.i - .INB inc/kernel.i + .INB inc/net.telnet.i .INB inc/libtui.i *-------------------------------------- .DUMMY .OR ZPLIB -hCtx .BS 1 +hScrn .BS 1 .BS 1 -ZPCtxPtr .BS 2 +ZPScrnPtr .BS 2 ZPObjPtr .BS 2 ZPPtr1 .BS 2 .ED @@ -35,39 +35,127 @@ CS.START cld *-------------------------------------- .1 .DA LIB.LOAD .DA LIB.UNLOAD - .DA Init - .DA Close + .DA LIB.Open + .DA LIB.Close + .DA LIB.LBOXNew *-------------------------------------- +L.SEQ.TERMCAP .DA SEQ.TERMCAP L.SEQ.INIT .DA SEQ.INIT +L.FMT.ESCCSI.R .DA FMT.ESCCSI.R .DA 0 *-------------------------------------- -LIB.LOAD clc - rts -*-------------------------------------- -LIB.UNLOAD clc - rts -*-------------------------------------- -Init >LDYAI 256 - >SYSCALL GetMem +LIB.LOAD lda LibCnt + bne .8 + + >LDYAI 256 + >SYSCALL2 GetMem bcs .9 + stx hLineBuf - txa -* clc + +.8 inc LibCnt + clc .9 rts *-------------------------------------- -Close clc +LIB.UNLOAD dec LibCnt + bne .8 + + lda hLineBuf + >SYSCALL2 FreeMem + +.8 clc rts *-------------------------------------- -LIBTUI.LBOXNew >PULLB hCtx - >SYSCALL GetMemPtr - >STYA ZPCtxPtr +LIB.Open >LDYAI S.SCRN + >SYSCALL2 GetMem + bcs .99 - >PULLW ZPPtr1 + >STYA ZPScrnPtr + txa + >PUSHA + + lda #0 + + ldy #S.SCRN-1 + +.10 sta (ZPScrnPtr),y + dey + bpl .10 + + jsr CheckCh.Reset + + >LDYA L.SEQ.TERMCAP + >SYSCALL2 puts + + lda #0 + >PUSHA + +.1 >SLEEP + + ldy #1 + lda (pStack),y + jsr GetScrn + + jsr CheckCh + bcs .97 + + beq .2 + + >SYSCALL2 PutChar + bcs .97 + +.2 ldy #S.OBJ.W + lda (ZPScrnPtr),y + bne .8 + + lda (pStack) + dec + sta (pStack) + bne .1 + + lda #80 + + ldy #S.OBJ.W + sta (ZPScrnPtr),y + + lda #24 + iny S.OBJ.H + sta (ZPScrnPtr),y + +.8 inc pStack + + >LDYA ZPScrnPtr + jsr LIB.SetObjX2Y2 + + >PULLA hScrn + clc + rts + +.97 inc pStack + inc pStack + +.98 pha + lda hScrn + >SYSCALL2 FreeMem + pla + sec + +.99 rts +*-------------------------------------- +LIB.Close >SYSCALL2 FreeMem + + clc + rts +*-------------------------------------- +LIB.LBOXNew >PULLW ZPPtr1 Params + + >PULLA hScrn + jsr GetScrn >LDYAI S.LBOX - >SYSCALL GetMem + >SYSCALL2 GetMem bcs .9 >STYA ZPObjPtr @@ -76,36 +164,43 @@ LIBTUI.LBOXNew >PULLB hCtx sta (ZPObjPtr) ldy #S.OBJ.P - lda hCtx + lda hScrn sta (ZPObjPtr),y iny #S.OBJ.F + lda #S.OBJ.F.bHBorder+S.OBJ.F.bVBorder + sta (ZPObjPtr),y + + ldy #S.OBJ.X1 .1 lda (ZPPtr1),y sta (ZPObjPtr),y - + iny cpy #S.OBJ.H+1 bne .1 + + .8 txa clc .9 rts *-------------------------------------- -LIBTUI.LBOXLoad >SYSCALL GetMemPtr +LIB.LBOXSetData >SYSCALL2 GetMemPtr >STYA ZPObjPtr rts *-------------------------------------- -LIBTUI.LBOXFocus +LIB.LBOXFocus *-------------------------------------- -LIBTUI.LBOXRun +LIB.LBOXRun *-------------------------------------- -LIBTUI.LBOXClose +LIB.LBOXClose clc rts *-------------------------------------- -LIBGUI.SetupX2Y2 +LIB.SetObjX2Y2 >STYA ZPObjPtr + ldy #S.OBJ.X1 jsr .1 @@ -122,11 +217,207 @@ LIBGUI.SetupX2Y2 sta (ZPObjPtr),y rts *-------------------------------------- -LIBTUI.DrawFrame +LIB.DrawFrame + clc + rts +*-------------------------------------- +CheckCh ldy #S.PS.hStdIn + lda (pPS),y + >SYSCALL2 FEOF + bcs .9 + tay + bne .18 + + >SYSCALL2 GetChar + bcs .9 + + tax + + ldy #S.SCRN.bEscMode + lda (ZPScrnPtr),y + beq .20 + + bmi .40 IAC mode + + iny S.SCRN.InBufPtr + lda (ZPScrnPtr),y + + cpx #'[' CSI ? + bne .10 + + cmp #S.SCRN.InBufPtr + bne .49 buffer not empty...bad SEQ + +.10 jsr CheckCh.ToBuf + bcs .49 Buffer Full + + cpx #'[' + beq .18 + + cpx #64 + bcs CheckCh.ESCSEQ if CC, not a letter...SEQ is incomplete + +.18 lda #0 + clc + rts +*-------------------------------------- +.20 cpx #C.ESC + bne .30 + + inc A = $01 + + jsr CheckCh.SetMode + + lda #0 + clc + rts +*-------------------------------------- +.30 cpx #IAC + bne .38 + + dec A = $FF + jsr CheckCh.SetMode + + inx X = 0 + +.38 txa + clc + rts +*-------------------------------------- +.40 jsr CheckCh.ToBuf + bcs .49 Buffer Full + + cpy #S.SCRN.InBuf First char... + beq .48 + + ldy #S.SCRN.InBuf + lda (ZPScrnPtr),y + cmp #SB + bne CheckCh.IACSEQ + + cpx #SE + bne .48 + + bra CheckCh.IACSEQ + +.49 jsr CheckCh.Reset + +.48 lda #0 + clc +.9 rts +*-------------------------------------- +CheckCh.ESCSEQ cmp #S.SCRN.InBuf+2 + bcs .2 + + ldy #ESC.Out-ESC.In-1 + txa + +.1 cmp ESC.In,y + beq .7 + + dey + bpl .1 + + bra .6 +*-------------------------------------- +* \e[xxx;yyyR +*-------------------------------------- +.2 cpx #'R' Response to cursor position query? + bne .6 + + lda #S.SCRN.InBuf+1 skip ESC [ + jsr GetScrnOfs + >PUSHYA + + >PUSHW L.FMT.ESCCSI.R + + lda #S.OBJ.H + jsr GetScrnOfs + >PUSHYA + + lda #S.OBJ.W + jsr GetScrnOfs + >PUSHYA + + >PUSHBI 4 2 pointers + >SYSCALL2 sscanf + +.6 ldx #0 + bra .8 + +.7 ldx ESC.Out,y + +.8 jsr CheckCh.Reset + + txa + clc +.9 rts +*-------------------------------------- +CheckCh.IACSEQ + >DEBUG + jsr CheckCh.Reset + + lda #0 + clc + rts +*-------------------------------------- +CheckCh.Reset lda #0 + +CheckCh.SetMode ldy #S.SCRN.bEscMode + sta (ZPScrnPtr),y + + iny Y = S.SCRN.InBufPtr + tya + sta (ZPScrnPtr),y + + rts +*-------------------------------------- +CheckCh.ToBuf ldy #S.SCRN.InBufPtr + lda (ZPScrnPtr),y + + cmp #S.SCRN.EndBuf buffer full + bcs .9 + + phy + inc + tay + txa + sta (ZPScrnPtr),y + tya + ply + sta (ZPScrnPtr),y + +* clc + +.9 rts +*-------------------------------------- +GetScrn sta hScrn + >SYSCALL2 GetMemPtr + >STYA ZPScrnPtr + rts +*-------------------------------------- +GetScrnOfs clc + adc ZPScrnPtr + tay + lda ZPScrnPtr+1 + adc #0 +.9 rts *-------------------------------------- CS.END *-------------------------------------- +LibCnt .BS 1 +hLineBuf .BS 1 +*-------------------------------------- +ESC.In .AS "DBAC" +ESC.Out .HS 080A0B15 +*-------------------------------------- +FMT.ESCCSI.R .AZ "%d;%d" +*-------------------------------------- +SEQ.TERMCAP .DA #C.ESC + .AS "[999;999H" Set Cursor Pos to 999,999 + .DA #C.ESC + .AZ "[6n" then query Cursor Pos SEQ.INIT .AS "\ec\e(B\e)0" SEQ.SCROLLRGN .AZ "\e[?7l\e[2;%dr" SEQ.SCROLLCURUP .AS "\e[?7l\e[%d;%dr" diff --git a/SBIN/GETTY.S.txt b/SBIN/GETTY.S.txt index 882a02f7..fdfdb4dc 100644 --- a/SBIN/GETTY.S.txt +++ b/SBIN/GETTY.S.txt @@ -10,7 +10,7 @@ NEW .INB inc/net.telnet.i *-------------------------------------- TIMEOUT.MAX .EQ 40 4 sec. -IAC.BUF.MAX .EQ 32 +IAC.BUF.MAX .EQ 20 *-------------------------------------- .DUMMY .OR ZPBIN @@ -22,10 +22,14 @@ ArgDev .BS 1 ArgProg .BS 1 hFILE .BS 1 bExitOnClose .BS 1 + IAC.CMD .BS 1 IAC.SUBCMD .BS 1 IAC.SB.CMD .BS 1 IAC.SB.LEN .BS 1 + +IAC.BUF .BS IAC.BUF.MAX + ZS.END .ED *-------------------------------------- * File Header (16 Bytes) @@ -90,13 +94,13 @@ CS.RUN ldy #S.PS.ARGC stx ArgProg bra .1 -.9 >PUSHW L.MSG.USAGE - >PUSHBI 0 - >SYSCALL PrintF +.9 >LDYA L.MSG.USAGE + >SYSCALL PutS + lda #E.SYN sec .99 rts - +*-------------------------------------- .8 lda ArgProg beq .9 @@ -120,7 +124,7 @@ CS.RUN ldy #S.PS.ARGC sta (pPS),y iny #S.PS.hStdErr sta (pPS),y - +*-------------------------------------- CS.RUN.LOOP0 >SLEEP >PUSHW L.ENV.TERM @@ -229,6 +233,7 @@ CS.RUN.IAC.SB >SYSCALL GetChar Wait for IAC SB.IS or SEND sta IAC.SB.CMD stz IAC.SB.LEN + .2 >SYSCALL GetChar bcs .9 @@ -236,10 +241,10 @@ CS.RUN.IAC.SB >SYSCALL GetChar Wait for IAC SB.IS or SEND beq .4 end of DATA, go wait SE ldy IAC.SB.LEN - sta (pData),y + sta IAC.BUF,y iny lda #0 - sta (pData),y + sta IAC.BUF,y sty IAC.SB.LEN cpy #IAC.BUF.MAX bne .2 @@ -261,9 +266,10 @@ CS.RUN.IAC.SB >SYSCALL GetChar Wait for IAC SB.IS or SEND bne .8 >PUSHW L.ENV.TERM - >PUSHW pData IAC.SB.DATA + >PUSHWI IAC.BUF >SYSCALL SetEnv .8 jmp CS.RUN.LOOP1 + .9 rts *-------------------------------------- CS.RUN.GREETINGS @@ -328,14 +334,15 @@ CS.END OptionList .AS "Ee" OptionVars .DA #bExitOnClose,#bExitOnClose MSG.GREETINGS .AZ "\r\nA2osX-GeTTY %d.%d on %s\r\n" -MSG.USAGE .AS "Usage : GETTY \r\n" - .AZ " -E : Exit on disconnect\r\n" +MSG.USAGE .AS "Usage : GETTY " + .DA #C.CR,#C.LF + .AZ " -E : Exit on disconnect" *-------------------------------------- TELNETOPTS .DA #IAC,#WILL,#TN.O.BINARY .DA #IAC,#WILL,#TN.O.ECHO .DA #IAC,#WILL,#TN.O.SGA .DA #IAC,#DO,#TN.O.SGA -* .DA #IAC,#DO,#TN.O.NAWS + .DA #IAC,#DO,#TN.O.NAWS .DA #IAC,#DO,#TN.O.TTYPE .DA #IAC,#DO,#TN.O.LINEMODE TELNETOPTS.LEN .EQ *-TELNETOPTS @@ -350,7 +357,6 @@ ENV.TERM .AZ "TERM" .DUMMY .OR 0 DS.START -IAC.SB.DATA .BS IAC.BUF.MAX DS.END .ED MAN SAVE usr/src/sbin/getty.s diff --git a/SBIN/LOGIN.S.txt b/SBIN/LOGIN.S.txt index 11c1cec4..2b1dbe3e 100644 --- a/SBIN/LOGIN.S.txt +++ b/SBIN/LOGIN.S.txt @@ -33,8 +33,8 @@ ZPNewSession .BS 1 ZPOldSession .BS 1 ZPhFile .BS 1 -ZS.END - .ED + +ZS.END .ED *-------------------------------------- * File Header (16 Bytes) *-------------------------------------- @@ -56,23 +56,24 @@ CS.START cld .DA CS.RUN .DA CS.DOEVENT .DA CS.QUIT -L.MSG.NOAUTH .DA MSG.NOAUTH L.MSG.LOGIN .DA MSG.LOGIN L.MSG.PASSWORD .DA MSG.PASSWORD L.MSG.BAD .DA MSG.BAD -L.MSG.CRLF .DA MSG.CRLF L.MSG.BS .DA MSG.BS +L.MSG.CRLF .DA MSG.CRLF +L.ETCNOAUTH .DA ETCNOAUTH L.ETCISSUE .DA ETCISSUE L.ETCMOTD .DA ETCMOTD L.SHELL .DA SHELL .DA 0 *-------------------------------------- +CS.QUIT +*-------------------------------------- CS.INIT clc CS.INIT.RTS rts *-------------------------------------- CS.RUN >LDYA L.ETCISSUE jsr CS.RUN.DumpFile - bcs CS.INIT.RTS lda #0 >PUSHA ROOT user @@ -81,9 +82,8 @@ CS.RUN >LDYA L.ETCISSUE >SYSCALL GetPWUID bcc CS.RUN.AUTH *-------------------------------------- - >LDYA L.MSG.NOAUTH - jsr CS.RUN.StrOut - bcs CS.INIT.RTS + >LDYA L.ETCNOAUTH + jsr CS.RUN.DumpFile *-------------------------------------- CS.RUN.EXECPS >LDYA L.ETCMOTD jsr CS.RUN.DumpFile @@ -94,13 +94,14 @@ CS.RUN.EXECPS >LDYA L.ETCMOTD bcs .9 >SLEEP + .9 rts *-------------------------------------- CS.RUN.AUTH lda #3 sta ZPRetryCnt .1 >LDYA L.MSG.LOGIN - jsr CS.RUN.StrOut + jsr CS.RUN.printf bcs .9 >LEA.G Username @@ -110,7 +111,7 @@ CS.RUN.AUTH lda #3 bcs .9 >LDYA L.MSG.PASSWORD - jsr CS.RUN.StrOut + jsr CS.RUN.printf bcs .9 >LDYA pData >LEA.G Password @@ -120,7 +121,7 @@ CS.RUN.AUTH lda #3 bcs .9 >LDYA L.MSG.CRLF - jsr CS.RUN.StrOut + >SYSCALL Puts bcs .9 >PUSHW pData >PUSHEA.G Password @@ -256,7 +257,7 @@ CS.RUN.GetLine >STYA ZPGetLinePtr bmi .1 >LDYA L.MSG.BS - jsr CS.RUN.StrOut + jsr CS.RUN.printf bra .1 .8 ldy ZPGetLineLen @@ -265,9 +266,9 @@ CS.RUN.GetLine >STYA ZPGetLinePtr clc .9 rts *-------------------------------------- -CS.RUN.StrOut >PUSHYA +CS.RUN.printf >PUSHYA >PUSHBI 0 - >SYSCALL PrintF + >SYSCALL printf rts *-------------------------------------- CS.RUN.DumpFile >PUSHYA @@ -287,13 +288,13 @@ CS.RUN.DumpFile >PUSHYA stx ZPhBuf .1 >PUSHB ZPhFile - >PUSHW ZPBufPtr + jsr .7 >PUSHWI 255 >SYSCALL FGetS bcs .8 - >PUSHW ZPBufPtr - >PUSHW ZPBufPtr + jsr .7 + jsr .7 >SYSCALL Expand >LDYA ZPBufPtr @@ -303,7 +304,7 @@ CS.RUN.DumpFile >PUSHYA .8 lda ZPhBuf >SYSCALL FreeMem - clc +* clc .9 php pha @@ -312,22 +313,24 @@ CS.RUN.DumpFile >PUSHYA pla plp .99 rts + +.7 >PUSHW ZPBufPtr + rts *-------------------------------------- CS.DOEVENT sec rts *-------------------------------------- -CS.QUIT clc - rts -*-------------------------------------- CS.END *-------------------------------------- -MSG.NOAUTH .AS "\r\n\r\nA2osX-Login:No ETC/PASSWD file present, Logged as ROOT.\r\n" - .AS "Consider adding ROOT password with USERADD command.\r\n" -MSG.CRLF .AZ "\r\n" -MSG.LOGIN .AZ "\r\nlogin:" -MSG.PASSWORD .AZ "\r\npassword:" +MSG.LOGIN .DA #C.CR,#C.LF + .AZ "login:" +MSG.PASSWORD .DA #C.CR,#C.LF + .AZ "password:" +*-------------------------------------- MSG.BAD .AZ "Bad user or password" -MSG.BS .DA #C.BS,#C.SPACE,#C.BS,#0 +MSG.BS .DA #C.BS,#C.SPACE,#C.BS +MSG.CRLF .HS 00 +ETCNOAUTH .AZ "${ROOT}etc/noauth" ETCISSUE .AZ "${ROOT}etc/issue" ETCMOTD .AZ "${ROOT}etc/motd" SHELL .AZ "${SHELL}" diff --git a/SHARED/X.SSC.DRV.S.txt b/SHARED/X.SSC.DRV.S.txt index c783e163..5e4bf8d4 100644 --- a/SHARED/X.SSC.DRV.S.txt +++ b/SHARED/X.SSC.DRV.S.txt @@ -278,14 +278,14 @@ Dev.BaudT10pA pha >PUSHBI 0 >PUSHBI 0 >PUSHBI 10 - >FPU MUL32 + >FPU uMUL >PUSHBI 0 >PUSHBI 0 >PUSHBI 0 pla >PUSHA - >FPU ADD32 + >FPU uADD >PULLL DCB+S.DCB.COM.BAUD rts *-------------------------------------- @@ -873,5 +873,5 @@ DCB .DA #S.DCB.T.COM DRV.END MAN SAVE usr/src/shared/x.ssc.drv.s -LOAD usr/src/drv/ssc.drv.s +LOAD usr/src/drv/ssc.i.drv.s ASM diff --git a/SYS/KERNEL.S.BIN.txt b/SYS/KERNEL.S.BIN.txt index 1b7c1664..b109c5a2 100644 --- a/SYS/KERNEL.S.BIN.txt +++ b/SYS/KERNEL.S.BIN.txt @@ -275,22 +275,54 @@ K.InsDrv >STYA ZPPtr3 SRC PTR for move ldy #0 .1 inx bne .2 + pla inc beq .3 + pha .2 lda (ZPPtr3),y sta (ZPPtr4),y iny bne .1 + inc ZPPtr3+1 inc ZPPtr4+1 bra .1 + .3 jsr BIN.RelDrv Relocate at Ptr1 + .7 ldy #$ff SELF MODIFIED .8 lda #$ff SELF MODIFIED .9 rts *-------------------------------------- +MEM.GetKBuf pha + tya + clc + adc DevMgr.Free + tax + pla + adc DevMgr.Free+1 + bcs .99 we crossed $FFFF, out of mem + + cpx #DevMgr.HiMem + pha + sbc /DevMgr.HiMem + pla + bcs .99 No More Room... + + ldy DevMgr.Free + stx DevMgr.Free + ldx DevMgr.Free+1 + sta DevMgr.Free+1 + txa +* clc + rts + +.99 lda #E.OOM +* sec + rts +*-------------------------------------- BIN.RelExe ldy #H.BIN.T+1 lda (ZPPtr1),y cmp /H.BIN.T.BIN65 diff --git a/SYS/KERNEL.S.MEM.txt b/SYS/KERNEL.S.MEM.txt index 1553bed0..a8baa452 100644 --- a/SYS/KERNEL.S.MEM.txt +++ b/SYS/KERNEL.S.MEM.txt @@ -615,33 +615,6 @@ MEM.SetA1A2 jsr K.GetMemPtr rts *-------------------------------------- -MEM.GetKBuf pha - tya - clc - adc DevMgr.Free - tax - pla - adc DevMgr.Free+1 - bcs .99 we crossed $FFFF, out of mem - - cpx #DevMgr.HiMem - pha - sbc /DevMgr.HiMem - pla - bcs .99 No More Room... - - ldy DevMgr.Free - stx DevMgr.Free - ldx DevMgr.Free+1 - sta DevMgr.Free+1 - txa -* clc - rts - -.99 lda #E.OOM -* sec - rts -*-------------------------------------- MAN SAVE usr/src/sys/kernel.s.mem LOAD usr/src/sys/kernel.s diff --git a/SYS/KERNEL.S.txt b/SYS/KERNEL.S.txt index 7a1c364c..5d31ee32 100644 --- a/SYS/KERNEL.S.txt +++ b/SYS/KERNEL.S.txt @@ -38,7 +38,6 @@ MAIN.B .PH A2osX.EndTables .INB usr/src/sys/kernel.s.drv .INB usr/src/sys/kernel.s.pft .INB usr/src/sys/kernel.s.fs - .INB usr/src/sys/kernel.s.math16 .INB usr/src/sys/kernel.s.mathf Mem.MLoMem .EQ * .EP @@ -110,6 +109,7 @@ E0.B .PH $E000 .INB usr/src/sys/kernel.s.irq .INB usr/src/sys/kernel.s.shared .INB usr/src/sys/kernel.s.math + .INB usr/src/sys/kernel.s.math16 .INB usr/src/sys/kernel.s.math32 .INB usr/src/sys/kernel.s.term