mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-10 06:29:33 +00:00
Kernel 0.94++
This commit is contained in:
parent
6b25a8947f
commit
15ea182602
|
@ -51,17 +51,17 @@ The definitions are listed in ASCII alphabetical order in several groups con
|
|||
|
||||
#### Nucleus Words
|
||||
|
||||
! * */ */MOD + +! +loop - / /MOD 0< 0= 0> 1+ 1- 2+ 2- < = > >R ?DUP @ ABS AND begin C! C@ colon CMOVE constant create D+ D< DEPTH DNEGATE do does> DROP DUP else EXECUTE EXIT FILL I if J LEAVE literal loop MAX MIN MOD MOVE NEGATE NOT OR OVER PICK R> R@ repeat ROLL ROT semicolon SWAP then U* U/ until variable while XOR
|
||||
! * */ */MOD + +! +loop - / /MOD 0< 0= 0> 1+ 1- 2+ 2- < = > >R ?DUP @ ABS AND begin C! C@ colon CMOVE constant create D+ D< DEPTH DNEGATE do does> DROP DUP else EXECUTE EXIT FILL I if J LEAVE literal loop MAX MIN MOD MOVE NEGATE NOT OR OVER PICK R> R@ repeat ROLL ROT semicolon SWAP then U* U/ until variable while XOR
|
||||
|
||||
(note that lower case entries refer to just the run-time code corresponding to a compiling word.)
|
||||
|
||||
#### Interpreter Words
|
||||
|
||||
# #> #S ' ( -TRAILING . 79-STANDARD <# >IN ? ABORT BASE BLK CONTEXT CONVERT COUNT CR CURRENT DECIMAL EMIT EXPECT FIND FORTH HERE HOLD KEY PAD QUERY QUIT SIGN SPACE SPACES TYPE U. WORD
|
||||
# #> #S ' ( -TRAILING . 79-STANDARD <# >IN ? ABORT BASE BLK CONTEXT CONVERT COUNT CR CURRENT DECIMAL EMIT EXPECT FIND FORTH HERE HOLD KEY PAD QUERY QUIT SIGN SPACE SPACES TYPE U. WORD
|
||||
|
||||
#### Compiler Words
|
||||
|
||||
+LOOP , ." : ; ALLOT BEGIN COMPILE CONSTANT CREATE DEFINITIONS DO DOES> ELSE FORGET IF IMMEDIATE LITERAL LOOP REPEAT STATE THEN UNTIL VARIABLE VOCABULARY WHILE [ [COMPILE] ]
|
||||
+LOOP , ." : ; ALLOT BEGIN COMPILE CONSTANT CREATE DEFINITIONS DO DOES> ELSE FORGET IF IMMEDIATE LITERAL LOOP REPEAT STATE THEN UNTIL VARIABLE VOCABULARY WHILE [ [COMPILE] ]
|
||||
|
||||
#### Device Words
|
||||
|
||||
|
@ -71,50 +71,50 @@ BLOCK BUFFER EMPTY-BUFFERS LIST LOAD SAVE-BUFFERS SCR UPDATE
|
|||
|
||||
| Word | Syntax | I/C | Status | Description | Comment |
|
||||
|-|-|-|-|-|-|
|
||||
| ! | n addr -- | | Working | Store second word at address on top | |
|
||||
| ! | n addr -- | I,C | Working | Store second word at address on top | |
|
||||
| # | ud1 -- ud2 | | | Convert one digit of double number and add character to output string | |
|
||||
| #> | d -- addr n | | | Terminate output string for TYPE | |
|
||||
| #S | ud -- 0 0 | | | Convert all significant digits of double number to output string | |
|
||||
| ' | -- addr | I | | Find address of next string in dictionary | |
|
||||
| | -- | I | | Begin comment, terminated by | |
|
||||
| * | n1 n2 -- n3 | | Working | Arithmetic product of n1 times n2 | |
|
||||
| * | n1 n2 -- n3 | I,C | Working | Arithmetic product of n1 times n2 | |
|
||||
| */ | n1 n2 n3 -- n4 | || Multiply n1 by n2, divide result by n3 and leave quotient in n4 | |
|
||||
| */MOD | n1 n2 n3 -- n4 n5 | | | Multiply n1 by n2, divide result by n3 and leave remainder in n4 and quotient in n5 | |
|
||||
| + | n1 n2 -- n3 | | Working | Arithmetic result of n1 plus n2 | |
|
||||
| + | n1 n2 -- n3 | I,C | Working | Arithmetic result of n1 plus n2 | |
|
||||
| +! | n addr -- | | Working | Add second 16-bit number to contents of address | |
|
||||
| +LOOP | n -- | I,C | Working | Increment index by n. Terminate loop if outside limit | |
|
||||
| +LOOP | n -- | C | Working | Increment index by n. Terminate loop if outside limit | |
|
||||
| , | n -- | | | Allot two bytes in dictionary, storing n there | |
|
||||
| - | n1 n2 -- n3 | | Working | Subtract n2 from n1 leaveing result in n3 | |
|
||||
| - | n1 n2 -- n3 | I,C | Working | Subtract n2 from n1 leaveing result in n3 | |
|
||||
| -TRAILING | addr n1 -- addr n2 | | | Adjust char count n1 of a text string at addr to exclude trailing blank, resulting in string at addr new length on n2| |
|
||||
| . | n -- | | Working | Print number | |
|
||||
| ." | -- | I | Working | Print message terminated by " | |
|
||||
| / | n1 n2 -- n3 | | Working | Divide n1 divide by n2, leave quotient in n3| |
|
||||
| /MOD | n1 n2 -- n3 n4 | | Working | Divide n1 divide by n2, leave remainder in n3 and quotient in n4 | |
|
||||
| 0< | n -- flag | | Working | True if n less than zero | |
|
||||
| 0= | n -- flag | | Working | True if n zero | |
|
||||
| 0> | n -- flag | | Working | True if n greater than zero | |
|
||||
| . | n -- | I,C | Working | Print number | |
|
||||
| ." | -- | I,C | Working | Print message terminated by " | |
|
||||
| / | n1 n2 -- n3 | I,C | Working | Divide n1 divide by n2, leave quotient in n3| |
|
||||
| /MOD | n1 n2 -- n3 n4 | I,C | Working | Divide n1 divide by n2, leave remainder in n3 and quotient in n4 | |
|
||||
| 0< | n -- flag | I,C | Working | True if n less than zero | |
|
||||
| 0= | n -- flag | I,C | Working | True if n zero | |
|
||||
| 0> | n -- flag | I,C | Working | True if n greater than zero | |
|
||||
| 1+| n -- n+1 | | | Increment n by one | |
|
||||
| 1- | n -- n-1 | | | Decrement n by one | |
|
||||
| 2+ | n -- n+2 | | | Increment n by two | |
|
||||
| 2- | n -- n-2 | | | Decrement n by two| |
|
||||
| 79-STANDARD | | | | Returns Error if FORTH-79 Standard is not available| |
|
||||
| : | -- | | Working | Begin a colon definition | |
|
||||
| ; | -- | I,C | Working | End of a colon definition | |
|
||||
| < | n1 n2 -- flag | | Working | True if n1 less than n2 | |
|
||||
| : | -- | I | Working | Begin a colon definition | |
|
||||
| ; | -- | C | Working | End of a colon definition | |
|
||||
| < | n1 n2 -- flag | I,C | Working | True if n1 less than n2 | |
|
||||
| <# | -- | | | Initialize pictured number output | |
|
||||
| = | n1 n2 -- flag | | Working | True if n1 equal to n2 | |
|
||||
| > | n1 n2 -- flag | | Working | True if n1 greater than n2 | |
|
||||
| = | n1 n2 -- flag | I,C | Working | True if n1 equal to n2 | |
|
||||
| > | n1 n2 -- flag | I,C | Working | True if n1 greater than n2 | |
|
||||
| >IN | -- addr | U | | Leave addr of variable of char offset input stream {0,,1023}| |
|
||||
| >R | n -- | C | | Move n to return stack | |
|
||||
| ? | addr -- | | Working | Print contents of address | |
|
||||
| ? | addr -- | I,C | Working | Print contents of address | |
|
||||
| ?DUP | n -- n ( n) | | duplicate n if non-zero | |
|
||||
| @ | addr -- n | | Working | Put on stack number at addr | |
|
||||
| @ | addr -- n | I,C | Working | Put on stack number at addr | |
|
||||
| ABORT | | | Clear data and return stacks | |
|
||||
| ABS | n1 -- n1 | | Working | Absolute value of n1 | |
|
||||
| ALLOT | n -- | | Working | Add n bytes to parameter field of most recently defined word | |
|
||||
| AND | n1 n2 -- n3 | | Working | Leave Logical bitwise AND of n1 and n2 | |
|
||||
| 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 | |
|
||||
| BASE | -- addr | U | | Leave address of variable containing current input-output number conversion base. {{2..70} | |
|
||||
| BEGIN | -- | I,C | Working | Used in a colon-definition in the form: <br>BEGIN ... flag UNTIL or<br>BEGIN ... flag WHILE ... REPEAT <br> 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. | |
|
||||
| BEGIN | -- | C | Working | Used in a colon-definition in the form: <br>BEGIN ... flag UNTIL or<br>BEGIN ... flag WHILE ... REPEAT <br> 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. | |
|
||||
| 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.| |
|
||||
| BLOCK | n -- addr | | | Return address of first byte of memory for block n. If block n is not in memory, retrieve it first | |
|
||||
| BUFFER | n -- addr | | | Obtain next block buffer, assign to n | |
|
||||
|
@ -122,37 +122,37 @@ BLOCK BUFFER EMPTY-BUFFERS LIST LOAD SAVE-BUFFERS SCR UPDATE
|
|||
| 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. <br>COMPILE [ 0 , ] will copy zero. | |
|
||||
| CONSTANT | n -- | | Working | A defining word used in the form: <br>n CONSTANT **name** <br>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. | |
|
||||
| CONSTANT | n -- | I,C | Working | A defining word used in the form: <br>n CONSTANT **name** <br>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. | |
|
||||
| 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. | |
|
||||
| COUNT | addr -- addr+1 n | | | Leave the address addr+1 and the character count of text beginning at addr. The first byte at addr must contain the character count n. Range of n is {0..255}. | |
|
||||
| CR | -- | | Working | Do a carriage-return | |
|
||||
| CR | -- | I,C | Working | Do a carriage-return | |
|
||||
| CREATE | | | | A defining word used in the form: <br>CREATE **name**<br> to create a dictionary entry for <name>, 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. | |
|
||||
| D+ | d1 d2 -- d3 | | Working | Leave arithmetic sum of d1 plus d2 | |
|
||||
| D+ | d1 d2 -- d3 | I,C | Working | Leave arithmetic sum of d1 plus d2 | |
|
||||
| D< | d1 d2 -- flag | | | True is d1 less than d2 | |
|
||||
| DECIMAL | -- | | | Set input-output numeric conversation base to ten | |
|
||||
| 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 | | | Leave the two's complement of a double number. | |
|
||||
| DO | n1 n2 -- | I,C | Working | Used in a colon-definition: <br>DO ... LOOP or <br>DO ... +LOOP <br>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. | |
|
||||
| DOES | | I,C| | Define the run-time action of a word created by a high-level defining word. Used in the form: <br>: **name** ... CREATE ... DOES> ... ; <br>and then **namex name**<br>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. | |
|
||||
| DROP | n -- | | Working | Drop top number from the stack | |
|
||||
| DUP | n -- n n | | Working | Duplicate top of stack | |
|
||||
| ELSE | -- | I,C | Working | Used in a colon-definition in the form: <br>IF ... ELSE ... THEN <br> 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) | |
|
||||
| EMIT | char -- | | Working | Transmit character to current output device | |
|
||||
| DO | n1 n2 -- | C | Working | Used in a colon-definition: <br>DO ... LOOP or <br>DO ... +LOOP <br>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. | |
|
||||
| DOES | | I,C | | Define the run-time action of a word created by a high-level defining word. Used in the form: <br>: **name** ... CREATE ... DOES> ... ; <br>and then **namex name**<br>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. | |
|
||||
| DROP | n -- | I,C | Working | Drop top number from the stack | |
|
||||
| DUP | n -- n n | I,C | Working | Duplicate top of stack | |
|
||||
| ELSE | -- | C | Working | Used in a colon-definition in the form: <br>IF ... ELSE ... THEN <br> 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) | |
|
||||
| EMIT | char -- | I,C | Working | Transmit character to current output device | |
|
||||
| EMPTY-BUFFERS | | | | Mark all block buffers as empty, without necessarily affecting their actual contents. UPDATEd blocks are not written to mass storage. | |
|
||||
| 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. | |
|
||||
| EXPECT | addr n -- | | | Transfer characters from the terminal beginning at addr, upward, until a "return" or the count of n has been received. Take no action for n less than or equal to zero. One or two nulls are added at the end of text. | |
|
||||
| FILL | addr n byte -- | | Working | Fill memory starting at addr with n copies of byte | |
|
||||
| FILL | addr n byte -- | I,C | Working | Fill memory starting at addr with n copies of byte | |
|
||||
| FIND | -- addr ||| Leave the compilation address of the next word name, which is accepted from the input stream. If that word cannot be found in the dictionary after a search of CONTEXT and FORTH leave zero. | |
|
||||
| FORGET | -- | | | Execute in the form: <br>FORGET **name** <br>Delete from the dictionary **name** (which is in the CURRENT vocabulary) and all words added to the dictionary after **name**, regardless of their vocabulary. Failure to find **name** in CURRENT or FORTH is an error condition. | |
|
||||
| FORTH | -- | I | | The name of the primary vocabulary. Execution makes FORTH the CONTEXT vocabulary. New definitions become a part of the FORTH until a differing CURRENT vocabulary is established. User vocabularies conclude by 'chaining' to FORTH, so it should be considered that FORTH is 'contained' within each user's vocabulary.y | |
|
||||
| HERE | -- addr | | Working | Return address of next available dictionary location.| |
|
||||
| HOLD | char -- | | | Insert ASCII character into pictured output string. May only be used between <# and #>. | |
|
||||
| I | -- n | C | Working | Copy loop index on stack. May only be used in the form: <br>DO ... I ... LOOP or <br>DO ... I ... +LOOP | |
|
||||
| IF | flag -- | I,C | Working | Used in a colon-definition in the form:<br>flag IF ... ELSE ... THEN or<br>flag IF ... THEN<br>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. | |
|
||||
| IF | flag -- | C | Working | Used in a colon-definition in the form:<br>flag IF ... ELSE ... THEN or<br>flag IF ... THEN<br>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. | |
|
||||
| IMMEDIATE | | | | Marks the most recently made dictionary entry as a word which will be executed when encountered during compilation rather than compiled. | |
|
||||
| J | -- n | C | | Return the index of the next outer loop. May only be used within a nested DO-LOOP in the form: <br>DO ... DO ... J ... LOOP ... LOOP | |
|
||||
| KEY | -- char | | Working | Read key, put ASCII value on stack | |
|
||||
|
@ -160,44 +160,44 @@ BLOCK BUFFER EMPTY-BUFFERS LIST LOAD SAVE-BUFFERS SCR UPDATE
|
|||
| LIST | n -- | | | List the ASCII symbolic contents of screen n on the current output device, setting SCR to contain n. n is unsigned. | |
|
||||
| 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. | |
|
||||
| LOAD | n -- | | | Begin interpretation of screen n by making it the input stream; preserve the locators of the present input stream (from >IN and BLK). If interpretation is not terminated explicitly it will be terminated when the input stream is exhausted. Control then returns to the input stream containing LOAD, determined by the input stream locators >IN and BLK. | |
|
||||
| LOOP | -- | I,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}. | |
|
||||
| MAX | n1 n2 -- n3 | | Working | Leave the greater of two numbers. | |
|
||||
| MIN | n1 n2 -- n3 | | Working | Leave the lesser of two numbers. | |
|
||||
| MOD | n1 n2 -- n3 | | Working | Divide n1 by n2, leaving the remainder n3, with the same sign as n1. | |
|
||||
| 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}. | |
|
||||
| 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. | |
|
||||
| MOD | n1 n2 -- n3 | I,C | Working | Divide n1 by n2, leaving the remainder n3, with the same sign as n1. | |
|
||||
| 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 | | Working | Leave the bitwise inclusive-or of two numbers. | |
|
||||
| OVER | n1 n2 -- n1 n2 n1 | | Working | Leave a copy of the second number on the stack. | |
|
||||
| PAD | -- addr | | 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). | |
|
||||
| OR | n1 n2 -- n3 | I,C | Working | Leave the bitwise inclusive-or of two numbers. | |
|
||||
| OVER | n1 n2 -- n1 n2 n1 | I,C | Working | Leave a copy of the second number on the stack. | |
|
||||
| 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. <br>2 PICK is equivalent to OVER. {1..n} | |
|
||||
| QUERY | | | | ccept input of up to 80 characters (or until a 'return') from the operator's terminal, into the terminal input buffer. WORD may be used to accept text from this buffer as the input stream, by setting >IN and BLK to zero. | |
|
||||
| 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. | |
|
||||
| REPEAT | -- | I,C | Working | Used in a colon-definition in the form: <br>BEGIN ... WHILE ... REPEAT <br>At run-time, REPEAT returns to just after the corresponding BEGIN. | |
|
||||
| REPEAT | -- | C | Working | Used in a colon-definition in the form: <br>BEGIN ... WHILE ... REPEAT <br>At run-time, REPEAT returns to just after the corresponding BEGIN. | |
|
||||
| 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} <br> 3 ROLL = ROT<br> 1 ROLL = null operation | |
|
||||
| ROT | n1 n2 n3 -- n2 n3 n1 | | Working | Rotate the top three values, bringing the deepest to the top. | |
|
||||
| ROT | n1 n2 n3 -- n2 n3 n1 | I,C | Working | Rotate the top three values, bringing the deepest to the top. | |
|
||||
| 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. | |
|
||||
| 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. | |
|
||||
| SPACE | -- |Working | Transmit an ASCII blank to the current output device. | |
|
||||
| SPACES | n -- | | Working | Transmit n spaces to the current output device. Take no action for n of zero or less. | |
|
||||
| SPACE | -- | I,C | Working | Transmit an ASCII blank to the current output device. | |
|
||||
| SPACES | n -- | I,C | Working | Transmit n spaces to the current output device. Take no action for n of zero or less. | |
|
||||
| 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. | |
|
||||
| SWAP | n1 n2 -- n2 n1 | | Working | Reverse top two stack items | |
|
||||
| THEN | | I,C | | Used in a colon-definition in the form:<br>IF ... ELSE ... THEN or<br>IF ... THEN<br>THEN is the point where execution resumes after ELSE or IF (when no ELSE is present). | |
|
||||
| SWAP | n1 n2 -- n2 n1 | I,C | Working | Reverse top two stack items | |
|
||||
| THEN | | C | Working | Used in a colon-definition in the form:<br>IF ... ELSE ... THEN or<br>IF ... THEN<br>THEN is the point where execution resumes after ELSE or IF (when no ELSE is present). | |
|
||||
| TYPE | addr n -- | | | Transmit n characters beginning at address to the current output device. No action takes place for n less than or equal to zero. | |
|
||||
| U* | un1 un2 -- ud3 | | | Perform an unsigned multiplication of un1 by un2, leaving the double number product ud3. All values are unsigned. | |
|
||||
| U. | un -- | | Working | Display un converted according to BASE as an unsigned number, in a free-field format, with one trailing blank. | |
|
||||
| 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 un 4 | | | 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. | |
|
||||
| UNTIL | flag -- | I,C | Working | LWithin a colon-definition, mark the end of a BEGIN-UNTIL loop, which will terminate based on flag. If flag is true, the loop is terminated. If flag is false, execution returns to the first word after BEGIN. BEGIN-UNTIL structures may be nested. | |
|
||||
| UNTIL | flag -- | C | Working | LWithin a colon-definition, mark the end of a BEGIN-UNTIL loop, which will terminate based on flag. If flag is true, the loop is terminated. If flag is false, execution returns to the first word after BEGIN. BEGIN-UNTIL structures may be nested. | |
|
||||
| UPDATE | | | | Mark the most recently referenced block as modified. The block will subsequently be automatically transferred to mass storage should its memory buffer be needed for storage of a different block, or upon execution of SAVE-BUFFERS. | |
|
||||
| VARIABLE | n -- | | Working | A defining word executed in the form:<br>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. | |
|
||||
| VARIABLE | n -- | I,C | Working | A defining word executed in the form:<br>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:<br>VOCABULARY **name**<br>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.<br>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. | |
|
||||
| WHILE | flag -- | I,C | Working | Used in the form:<br>BEGIN ... flag WHILE ... REPEAT<br>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. | |
|
||||
| WHILE | flag -- | C | Working | Used in the form:<br>BEGIN ... flag WHILE ... REPEAT<br>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. | |
|
||||
| WORD | char -- addr | | | Receive characters from the input stream until the non-zero delimiting character is encountered or the input stream is exhausted, ignoring leading delimiters. The characters are stored as a packed string with the character count in the first character position. The actual delimiter encountered (char or null) is stored at the end of the text but not included in the count. If the input stream was exhausted as WORD is called, then a zero length will result. The address of the beginning of this packed string is left on the stack. | |
|
||||
| XOR | n1 n2 -- n3 | | Working | Leave the bitwise exclusive-or of two numbers. | |
|
||||
| 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:<br>[COMPILE] **name**<br>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 [ | |
|
||||
|
@ -329,13 +329,13 @@ The Reference Word Set contain both Standard Word Definitions and uncontrolled
|
|||
|
||||
| Word | Syntax | I/C | Status | Description | Comment |
|
||||
|-|-|-|-|-|-|
|
||||
| -DUP | n -- n ? | | Working | Duplicate only if non-zero | **should be ?DUP** |
|
||||
| -DUP | n -- n ? | RENAMED to ?DUP | Working | Duplicate only if non-zero | **should be ?DUP** |
|
||||
| R | -- n | | Working | Copy top of return stack onto stack |** really >R maybe** |
|
||||
| MINUS | n -- -n | | Working | Change sign | **rename NEGATE** |
|
||||
| DMINUS | d -- -d | | Working | Change sign of double-precision number | **rename DNEGATE**|
|
||||
| MINUS | n -- -n | RENAMED to NEGATE | Working | Change sign | **rename NEGATE** |
|
||||
| DMINUS | d -- -d |RENAMED to DNEGATE | Working | Change sign of double-precision number | **rename DNEGATE**|
|
||||
| ?TERMINAL | -- f | | | True if terminal break request present | |
|
||||
| SIGN | ( n d -- d | | | Insert sign of n to output string | |
|
||||
| ENDIF | -- | | Working | End of the IF-ELSE structure | **there is no ENDIF like statement in forth, i think maybe IFs are only in loops or DOs or create word type structure so there is other "terminating" words that tell you IF is done**|
|
||||
| ENDIF | -- | | RENAMED to THEN | End of the IF-ELSE structure | **there is no ENDIF like statement in forth, i think maybe IFs are only in loops or DOs or create word type structure so there is other "terminating" words that tell you IF is done**|
|
||||
|
||||
## License
|
||||
A2osX is licensed under the GNU General Pulic License |
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,7 +2,115 @@ NEW
|
|||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
CODE.PUSHINT32 ldy #3
|
||||
* ZPADDR=STR ID, New pSTR Value on stack
|
||||
*--------------------------------------
|
||||
CODE.STRSET jsr CODE.PULLWS save pSTR
|
||||
|
||||
ldx hStrings
|
||||
jsr CODE.PUSHBI >PUSHB hSTRV
|
||||
|
||||
>LDYA ZPADDR
|
||||
jsr CODE.PUSHIYA >PUSHW id
|
||||
|
||||
jsr CODE.PUSHWS >PUSHW str
|
||||
|
||||
ldx #SYS.StrVSet
|
||||
jsr CODE.SYSCALL >SYSCALL StrVSet
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* EXP.ADDR = STR ID
|
||||
* output : str to ZPStrBuf
|
||||
*--------------------------------------
|
||||
CODE.STRGET ldx hStrings
|
||||
jsr CODE.PUSHBI >PUSHB hSTRV
|
||||
|
||||
>LDYA EXP.ADDR
|
||||
jsr CODE.PUSHIYA >PUSHW id
|
||||
|
||||
>LDYA ZPStrBuf
|
||||
jsr CODE.PUSHIYA >PUSHW str
|
||||
|
||||
ldx #SYS.StrVGet
|
||||
jsr CODE.SYSCALL >SYSCALL StrVGet
|
||||
|
||||
>LDYA ZPStrBuf
|
||||
jsr CODE.PUSHYA
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* ZPADDR=pInt, Int16 on Stack
|
||||
*--------------------------------------
|
||||
CODE.INTSET >LDYA ZPADDR
|
||||
jsr CODE.LDYAI
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda CCODE.PULLWYA,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.PULLWYA.LEN
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* EXP.ADDR=pInt
|
||||
* output : Int16 on Stack
|
||||
*--------------------------------------
|
||||
CODE.INTGET >LDYA EXP.ADDR
|
||||
jsr CODE.LDYAI
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda CCODE.PUSHWYA,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.PULLWYA.LEN
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CODE.PULLWS ldx #0
|
||||
|
||||
.1 lda CCODE.PULLWS,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.PULLWS.LEN
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CODE.PUSHWS ldx #0
|
||||
|
||||
.1 lda CCODE.PUSHWS,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.PUSHWS.LEN
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CODE.PUSHBI lda #$A9 LDA #imm
|
||||
jsr CODE.EmitByte
|
||||
txa
|
||||
jsr CODE.EmitByte
|
||||
|
||||
jmp CODE.PUSHA
|
||||
*--------------------------------------
|
||||
CODE.PUSHIYA pha
|
||||
lda #$A9 LDA #imm
|
||||
jsr CODE.EmitByte
|
||||
pla
|
||||
jsr CODE.EmitByte
|
||||
jsr CODE.PUSHA
|
||||
|
||||
lda #$A9 LDA #imm
|
||||
jsr CODE.EmitByte
|
||||
tya
|
||||
jsr CODE.EmitByte
|
||||
jmp CODE.PUSHA
|
||||
*--------------------------------------
|
||||
CODE.PUSHINT16 ldy #1
|
||||
|
||||
.1 lda #$A9 LDA #imm
|
||||
jsr CODE.EmitByte
|
||||
|
@ -16,34 +124,6 @@ CODE.PUSHINT32 ldy #3
|
|||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CODE.PULLL2ZPADDR
|
||||
>LDYA ZPADDR
|
||||
jsr CODE.LDYAI
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda CCODE.PULLLYA,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.PULLLYA.LEN
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CODE.PUSHfZPADDR
|
||||
>LDYA ZPADDR
|
||||
CODE.PUSHfYA jsr CODE.LDYAI
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda CCODE.PUSHLYA,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.PUSHLYA.LEN
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CODE.LDYAI pha
|
||||
lda #$A0 LDY #imm
|
||||
jsr CODE.EmitByte
|
||||
|
@ -55,6 +135,10 @@ CODE.LDYAI pha
|
|||
pla
|
||||
jmp CODE.EmitByte
|
||||
*--------------------------------------
|
||||
CODE.PUSHYA jsr CODE.PUSHA
|
||||
lda #$98 tya
|
||||
jsr CODE.EmitByte
|
||||
*--------------------------------------
|
||||
CODE.PUSHA ldx #0
|
||||
|
||||
.1 lda CCODE.PUSHA,x
|
||||
|
@ -65,6 +149,10 @@ CODE.PUSHA ldx #0
|
|||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CODE.PULLYA jsr CODE.PULLA
|
||||
lda #$A8 tay
|
||||
jsr CODE.EmitByte
|
||||
*--------------------------------------
|
||||
CODE.PULLA ldx #0
|
||||
|
||||
.1 lda CCODE.PULLA,x
|
||||
|
@ -85,12 +173,12 @@ CODE.FPRINTSTR ldx #0
|
|||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CODE.FPRINTL ldx #0
|
||||
CODE.FPRINTINT ldx #0
|
||||
|
||||
.1 lda CCODE.FPRINTL,x
|
||||
.1 lda CCODE.FPRINTINT,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.FPRINTL.LEN
|
||||
cpx #CCODE.FPRINTINT.LEN
|
||||
bne .1
|
||||
|
||||
rts
|
||||
|
|
|
@ -36,9 +36,22 @@ CORE.Init >LDYAI CODESEG
|
|||
|
||||
>STA.G hVars
|
||||
|
||||
>LDYAI FWREF
|
||||
>LDYAI STRVSEG
|
||||
>SYSCALL StrVNew
|
||||
bcs .9
|
||||
|
||||
sta hStrings
|
||||
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPStrBuf
|
||||
txa
|
||||
>STA.G hStrBuf
|
||||
|
||||
>LDYAI FWREF
|
||||
>SYSCALL GetMem
|
||||
|
||||
>STYA ZPFWRefBufPtr
|
||||
txa
|
||||
|
@ -50,17 +63,27 @@ CORE.Init >LDYAI CODESEG
|
|||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CORE.Quit >LDA.G hConstBuf
|
||||
CORE.Quit lda hStrings
|
||||
beq .1
|
||||
|
||||
>SYSCALL FreeMem
|
||||
>SYSCALL StrVFree
|
||||
|
||||
.1 >LDA.G hCodeBuf
|
||||
beq CORE.Cleanup
|
||||
.1 ldy #hStrBuf
|
||||
jsr CORE.Quit.Freemem
|
||||
|
||||
>SYSCALL FreeMem
|
||||
ldy #hDataBuf
|
||||
jsr CORE.Quit.Freemem
|
||||
|
||||
ldy #hConstBuf
|
||||
jsr CORE.Quit.Freemem
|
||||
|
||||
ldy #hCodeBuf
|
||||
jsr CORE.Quit.Freemem
|
||||
*--------------------------------------
|
||||
CORE.Cleanup >LDA.G hVars
|
||||
CORE.Cleanup ldy #hFWRefBuf
|
||||
jsr CORE.Quit.Freemem
|
||||
|
||||
>LDA.G hVars
|
||||
beq .1
|
||||
|
||||
>PUSHA
|
||||
|
@ -79,6 +102,19 @@ CORE.Cleanup >LDA.G hVars
|
|||
.8 clc
|
||||
CORE.Quit.RTS rts
|
||||
*--------------------------------------
|
||||
CORE.Quit.Freemem
|
||||
lda (pData),y
|
||||
beq .8
|
||||
|
||||
pha
|
||||
lda #0
|
||||
sta (pData),y
|
||||
pla
|
||||
|
||||
>SYSCALL FreeMem
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
CORE.Compile jsr CORE.GetChar
|
||||
bcs CORE.Quit.RTS
|
||||
|
||||
|
@ -132,14 +168,17 @@ CORE.Compile jsr CORE.GetChar
|
|||
jsr EXP.Eval ZPTYPE set by CreateOrGetVar
|
||||
bcs .99
|
||||
|
||||
ldx ZPTYPE
|
||||
lda ZPTYPE
|
||||
cmp EXP.TYPE
|
||||
bne .91
|
||||
|
||||
tax
|
||||
beq .4
|
||||
|
||||
|
||||
|
||||
jsr CODE.STRSET Store String in hSTRV
|
||||
bra .8
|
||||
|
||||
.4 jsr CODE.PULLL2ZPADDR Store Int32 result in DATASEG
|
||||
.4 jsr CODE.INTSET Store Int16 result in DATASEG
|
||||
*--------------------------------------
|
||||
.8 jsr CORE.GetCharNB
|
||||
bcs .99
|
||||
|
@ -159,6 +198,10 @@ CORE.Compile jsr CORE.GetChar
|
|||
.90 lda #E.CSYN
|
||||
sec
|
||||
.99 rts
|
||||
|
||||
.91 lda #E.TMISMATCH
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CORE.FWREF >LDA.G hFWRefBuf
|
||||
>SYSCALL GetMemPtr
|
||||
|
@ -273,7 +316,13 @@ CORE.Lookup >STYA ZPPtr1
|
|||
lda (ZPInputBufPtr),y Get Src text char...
|
||||
beq .9 end of text
|
||||
|
||||
jmp CORE.IsLetterOrDigit CS=end of valid chars
|
||||
cmp #'$'
|
||||
bne .70
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.70 jmp CORE.IsLetterOrDigit CS=end of valid chars
|
||||
*--------------------------------------
|
||||
CORE.IncPtr1 inc ZPPtr1
|
||||
bne .8
|
||||
|
@ -348,28 +397,43 @@ CORE.2FWRefBuf sta (ZPFWRefBufPtr)
|
|||
.8 rts
|
||||
*--------------------------------------
|
||||
CORE.CreateOrGetVar
|
||||
stz ZPTYPE
|
||||
|
||||
>LDA.G hVars
|
||||
jsr CORE.GetAddr
|
||||
bcc .1
|
||||
bcc .2
|
||||
|
||||
>LDA.G hVars
|
||||
jsr CORE.NewKey
|
||||
bcs .9
|
||||
bcs .99
|
||||
|
||||
>PUSHB.G hVars
|
||||
>PUSHW ZPSID
|
||||
>PUSHWI ZPDataBufPtr
|
||||
>PUSHWI 3 3 bytes : ADDR + TYPE
|
||||
>SYSCALL SListAddData
|
||||
bcs .9
|
||||
jsr CORE.GetChar
|
||||
bcs .1
|
||||
|
||||
stz ZPTYPE
|
||||
|
||||
lda ZPDataBufPtr
|
||||
cmp #'$'
|
||||
bne .1
|
||||
|
||||
sta ZPTYPE
|
||||
|
||||
jsr CORE.GetNextChar skip $
|
||||
|
||||
lda STRID
|
||||
sta ZPADDR
|
||||
|
||||
lda STRID+1
|
||||
sta ZPADDR+1
|
||||
|
||||
inc STRID
|
||||
bne .10
|
||||
|
||||
inc STRID+1
|
||||
bra .10
|
||||
|
||||
.1 lda ZPDataBufPtr
|
||||
sta ZPADDR
|
||||
|
||||
* clc
|
||||
adc #4 longint
|
||||
clc
|
||||
adc #2 Word
|
||||
sta ZPDataBufPtr
|
||||
|
||||
lda ZPDataBufPtr+1
|
||||
|
@ -377,16 +441,35 @@ CORE.CreateOrGetVar
|
|||
adc #0
|
||||
sta ZPDataBufPtr+1
|
||||
|
||||
.1 jsr CORE.GetChar
|
||||
cmp #'$'
|
||||
bne .8
|
||||
.10 >PUSHB.G hVars
|
||||
>PUSHW ZPSID
|
||||
>PUSHWI ZPADDR
|
||||
>PUSHWI 3 3 bytes : ADDR + TYPE
|
||||
>SYSCALL SListAddData
|
||||
rts
|
||||
*--------------------------------------
|
||||
.2 ldx #0
|
||||
|
||||
jsr CORE.GetChar
|
||||
bcs .3
|
||||
|
||||
cmp #'$'
|
||||
bne .3
|
||||
|
||||
tax
|
||||
|
||||
sta ZPTYPE
|
||||
jsr CORE.GetNextChar skip $
|
||||
|
||||
.8 clc
|
||||
.3 cpx ZPTYPE
|
||||
bne .90
|
||||
|
||||
.9 rts
|
||||
clc
|
||||
rts
|
||||
|
||||
.90 lda #E.TMISMATCH
|
||||
sec
|
||||
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
CORE.NewKey >PUSHA
|
||||
>PUSHW ZPInputBufPtr
|
||||
|
|
|
@ -3,9 +3,11 @@ NEW
|
|||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* In: A = current CHAR
|
||||
* Out: CC, longint on stack
|
||||
* Out: CC, longint on stack or pSTR in stack
|
||||
*--------------------------------------
|
||||
EXP.Eval lda EXP.AOPS
|
||||
EXP.Eval stz EXP.TYPE
|
||||
|
||||
EXP.Eval.R lda EXP.AOPS
|
||||
pha
|
||||
|
||||
lda #$FF
|
||||
|
@ -20,14 +22,15 @@ EXP.Eval lda EXP.AOPS
|
|||
jsr CORE.GetNextCharNB skip (
|
||||
bcs .39
|
||||
|
||||
jsr EXP.Eval
|
||||
jsr EXP.Eval.R
|
||||
bcs .39
|
||||
|
||||
jsr CORE.GetCharNB
|
||||
bcs .39
|
||||
|
||||
cmp #')'
|
||||
bne .90
|
||||
sec
|
||||
bne .39
|
||||
|
||||
jsr CORE.GetNextCharNB skip )
|
||||
bra .41
|
||||
|
@ -35,10 +38,7 @@ EXP.Eval lda EXP.AOPS
|
|||
.12 cmp #'"'
|
||||
bne .20
|
||||
|
||||
lda ZPTYPE
|
||||
beq .90
|
||||
|
||||
jsr EXP.GetString
|
||||
jsr EXP.CreateStrConst
|
||||
bcs .99
|
||||
|
||||
bra .40
|
||||
|
@ -48,6 +48,7 @@ EXP.Eval lda EXP.AOPS
|
|||
|
||||
>LDYA L.ACOS.FN
|
||||
jsr CORE.Lookup
|
||||
|
||||
bcs .21
|
||||
|
||||
jsr EXP.FNjmpX
|
||||
|
@ -58,15 +59,21 @@ EXP.Eval lda EXP.AOPS
|
|||
.21 jsr EXP.VARLookup
|
||||
bcs .99
|
||||
|
||||
>LDYA EXP.ADDR
|
||||
jsr CODE.PUSHfYA
|
||||
ldx EXP.TYPE
|
||||
bne .22
|
||||
|
||||
jsr CODE.INTGET
|
||||
|
||||
bra .40
|
||||
|
||||
.22 jsr CODE.STRGET
|
||||
|
||||
bra .40
|
||||
*--------------------------------------
|
||||
.30 jsr CORE.IsDigit10
|
||||
.39 bcs .90
|
||||
|
||||
jsr EXP.Int32
|
||||
jsr EXP.Int16
|
||||
bcs .99
|
||||
*--------------------------------------
|
||||
.40 jsr CORE.GetCharNB
|
||||
|
@ -109,9 +116,9 @@ EXP.Eval lda EXP.AOPS
|
|||
|
||||
.99 tay Save Err code
|
||||
|
||||
>PULLA
|
||||
.98 >PULLA
|
||||
tax
|
||||
bpl .99
|
||||
bpl .98
|
||||
|
||||
sec
|
||||
.HS 90 BCC
|
||||
|
@ -127,7 +134,11 @@ EXP.Eval lda EXP.AOPS
|
|||
EXP.FNjmpX jmp (J.ACOS.FN,x)
|
||||
EXP.OPjmpX jmp (J.ACOS.AOPS,x)
|
||||
*--------------------------------------
|
||||
EXP.GetString ldy #0
|
||||
EXP.CreateStrConst
|
||||
lda #'$'
|
||||
sta EXP.TYPE
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 jsr CORE.GetNextChar
|
||||
bcs .91
|
||||
|
@ -142,10 +153,12 @@ EXP.GetString ldy #0
|
|||
.2 lda #0
|
||||
sta (ZPConstBufPtr),y
|
||||
|
||||
>PUSHW ZPConstBufPtr
|
||||
phy
|
||||
>LDYA ZPConstBufPtr
|
||||
jsr CODE.PUSHIYA
|
||||
|
||||
tya
|
||||
clc
|
||||
pla
|
||||
sec for \0
|
||||
adc ZPConstBufPtr
|
||||
sta ZPConstBufPtr
|
||||
bcc .3
|
||||
|
@ -156,8 +169,6 @@ EXP.GetString ldy #0
|
|||
|
||||
clc
|
||||
rts
|
||||
|
||||
.90
|
||||
|
||||
.91 lda #E.ESYN
|
||||
* sec
|
||||
|
@ -177,13 +188,13 @@ EXP.GetOP jsr CORE.IsAOPSChar + - * /
|
|||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
EXP.Int32 >PUSHW ZPInputBufPtr
|
||||
EXP.Int16 >PUSHW ZPInputBufPtr
|
||||
>PUSHWI ZPInputBufPtr
|
||||
>PUSHBI 10
|
||||
>SYSCALL StrToL
|
||||
bcs .9
|
||||
|
||||
jsr CODE.PUSHINT32
|
||||
jsr CODE.PUSHINT16
|
||||
|
||||
>POP 4
|
||||
|
||||
|
@ -209,24 +220,46 @@ EXP.VARLookup >LDA.G hVars
|
|||
>PUSHWI 3 3 bytes : ADDR + TYPE
|
||||
>PUSHWZ From Start
|
||||
>SYSCALL SListGetData
|
||||
bcs .99
|
||||
|
||||
ldx #0
|
||||
|
||||
jsr CORE.GetChar
|
||||
bcs .2
|
||||
|
||||
cmp #'$'
|
||||
bne .2
|
||||
|
||||
tax
|
||||
|
||||
jsr CORE.GetNextChar skip $
|
||||
|
||||
.2 cpx EXP.TYPE
|
||||
bne .90
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 >PULLA
|
||||
.99 rts
|
||||
|
||||
.90 lda #E.TMISMATCH
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
EXP.ADD ldx #FPU.ADD32
|
||||
EXP.ADD ldx #FPU.ADD16
|
||||
jmp CODE.FPUCALL
|
||||
|
||||
EXP.SUB ldx #FPU.SUB32
|
||||
EXP.SUB ldx #FPU.SUB16
|
||||
jmp CODE.FPUCALL
|
||||
|
||||
EXP.MUL ldx #FPU.IMUL32
|
||||
EXP.MUL ldx #FPU.IMUL16
|
||||
jmp CODE.FPUCALL
|
||||
|
||||
EXP.DIV ldx #FPU.IDIV32
|
||||
EXP.DIV ldx #FPU.IDIV16
|
||||
jmp CODE.FPUCALL
|
||||
|
||||
EXP.MOD ldx #FPU.IMOD32
|
||||
EXP.MOD ldx #FPU.IMOD16
|
||||
jmp CODE.FPUCALL
|
||||
*--------------------------------------
|
||||
*--------------------------------------
|
||||
|
|
|
@ -9,8 +9,103 @@ FN.FLAG
|
|||
FN.CHRd
|
||||
FN.INSTR
|
||||
FN.KEY
|
||||
FN.LEN
|
||||
FN.LEFTd
|
||||
lda #E.CSYN
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
FN.LEN jsr CORE.GetCharNB
|
||||
bcs .90
|
||||
|
||||
cmp #'('
|
||||
bne .90
|
||||
|
||||
jsr EXP.Eval
|
||||
bcs .99
|
||||
|
||||
lda EXP.TYPE
|
||||
beq .91
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda CCODE.LEN,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.LEN.LEN
|
||||
bne .1
|
||||
|
||||
stz EXP.TYPE
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.90 lda #E.CSYN
|
||||
sec
|
||||
rts
|
||||
|
||||
.91 lda #E.TMISMATCH
|
||||
sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
FN.LEFTd jsr CORE.GetCharNB
|
||||
bcs .90
|
||||
|
||||
cmp #'('
|
||||
bne .90
|
||||
|
||||
jsr CORE.GetNextCharNB skip (
|
||||
bcs .90
|
||||
|
||||
jsr EXP.Eval
|
||||
bcs .99
|
||||
|
||||
lda EXP.TYPE
|
||||
beq .91
|
||||
|
||||
jsr CORE.GetCharNB
|
||||
bcs .90
|
||||
|
||||
cmp #','
|
||||
bne .90
|
||||
|
||||
jsr CORE.GetNextCharNB skip ,
|
||||
bcs .90
|
||||
|
||||
jsr EXP.Eval
|
||||
bcs .99
|
||||
|
||||
lda EXP.TYPE
|
||||
bne .91
|
||||
|
||||
jsr CORE.GetCharNB
|
||||
bcs .90
|
||||
|
||||
cmp #')'
|
||||
bne .90
|
||||
|
||||
jsr CORE.GetNextCharNB skip )
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda CCODE.LEFT,x
|
||||
jsr CODE.EmitByte
|
||||
inx
|
||||
cpx #CCODE.LEFT.LEN
|
||||
bne .1
|
||||
|
||||
lda #'$'
|
||||
sta EXP.TYPE
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.90 lda #E.CSYN
|
||||
sec
|
||||
rts
|
||||
|
||||
.91 lda #E.TMISMATCH
|
||||
sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
FN.MIDd
|
||||
FN.PDL
|
||||
FN.PEEK
|
||||
|
@ -22,7 +117,8 @@ FN.TIMEd
|
|||
FN.VAL
|
||||
FN.WHENd
|
||||
FN.WIDTH
|
||||
clc
|
||||
lda #E.CSYN
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
|
|
@ -98,47 +98,21 @@ KW.PRINT stz hOut reset to hStdOut
|
|||
bcs .8
|
||||
|
||||
stz bFlag put ending CR
|
||||
|
||||
cmp #'"'
|
||||
bne .5
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 jsr CORE.GetNextChar
|
||||
bcs .90
|
||||
|
||||
cmp #'"'
|
||||
beq .2
|
||||
|
||||
sta (ZPConstBufPtr),y
|
||||
iny
|
||||
bne .1
|
||||
|
||||
.2 lda #0
|
||||
sta (ZPConstBufPtr),y
|
||||
iny
|
||||
phy
|
||||
|
||||
>LDYA ZPConstBufPtr
|
||||
jsr CODE.LDYAI
|
||||
jsr CODE.FPRINTSTR
|
||||
|
||||
pla
|
||||
clc
|
||||
adc ZPConstBufPtr
|
||||
sta ZPConstBufPtr
|
||||
bcc .3
|
||||
|
||||
inc ZPConstBufPtr+1
|
||||
|
||||
.3 jsr CORE.GetNextCharNB skip "
|
||||
bra .70
|
||||
*--------------------------------------
|
||||
.5 jsr EXP.Eval
|
||||
bcs .99
|
||||
|
||||
jsr CODE.FPRINTL
|
||||
lda EXP.TYPE
|
||||
beq .6
|
||||
|
||||
jsr CODE.PULLYA
|
||||
jsr CODE.FPRINTSTR
|
||||
|
||||
bra .7
|
||||
|
||||
.6 jsr CODE.PULLYA
|
||||
jsr CODE.FPRINTINT
|
||||
*--------------------------------------
|
||||
.7 jsr CORE.GetCharNB
|
||||
bcs .8
|
||||
|
||||
|
|
323
BIN/ACOS.S.txt
323
BIN/ACOS.S.txt
|
@ -8,6 +8,7 @@ NEW
|
|||
CODESEG .EQ 4096
|
||||
CONSTSEG .EQ 1024
|
||||
DATASEG .EQ 256
|
||||
STRVSEG .EQ 2048
|
||||
FWREF .EQ 1024
|
||||
EXP.DEPTH.MAX .EQ 16
|
||||
*--------------------------------------
|
||||
|
@ -26,13 +27,14 @@ ZPInputBufPtr .BS 2
|
|||
ZPSID .BS 2
|
||||
ZPADDR .BS 2
|
||||
ZPTYPE .BS 1
|
||||
.BS 1
|
||||
hStrings .BS 1
|
||||
|
||||
ZPStrBuf .BS 2
|
||||
|
||||
ZPPtr1 .BS 2
|
||||
ZPPtr2 .BS 2
|
||||
ZPPtr3 .BS 2
|
||||
hIn .BS 1
|
||||
hOut .BS 1
|
||||
ArgIndex .BS 1
|
||||
bFlag .BS 1
|
||||
|
||||
ZPCodeBufPtr .BS 2
|
||||
ZPConstBufPtr .BS 2
|
||||
|
@ -42,8 +44,10 @@ ZPFWRefBufPtr .BS 2
|
|||
EXP.ADDR .BS 2
|
||||
EXP.TYPE .BS 1
|
||||
EXP.AOPS .BS 1
|
||||
ArgIndex .BS 1
|
||||
bFlag .BS 1
|
||||
|
||||
STRID .BS 2
|
||||
hIn .BS 1
|
||||
hOut .BS 1
|
||||
|
||||
ZS.END .ED
|
||||
*--------------------------------------
|
||||
|
@ -67,16 +71,18 @@ CS.START cld
|
|||
.DA CS.RUN
|
||||
.DA CS.DOEVENT
|
||||
.DA CS.QUIT
|
||||
*--------------------------------------
|
||||
L.MSG.GREETINGS .DA MSG.GREETINGS
|
||||
L.MSG.USAGE .DA MSG.USAGE
|
||||
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
|
||||
L.MSG.COMPILING .DA MSG.COMPILING
|
||||
L.MSG.DEBUG .DA MSG.DEBUG
|
||||
L.MSG.ERR .DA MSG.ERR
|
||||
L.MSG.TRACE .DA MSG.TRACE
|
||||
L.MSG.ERROR .DA MSG.ERROR
|
||||
L.MSG.RUN .DA MSG.RUN
|
||||
L.MSG.FWREFERR .DA MSG.FWREFERR
|
||||
L.MSG.STR .DA MSG.STR
|
||||
L.MSG.INT32 .DA MSG.INT32
|
||||
L.MSG.INT16 .DA MSG.INT16
|
||||
*--------------------------------------
|
||||
L.ACOS.AOPS .DA ACOS.AOPS
|
||||
J.ACOS.AOPS .DA EXP.ADD
|
||||
|
@ -185,34 +191,46 @@ CS.RUN >PUSHW L.MSG.GREETINGS
|
|||
jsr CS.RUN.ARGS
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs CS.INIT.RTS
|
||||
>STYA.G InputBufPtr
|
||||
|
||||
jsr CORE.Init
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>PUSHW L.MSG.COMPILING
|
||||
>PUSHW ZPPtr2
|
||||
>PUSHW ZPPtr2 File name
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
.1 >SLEEP
|
||||
CS.RUN.LOOP >SLEEP
|
||||
|
||||
>LDA.G bDebug
|
||||
bpl .2
|
||||
|
||||
jsr PrintDebugMsg
|
||||
|
||||
.2 >LDA.G bTrace
|
||||
.2 jsr CS.RUN.FGetS
|
||||
bcs .4
|
||||
|
||||
>LDA.G bTrace
|
||||
bpl .3
|
||||
|
||||
>LDYA ZPInputBufPtr
|
||||
jsr PrintTraceMsg
|
||||
|
||||
.3 jsr CORE.Compile
|
||||
bcc .1
|
||||
bcc CS.RUN.LOOP
|
||||
|
||||
cmp #MLI.E.EOF
|
||||
beq CS.RUN.LOOP
|
||||
|
||||
.4 cmp #MLI.E.EOF
|
||||
bne .9
|
||||
|
||||
jsr CS.FClose
|
||||
|
||||
jsr CORE.FWREF
|
||||
bcs .9
|
||||
|
||||
|
@ -220,7 +238,7 @@ CS.RUN >PUSHW L.MSG.GREETINGS
|
|||
bcc .8
|
||||
|
||||
.9 pha
|
||||
jsr PrintErrMsg
|
||||
jsr PrintErrorMsg
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
|
@ -258,25 +276,21 @@ CS.RUN.ARGS inc ArgIndex
|
|||
sta (pData),y
|
||||
bra CS.RUN.ARGS
|
||||
|
||||
.4 >LDA.G hFileBuf
|
||||
.4 >LDA.G hFile
|
||||
bne .90
|
||||
|
||||
>LDYA ZPPtr1
|
||||
>STYA ZPPtr2 form printing later
|
||||
jsr CS.RUN.LoadFile
|
||||
bcs .9
|
||||
>STYA ZPPtr2 for printing later
|
||||
jsr CS.RUN.FOpen
|
||||
bcc CS.RUN.ARGS
|
||||
|
||||
>STYA ZPInputBufPtr
|
||||
.9 rts
|
||||
|
||||
txa
|
||||
>STA.G hFileBuf
|
||||
bra CS.RUN.ARGS
|
||||
|
||||
.7 >LDA.G hFileBuf
|
||||
.7 >LDA.G hFile
|
||||
beq .90
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
rts
|
||||
|
||||
.90 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
|
@ -286,85 +300,42 @@ CS.RUN.ARGS inc ArgIndex
|
|||
sec QUIT Process
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.LoadFile >SYSCALL LoadTxtFile
|
||||
CS.RUN.FOpen >PUSHYA
|
||||
>PUSHBI O.RDONLY
|
||||
>PUSHBI S.FI.T.TXT
|
||||
>PUSHWZ Aux type
|
||||
>SYSCALL FOpen
|
||||
bcs .9
|
||||
|
||||
phx
|
||||
txa
|
||||
>SYSCALL GetMemPtr
|
||||
plx
|
||||
>STA.G hFile
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.FGetS >LDYA.G InputBufPtr
|
||||
>STYA ZPInputBufPtr
|
||||
|
||||
>INCW.G LineCounter
|
||||
|
||||
>PUSHB.G hFile
|
||||
>PUSHW ZPInputBufPtr
|
||||
>PUSHWI 256
|
||||
>SYSCALL FGetS
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT jsr CORE.Quit
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintErrMsg >LDA.G hFileBuf
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPPtr1
|
||||
|
||||
stz ZPPtr2
|
||||
stz ZPPtr2+1 Line counter
|
||||
|
||||
.1 inc ZPPtr2
|
||||
bne .2
|
||||
inc ZPPtr2+1
|
||||
|
||||
.2 >LDYA ZPPtr1
|
||||
>STYA ZPPtr3 save line start
|
||||
|
||||
.20 lda (ZPPtr1)
|
||||
beq .4 EoF
|
||||
|
||||
inc ZPPtr1
|
||||
bne .3
|
||||
|
||||
inc ZPPtr1+1
|
||||
.3 cmp #C.CR
|
||||
bne .20 Scan until EoL
|
||||
|
||||
ldx ZPPtr1
|
||||
cpx ZPInputBufPtr
|
||||
lda ZPPtr1+1
|
||||
sbc ZPInputBufPtr+1
|
||||
bcc .1 not this line....
|
||||
|
||||
.4 >LDA.G bTrace
|
||||
bmi .5
|
||||
|
||||
jsr PrintTraceMsg.3
|
||||
|
||||
.5 lda ZPPtr3
|
||||
cmp ZPInputBufPtr
|
||||
bne .6
|
||||
|
||||
lda ZPPtr3+1
|
||||
cmp ZPInputBufPtr+1
|
||||
CS.FClose >LDA.G hFile
|
||||
beq .8
|
||||
|
||||
.6 >PUSHBI '-'
|
||||
ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>SYSCALL FPutC
|
||||
inc ZPPtr3
|
||||
bne .5
|
||||
>SYSCALL FClose
|
||||
|
||||
inc ZPPtr3+1
|
||||
bra .5
|
||||
|
||||
.8 ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>PUSHA
|
||||
>PUSHW L.MSG.ERR
|
||||
>PUSHW ZPPtr2 Line counter
|
||||
>PUSHBI 2
|
||||
>SYSCALL FPrintF
|
||||
>STZ.G hFile
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintDebugMsg >LDYA pStack
|
||||
|
@ -378,56 +349,85 @@ PrintDebugMsg >LDYA pStack
|
|||
>SYSCALL PrintF
|
||||
rts
|
||||
*--------------------------------------
|
||||
PrintTraceMsg >STYA ZPPtr3
|
||||
|
||||
PrintTraceMsg.3 >PUSHBI '>'
|
||||
ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>SYSCALL FPutC
|
||||
|
||||
ldy #$ff
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr3),y
|
||||
beq .8
|
||||
|
||||
cmp #C.CR
|
||||
beq .8
|
||||
|
||||
phy
|
||||
>PUSHA
|
||||
ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>SYSCALL FPutC
|
||||
ply
|
||||
bra .1
|
||||
|
||||
.8 ldy #S.PS.hStdErr
|
||||
PrintTraceMsg ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>PUSHA
|
||||
|
||||
>PUSHW L.MSG.ECHOCRLF
|
||||
>PUSHBI 0
|
||||
>PUSHW L.MSG.TRACE
|
||||
>PUSHW.G LineCounter
|
||||
>PUSHW.G InputBufPtr
|
||||
>PUSHBI 4
|
||||
>SYSCALL FPrintF
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CCODE.PUSHLYA >STYA ZPADDR
|
||||
ldy #3
|
||||
.1 lda (ZPADDR),y
|
||||
>PUSHA
|
||||
dey
|
||||
bpl .1
|
||||
CCODE.PUSHLYA.LEN .EQ *-CCODE.PUSHLYA
|
||||
*--------------------------------------
|
||||
CCODE.PULLLYA >STYA ZPADDR
|
||||
PrintErrorMsg >LDA.G bTrace
|
||||
bmi .1
|
||||
|
||||
jsr PrintTraceMsg
|
||||
|
||||
.1 lda ZPInputBufPtr
|
||||
|
||||
sec
|
||||
>SBC.G InputBufPtr
|
||||
tax
|
||||
bcc *
|
||||
>LDYA.G InputBufPtr
|
||||
>STYA ZPInputBufPtr
|
||||
|
||||
txa
|
||||
beq .3
|
||||
|
||||
ldy #0
|
||||
.1 >PULLA
|
||||
sta (ZPADDR),y
|
||||
lda #'-'
|
||||
|
||||
.2 sta (ZPInputBufPtr),y
|
||||
iny
|
||||
cpy #4
|
||||
bcc .1
|
||||
CCODE.PULLLYA.LEN .EQ *-CCODE.PULLLYA
|
||||
dex
|
||||
bne .2
|
||||
|
||||
txa
|
||||
|
||||
.3 sta (ZPInputBufPtr),y
|
||||
|
||||
.8 ldy #S.PS.hStdErr
|
||||
lda (pPS),y
|
||||
>PUSHA
|
||||
>PUSHW L.MSG.ERROR
|
||||
>PUSHW ZPInputBufPtr
|
||||
>PUSHBI 2
|
||||
>SYSCALL FPrintF
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Precompiled code
|
||||
*--------------------------------------
|
||||
CCODE.PULLWS >PULLA
|
||||
pha
|
||||
>PULLA
|
||||
pha
|
||||
CCODE.PULLWS.LEN .EQ *-CCODE.PULLWS
|
||||
*--------------------------------------
|
||||
CCODE.PUSHWS pla
|
||||
>PUSHA
|
||||
pla
|
||||
>PUSHA
|
||||
CCODE.PUSHWS.LEN .EQ *-CCODE.PUSHWS
|
||||
*--------------------------------------
|
||||
CCODE.PUSHWYA >STYA ZPADDR
|
||||
ldy #1
|
||||
lda (ZPADDR),y
|
||||
>PUSHA
|
||||
lda (ZPADDR)
|
||||
>PUSHA
|
||||
CCODE.PUSHWYA.LEN .EQ *-CCODE.PUSHWYA
|
||||
*--------------------------------------
|
||||
CCODE.PULLWYA >STYA ZPADDR
|
||||
>PULLA
|
||||
sta (ZPADDR)
|
||||
>PULLA
|
||||
ldy #1
|
||||
sta (ZPADDR),y
|
||||
CCODE.PULLWYA.LEN .EQ *-CCODE.PULLWYA
|
||||
*--------------------------------------
|
||||
CCODE.PUSHA >PUSHA
|
||||
CCODE.PUSHA.LEN .EQ *-CCODE.PUSHA
|
||||
|
@ -445,26 +445,54 @@ CCODE.FPRINTSTR pha
|
|||
>SYSCALL PrintF
|
||||
CCODE.FPRINTSTR.LEN .EQ *-CCODE.FPRINTSTR
|
||||
*--------------------------------------
|
||||
CCODE.FPRINTL >PUSHW L.MSG.INT32
|
||||
ldx #4
|
||||
ldy #5
|
||||
|
||||
.1 lda (pStack),y
|
||||
CCODE.FPRINTINT pha
|
||||
>PUSHW L.MSG.INT16
|
||||
pla
|
||||
>PUSHA
|
||||
dex
|
||||
tya
|
||||
>PUSHA
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
CCODE.FPRINTINT.LEN .EQ *-CCODE.FPRINTINT
|
||||
*--------------------------------------
|
||||
CCODE.LEN >PULLW ZPPtr1
|
||||
|
||||
ldy #$FF
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr1),y
|
||||
bne .1
|
||||
|
||||
>PUSHBI 4
|
||||
>SYSCALL PrintF
|
||||
>POP 4 Discard long on stack
|
||||
CCODE.FPRINTL.LEN .EQ *-CCODE.FPRINTL
|
||||
>PUSHYA
|
||||
CCODE.LEN.LEN .EQ *-CCODE.LEN
|
||||
*--------------------------------------
|
||||
CCODE.LEFT >PULLW ZPPtr2 cnt
|
||||
lda (pStack)
|
||||
sta ZPPtr1
|
||||
ldy #1
|
||||
lda (pStack),y
|
||||
sta ZPPtr1+1
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 lda (ZPPtr1),y
|
||||
beq .8
|
||||
|
||||
iny
|
||||
cpy ZPPtr2
|
||||
bne .1
|
||||
|
||||
lda #0
|
||||
sta (ZPPtr1),y
|
||||
.8
|
||||
|
||||
CCODE.LEFT.LEN .EQ *-CCODE.LEFT
|
||||
*--------------------------------------
|
||||
.INB usr/src/bin/acos.s.code
|
||||
.INB usr/src/bin/acos.s.core
|
||||
.INB usr/src/bin/acos.s.exp
|
||||
.INB usr/src/bin/acos.s.fn
|
||||
.INB usr/src/bin/acos.s.kw
|
||||
.INB usr/src/bin/acos.s.str
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
|
@ -477,11 +505,12 @@ MSG.USAGE .AS "Usage : ACOS <option> file\r\n"
|
|||
MSG.ECHOCRLF .AZ "\r\n"
|
||||
MSG.COMPILING .AZ "Compiling : %s...\r\n"
|
||||
MSG.DEBUG .AZ "pStack=%H CodePtr=%H\r\n"
|
||||
MSG.ERR .AZ "-^\r\nLine #%D:"
|
||||
MSG.TRACE .AZ "%05D>%s\r\n"
|
||||
MSG.ERROR .AZ " %s^\r\n"
|
||||
MSG.RUN .AZ "Success, Code size = %D Bytes\r\nResolving FWRefs...\r\n"
|
||||
MSG.FWREFERR .AZ "Unresolved FWRef : %s\r\n"
|
||||
MSG.STR .AZ "%s"
|
||||
MSG.INT32 .AZ "%L"
|
||||
MSG.INT16 .AZ "%I"
|
||||
*--------------------------------------
|
||||
OptionList .AS "DdTt"
|
||||
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
|
||||
|
@ -572,6 +601,7 @@ ACOS.FN .AT "BYTE"
|
|||
.AT "INFO"
|
||||
.AT "INSTR"
|
||||
.AT "KEY"
|
||||
.AT "LEN"
|
||||
.AT "LEFT$"
|
||||
.AT "MID$"
|
||||
.AT "PDL"
|
||||
|
@ -591,12 +621,15 @@ ACOS.FN .AT "BYTE"
|
|||
DS.START
|
||||
bDebug .BS 1
|
||||
bTrace .BS 1
|
||||
hFileBuf .BS 1
|
||||
LineCounter .BS 2
|
||||
hFile .BS 1
|
||||
InputBufPtr .BS 2
|
||||
hCodeBuf .BS 1
|
||||
hConstBuf .BS 1
|
||||
hDataBuf .BS 1
|
||||
hLabels .BS 1
|
||||
hVars .BS 1
|
||||
hStrBuf .BS 1
|
||||
hFWRefBuf .BS 1
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
|
|
|
@ -111,20 +111,20 @@ CP.LEAVE ldy RP
|
|||
*--------------------------------------
|
||||
CP.IF jsr CP.Emit.TESTTRUE
|
||||
ldx #KW.IF.ID
|
||||
jsr CP.Emit.JMP0000 to put jmp -> ELSE/ENDIF later
|
||||
jsr CP.Emit.JMP0000 to put jmp -> ELSE/THEN later
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CP.ELSE jsr CP.PopCodePtr get previous JMP -> ptr1
|
||||
ldx #KW.IF.ID
|
||||
jsr CP.Emit.JMP0000 to put jmp -> ENDIF later
|
||||
jsr CP.Emit.JMP0000 to put jmp -> THEN later
|
||||
jsr CP.UpdatePtr1
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CP.ENDIF jsr CP.PopCodePtr
|
||||
CP.THEN jsr CP.PopCodePtr
|
||||
jsr CP.UpdatePtr1
|
||||
|
||||
clc
|
||||
|
@ -164,6 +164,15 @@ CP.E.NOBEGIN lda #E.NOFOR
|
|||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.gR
|
||||
*--------------------------------------
|
||||
KW.Rg
|
||||
*--------------------------------------
|
||||
KW.R
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CP.Emit.JMP0000 lda #$4C JMP
|
||||
jsr CP.Emit.Byte
|
||||
|
||||
|
|
|
@ -2,17 +2,16 @@ NEW
|
|||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
HIS.Init >LDYAI HISTORY.MAX Get a buffer for History
|
||||
>SYSCALL NewStkObj
|
||||
HIS.Init clc
|
||||
rts
|
||||
|
||||
>LDYAI HISTORY.MAX Get a buffer for History
|
||||
>SYSCALL StrVNew
|
||||
bcs .9
|
||||
|
||||
txa
|
||||
>STA.G HIS.hBuf
|
||||
|
||||
>PUSHA
|
||||
>PUSHWI 0
|
||||
>SYSCALL StrVAdd Reset Buffer
|
||||
|
||||
>STZ.G HIS.Count
|
||||
>STA.G HIS.Index
|
||||
.9 rts
|
||||
|
@ -22,13 +21,12 @@ HIS.Add >LDA.G HIS.hBuf
|
|||
|
||||
>PUSHA
|
||||
>PUSHW ZPCLBuf
|
||||
>SYSCALL StrVAdd
|
||||
>SYSCALL StrVSet
|
||||
bcc .1
|
||||
|
||||
>PUSHB.G HIS.hBuf
|
||||
lda #0
|
||||
>PUSHA
|
||||
>SYSCALL StrVShift
|
||||
>PUSHWZ
|
||||
>SYSCALL StrVSet
|
||||
>DEC.G HIS.Count
|
||||
bra HIS.Add
|
||||
|
||||
|
@ -70,6 +68,7 @@ HIS.GetToCl >STA.G HIS.Index
|
|||
jsr CL.CLR
|
||||
|
||||
>PUSHB.G HIS.hBuf
|
||||
>PUSHBI 0
|
||||
>PUSHB.G HIS.Index
|
||||
>PUSHW ZPCLBuf
|
||||
|
||||
|
@ -83,8 +82,8 @@ HIS.GetToCl >STA.G HIS.Index
|
|||
|
||||
tya
|
||||
|
||||
>STA.G CL.Ptr
|
||||
>STA.G CL.Len
|
||||
sta CL.Ptr
|
||||
sta CL.Len
|
||||
jmp CL.PrintCLBuf
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
|
|
@ -53,7 +53,7 @@ KW.Lookup >LDYA L.KEYWORDS
|
|||
|
||||
jmp IsSpaceOrCR CS=end of valid chars
|
||||
*--------------------------------------
|
||||
KW.mDUP lda (pStack)
|
||||
KW.qDUP lda (pStack)
|
||||
ldy #1
|
||||
ora (pStack),y
|
||||
bne KW.DUP
|
||||
|
@ -186,29 +186,10 @@ KW.ROT lda pStack
|
|||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.gR
|
||||
*--------------------------------------
|
||||
KW.Rg
|
||||
*--------------------------------------
|
||||
KW.R
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.Add jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
clc
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
adc (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
adc (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
>FPU ADD16
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
|
@ -220,52 +201,19 @@ KW.DAdd >FPU ADD32
|
|||
KW.Sub jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
sec
|
||||
ldy #2
|
||||
lda (pStack),y
|
||||
sbc (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
|
||||
lda (pStack),y
|
||||
sbc (pStack)
|
||||
sta (pStack),y
|
||||
inc pStack
|
||||
>FPU SUB16
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
KW.DSub >FPU SUB32
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.Mul jsr CheckStackPop4
|
||||
bcs .9
|
||||
|
||||
jsr KW.GetPtr1Ptr2Sign
|
||||
|
||||
stz ZPPtr3
|
||||
stz ZPPtr3+1
|
||||
|
||||
ldx #16
|
||||
|
||||
.1 lsr ZPPtr2+1
|
||||
ror ZPPtr2
|
||||
bcc .2
|
||||
|
||||
clc
|
||||
lda ZPPtr1
|
||||
adc ZPPtr3
|
||||
sta ZPPtr3
|
||||
|
||||
lda ZPPtr1+1
|
||||
adc ZPPtr3+1
|
||||
sta ZPPtr3+1
|
||||
|
||||
.2 asl ZPPtr1
|
||||
rol ZPPtr1+1
|
||||
|
||||
dex
|
||||
bne .1
|
||||
|
||||
>LDYA ZPPtr3
|
||||
jsr KW.PushWSigned
|
||||
>FPU IMUL16
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
|
@ -471,7 +419,7 @@ KW.DABS
|
|||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.MINUS lda (pStack) LO
|
||||
KW.NEGATE lda (pStack) LO
|
||||
eor #$ff
|
||||
sec
|
||||
adc #0
|
||||
|
@ -486,7 +434,7 @@ KW.MINUS lda (pStack) LO
|
|||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
KW.DMINUS lda (pStack) LO
|
||||
KW.DNEGATE lda (pStack) LO
|
||||
eor #$ff
|
||||
sec
|
||||
adc #0
|
||||
|
|
|
@ -105,13 +105,11 @@ J.KEYWORDS.DUP .DA KW.DUP
|
|||
.DA KW.SWAP
|
||||
J.KEYWORDS.OVER .DA KW.OVER
|
||||
.DA KW.ROT
|
||||
.DA KW.mDUP
|
||||
.DA KW.gR
|
||||
.DA KW.Rg
|
||||
.DA KW.R
|
||||
.DA KW.qDUP
|
||||
J.KEYWORDS.ADD .DA KW.Add
|
||||
.DA KW.DAdd
|
||||
.DA KW.Sub
|
||||
.DA KW.DSub
|
||||
.DA KW.Mul
|
||||
.DA KW.Div
|
||||
.DA KW.Mod
|
||||
|
@ -122,8 +120,8 @@ J.KEYWORDS.ADD .DA KW.Add
|
|||
.DA KW.MIN
|
||||
.DA KW.ABS
|
||||
.DA KW.DABS
|
||||
.DA KW.MINUS
|
||||
.DA KW.DMINUS
|
||||
.DA KW.NEGATE
|
||||
.DA KW.DNEGATE
|
||||
.DA KW.AND
|
||||
.DA KW.OR
|
||||
.DA KW.XOR
|
||||
|
@ -202,11 +200,14 @@ KW.DO.ID .EQ *-J.KEYWORDS
|
|||
KW.IF.ID .EQ *-J.KEYWORDS
|
||||
.DA CP.IF
|
||||
.DA CP.ELSE
|
||||
.DA CP.ENDIF
|
||||
.DA CP.THEN
|
||||
.DA CP.BEGIN
|
||||
.DA CP.UNTIL
|
||||
.DA CP.REPEAT
|
||||
.DA CP.WHILE
|
||||
.DA KW.gR
|
||||
.DA KW.Rg
|
||||
.DA KW.R
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT clc
|
||||
|
@ -813,7 +814,7 @@ CheckStackPop4 lda pStack
|
|||
CS.END
|
||||
*--------------------------------------
|
||||
DEV.GFX .AZ "/dev/gfx"
|
||||
MSG.GREETINGS .AZ "\e[?7h\r\nA2osX-FORTH %d.%d (figFORTH)\r\n"
|
||||
MSG.GREETINGS .AZ "\e[?7h\r\nA2osX-FORTH %d.%d (FORTH-79)\r\n"
|
||||
MSG.USAGE .AS "Usage : FORTH <option> file\r\n"
|
||||
.AS " -D : Debug Mode\r\n"
|
||||
.AS " -T : Trace On"
|
||||
|
@ -846,13 +847,11 @@ KEYWORDS .AT "PLOT"
|
|||
.AT "SWAP" ( n1 n2 - n2 n1 ) Reverse top two stack items.
|
||||
.AT "OVER" ( n1 n2 - n1 n2 n1 ) Copy second item to top.
|
||||
.AT "ROT" ( n1 n2 n3 - n2 n3 n1 ) Rotate third item to top.
|
||||
.AT "-DUP" ( n - n ? ) Duplicate only if non-zero.
|
||||
.AT ">R" ( n - ) Move top item to return stack.
|
||||
.AT "R>" ( - n ) Retrieve item from return stack.
|
||||
.AT "R" ( - n ) Copy top of return stack onto stack.
|
||||
.AT "?DUP" ( n - n ? ) Duplicate only if non-zero.
|
||||
.AT "+" ( n1 n2 - sum ) Add.
|
||||
.AT "D+" ( d1 d2 - sum ) Add double-precision numbers.
|
||||
.AT "-" ( n1 n2 - diff ) Subtract (n1-n2).
|
||||
.AT "D-" ( d1 d2 - diff ) Subtract double-precision numbers.
|
||||
.AT "*" ( n1 n2 - prod ) Multiply.
|
||||
.AT "/" ( n1 n2 - quot ) Divide (n1/n2).
|
||||
.AT "MOD" ( n1 n2 - rem ) Modulo (remainder from division).
|
||||
|
@ -863,8 +862,8 @@ KEYWORDS .AT "PLOT"
|
|||
.AT "MIN" ( n1 n2 - min ) Minimum.
|
||||
.AT "ABS" ( n - absolute ) Absolute value.
|
||||
.AT "DABS" ( d - absolute ) Absolute value of double-precision number.
|
||||
.AT "MINUS" ( n - -n ) Change sign.
|
||||
.AT "DMINUS" ( d - -d ) Change sign of double-precision number.
|
||||
.AT "NEGATE" ( n - -n ) Change sign.
|
||||
.AT "DNEGATE" ( d - -d ) Change sign of double-precision number.
|
||||
.AT "AND" ( n1 n2 - and ) Logical bitwise AND.
|
||||
.AT "OR" ( n1 n2 - or ) Logical bitwise OR.
|
||||
.AT "XOR" ( n1 n2 - xor ) Logical bitwise exclusive OR.
|
||||
|
@ -939,11 +938,14 @@ KEYWORDS .AT "PLOT"
|
|||
.AT "LEAVE" ( - ) Terminate loop at next LOOP or +LOOP.
|
||||
.AT "IF" ( f - ) If top of stack is true, execute true clause.
|
||||
.AT "ELSE" ( - ) Beginning of the false clause.
|
||||
.AT "ENDIF" ( - ) End of the IF-ELSE structure.
|
||||
.AT "THEN" ( - ) End of the IF-ELSE structure.
|
||||
.AT "BEGIN" ( - ) Start an indefinite loop.
|
||||
.AT "UNTIL" ( f - ) Loop back to BEGIN until f is true.
|
||||
.AT "REPEAT" ( - ) Loop back to BEGIN unconditionally.
|
||||
.AT "WHILE" ( f - ) Exit loop immediately if f is false.
|
||||
.AT ">R" ( n - ) Move top item to return stack.
|
||||
.AT "R>" ( - n ) Retrieve item from return stack.
|
||||
.AT "R" ( - n ) Copy top of return stack onto stack.
|
||||
*--------------------------------------
|
||||
.DA #0
|
||||
*--------------------------------------
|
||||
|
|
|
@ -164,7 +164,12 @@ CL.CHARIN.CTRL cpx #C.CR
|
|||
cpx #3 Ctrl-C
|
||||
beq CL.CLR
|
||||
|
||||
cpx #26 Ctrl-Z
|
||||
cpx #C.TAB
|
||||
bne .1
|
||||
|
||||
jmp HIS.Select
|
||||
|
||||
.1 cpx #26 Ctrl-Z
|
||||
bne .8
|
||||
jmp CL.SUPPR
|
||||
|
||||
|
|
126
BIN/SH.S.HIS.txt
126
BIN/SH.S.HIS.txt
|
@ -1,91 +1,147 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
HIS.Init >LDYAI HISTORY.MAX Get a buffer for History
|
||||
>SYSCALL NewStkObj
|
||||
|
||||
>SYSCALL StrVNew
|
||||
bcs .9
|
||||
|
||||
txa
|
||||
>STA.G HIS.hBuf
|
||||
|
||||
>PUSHA
|
||||
>PUSHWI 0
|
||||
>SYSCALL StrVAdd Reset Buffer
|
||||
|
||||
>STZ.G HIS.Count
|
||||
>STA.G HIS.Index
|
||||
>STA.G HIS.LRU
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
HIS.Add >LDA.G HIS.hBuf
|
||||
beq .9
|
||||
|
||||
>LDA.G HIS.Count
|
||||
cmp #HIS.MAX
|
||||
bcc .2
|
||||
|
||||
>LDA.G HIS.LRU
|
||||
tax
|
||||
inc
|
||||
cmp #HIS.MAX
|
||||
bne .1
|
||||
|
||||
lda #0
|
||||
|
||||
.1 >STA.G HIS.LRU
|
||||
bra .7
|
||||
|
||||
.2 tax
|
||||
>INC.G HIS.Count
|
||||
|
||||
.7 >PUSHB.G HIS.hBuf
|
||||
>PUSHBI 0
|
||||
txa
|
||||
>PUSHA
|
||||
>PUSHW ZPCLBuf
|
||||
>SYSCALL StrVAdd
|
||||
bcc .1
|
||||
>SYSCALL StrVSet
|
||||
|
||||
>STZ.G HIS.Index Reset Index
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
HIS.Select >LDA.G HIS.Count
|
||||
beq .8
|
||||
|
||||
>STZ.G HIS.Index
|
||||
|
||||
.1 jsr HIS.GetIndex
|
||||
bcs .9
|
||||
|
||||
>PUSHW L.MSG.HISTORY
|
||||
>PUSHB.G HIS.Index
|
||||
>PUSHW ZPCLBuf
|
||||
>PUSHBI 3
|
||||
>SYSCALL PrintF
|
||||
bcs .9
|
||||
|
||||
>INC.G HIS.Index
|
||||
>CMP.G HIS.Count
|
||||
bne .1
|
||||
|
||||
>PUSHB.G HIS.hBuf
|
||||
lda #0
|
||||
>PUSHA
|
||||
>SYSCALL StrVShift
|
||||
>DEC.G HIS.Count
|
||||
bra HIS.Add
|
||||
>PUSHW L.MSG.HISTORYPROMPT
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
|
||||
.1 >STZ.G HIS.Index Reset Index
|
||||
>INC.G HIS.Count
|
||||
>SYSCALL GetChar
|
||||
bcs HIS.Select.RTS
|
||||
|
||||
|
||||
|
||||
* >PUSHW L.MSG.ECHOCRLF
|
||||
* >PUSHBI 0
|
||||
* >SYSCALL PrintF
|
||||
|
||||
jsr CL.PrintPrompt
|
||||
bcs .9
|
||||
|
||||
bra HIS.Reset
|
||||
|
||||
.8 clc
|
||||
.9
|
||||
HIS.Add.RTS rts
|
||||
|
||||
HIS.Select.RTS rts
|
||||
*--------------------------------------
|
||||
HIS.GetPrev >LDA.G HIS.hBuf
|
||||
beq HIS.Add.RTS
|
||||
beq HIS.Select.RTS
|
||||
|
||||
>LDA.G HIS.Count
|
||||
beq HIS.Add.RTS empty history,nothing to do
|
||||
beq HIS.Select.RTS empty history,nothing to do
|
||||
|
||||
>LDA.G HIS.Index
|
||||
bne .1
|
||||
|
||||
>LDA.G HIS.Count
|
||||
|
||||
.1 dec
|
||||
bra HIS.GetToCl
|
||||
bra HIS.GetToCL
|
||||
*--------------------------------------
|
||||
HIS.GetNext >LDA.G HIS.hBuf
|
||||
beq HIS.Add.RTS
|
||||
beq HIS.Select.RTS
|
||||
|
||||
>LDA.G HIS.Count
|
||||
beq HIS.Add.RTS empty history,nothing to do
|
||||
beq HIS.Select.RTS empty history,nothing to do
|
||||
|
||||
>LDA.G HIS.Index
|
||||
inc
|
||||
>CMP.G HIS.Count
|
||||
bne HIS.GetToCl
|
||||
bne HIS.GetToCL
|
||||
|
||||
lda #0
|
||||
>STA.G HIS.Index
|
||||
HIS.Reset >STZ.G HIS.Index
|
||||
jmp CL.CLR
|
||||
*--------------------------------------
|
||||
HIS.GetToCl >STA.G HIS.Index
|
||||
HIS.GetToCL >STA.G HIS.Index
|
||||
|
||||
jsr CL.CLR
|
||||
|
||||
>PUSHB.G HIS.hBuf
|
||||
>PUSHB.G HIS.Index
|
||||
>PUSHW ZPCLBuf
|
||||
jsr HIS.GetIndex
|
||||
bcs .9
|
||||
|
||||
>SYSCALL StrVGet
|
||||
|
||||
ldy #$ff
|
||||
|
||||
|
||||
.1 iny
|
||||
lda (ZPCLBuf),y
|
||||
bne .1
|
||||
|
||||
|
||||
tya
|
||||
|
||||
|
||||
>STA.G CL.Ptr
|
||||
>STA.G CL.Len
|
||||
jmp CL.PrintCLBuf
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
HIS.GetIndex >PUSHB.G HIS.hBuf
|
||||
>PUSHBI 0
|
||||
>PUSHB.G HIS.Index
|
||||
>PUSHW ZPCLBuf
|
||||
>SYSCALL StrVGet
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/bin/sh.s.his
|
||||
|
|
|
@ -5,6 +5,7 @@ NEW
|
|||
.OR $2000
|
||||
.TF bin/sh
|
||||
*--------------------------------------
|
||||
HIS.MAX .EQ 10
|
||||
HISTORY.MAX .EQ 256
|
||||
CORE.STACK.MAX .EQ 128
|
||||
PUSHD.STACK.MAX .EQ 4
|
||||
|
@ -102,6 +103,8 @@ CS.START cld
|
|||
.DA CS.QUIT
|
||||
*--------------------------------------
|
||||
L.MSG.GREETINGS .DA MSG.GREETINGS
|
||||
L.MSG.HISTORY .DA MSG.HISTORY
|
||||
L.MSG.HISTORYPROMPT .DA MSG.HISTORYPROMPT
|
||||
L.MSG.PROMPT .DA MSG.PROMPT
|
||||
L.MSG.PROMPTCRLF .DA MSG.PROMPTCRLF
|
||||
L.MSG.TRACE .DA MSG.TRACE
|
||||
|
@ -558,6 +561,8 @@ IncPStack3 inc pStack
|
|||
CS.END
|
||||
*--------------------------------------
|
||||
MSG.GREETINGS .AZ "\r\nA2osX-SH %d.%d\r\n\r\n"
|
||||
MSG.HISTORY .AZ "\r\n%3d : %s"
|
||||
MSG.HISTORYPROMPT .AZ "\r\n\r\n? "
|
||||
MSG.PROMPT .AZ "\e[?7h$ " Enable Line Wrap
|
||||
MSG.PROMPTCRLF .AZ "\e[?7l\r\n" Disable Line Wrap
|
||||
MSG.TRACE .AS ">"
|
||||
|
@ -715,6 +720,7 @@ CORE.bPipeOut .BS 1
|
|||
HIS.hBuf .BS 1
|
||||
HIS.Count .BS 1
|
||||
HIS.Index .BS 1
|
||||
HIS.LRU .BS 1
|
||||
|
||||
IO.hIn .BS 1
|
||||
IO.hOut .BS 1
|
||||
|
|
|
@ -29,7 +29,7 @@ NEW
|
|||
MAXITER 0 DO
|
||||
ZX @ ZX @ * 50 / ZX2 !
|
||||
ZY @ ZY @ * 100 / ZY2 !
|
||||
ZX2 @ ZY2 @ + 1000 > IF I COLOR ! LEAVE ENDIF
|
||||
ZX2 @ ZY2 @ + 1000 > IF I COLOR ! LEAVE THEN
|
||||
ZX @ ZY @ * 25 / CY @ + ZY !
|
||||
ZX2 @ ZY2 @ - CX @ + ZX !
|
||||
LOOP
|
||||
|
|
|
@ -123,6 +123,8 @@ E.BADFTYPE .EQ $C7
|
|||
E.FUNDEF .EQ $C8
|
||||
E.UNEXPEOF .EQ $C9
|
||||
E.NODO .EQ $CA
|
||||
*
|
||||
E.TMISMATCH .EQ $CF
|
||||
*--------------------------------------
|
||||
E.OOM .EQ $7F Out Of Memory Error
|
||||
E.OOH .EQ $7E Out Of Handle Error
|
||||
|
@ -167,7 +169,6 @@ C.XOFF .EQ 19
|
|||
C.FS .EQ 21
|
||||
C.ESC .EQ 27
|
||||
C.SPACE .EQ 32
|
||||
C.COLON .EQ 58
|
||||
C.DEL .EQ 127
|
||||
*--------------------------------------
|
||||
AF.LOCAL .EQ 0
|
||||
|
@ -295,10 +296,10 @@ SYS.FileSearch .EQ $AC
|
|||
SYS.GetMemStat .EQ $AE
|
||||
*--------------------------------------E0/AUX
|
||||
* STRV / STRVX
|
||||
SYS.StrVShift .EQ $B0
|
||||
SYS.StrVGet .EQ $B2
|
||||
SYS.StrVAdd .EQ $B4
|
||||
* .EQ $B6
|
||||
SYS.StrVNew .EQ $B0
|
||||
SYS.StrVSet .EQ $B2
|
||||
SYS.StrVGet .EQ $B4
|
||||
SYS.StrVFree .EQ $B6
|
||||
* ENV / ENVX
|
||||
SYS.PutEnv .EQ $B8
|
||||
SYS.SetEnv .EQ $BA
|
||||
|
|
|
@ -5,14 +5,16 @@ LIBTUI.Init .EQ 4
|
|||
LIBTUI.Close .EQ 6
|
||||
*--------------------------------------
|
||||
S.OBJ.T .EQ 0
|
||||
S.OBJ.T.LBOX .EQ 0
|
||||
S.OBJ.F .EQ 1
|
||||
S.OBJ.T.SCRN .EQ 0
|
||||
S.OBJ.T.LBOX .EQ 2
|
||||
S.OBJ.P .EQ 1
|
||||
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.S .EQ 2
|
||||
S.OBJ.S .EQ 3
|
||||
S.OBJ.S.bVISIBLE .EQ %10000000
|
||||
* .EQ 3
|
||||
S.OBJ.S.bACTIVE .EQ %01000000
|
||||
S.OBJ.X1 .EQ 4
|
||||
S.OBJ.Y1 .EQ 5
|
||||
S.OBJ.W .EQ 6
|
||||
|
|
|
@ -129,42 +129,53 @@ NEW
|
|||
*--------------------------------------
|
||||
* FPU Entry Point
|
||||
*--------------------------------------
|
||||
FPU.ADD32 .EQ 0
|
||||
FPU.SUB32 .EQ 2
|
||||
FPU.MUL32 .EQ 4
|
||||
FPU.IMUL32 .EQ 6
|
||||
FPU.DIV32 .EQ 8
|
||||
FPU.IDIV32 .EQ 10
|
||||
FPU.MOD32 .EQ 12
|
||||
FPU.IMOD32 .EQ 14
|
||||
FPU.CMP32 .EQ 16
|
||||
FPU.ICMP32 .EQ 18
|
||||
FPU.ADD16 .EQ 0
|
||||
FPU.SUB16 .EQ 2
|
||||
FPU.MUL16 .EQ 4
|
||||
FPU.IMUL16 .EQ 6
|
||||
FPU.DIV16 .EQ 8
|
||||
FPU.IDIV16 .EQ 10
|
||||
FPU.MOD16 .EQ 12
|
||||
FPU.IMOD16 .EQ 14
|
||||
FPU.CMP16 .EQ 16
|
||||
FPU.ICMP16 .EQ 18
|
||||
|
||||
FPU.FADD .EQ 20
|
||||
FPU.FSUB .EQ 22
|
||||
FPU.FMULT .EQ 24
|
||||
FPU.FDIV .EQ 26
|
||||
FPU.PWR .EQ 28
|
||||
FPU.ADD32 .EQ 20
|
||||
FPU.SUB32 .EQ 22
|
||||
FPU.MUL32 .EQ 24
|
||||
FPU.IMUL32 .EQ 26
|
||||
FPU.DIV32 .EQ 28
|
||||
FPU.IDIV32 .EQ 30
|
||||
FPU.MOD32 .EQ 32
|
||||
FPU.IMOD32 .EQ 34
|
||||
FPU.CMP32 .EQ 36
|
||||
FPU.ICMP32 .EQ 38
|
||||
|
||||
FPU.LOG .EQ 30
|
||||
FPU.SQR .EQ 32
|
||||
FPU.EXP .EQ 34
|
||||
FPU.COS .EQ 36
|
||||
FPU.SIN .EQ 38
|
||||
FPU.TAN .EQ 40
|
||||
FPU.ATAN .EQ 42
|
||||
FPU.FADD .EQ 40
|
||||
FPU.FSUB .EQ 42
|
||||
FPU.FMULT .EQ 44
|
||||
FPU.FDIV .EQ 46
|
||||
FPU.PWR .EQ 48
|
||||
|
||||
FPU.SETARG .EQ 44 fadd.....
|
||||
FPU.SETFAC .EQ 46 log...., PrintF
|
||||
FPU.LOG .EQ 50
|
||||
FPU.SQR .EQ 52
|
||||
FPU.EXP .EQ 54
|
||||
FPU.COS .EQ 56
|
||||
FPU.SIN .EQ 58
|
||||
FPU.TAN .EQ 60
|
||||
FPU.ATAN .EQ 62
|
||||
|
||||
FPU.GETFAC .EQ 48 Copy FAC to (FORPNT)
|
||||
FPU.FCOMP .EQ 50
|
||||
FPU.SETARG .EQ 64 fadd.....
|
||||
FPU.SETFAC .EQ 66 log...., PrintF
|
||||
|
||||
FPU.LTOF .EQ 48 Float
|
||||
FPU.QINT .EQ 50 lrintf
|
||||
FPU.GETFAC .EQ 68 Copy FAC to (FORPNT)
|
||||
FPU.FCOMP .EQ 70
|
||||
|
||||
FPU.FIN .EQ 56 sscanf
|
||||
FPU.FOUT .EQ 58 PrintF
|
||||
FPU.LTOF .EQ 72 Float
|
||||
FPU.QINT .EQ 74 lrintf
|
||||
|
||||
FPU.FIN .EQ 76 sscanf
|
||||
FPU.FOUT .EQ 78 PrintF
|
||||
*--------------------------------------
|
||||
.MA FPU
|
||||
ldx #FPU.]1
|
||||
|
|
|
@ -84,6 +84,7 @@ D2.MoveHead.SEI lda D2.CurrentQTrack
|
|||
bne .1
|
||||
|
||||
jsr D2.SeekPhOnY we are on 0/4 or 2/4 track
|
||||
lda #1
|
||||
bra .9 no wait, next operation will be phy/plx/Ph0On,y
|
||||
|
||||
.1 cmp D2.TargetQTrack we are on 1/4 or 3/4
|
||||
|
@ -126,9 +127,9 @@ D2.MoveHead.SEI lda D2.CurrentQTrack
|
|||
.6 jsr D2.SeekPhOnY now X and Y on
|
||||
|
||||
.8 lda #IO.D2.SeekTimeF
|
||||
jsr D2.Wait100usecA ...wait...
|
||||
.9 jsr D2.Wait100usecA ...wait...
|
||||
|
||||
.9 lda D2.CurrentQTrack
|
||||
lda D2.CurrentQTrack
|
||||
cmp D2.TargetQTrack
|
||||
bne .3
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ NEW
|
|||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPLIB
|
||||
hCtx .BS 1
|
||||
.BS 1
|
||||
ZPCtxPtr .BS 2
|
||||
ZPObjPtr .BS 2
|
||||
ZPPtr1 .BS 2
|
||||
.ED
|
||||
|
@ -34,6 +37,9 @@ CS.START cld
|
|||
.DA LIB.UNLOAD
|
||||
.DA LIBTUI.Init
|
||||
.DA LIBTUI.Close
|
||||
*--------------------------------------
|
||||
|
||||
L.SEQ.INIT .DA SEQ.INIT
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
LIB.LOAD clc
|
||||
|
@ -42,13 +48,24 @@ LIB.LOAD clc
|
|||
LIB.UNLOAD clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
LIBTUI.Init clc
|
||||
rts
|
||||
LIBTUI.Init >LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
|
||||
|
||||
txa
|
||||
* clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
LIBTUI.Close clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
LIBTUI.LBOXNew >STYA ZPPtr1
|
||||
LIBTUI.LBOXNew >PULLB hCtx
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPCtxPtr
|
||||
|
||||
>PULLW ZPPtr1
|
||||
|
||||
>LDYAI S.LBOX
|
||||
>SYSCALL GetMem
|
||||
|
@ -59,7 +76,11 @@ LIBTUI.LBOXNew >STYA ZPPtr1
|
|||
lda #S.OBJ.T.LBOX
|
||||
sta (ZPObjPtr)
|
||||
|
||||
ldy #S.OBJ.F
|
||||
ldy #S.OBJ.P
|
||||
lda hCtx
|
||||
sta (ZPObjPtr),y
|
||||
|
||||
iny #S.OBJ.F
|
||||
|
||||
.1 lda (ZPPtr1),y
|
||||
sta (ZPObjPtr),y
|
||||
|
@ -71,7 +92,11 @@ LIBTUI.LBOXNew >STYA ZPPtr1
|
|||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
LIBTUI.LBOXLoad
|
||||
LIBTUI.LBOXLoad >SYSCALL GetMemPtr
|
||||
>STYA ZPObjPtr
|
||||
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
LIBTUI.LBOXFocus
|
||||
*--------------------------------------
|
||||
|
@ -103,7 +128,13 @@ LIBTUI.DrawFrame
|
|||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
|
||||
SEQ.INIT .AS "\ec\e(B\e)0"
|
||||
SEQ.SCROLLRGN .AZ "\e[?7l\e[2;%dr"
|
||||
SEQ.SCROLLCURUP .AS "\e[?7l\e[%d;%dr"
|
||||
SEQ.SCROLLUP .AZ "\eD"
|
||||
SEQ.SCROLLCURDN .AS "\e[?7l\e[%d;%dr"
|
||||
SEQ.SCROLLDN .AZ "\eM"
|
||||
SEQ.CLOSE .AZ "\ec"
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/lib/libtui.s
|
||||
|
|
|
@ -784,12 +784,7 @@ XRW.DEBUG.PBYTEx
|
|||
.8 sta $700,x
|
||||
inx
|
||||
rts
|
||||
|
||||
XRW.DEBUG2 ldx #$1E
|
||||
lda XRW.AddrField.V
|
||||
jsr XRW.DEBUG.PBYTEx
|
||||
lda XRW.AddrField.T
|
||||
bra XRW.DEBUG.PBYTEx
|
||||
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
* data tables
|
||||
|
|
|
@ -211,8 +211,7 @@ XRW.SectorIO bit XRW.bWrite
|
|||
* plx
|
||||
* jsr XRW.SeekPhOff
|
||||
|
||||
.1 lda #64
|
||||
sta XRW.RetryCnt
|
||||
.1 stz XRW.RetryCnt
|
||||
|
||||
.2 jsr XRW.ReadAddr
|
||||
bcs .3 (2)
|
||||
|
@ -226,8 +225,8 @@ XRW.SectorIO bit XRW.bWrite
|
|||
|
||||
jmp XRW.Write (3)
|
||||
|
||||
.3 dec XRW.RetryCnt
|
||||
bne .2
|
||||
.3 inc XRW.RetryCnt
|
||||
bpl .2
|
||||
|
||||
sec
|
||||
|
||||
|
@ -400,17 +399,18 @@ XRW.TestWP ldx A2L
|
|||
* on entry: x = slotnum times 16
|
||||
*--------------------------------------
|
||||
.LIST ON
|
||||
XRW.Write bit IO.D2.ReadProt,x (4) PREWRITE MODE
|
||||
XRW.Write lda IO.D2.RData,x (4)
|
||||
.LIST OFF
|
||||
bit IO.D2.ReadMode,x (4)
|
||||
bpl XRW.Write (2)
|
||||
|
||||
lda #$FF (2)
|
||||
|
||||
* nop (2)
|
||||
|
||||
* jsr XRW.Write.RTS (12)
|
||||
|
||||
sta IO.D2.WriteMode,x (5) goto write mode
|
||||
bit IO.D2.ReadProt,x (4) PREWRITE MODE
|
||||
* bit IO.D2.ReadMode,x (4)
|
||||
|
||||
bra .11 (3)
|
||||
|
||||
.11 sta IO.D2.WriteMode,x (5) goto write mode
|
||||
ora IO.D2.WShift,x (4)
|
||||
|
||||
nop (2)
|
||||
|
@ -688,26 +688,20 @@ XRW.ReadAddr.RTS
|
|||
XRW.TrackSelect lda #2
|
||||
sta XRW.BadSeekCnt
|
||||
|
||||
.1 lda #64
|
||||
sta XRW.RetryCnt
|
||||
.1 stz XRW.RetryCnt
|
||||
|
||||
.2 jsr XRW.ReadAddr
|
||||
bcc .4
|
||||
|
||||
.3 dec XRW.RetryCnt
|
||||
bne .2
|
||||
.3 inc XRW.RetryCnt
|
||||
bpl .2
|
||||
|
||||
jsr XRW.Recalibrate
|
||||
bcc .1
|
||||
|
||||
rts
|
||||
|
||||
.4
|
||||
* .DO XRWDBG=1
|
||||
* jsr XRW.DEBUG2
|
||||
* .FIN
|
||||
|
||||
ldx XRW.UnitIndex
|
||||
.4 ldx XRW.UnitIndex
|
||||
lda XRW.AddrField.V
|
||||
cmp #194
|
||||
bcc .5
|
||||
|
@ -722,26 +716,26 @@ XRW.TrackSelect lda #2
|
|||
lda XRW.ReqTrack
|
||||
bcc .50
|
||||
|
||||
lsr Track 160 -> 80+Carry
|
||||
pha
|
||||
* lsr Track 160 -> 80+Carry
|
||||
* pha
|
||||
|
||||
lda #0 Carry = Head
|
||||
* lda #0 Carry = Head
|
||||
|
||||
rol
|
||||
rol A = 0/2
|
||||
* rol
|
||||
* rol A = 0/2
|
||||
|
||||
ora A2L
|
||||
tay y = n0/n2
|
||||
* ora A2L
|
||||
* tay y = n0/n2
|
||||
|
||||
lda IO.D2.Ph0On,y
|
||||
lda IO.D2.Ph0On+4,y
|
||||
* lda IO.D2.Ph0On,y
|
||||
* lda IO.D2.Ph0On+4,y
|
||||
|
||||
jsr XRW.Wait100usec
|
||||
* jsr XRW.Wait100usec
|
||||
|
||||
lda IO.D2.Ph0Off,y
|
||||
lda IO.D2.Ph0Off+4,y
|
||||
* lda IO.D2.Ph0Off,y
|
||||
* lda IO.D2.Ph0Off+4,y
|
||||
|
||||
pla
|
||||
* pla
|
||||
|
||||
.50 sta XRW.ReqTrack2
|
||||
|
||||
|
@ -799,6 +793,7 @@ XRW.SeekYA sta XRW.D2Trk-1,x will be current track at the end
|
|||
bne .1
|
||||
|
||||
jsr XRW.SeekPhOnY we are on 0/4 or 2/4 track : PhY on
|
||||
lda #1
|
||||
bra .9 no wait, next operation will be phy/plx/Ph0On,y
|
||||
|
||||
.1 cmp XRW.TargetQTrack we are on 1/4 or 3/4
|
||||
|
@ -841,9 +836,9 @@ XRW.SeekYA sta XRW.D2Trk-1,x will be current track at the end
|
|||
.6 jsr XRW.SeekPhOnY now X and Y on
|
||||
|
||||
.8 lda XRW.SeekTime
|
||||
jsr XRW.Wait100usecA ...wait...
|
||||
.9 jsr XRW.Wait100usecA ...wait...
|
||||
|
||||
.9 lda XRW.CurrentQTrack
|
||||
lda XRW.CurrentQTrack
|
||||
cmp XRW.TargetQTrack
|
||||
bne .3
|
||||
|
||||
|
@ -856,16 +851,18 @@ XRW.SeekPhOff lda IO.D2.Ph0Off,x
|
|||
clc Exit wit CC (recalibrate)
|
||||
rts
|
||||
*--------------------------------------
|
||||
*XRW.SeekPhOnXY lda XRW.ReqTrack2
|
||||
XRW.SeekPhOnXY lda XRW.ReqTrack2
|
||||
|
||||
* jsr XRW.Trk2Qtrk
|
||||
* and #6
|
||||
* ora A2L
|
||||
* tax
|
||||
jsr XRW.Trk2Qtrk
|
||||
pha
|
||||
and #6
|
||||
ora A2L
|
||||
tax
|
||||
|
||||
* bit IO.D2.Ph0On,x
|
||||
lda IO.D2.Ph0On,x
|
||||
|
||||
* inc
|
||||
pla
|
||||
inc
|
||||
|
||||
XRW.SeekPhOnY and #6
|
||||
ora A2L
|
||||
|
|
|
@ -182,7 +182,7 @@ K.ArgVDup >STYA ZPPtr1
|
|||
>STYA ZPPtr2
|
||||
phx
|
||||
|
||||
jsr STRV.Ptr1Ptr2cpy
|
||||
jsr ARG.Ptr1Ptr2cpy
|
||||
|
||||
txa Count
|
||||
plx hMem
|
||||
|
@ -190,6 +190,33 @@ K.ArgVDup >STYA ZPPtr1
|
|||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
ARG.Ptr1Ptr2cpy ldx #0
|
||||
ldy #0
|
||||
|
||||
.4 lda (ZPPtr1),y
|
||||
sta (ZPPtr2),y
|
||||
beq .6
|
||||
|
||||
.5 iny
|
||||
bne .4
|
||||
|
||||
inc ZPPtr1+1
|
||||
inc ZPPtr2+1
|
||||
bra .4
|
||||
|
||||
.6 inx
|
||||
|
||||
iny
|
||||
bne .7
|
||||
|
||||
inc ZPPtr1+1
|
||||
inc ZPPtr2+1
|
||||
|
||||
.7 lda (ZPPtr1),y
|
||||
sta (ZPPtr2),y Ending \0 ?
|
||||
bne .5
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.arg
|
||||
LOAD usr/src/sys/kernel.s
|
||||
|
|
|
@ -93,21 +93,12 @@ K.LoadDrv >STYA .2+1 Save "BIN\0ARGS\0\0"
|
|||
adc .2+2 Y,A = ARGS
|
||||
|
||||
.3 jsr $ffff SELF MODIFIED, call Dev.Detect
|
||||
jsr BIN.Load.Cleanup
|
||||
jsr BIN.Load.Free
|
||||
bcs .9
|
||||
|
||||
lda #0 Make sure RC = 0 if success
|
||||
* clc
|
||||
.9 rts
|
||||
BIN.Load.Cleanup
|
||||
php
|
||||
pha
|
||||
lda BIN.hMem
|
||||
jsr K.FreeMem
|
||||
pla
|
||||
plp
|
||||
BIN.Load.Cleanup.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
* BIN.Load
|
||||
* in :
|
||||
|
@ -181,7 +172,7 @@ BIN.Load.1 >PUSHWI K.Buf256
|
|||
>PUSHYA Push AUXTYPE
|
||||
|
||||
jsr K.LoadFile
|
||||
bcs .9 Error Loading file
|
||||
bcs BIN.Load.Free.RTS Error Loading file
|
||||
|
||||
stx BIN.hMem save hMem
|
||||
|
||||
|
@ -213,7 +204,7 @@ BIN.Load.1 >PUSHWI K.Buf256
|
|||
|
||||
>LDYAI K.Buf256 get back bin path
|
||||
jsr K.strdup make a copy of this string
|
||||
bcs .98
|
||||
bcs BIN.Load.Free
|
||||
|
||||
jsr Mem.SetOwnerPS0 Make BINPATH owned by PS0
|
||||
|
||||
|
@ -229,8 +220,16 @@ BIN.Load.1 >PUSHWI K.Buf256
|
|||
ldx BIN.hMem setup X = CS hMem
|
||||
clc
|
||||
jmp MEM.GetMEMPTR ...and Y,A=PTR to CS
|
||||
.98 jmp BIN.Load.Cleanup Discard Loaded Code, exits CS
|
||||
.9 rts
|
||||
|
||||
BIN.Load.Free php
|
||||
pha
|
||||
lda BIN.hMem
|
||||
jsr K.FreeMem
|
||||
pla
|
||||
plp
|
||||
|
||||
BIN.Load.Free.RTS
|
||||
rts Discard Loaded Code, exits CS
|
||||
*/--------------------------------------
|
||||
* # InsDrv
|
||||
* ## C
|
||||
|
|
110
SYS/KERNEL.S.BLISTX.txt
Normal file
110
SYS/KERNEL.S.BLISTX.txt
Normal file
|
@ -0,0 +1,110 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
ZPBLISTXIBlkPtr .EQ ZPMEMMGR+12
|
||||
ZPBLISTXDBlkPtr .EQ ZPMEMMGR+14
|
||||
*--------------------------------------
|
||||
BLISTX.BytePtr .BS 1
|
||||
BLISTX.BlockPtr .BS 1
|
||||
*--------------------------------------
|
||||
BLISTX.New >LDYAI 128 32k Max before out of memory!!!
|
||||
ldx #S.MEM.F.INIT0+8 index
|
||||
jsr MEM.GetMem.YAX
|
||||
bcs .9
|
||||
|
||||
>STYA ZPBLISTXIBlkPtr
|
||||
stx .8+1
|
||||
|
||||
>LDYAI 256
|
||||
ldx #4 data
|
||||
jsr MEM.GetMem.YAX
|
||||
bcs .9
|
||||
|
||||
>STYA ZPBLISTXDBlkPtr
|
||||
|
||||
lda #0
|
||||
sta (ZPBLISTXDBlkPtr)
|
||||
txa
|
||||
sta (ZPBLISTXIBlkPtr)
|
||||
|
||||
.8 lda #$ff SELF MODIFIED
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
BLISTX.Free pha
|
||||
|
||||
jsr K.GetMemPtr
|
||||
>STYA .1+1
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda $ffff,x SELF MODIFIED
|
||||
beq .8
|
||||
|
||||
jsr K.FreeMem
|
||||
inx
|
||||
bra .1
|
||||
|
||||
.8 pla
|
||||
jmp K.FreeMem
|
||||
*--------------------------------------
|
||||
BLISTX.GetNextByte
|
||||
ldy BLISTX.BytePtr
|
||||
lda (ZPBLISTXDBlkPtr),y
|
||||
BLISTX.ToNextByte
|
||||
inc BLISTX.BytePtr
|
||||
bne .8
|
||||
|
||||
pha
|
||||
jsr BLISTX.ToNextBlock
|
||||
pla
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
BLISTX.AddDataByte
|
||||
phy
|
||||
ldy BLISTX.BytePtr
|
||||
sta (ZPBLISTXDBlkPtr),y
|
||||
inc BLISTX.BytePtr
|
||||
bne .8
|
||||
|
||||
phx
|
||||
>LDYAI 256
|
||||
ldx #4
|
||||
jsr MEM.GetMem.YAX
|
||||
bcs .9
|
||||
|
||||
>STYA ZPBLISTXDBlkPtr
|
||||
txa
|
||||
inc BLISTX.BlockPtr
|
||||
ldy BLISTX.BlockPtr
|
||||
sta (ZPBLISTXIBlkPtr),y
|
||||
|
||||
* stz BLISTX.BytePtr
|
||||
plx
|
||||
|
||||
.8 ply
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 plx
|
||||
ply
|
||||
rts
|
||||
*--------------------------------------
|
||||
BLISTX.SetBlockByte
|
||||
ldy BLISTX.BytePtr
|
||||
sta (ZPBLISTXDBlkPtr),y
|
||||
inc BLISTX.BytePtr
|
||||
bne BLISTX.ToNextBlock.RTS
|
||||
*--------------------------------------
|
||||
BLISTX.ToNextBlock
|
||||
inc BLISTX.BlockPtr
|
||||
ldy BLISTX.BlockPtr
|
||||
lda (ZPBLISTXIBlkPtr),y
|
||||
jsr K.GetMemPtr
|
||||
>STYA ZPBLISTXDBlkPtr
|
||||
BLISTX.ToNextBlock.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.blistx
|
||||
LOAD usr/src/sys/kernel.s
|
||||
ASM
|
|
@ -33,7 +33,7 @@ CORE.Run ldx #1
|
|||
dec IRQ.InKernel
|
||||
bcc .4 INIT/RUN Exit ?
|
||||
|
||||
jsr CORE.UpdateParentPS
|
||||
jsr CORE.UpdPPS Yes, go Update Parent PS
|
||||
|
||||
ldy #S.PS.S
|
||||
lda #S.PS.S.QUIT
|
||||
|
@ -131,7 +131,7 @@ CORE.Events jsr CORE.GetEvents
|
|||
*--------------------------------------
|
||||
CORE.Quit php
|
||||
sei
|
||||
jsr CORE.IRQ.None.Off
|
||||
jsr CORE.IRQ.Off
|
||||
|
||||
plp
|
||||
|
||||
|
@ -150,8 +150,7 @@ CORE.Quit php
|
|||
ldx #MLIQUIT
|
||||
jmp GP.MLICall
|
||||
*--------------------------------------
|
||||
CORE.UpdateParentPS
|
||||
tax save RC From INIT or RUN
|
||||
CORE.UpdPPS tax save RC From INIT or RUN
|
||||
|
||||
ldy #S.PS.PPID Notify Parent Process for exit code...
|
||||
lda (pPS),y
|
||||
|
@ -339,26 +338,30 @@ CORE.Dispatch ldx #1 skip PS0
|
|||
*--------------------------------------
|
||||
CORE.GetPSByID jsr CORE.GetPS
|
||||
bcs CORE.GetPS.RTS
|
||||
|
||||
lda PS.TABLE.hPS,y
|
||||
jmp K.GetMemPtr
|
||||
*--------------------------------------
|
||||
* X,A unmodified
|
||||
*--------------------------------------
|
||||
CORE.GetPS tay
|
||||
beq CORE.GetPS.8 PS0 requested
|
||||
beq .8 PS0 requested
|
||||
|
||||
ldy #0
|
||||
bra .2 Skip PS0
|
||||
|
||||
.1 cmp PS.Table.PID,y
|
||||
beq CORE.GetPS.8
|
||||
beq .8
|
||||
|
||||
.2 iny
|
||||
cpy CORE.PSCount
|
||||
bne .1
|
||||
|
||||
.9 lda #E.NSP
|
||||
* sec
|
||||
rts
|
||||
CORE.GetPS.8
|
||||
clc
|
||||
|
||||
.8 clc
|
||||
CORE.GetPS.RTS rts
|
||||
*--------------------------------------
|
||||
*CORE.DumpEvent ldy #S.EVT-1
|
||||
|
@ -616,15 +619,15 @@ CORE.IRQ.TCLOCK.Off
|
|||
lda $c080,x
|
||||
|
||||
ldx IRQ.0n
|
||||
sta CLRPAGE2
|
||||
stz $478,x
|
||||
stz $7f8,x
|
||||
|
||||
sta SETPAGE2
|
||||
stz $478,x
|
||||
stz $7f8,x
|
||||
|
||||
rts
|
||||
sta CLRPAGE2
|
||||
stz $478,x
|
||||
stz $7f8,x
|
||||
*--------------------------------------
|
||||
CORE.IRQ.Off rts
|
||||
*--------------------------------------
|
||||
CORE.IRQ.MOUSE.Off
|
||||
ldy CORE.IRQ.MOUSE.Off.1+2 Cn
|
||||
|
@ -632,8 +635,6 @@ CORE.IRQ.MOUSE.Off
|
|||
lda #0
|
||||
CORE.IRQ.MOUSE.Off.1
|
||||
jmp $ffff SELF MODIFIED
|
||||
CORE.IRQ.None.Off
|
||||
rts
|
||||
*--------------------------------------
|
||||
IRQ.InKernel .BS 1
|
||||
IRQ.InLib .BS 1
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
ZPKERNEL .EQ $0
|
||||
*--------------------------------------
|
||||
ZPPtr1 .EQ ZPKERNEL
|
||||
ZPPtr2 .EQ ZPKERNEL+2
|
||||
ZPPtr3 .EQ ZPKERNEL+4
|
||||
ZPPtr4 .EQ ZPKERNEL+6
|
||||
ZPPtr1 .EQ 0
|
||||
ZPPtr2 .EQ 2
|
||||
ZPPtr3 .EQ 4
|
||||
ZPPtr4 .EQ 6
|
||||
|
||||
pFD .EQ ZPKERNEL+8
|
||||
pDRV .EQ ZPKERNEL+10
|
||||
pIOCTL .EQ ZPKERNEL+12
|
||||
pIOBuf .EQ ZPKERNEL+14
|
||||
pFD .EQ 8
|
||||
pDRV .EQ 10
|
||||
pIOCTL .EQ 12
|
||||
pIOBuf .EQ 14
|
||||
*--------------------------------------
|
||||
ZPMEMMGR .EQ $10
|
||||
*--------------------------------------
|
||||
|
@ -31,9 +29,9 @@ XFer .EQ $C314 CS:M->X, VS:Use Aux ZP
|
|||
* $42-$47 ProDOS Block Device Drivers Main
|
||||
*--------------------------------------
|
||||
DRV.BLK.Cmd .EQ $42
|
||||
DRV.BLK.UnitNum .EQ $43
|
||||
DRV.BLK.Buf .EQ $44
|
||||
DRV.BLK.BlkNum .EQ $46
|
||||
*DRV.BLK.UnitNum .EQ $43
|
||||
*DRV.BLK.Buf .EQ $44
|
||||
*DRV.BLK.BlkNum .EQ $46
|
||||
*--------------------------------------
|
||||
* $5E-$C8 RESERVED APPLESOFT Main/Aux (ROM Call, no need to switch back MainZP)
|
||||
*--------------------------------------
|
||||
|
@ -222,10 +220,10 @@ S.DCB.TTY.bG0G1ALT .EQ 15
|
|||
|
||||
S.DCB.TTY.OUTTAIL .EQ 16
|
||||
S.DCB.TTY.OUTHEAD .EQ 17
|
||||
S.DCB.TTY.INBUFFER .EQ 18
|
||||
S.DCB.TTY.INBUFFER.MAX .EQ 31
|
||||
S.DCB.TTY.OUTBUFFER .EQ 32
|
||||
S.DCB.TTY.OUTBUFFER.MAX .EQ 64
|
||||
S.DCB.TTY.INBUF .EQ 18
|
||||
S.DCB.TTY.INBUF.MAX .EQ 31
|
||||
S.DCB.TTY.OUTBUF .EQ 32
|
||||
S.DCB.TTY.OUTBUF.MAX .EQ 64
|
||||
*
|
||||
S.DCB.TTY .EQ 64
|
||||
*--------------------------------------
|
||||
|
|
|
@ -61,32 +61,31 @@ DRV.RamDrive.DIB
|
|||
.DA #0
|
||||
.DA K.VER
|
||||
*--------------------------------------
|
||||
* DRV.BlkDevice
|
||||
* DRV.BlkDev
|
||||
* X = IOCTL
|
||||
* Y,A = PTR to S.IOCTL
|
||||
*--------------------------------------
|
||||
DRV.BlkDevice cld
|
||||
DRV.BlkDev cld
|
||||
cpx #IOCTL.CONTROL
|
||||
bcs DRV.RamDrive.9
|
||||
>STYA pIOCTL
|
||||
jmp (.1,x)
|
||||
.1 .DA DRV.BlkDevice.STATUS
|
||||
.1 .DA DRV.BlkDev.STATUS
|
||||
.DA DRV.BLK READ
|
||||
.DA DRV.BLK WRITE
|
||||
.DA DRV.BLK FORMAT
|
||||
*--------------------------------------
|
||||
DRV.BlkDevice.STATUS
|
||||
DRV.BlkDev.STATUS
|
||||
jsr DRV.Blk
|
||||
bcs .9
|
||||
stx DRV.BlkDevice.DIB+S.DIB.SIZE
|
||||
sty DRV.BlkDevice.DIB+S.DIB.SIZE+1
|
||||
stx DRV.BlkDev.DIB+S.DIB.SIZE
|
||||
sty DRV.BlkDev.DIB+S.DIB.SIZE+1
|
||||
|
||||
>LDYAI DRV.BlkDevice.DIB
|
||||
>LDYAI DRV.BlkDev.DIB
|
||||
jmp DRV.STATUS.YA
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
DRV.BlkDevice.DIB
|
||||
.DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
|
||||
DRV.BlkDev.DIB .DA #S.DIB.S.BLOCK+S.DIB.S.WRITE+S.DIB.S.READ
|
||||
.BS 3
|
||||
>PSTR "ProDOS Block Dev"
|
||||
.DA #S.DIB.T.PRODOS
|
||||
|
@ -98,7 +97,7 @@ DRV.BlkDevice.DIB
|
|||
*--------------------------------------
|
||||
DRV.BLK txa
|
||||
lsr
|
||||
sta DRV.BLK.PARAMS CMD
|
||||
sta DRV.BLK.P CMD
|
||||
ldy #S.FD.DEV.DEVID Drive 1, or 2
|
||||
lda (pFD),y
|
||||
dec O or 1
|
||||
|
@ -114,12 +113,12 @@ DRV.BLK txa
|
|||
plp
|
||||
ror DSSS0000
|
||||
|
||||
sta DRV.BLK.PARAMS+1 UNITNUM
|
||||
sta DRV.BLK.P+1 UNITNUM
|
||||
ldx #3
|
||||
ldy #S.IOCTL.BUFPTR+3
|
||||
|
||||
.1 lda (pIOCTL),y BUF,BLKNUM
|
||||
sta DRV.BLK.PARAMS+2,x
|
||||
sta DRV.BLK.P+2,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
@ -135,8 +134,8 @@ DRV.BLK txa
|
|||
|
||||
ldx #5
|
||||
|
||||
.2 lda DRV.BLK.PARAMS,x
|
||||
sta $42,x
|
||||
.2 lda DRV.BLK.P,x
|
||||
sta DRV.BLK.Cmd,x
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
|
@ -144,7 +143,8 @@ DRV.BLK txa
|
|||
|
||||
jsr GO.A2osX
|
||||
rts
|
||||
DRV.BLK.PARAMS .BS 6
|
||||
|
||||
DRV.BLK.P .BS 6
|
||||
*--------------------------------------
|
||||
* Smartport Driver
|
||||
*--------------------------------------
|
||||
|
@ -200,10 +200,10 @@ DRV.NULL cld
|
|||
* .DA A2osX.BADCALL FORMAT
|
||||
* .DA A2osX.BADCALL CONTROL
|
||||
* .DA A2osX.BADCALL INIT
|
||||
.DA DRV.NULL.OPEN
|
||||
.DA DRV.NULL.CLOSE
|
||||
.DA DRV.NULL.READ
|
||||
.DA DRV.NULL.WRITE
|
||||
.DA DRV.CLCRTS OPEN
|
||||
.DA DRV.CLCRTS CLOSE
|
||||
.DA DRV.NULL.READ
|
||||
.DA DRV.CLCRTS WRITE
|
||||
*--------------------------------------
|
||||
DRV.NULL.DIB .DA #S.DIB.S.WRITE+S.DIB.S.READ+S.DIB.S.OPENED
|
||||
.DA #0,#0,#0
|
||||
|
@ -248,8 +248,8 @@ DRV.STATUS.YA >STYA .2+1
|
|||
rts
|
||||
*--------------------------------------
|
||||
DRV.NULL.READ ldx #C.EOF
|
||||
*--------------------------------------
|
||||
DRV.READ.X ldy #S.IOCTL.BYTECNT
|
||||
|
||||
ldy #S.IOCTL.BYTECNT
|
||||
lda #1
|
||||
sta (pIOCTL),y
|
||||
iny
|
||||
|
@ -264,9 +264,7 @@ DRV.READ.X ldy #S.IOCTL.BYTECNT
|
|||
sta .1+2
|
||||
.1 stx $ffff SELF MODIFIED
|
||||
*--------------------------------------
|
||||
DRV.NULL.OPEN
|
||||
DRV.NULL.WRITE
|
||||
DRV.NULL.CLOSE clc
|
||||
DRV.CLCRTS clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
|
|
@ -346,7 +346,7 @@ ENVX.SIDVarsGID ldx #S.SESSION.GID
|
|||
tay
|
||||
lda (ZPPtr3),y
|
||||
|
||||
jsr MATH32.A2STR10NP
|
||||
jsr MATH.A2STR10NP
|
||||
|
||||
>LDYAI A2osX.NumStrBuf
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ NEW
|
|||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
ERRORX.GetErrorMessage
|
||||
ldx #ERRORX.Messages
|
||||
ldx #ERRORX.MSG
|
||||
stx ZPPtr1
|
||||
ldx /ERRORX.Messages
|
||||
ldx /ERRORX.MSG
|
||||
stx ZPPtr1+1
|
||||
|
||||
ldx #0
|
||||
|
@ -12,7 +12,7 @@ ERRORX.GetErrorMessage
|
|||
pha
|
||||
|
||||
.1 pla
|
||||
cmp ERRORX.Codes,x
|
||||
cmp ERRORX.ID,x
|
||||
beq .4
|
||||
|
||||
pha
|
||||
|
@ -31,7 +31,7 @@ ERRORX.GetErrorMessage
|
|||
inc ZPPtr1+1
|
||||
|
||||
.3 inx
|
||||
cpx #ERRORX.Count
|
||||
cpx #ERRORX.CNT
|
||||
bne .1
|
||||
|
||||
pla
|
||||
|
@ -55,7 +55,7 @@ ERRORX.GetErrorMessage
|
|||
clc
|
||||
rts
|
||||
*-------------------------------------- MLI
|
||||
ERRORX.Codes .DA #MLI.E.BADCALL
|
||||
ERRORX.ID .DA #MLI.E.BADCALL
|
||||
.DA #MLI.E.IO
|
||||
.DA #MLI.E.NODEV
|
||||
.DA #MLI.E.WRTPROT
|
||||
|
@ -99,10 +99,11 @@ ERRORX.Codes .DA #MLI.E.BADCALL
|
|||
.DA #E.FUNDEF
|
||||
.DA #E.UNEXPEOF
|
||||
.DA #E.NODO
|
||||
.DA #E.TMISMATCH
|
||||
*--------------------------------------
|
||||
ERRORX.Count .EQ *-ERRORX.Codes
|
||||
ERRORX.CNT .EQ *-ERRORX.ID
|
||||
*--------------------------------------
|
||||
ERRORX.Messages .AT "Bad MLI Call"
|
||||
ERRORX.MSG .AT "Bad MLI Call"
|
||||
.AT "I/O Error"
|
||||
.AT "No Device"
|
||||
.AT "Disk Write-Prot."
|
||||
|
@ -146,6 +147,7 @@ ERRORX.Messages .AT "Bad MLI Call"
|
|||
.AT "Undef. Function"
|
||||
.AT "Unexp. EOF"
|
||||
.AT "LOOP Without DO"
|
||||
.AT "Type Mismatch"
|
||||
*--------------------------------------
|
||||
.AT "Unknown Error"
|
||||
*--------------------------------------
|
||||
|
|
|
@ -207,7 +207,7 @@ GP.FpuCall dec IRQ.InKernel
|
|||
cpx #FPU.FADD
|
||||
bcs .1
|
||||
|
||||
jsr MATH32 INT32, direct JMP
|
||||
jsr MATH INT32, direct JMP
|
||||
bra GP.AtkCall.INC
|
||||
|
||||
.1 phx
|
||||
|
|
|
@ -777,7 +777,7 @@ DevMgrInit.SP ldy #$ff
|
|||
DevMgrInit.RSP ldx #10
|
||||
*--------------------------------------
|
||||
DevMgrInit.AddBDev
|
||||
>LDYA DRV.BLKDEV,x
|
||||
>LDYA DRV.BLKDEVX,x
|
||||
>STYA FD.BDEV+S.FD.DEV.DRVPTR
|
||||
|
||||
>PUSHWI MSG.BLKDEV
|
||||
|
@ -1247,12 +1247,12 @@ MSG.BLKDEV.USR .AZ "User"
|
|||
MSG.BLKDEV.BLK .AZ "Generic Block"
|
||||
MSG.BLKDEV.SP .AZ "Smart Port"
|
||||
MSG.BLKDEV.RSP .AZ "Remapped SP"
|
||||
DRV.BLKDEV .DA DRV.RamDrive
|
||||
DRV.BLKDEVX .DA DRV.RamDrive
|
||||
.DA DRV.DiskII
|
||||
.DA DRV.BlkDevice
|
||||
.DA DRV.BlkDevice
|
||||
.DA DRV.BlkDev
|
||||
.DA DRV.BlkDev
|
||||
.DA DRV.SmartPort
|
||||
.DA DRV.BlkDevice
|
||||
.DA DRV.BlkDev
|
||||
*--------------------------------------
|
||||
MSG.IRQ .AZ "Interrupt Manager..."
|
||||
MSG.IRQ.IIGS .AZ " Apple IIgs VBL IRQ Activated."
|
||||
|
|
|
@ -108,10 +108,10 @@ K.SYSCALL .DA K.ChTyp $00 : STAT
|
|||
*--------------------------------------
|
||||
* AUX
|
||||
*--------------------------------------
|
||||
.DA K.StrVShift $B0 : STRV
|
||||
.DA K.StrVNew $B0 : STRV
|
||||
.DA K.StrVSet
|
||||
.DA K.StrVGet
|
||||
.DA K.StrVAdd
|
||||
.DA 0
|
||||
.DA K.StrVFree
|
||||
.DA K.PutEnv $B8 : ENV
|
||||
.DA K.SetEnv
|
||||
.DA K.GetEnv
|
||||
|
@ -492,7 +492,7 @@ K.SYSCALL.JMPX sta SETREADAUX
|
|||
sta CLRWRITEAUX
|
||||
rts
|
||||
|
||||
.1 jmp (KX.SYSCALL-SYS.StrVShift,x)
|
||||
.1 jmp (KX.SYSCALL-SYS.StrVNew,x)
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.jmp
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
KX.SYSCALL .DA STRVX.StrVShift
|
||||
KX.SYSCALL .DA STRVX.StrVNew
|
||||
.DA STRVX.StrVSet
|
||||
.DA STRVX.StrVGet
|
||||
.DA STRVX.StrVAdd
|
||||
.DA 0
|
||||
.DA STRVX.StrVFree
|
||||
|
||||
.DA ENVX.PutEnv
|
||||
.DA ENVX.SetEnv
|
||||
|
|
|
@ -1,6 +1,256 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
MATH jmp (.1,x)
|
||||
.1 .DA M16.ADD
|
||||
.DA M16.SUB
|
||||
.DA M16.UMUL
|
||||
.DA M16.IMUL
|
||||
.DA M16.UDIV
|
||||
.DA M16.IDIV
|
||||
.DA M16.UMOD
|
||||
.DA M16.IMOD
|
||||
.DA M16.CMP UCMP
|
||||
.DA M16.CMP ICMP
|
||||
.DA M32.ADD
|
||||
.DA M32.SUB
|
||||
.DA M32.UMUL
|
||||
.DA M32.IMUL
|
||||
.DA M32.UDIV
|
||||
.DA M32.IDIV
|
||||
.DA M32.UMOD
|
||||
.DA M32.IMOD
|
||||
.DA M32.CMP UCMP
|
||||
.DA M32.CMP ICMP
|
||||
*--------------------------------------
|
||||
MATH.A2STR10NP ldx #3 3 digit max
|
||||
ldy #0 Disable Padding
|
||||
|
||||
MATH.A2STR10 jsr M32.A2ACC32
|
||||
clc unsigned
|
||||
*--------------------------------------
|
||||
* CS = signed long
|
||||
* CC = unsigned long
|
||||
* X = Pad Len
|
||||
* Y = Pad Char
|
||||
*--------------------------------------
|
||||
MATH.ACC322STR10
|
||||
stx .5+1 Pad Len
|
||||
sty .81+1 Pad Char
|
||||
|
||||
stz A2osX.NumStrLen
|
||||
bcc .1
|
||||
|
||||
clc
|
||||
lda ACC32+3
|
||||
bpl .1
|
||||
|
||||
jsr M32.nACC32
|
||||
|
||||
sec
|
||||
.1 ror ACC32.Sign Save sign
|
||||
|
||||
ldx #4
|
||||
|
||||
.2 stz RESULT,x Clear all 5 bytes
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
sed switch to BCD mode
|
||||
|
||||
ldx #32 let's roll 32 bits
|
||||
.3 jsr MATH.ACC32x2
|
||||
|
||||
ldy #4
|
||||
|
||||
.4 lda RESULT,y
|
||||
adc RESULT,y
|
||||
sta RESULT,y
|
||||
dey
|
||||
bpl .4
|
||||
|
||||
dex
|
||||
bne .3
|
||||
|
||||
cld
|
||||
|
||||
ldx .5+1 no padding
|
||||
beq .6
|
||||
|
||||
lda #10 starts at 10-padlen
|
||||
sec
|
||||
|
||||
.5 sbc #$ff SELF MODIFIED
|
||||
tax
|
||||
|
||||
.6 txa
|
||||
lsr
|
||||
tay
|
||||
lda RESULT,y
|
||||
bcs .7
|
||||
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
|
||||
.7 and #$0F
|
||||
ora #$30
|
||||
|
||||
cmp #'0'
|
||||
beq .80
|
||||
|
||||
ldy #'0' next 0s always printed
|
||||
sty .81+1
|
||||
bra .82
|
||||
|
||||
.80 cpx #9 last char, print always
|
||||
beq .82
|
||||
|
||||
.81 lda #$ff SELF MODIFIED Get Padding char
|
||||
beq .87
|
||||
|
||||
.82 bit ACC32.Sign "-" to print ?
|
||||
bpl .86
|
||||
|
||||
pha
|
||||
lda #'-'
|
||||
jsr .88
|
||||
stz ACC32.Sign
|
||||
pla
|
||||
|
||||
.86 jsr .88
|
||||
.87 inx
|
||||
cpx #10
|
||||
bne .6
|
||||
|
||||
lda #0
|
||||
|
||||
.88 ldy A2osX.NumStrLen
|
||||
inc A2osX.NumStrLen
|
||||
sta A2osX.NumStrBuf,y
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert Hex int at ZPPtr2 to ACC32
|
||||
*--------------------------------------
|
||||
MATH.Hex2ACC32 lda (ZPPtr2)
|
||||
beq .9
|
||||
|
||||
jsr SHARED.IsHexDigit
|
||||
bcs .9
|
||||
|
||||
jsr M32.A2ACC32
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr2),y
|
||||
beq .8
|
||||
|
||||
jsr SHARED.IsHexDigit
|
||||
bcs .8
|
||||
|
||||
pha
|
||||
ldx #4
|
||||
|
||||
.2 jsr MATH.ACC32x2
|
||||
dex
|
||||
bne .2
|
||||
|
||||
pla
|
||||
ora ACC32
|
||||
sta ACC32
|
||||
bra .1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert Decimal int at ZPPtr2 to ACC32
|
||||
*--------------------------------------
|
||||
MATH.Dec2ACC32 jsr M32.ACC32Z
|
||||
clc
|
||||
lda (ZPPtr2)
|
||||
eor #'-'
|
||||
bne .10
|
||||
|
||||
jsr SHARED.NextCharPtr2 skip '-'
|
||||
sec
|
||||
.10 ror .80+1 set pos/neg flag
|
||||
|
||||
ldy #$ff
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr2),y
|
||||
beq .8
|
||||
jsr ZP.IsDigit
|
||||
bcs .8
|
||||
|
||||
phy Save Y, pointing to next char
|
||||
jsr .70
|
||||
ply
|
||||
bcs .9
|
||||
|
||||
lda (ZPPtr2),y
|
||||
and #$0F
|
||||
* clc
|
||||
|
||||
adc ACC32
|
||||
sta ACC32
|
||||
bcc .1
|
||||
inc ACC32+1
|
||||
bne .1
|
||||
inc ACC32+2
|
||||
bne .1
|
||||
inc ACC32+3
|
||||
bne .1 if 0, overflow!!!
|
||||
|
||||
.9 lda #E.INUM
|
||||
sec
|
||||
rts
|
||||
|
||||
.8 tya no digit parsed...error
|
||||
beq .9
|
||||
|
||||
.80 lda #$FF SELF MODIFIED
|
||||
bpl .88
|
||||
|
||||
phy
|
||||
jsr M32.nACC32
|
||||
ply
|
||||
|
||||
.88 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
.70 ldx #3
|
||||
|
||||
.71 lda ACC32,x save ACC32 for 4+1
|
||||
pha
|
||||
dex
|
||||
bpl .71
|
||||
|
||||
jsr MATH.ACC32x2 ACC32 * 2 -> ACC32
|
||||
jsr MATH.ACC32x2 ACC32 * 4 -> ACC32
|
||||
|
||||
ldx #0
|
||||
ldy #4
|
||||
* clc
|
||||
|
||||
.72 pla ACC32 * 4 + ACC32 -> ACC32
|
||||
adc ACC32,x
|
||||
sta ACC32,x
|
||||
inx
|
||||
dey
|
||||
bne .72
|
||||
|
||||
MATH.ACC32x2 asl ACC32
|
||||
rol ACC32+1
|
||||
rol ACC32+2
|
||||
rol ACC32+3
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.math
|
||||
LOAD usr/src/sys/kernel.s
|
||||
|
|
235
SYS/KERNEL.S.MATH16.txt
Normal file
235
SYS/KERNEL.S.MATH16.txt
Normal file
|
@ -0,0 +1,235 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
M16.ADD lda #$72 ADC (zp)
|
||||
.HS 2C BIT ABS
|
||||
M16.SUB lda #$F2 SBC (zp)
|
||||
|
||||
sta .3
|
||||
|
||||
asl CS if SBC, CC if ADC
|
||||
|
||||
ldy #2
|
||||
ldx #2
|
||||
|
||||
.2 lda (pStack),y
|
||||
.3 adc (pStack) SELF MODIFIED
|
||||
sta (pStack),y
|
||||
|
||||
inc pStack
|
||||
dex
|
||||
bne .2
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Returns:
|
||||
* ff X < Y
|
||||
* 0 X = Y
|
||||
* 1 X > Y
|
||||
*--------------------------------------
|
||||
*M16.UCMP
|
||||
*M16.ICMP
|
||||
M16.CMP jsr M16.SUB
|
||||
|
||||
tay A = HI byte
|
||||
bmi .2
|
||||
|
||||
.1 ora (pStack) LO byte
|
||||
beq .8
|
||||
|
||||
lda #1
|
||||
.HS 2C BIT ABS
|
||||
|
||||
.2 lda #$ff
|
||||
|
||||
.8 inc pStack
|
||||
inc pStack
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
M16.UMUL clc
|
||||
.HS B0 BCS
|
||||
M16.IMUL sec
|
||||
|
||||
php
|
||||
jsr M16.MULDIVMOD
|
||||
jsr M16.MUL
|
||||
|
||||
plp
|
||||
bcc M16.PutTMP32
|
||||
|
||||
M16.ITMP lda ACC32.Sign
|
||||
eor ARG32.Sign
|
||||
bpl M16.PutTMP32
|
||||
*--------------------------------------
|
||||
* M16.PutnTMP32
|
||||
*--------------------------------------
|
||||
lda #TMP32
|
||||
.HS 2C BIT ABS
|
||||
*--------------------------------------
|
||||
M16.PutnARG32
|
||||
lda #ARG32
|
||||
sta .1+1
|
||||
ldy #0
|
||||
ldx #3
|
||||
sec
|
||||
|
||||
.1 lda $ff,y SELF MODIFIED
|
||||
eor #$ff two's complement of X bytes
|
||||
adc #0
|
||||
sta (pStack),y
|
||||
iny
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
M16.UDIV clc
|
||||
.HS B0 BCS
|
||||
M16.IDIV sec
|
||||
clv
|
||||
bra M16.MOD
|
||||
|
||||
M16.UMOD clc
|
||||
.HS B0 BCS
|
||||
M16.IMOD sec
|
||||
bit M16.RTS $60
|
||||
|
||||
M16.MOD php
|
||||
jsr M16.MULDIVMOD
|
||||
jsr M16.DIVMOD
|
||||
|
||||
plp
|
||||
bcc .3 unsigned
|
||||
|
||||
bvs M16.ITMP return ITMP
|
||||
|
||||
lda ACC32.Sign IDIV
|
||||
eor ARG32.Sign
|
||||
bpl M16.PutARG32
|
||||
bra M16.PutnARG32
|
||||
|
||||
.3 bvc M16.PutARG32 DIV
|
||||
*--------------------------------------
|
||||
M16.PutTMP32 ldy #TMP32 MOD
|
||||
.HS 2C BIT ABS
|
||||
*--------------------------------------
|
||||
M16.PutARG32 ldy #ARG32
|
||||
|
||||
lda $0,y
|
||||
sta (pStack)
|
||||
|
||||
lda $1,y
|
||||
ldy #1
|
||||
sta (pStack),y
|
||||
|
||||
M16.RTS rts
|
||||
*--------------------------------------
|
||||
M16.MULDIVMOD >PULLW ACC32
|
||||
sta ACC32.Sign
|
||||
|
||||
lda (pStack)
|
||||
sta ARG32
|
||||
|
||||
ldy #1
|
||||
lda (pStack),y
|
||||
sta ARG32+1
|
||||
|
||||
sta ARG32.Sign
|
||||
|
||||
bcc M16.RTS
|
||||
jsr .1
|
||||
*--------------------------------------
|
||||
* M16.ARG32ABS
|
||||
*--------------------------------------
|
||||
lda ARG32.Sign
|
||||
bmi .2
|
||||
rts
|
||||
*--------------------------------------
|
||||
* M16.ACC32ABS
|
||||
*--------------------------------------
|
||||
.1 lda ACC32.Sign
|
||||
bpl M16.RTS
|
||||
*--------------------------------------
|
||||
* M16.nACC32
|
||||
*--------------------------------------
|
||||
ldy #ACC32
|
||||
.HS 2C BIT ABS
|
||||
*--------------------------------------
|
||||
* M16.nARG32
|
||||
*--------------------------------------
|
||||
.2 ldy #ARG32
|
||||
|
||||
sec
|
||||
|
||||
lda $0,y
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta $0,y
|
||||
|
||||
lda $1,y
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta $1,y
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
M16.MUL stz TMP32
|
||||
stz TMP32+1
|
||||
|
||||
ldx #16
|
||||
.1 lsr ARG32+1
|
||||
ror ARG32
|
||||
bcc .3
|
||||
|
||||
clc
|
||||
|
||||
.2 lda TMP32
|
||||
adc ACC32
|
||||
sta TMP32
|
||||
|
||||
lda TMP32+1
|
||||
adc ACC32+1
|
||||
sta TMP32+1
|
||||
|
||||
.3 asl ACC32
|
||||
rol ACC32+1
|
||||
|
||||
dex
|
||||
bne .1
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
M16.DIVMOD stz TMP32
|
||||
stz TMP32+1
|
||||
|
||||
ldx #16
|
||||
|
||||
.1 asl ARG32
|
||||
rol ARG32+1
|
||||
|
||||
rol TMP32
|
||||
rol TMP32+1
|
||||
|
||||
sec
|
||||
lda TMP32
|
||||
sbc ACC32
|
||||
tay
|
||||
lda TMP32+1
|
||||
sbc ACC32+1
|
||||
bcc .2
|
||||
|
||||
sty TMP32
|
||||
sta TMP32+1
|
||||
inc ARG32 bit0 always 0 because of .1 asl
|
||||
|
||||
.2 dex
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.math16
|
||||
LOAD usr/src/sys/kernel.s
|
||||
ASM
|
|
@ -1,128 +1,79 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
MATH32 jmp (.1,x)
|
||||
.1 .DA MATH32.ADD
|
||||
.DA MATH32.SUB
|
||||
.DA MATH32.UMUL
|
||||
.DA MATH32.IMUL
|
||||
.DA MATH32.UDIV
|
||||
.DA MATH32.IDIV
|
||||
.DA MATH32.UMOD
|
||||
.DA MATH32.IMOD
|
||||
.DA MATH32.UCMP
|
||||
.DA MATH32.ICMP
|
||||
*--------------------------------------
|
||||
MATH32.ADD clc
|
||||
.HS B0 BCS
|
||||
MATH32.SUB sec
|
||||
php
|
||||
jsr MATH32.PopACC32
|
||||
|
||||
ldy #0
|
||||
ldx #3
|
||||
plp
|
||||
bcs .1
|
||||
|
||||
lda #$79 ADC Absolute,Y
|
||||
M32.ADD lda #$72 ADC (zp)
|
||||
.HS 2C BIT ABS
|
||||
.1 lda #$F9 SBC Absolute,Y
|
||||
M32.SUB lda #$F2 SBC (zp)
|
||||
|
||||
sta .3
|
||||
|
||||
.2 lda (pStack),y
|
||||
.3 adc ACC32,y SELF MODIFIED
|
||||
sta (pStack),y
|
||||
iny
|
||||
dex
|
||||
bpl .2
|
||||
asl CS if SBC, CC if ADC
|
||||
|
||||
MATH32.SUB.RTS rts
|
||||
ldy #4
|
||||
ldx #4
|
||||
|
||||
.2 lda (pStack),y
|
||||
.3 adc (pStack) SELF MODIFIED
|
||||
sta (pStack),y
|
||||
|
||||
inc pStack
|
||||
dex
|
||||
bne .2
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Returns:
|
||||
* ff X < Y
|
||||
* 0 X = Y
|
||||
* 1 X > Y
|
||||
*--------------------------------------
|
||||
MATH32.UCMP
|
||||
MATH32.ICMP jsr MATH32.SUB
|
||||
jsr MATH32.PopACC32 A = ACC32+3 (sign)
|
||||
tay
|
||||
*M32.UCMP
|
||||
*M32.ICMP
|
||||
M32.CMP jsr M32.SUB
|
||||
|
||||
tay A = BYTE 3
|
||||
bmi .2
|
||||
|
||||
.1 ora ACC32+2
|
||||
ora ACC32+1
|
||||
ora ACC32
|
||||
.1 ora (pStack) BYTE 0
|
||||
ldy #1
|
||||
ora (pStack),y BYTE 1
|
||||
iny
|
||||
ora (pStack),y BYTE 2
|
||||
beq .8
|
||||
|
||||
lda #1
|
||||
rts
|
||||
.HS 2C BIT ABS
|
||||
|
||||
.2 lda #$ff
|
||||
.8 rts
|
||||
|
||||
.8 inc pStack
|
||||
inc pStack
|
||||
inc pStack
|
||||
inc pStack
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.UMUL clc
|
||||
M32.UMUL clc
|
||||
.HS B0 BCS
|
||||
MATH32.IMUL sec
|
||||
M32.IMUL sec
|
||||
|
||||
php
|
||||
jsr MATH32.MULDIVMOD.COMMON
|
||||
jsr MATH32.MUL
|
||||
jsr M32.MULDIVMOD
|
||||
jsr M32.MUL
|
||||
|
||||
plp
|
||||
bcc MATH32.PutTMP32
|
||||
MATH32.RETURN.ITMP
|
||||
lda ACC32.Sign
|
||||
bcc M32.PutTMP32
|
||||
|
||||
M32.ITMP lda ACC32.Sign
|
||||
eor ARG32.Sign
|
||||
bpl MATH32.PutTMP32
|
||||
bra MATH32.PutNotTMP32
|
||||
bpl M32.PutTMP32
|
||||
*--------------------------------------
|
||||
MATH32.UDIV clc
|
||||
.HS B0 BCS
|
||||
MATH32.IDIV sec
|
||||
clv
|
||||
bra MATH32.MOD
|
||||
|
||||
MATH32.UMOD clc
|
||||
.HS B0 BCS
|
||||
MATH32.IMOD sec
|
||||
bit MATH32.SUB.RTS $60
|
||||
|
||||
MATH32.MOD php
|
||||
jsr MATH32.MULDIVMOD.COMMON
|
||||
jsr MATH32.DIVMOD
|
||||
|
||||
plp
|
||||
bcc .3 unsigned
|
||||
|
||||
bvs MATH32.RETURN.ITMP IMOD
|
||||
|
||||
lda ACC32.Sign IDIV
|
||||
eor ARG32.Sign
|
||||
bpl MATH32.PutARG32
|
||||
bra MATH32.PutNotARG32
|
||||
|
||||
.3 bvc MATH32.PutARG32 DIV
|
||||
* M32.PutnTMP32
|
||||
*--------------------------------------
|
||||
MATH32.PutTMP32 lda #TMP32 MOD
|
||||
.HS 2C BIT ABS
|
||||
*--------------------------------------
|
||||
MATH32.PutARG32 lda #ARG32
|
||||
sta .1+1
|
||||
|
||||
ldy #3
|
||||
|
||||
.1 lda $ff,y SELF MODIFIED
|
||||
sta (pStack),y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.PutNotTMP32
|
||||
lda #TMP32
|
||||
.HS 2C BIT ABS
|
||||
*--------------------------------------
|
||||
MATH32.PutNotARG32
|
||||
lda #ARG32
|
||||
M32.PutnARG32 lda #ARG32
|
||||
sta .1+1
|
||||
ldy #0
|
||||
ldx #3
|
||||
|
@ -135,9 +86,52 @@ MATH32.PutNotARG32
|
|||
iny
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.PopACC32 ldy #0
|
||||
M32.UDIV clc
|
||||
.HS B0 BCS
|
||||
M32.IDIV sec
|
||||
clv
|
||||
bra M32.MOD
|
||||
|
||||
M32.UMOD clc
|
||||
.HS B0 BCS
|
||||
M32.IMOD sec
|
||||
bit M32.RTS $60
|
||||
|
||||
M32.MOD php
|
||||
jsr M32.MULDIVMOD
|
||||
jsr M32.DIVMOD
|
||||
|
||||
plp
|
||||
bcc .3 unsigned
|
||||
|
||||
bvs M32.ITMP return ITMP
|
||||
|
||||
lda ACC32.Sign IDIV
|
||||
eor ARG32.Sign
|
||||
bpl M32.PutARG32
|
||||
bra M32.PutnARG32
|
||||
|
||||
.3 bvc M32.PutARG32 DIV
|
||||
*--------------------------------------
|
||||
M32.PutTMP32 lda #TMP32 MOD
|
||||
.HS 2C BIT ABS
|
||||
*--------------------------------------
|
||||
M32.PutARG32 lda #ARG32
|
||||
sta .1+1
|
||||
|
||||
ldy #3
|
||||
|
||||
.1 lda $ff,y SELF MODIFIED
|
||||
sta (pStack),y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
M32.PopACC32 ldy #0
|
||||
|
||||
.1 lda (pStack)
|
||||
inc pStack
|
||||
|
@ -145,10 +139,11 @@ MATH32.PopACC32 ldy #0
|
|||
iny
|
||||
cpy #4
|
||||
bne .1
|
||||
|
||||
sta ACC32.Sign
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.GetARG32 ldy #0
|
||||
M32.GetARG32 ldy #0
|
||||
|
||||
.1 lda (pStack),y
|
||||
sta ARG32,y
|
||||
|
@ -158,33 +153,61 @@ MATH32.GetARG32 ldy #0
|
|||
|
||||
sta ARG32.Sign
|
||||
|
||||
MATH32.GetARG32.RTS
|
||||
M32.RTS rts
|
||||
*--------------------------------------
|
||||
M32.MULDIVMOD php
|
||||
jsr M32.PopACC32
|
||||
jsr M32.GetARG32
|
||||
plp
|
||||
bcc M32.RTS
|
||||
jsr .1
|
||||
*--------------------------------------
|
||||
* M32.ARG32ABS
|
||||
*--------------------------------------
|
||||
lda ARG32.Sign
|
||||
bmi M32.nARG32
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.MULDIVMOD.COMMON
|
||||
php
|
||||
jsr MATH32.PopACC32
|
||||
jsr MATH32.GetARG32
|
||||
plp
|
||||
bcc MATH32.GetARG32.RTS
|
||||
jsr MATH32.ACC32ABS
|
||||
jmp MATH32.ARG32ABS
|
||||
* M32.ACC32ABS
|
||||
*--------------------------------------
|
||||
.1 lda ACC32.Sign
|
||||
bpl M32.RTS
|
||||
*--------------------------------------
|
||||
M32.nACC32 ldy #ACC32
|
||||
.HS 2C BIT ABS
|
||||
M32.nARG32 ldy #ARG32
|
||||
|
||||
ldx #3
|
||||
sec
|
||||
|
||||
.1 lda $0,y two's complement of X bytes
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta $0,y
|
||||
iny
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* http://6502.org/source/integers/32muldiv.htm
|
||||
* http://nparker.llx.com/a2/mult.html
|
||||
*--------------------------------------
|
||||
* ARG32*ACC32->TMP32
|
||||
*--------------------------------------
|
||||
MATH32.MUL jsr MATH32.TMP32ZERO
|
||||
M32.MUL jsr M32.TMP32Z
|
||||
ldx #32
|
||||
|
||||
.1 lsr ARG32+3
|
||||
ror ARG32+2
|
||||
ror ARG32+1
|
||||
ror ARG32
|
||||
bcc .3
|
||||
|
||||
clc
|
||||
|
||||
ldy #0
|
||||
|
||||
.2 lda TMP32,y
|
||||
adc ACC32,y
|
||||
sta TMP32,y
|
||||
|
@ -193,16 +216,22 @@ MATH32.MUL jsr MATH32.TMP32ZERO
|
|||
tya
|
||||
eor #4
|
||||
bne .2
|
||||
.3 jsr MATH32.ACC32.T2
|
||||
|
||||
.3 asl ACC32
|
||||
rol ACC32+1
|
||||
rol ACC32+2
|
||||
rol ACC32+3
|
||||
|
||||
dex
|
||||
bne .1
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* ARG32 = ARG32 div ACC32
|
||||
* TMP32 = ARG32 mod ACC32
|
||||
*--------------------------------------
|
||||
MATH32.DIVMOD jsr MATH32.TMP32ZERO
|
||||
M32.DIVMOD jsr M32.TMP32Z
|
||||
|
||||
ldx #32
|
||||
|
||||
|
@ -271,285 +300,22 @@ MATH32.DIVMOD jsr MATH32.TMP32ZERO
|
|||
* return *state = result;
|
||||
*}
|
||||
*--------------------------------------
|
||||
* MATH32.RND TODO
|
||||
* M32.RND TODO
|
||||
*--------------------------------------
|
||||
MATH32.A2STR10NP ldx #3 3 digit max
|
||||
ldy #0 Disable Padding
|
||||
MATH32.A2STR10 jsr MATH32.A2ACC32
|
||||
clc unsigned
|
||||
*--------------------------------------
|
||||
* CS = signed long
|
||||
* CC = unsigned long
|
||||
* X = Pad Len
|
||||
* Y = Pad Char
|
||||
*--------------------------------------
|
||||
MATH32.ACC322STR10
|
||||
stx .5+1 Pad Len
|
||||
sty .81+1 Pad Char
|
||||
|
||||
stz A2osX.NumStrLen
|
||||
bcc .1
|
||||
|
||||
clc
|
||||
lda ACC32+3
|
||||
bpl .1
|
||||
|
||||
jsr MATH32.ACC32NEG
|
||||
|
||||
sec
|
||||
.1 ror ACC32.Sign Save sign
|
||||
|
||||
ldx #4
|
||||
|
||||
.2 stz RESULT,x Clear all 5 bytes
|
||||
dex
|
||||
bpl .2
|
||||
sed switch to BCD mode
|
||||
|
||||
ldx #32 let's roll 32 bits
|
||||
.3 jsr MATH32.ACC32.T2
|
||||
|
||||
ldy #4
|
||||
.4 lda RESULT,y
|
||||
adc RESULT,y
|
||||
sta RESULT,y
|
||||
dey
|
||||
bpl .4
|
||||
dex
|
||||
bne .3
|
||||
cld
|
||||
|
||||
ldx .5+1 no padding
|
||||
beq .6
|
||||
lda #10 starts at 10-padlen
|
||||
sec
|
||||
.5 sbc #$ff SELF MODIFIED
|
||||
tax
|
||||
|
||||
.6 txa
|
||||
lsr
|
||||
tay
|
||||
lda RESULT,y
|
||||
bcs .7
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
|
||||
.7 and #$0F
|
||||
ora #$30
|
||||
|
||||
cmp #'0'
|
||||
beq .80
|
||||
ldy #'0' next 0s always printed
|
||||
sty .81+1
|
||||
bra .82
|
||||
|
||||
.80 cpx #9 last char, print always
|
||||
beq .82
|
||||
|
||||
.81 lda #$ff SELF MODIFIED Get Padding char
|
||||
beq .87
|
||||
|
||||
.82 bit ACC32.Sign "-" to print ?
|
||||
bpl .86
|
||||
|
||||
pha
|
||||
lda #'-'
|
||||
jsr .88
|
||||
stz ACC32.Sign
|
||||
pla
|
||||
.86 jsr .88
|
||||
.87 inx
|
||||
cpx #10
|
||||
bne .6
|
||||
lda #0
|
||||
.88 ldy A2osX.NumStrLen
|
||||
inc A2osX.NumStrLen
|
||||
sta A2osX.NumStrBuf,y
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert Hex int at ZPPtr2 to ACC32
|
||||
*--------------------------------------
|
||||
MATH32.Hex2ACC32
|
||||
lda (ZPPtr2)
|
||||
beq .9
|
||||
|
||||
jsr SHARED.IsHexDigit
|
||||
bcs .9
|
||||
|
||||
jsr MATH32.A2ACC32
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr2),y
|
||||
beq .8
|
||||
|
||||
jsr SHARED.IsHexDigit
|
||||
bcs .8
|
||||
|
||||
pha
|
||||
ldx #4
|
||||
|
||||
.2 jsr MATH32.ACC32.T2
|
||||
dex
|
||||
bne .2
|
||||
|
||||
pla
|
||||
ora ACC32
|
||||
sta ACC32
|
||||
bra .1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert A to 2 hex digits in AX
|
||||
*--------------------------------------
|
||||
MATH32.AToHexAX pha
|
||||
and #$0F
|
||||
jsr .8
|
||||
tax
|
||||
|
||||
pla
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
.8 ora #$30
|
||||
cmp #'9'+1
|
||||
bcc .9
|
||||
adc #6
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
* Convert Decimal int at ZPPtr2 to ACC32
|
||||
*--------------------------------------
|
||||
MATH32.Dec2ACC32
|
||||
jsr MATH32.ACC32ZERO
|
||||
clc
|
||||
lda (ZPPtr2)
|
||||
eor #'-'
|
||||
bne .10
|
||||
|
||||
jsr SHARED.NextCharPtr2 skip '-'
|
||||
sec
|
||||
.10 ror .80+1 set pos/neg flag
|
||||
|
||||
ldy #$ff
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr2),y
|
||||
beq .8
|
||||
jsr ZP.IsDigit
|
||||
bcs .8
|
||||
|
||||
phy Save Y, pointing to next char
|
||||
jsr MATH32.ACC32.T10
|
||||
ply
|
||||
bcs .9
|
||||
|
||||
lda (ZPPtr2),y
|
||||
and #$0F
|
||||
* clc
|
||||
|
||||
adc ACC32
|
||||
sta ACC32
|
||||
bcc .1
|
||||
inc ACC32+1
|
||||
bne .1
|
||||
inc ACC32+2
|
||||
bne .1
|
||||
inc ACC32+3
|
||||
bne .1 if 0, overflow!!!
|
||||
|
||||
.9 lda #E.INUM
|
||||
sec
|
||||
rts
|
||||
|
||||
.8 tya no digit parsed...error
|
||||
beq .9
|
||||
|
||||
.80 lda #$FF SELF MODIFIED
|
||||
bpl .88
|
||||
|
||||
phy
|
||||
jsr MATH32.ACC32NEG
|
||||
ply
|
||||
|
||||
.88 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.ACC32.T10
|
||||
ldx #3
|
||||
|
||||
.1 lda ACC32,x save ACC32 for 4+1
|
||||
pha
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
jsr MATH32.ACC32.T2 ACC32 * 2 -> ACC32
|
||||
jsr MATH32.ACC32.T2 ACC32 * 4 -> ACC32
|
||||
|
||||
ldx #0
|
||||
ldy #4
|
||||
* clc
|
||||
|
||||
.2 pla ACC32 * 4 + ACC32 -> ACC32
|
||||
adc ACC32,x
|
||||
sta ACC32,x
|
||||
inx
|
||||
dey
|
||||
bne .2
|
||||
|
||||
MATH32.ACC32.T2 asl ACC32
|
||||
rol ACC32+1
|
||||
rol ACC32+2
|
||||
rol ACC32+3
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.A2ACC32 sta ACC32
|
||||
M32.A2ACC32 sta ACC32
|
||||
.HS 2C BIT ABS
|
||||
MATH32.ACC32ZERO
|
||||
stz ACC32
|
||||
M32.ACC32Z stz ACC32
|
||||
stz ACC32+1
|
||||
stz ACC32+2
|
||||
stz ACC32+3
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.TMP32ZERO
|
||||
stz TMP32
|
||||
M32.TMP32Z stz TMP32
|
||||
stz TMP32+1
|
||||
stz TMP32+2
|
||||
stz TMP32+3
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.ARG32ABS lda ARG32.Sign
|
||||
bmi MATH32.ARG32NEG
|
||||
rts
|
||||
*--------------------------------------
|
||||
MATH32.ACC32ABS lda ACC32.Sign
|
||||
bpl MATH32.ACC32NEG.RTS
|
||||
*--------------------------------------
|
||||
MATH32.ACC32NEG ldy #ACC32
|
||||
.HS 2C BIT ABS
|
||||
MATH32.ARG32NEG ldy #ARG32
|
||||
|
||||
ldx #3
|
||||
sec
|
||||
|
||||
.1 lda $0,y two's complement of X bytes
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta $0,y
|
||||
iny
|
||||
dex
|
||||
bpl .1
|
||||
MATH32.ACC32NEG.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.math32
|
||||
LOAD usr/src/sys/kernel.s
|
||||
|
|
|
@ -3,13 +3,10 @@ NEW
|
|||
*--------------------------------------
|
||||
.DUMMY ZPTMP,6
|
||||
.OR ZPTMP 29 bytes
|
||||
ZS.START
|
||||
ZPCtxPtr .BS 2
|
||||
ZPDataLen .BS 2
|
||||
|
||||
ZPChunkLen .BS 2
|
||||
|
||||
ZS.END .ED
|
||||
.ED
|
||||
*--------------------------------------
|
||||
* DWORD Macros : Do NOT disturb carry with cpx, cpy...
|
||||
*--------------------------------------
|
||||
|
|
|
@ -250,7 +250,7 @@ PWDX.GetGR.9 lda #E.IPWDDB
|
|||
|
||||
PWDX.GetGR.99 lda #E.IUSR
|
||||
sec
|
||||
PWDX.GetGR.RTS rts
|
||||
rts
|
||||
*--------------------------------------
|
||||
PWDX.GetGRName lda PWD.hGrpDB
|
||||
beq PWDX.GetGR.9
|
||||
|
@ -796,7 +796,7 @@ PWDX.StoreString
|
|||
*--------------------------------------
|
||||
PWDX.StoreByte php
|
||||
phx
|
||||
jsr MATH32.A2STR10NP
|
||||
jsr MATH.A2STR10NP
|
||||
plx
|
||||
plp
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ K.MKFIFO jsr STAT.PullPathAndMode
|
|||
bne .1
|
||||
|
||||
lda IO.hFD
|
||||
jsr MATH32.AToHexAX
|
||||
jsr STDIO.A2HexAX
|
||||
sta (ZPPtr1),y
|
||||
txa
|
||||
iny
|
||||
|
@ -305,7 +305,7 @@ K.Pipe sta .1+1 SIZE HI
|
|||
pla
|
||||
sec
|
||||
.99
|
||||
K.Pipe.RTS rts
|
||||
rts
|
||||
*--------------------------------------
|
||||
STAT.PullPathAndMode
|
||||
>PULLW K.S.STAT+S.STAT.MODE
|
||||
|
|
|
@ -771,7 +771,7 @@ K.PrintF.1 sec format string->ptr2
|
|||
jsr ZP.IsDigit
|
||||
bcs .6 %0x ??????
|
||||
|
||||
.4 jsr MATH32.Dec2ACC32
|
||||
.4 jsr MATH.Dec2ACC32
|
||||
bcs .99
|
||||
lda ACC32
|
||||
sta K.PrintF.PadL
|
||||
|
@ -816,7 +816,7 @@ K.PrintF.1 sec format string->ptr2
|
|||
cmp #'x' \xHH
|
||||
bne .1
|
||||
|
||||
jsr MATH32.Hex2ACC32
|
||||
jsr MATH.Hex2ACC32
|
||||
bcs .99
|
||||
|
||||
jsr SHARED.AddYToPtr2
|
||||
|
@ -911,7 +911,7 @@ PrintF.U clc unsigned long (DWORD)
|
|||
PrintF.NUM sty .2+1
|
||||
|
||||
ror ACC32.Sign save signed/unsigned flag
|
||||
jsr MATH32.ACC32ZERO
|
||||
jsr M32.ACC32Z
|
||||
|
||||
.1 jsr STDIO.GetStackByte
|
||||
bcs PrintF.B.RTS
|
||||
|
@ -941,7 +941,7 @@ PrintF.NUM sty .2+1
|
|||
ldy K.PrintF.PadC
|
||||
|
||||
rol ACC32.Sign get back signed/unsigned flag
|
||||
jsr MATH32.ACC322STR10
|
||||
jsr MATH.ACC322STR10
|
||||
bra PrintF.StrNum
|
||||
*--------------------------------------
|
||||
* EXP(8) 1(s) 1significants(31)
|
||||
|
@ -1056,7 +1056,8 @@ PrintF.HH jsr STDIO.GetStackByte
|
|||
*--------------------------------------
|
||||
PrintF.H jsr STDIO.GetStackByte
|
||||
bcs PrintF.PutC.RTS
|
||||
PrintF.H.1 jsr MATH32.AToHexAX
|
||||
|
||||
PrintF.H.1 jsr STDIO.A2HexAX
|
||||
jsr PrintF.PutC
|
||||
bcs PrintF.PutC.RTS
|
||||
txa
|
||||
|
@ -1240,14 +1241,14 @@ K.SScanF.L
|
|||
K.SScanF.U lda K.SScanFTBL+1,x Get VAR size
|
||||
pha Save VAL size
|
||||
|
||||
jsr MATH32.Dec2ACC32
|
||||
jsr MATH.Dec2ACC32
|
||||
bra K.SScanF.GetVAL
|
||||
*--------------------------------------
|
||||
K.SScanF.HH
|
||||
K.SScanF.H lda K.SScanFTBL+1,x Get VAR size
|
||||
pha
|
||||
|
||||
jsr MATH32.Hex2ACC32
|
||||
jsr MATH.Hex2ACC32
|
||||
|
||||
K.SScanF.GetVAL jsr SHARED.AddYToPtr2 Y=char count parsed
|
||||
|
||||
|
@ -1378,6 +1379,29 @@ STDIO.Exit php
|
|||
plp
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Convert A to 2 hex digits in AX
|
||||
*--------------------------------------
|
||||
STDIO.A2HexAX pha
|
||||
|
||||
and #$0F
|
||||
jsr .8
|
||||
|
||||
tax
|
||||
|
||||
pla
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
|
||||
.8 ora #$30
|
||||
cmp #'9'+1
|
||||
bcc .9
|
||||
|
||||
adc #6
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.stdio
|
||||
LOAD usr/src/sys/kernel.s
|
||||
|
|
|
@ -94,7 +94,7 @@ K.AToL >STYA ZPPtr2 C-String in Ptr2, Dst buffer in Ptr1
|
|||
|
||||
* lda #10 base 10
|
||||
sec signed
|
||||
K.AToL.I jsr MATH32.Dec2ACC32
|
||||
K.AToL.I jsr MATH.Dec2ACC32
|
||||
bcs .9
|
||||
ldx #3
|
||||
|
||||
|
@ -102,6 +102,7 @@ K.AToL.I jsr MATH32.Dec2ACC32
|
|||
>PUSHA
|
||||
dex
|
||||
bpl .3
|
||||
|
||||
tya Y = A = Count processed
|
||||
* clc
|
||||
.9
|
||||
|
@ -121,7 +122,7 @@ K.AToL.I jsr MATH32.Dec2ACC32
|
|||
K.atoi >STYA ZPPtr2
|
||||
* lda #10 base 10
|
||||
sec signed
|
||||
jsr MATH32.Dec2ACC32
|
||||
jsr MATH.Dec2ACC32
|
||||
bcs .9
|
||||
>LDYA ACC32
|
||||
|
||||
|
@ -460,7 +461,7 @@ ENV.SysVar jsr ZP.IsDigit $0 ... $9 ?
|
|||
ldy ENV.SysVars.PS-1,x
|
||||
lda (pPS),y
|
||||
*--------------------------------------
|
||||
ENV.SysVarsNum jsr MATH32.A2STR10NP
|
||||
ENV.SysVarsNum jsr MATH.A2STR10NP
|
||||
|
||||
ldy #0
|
||||
|
||||
|
|
|
@ -15,13 +15,17 @@ K.StrLen >STYA .1+1
|
|||
|
||||
ldy #0
|
||||
tya
|
||||
|
||||
.1 ldx $ffff,y SELF MODIFIED
|
||||
beq .8
|
||||
|
||||
iny
|
||||
bne .1
|
||||
|
||||
inc
|
||||
inc .1+2
|
||||
bra .1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*/--------------------------------------
|
||||
|
@ -63,11 +67,14 @@ K.StrCpy clc
|
|||
bne .1
|
||||
|
||||
.2 ldy #0
|
||||
|
||||
.3 lda (ZPPtr2),y
|
||||
sta (ZPPtr1),y
|
||||
beq K.StrDup.8
|
||||
|
||||
iny
|
||||
bne .3
|
||||
|
||||
inc ZPPtr2+1
|
||||
inc ZPPtr1+1
|
||||
bra .3
|
||||
|
@ -150,17 +157,23 @@ K.StrLwr ldx #2
|
|||
>STYA ZPPtr1
|
||||
phy
|
||||
pha save Y,A to restore them at exit
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 lda (ZPPtr1),y
|
||||
beq K.StrDup.8
|
||||
cmp .9,x
|
||||
bcc .2
|
||||
|
||||
cmp .9+1,x
|
||||
bcs .2
|
||||
|
||||
eor #$20
|
||||
sta (ZPPtr1),y
|
||||
|
||||
.2 iny
|
||||
bne .1
|
||||
|
||||
inc ZPPtr1+1
|
||||
bra .1
|
||||
*--------------------------------------
|
||||
|
@ -203,24 +216,32 @@ K.StrCaseCmp clc
|
|||
jsr SHARED.SPtr1PPtr2
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 lda (ZPPtr1),y
|
||||
beq .7
|
||||
|
||||
jsr K.StrCaseCmp.toUpper
|
||||
sta .2+1
|
||||
lda (ZPPtr2),y
|
||||
beq .9
|
||||
|
||||
jsr K.StrCaseCmp.toUpper
|
||||
|
||||
.2 eor #$ff SELF MODIFIED
|
||||
bne .9
|
||||
|
||||
iny
|
||||
bne .1
|
||||
|
||||
inc ZPPtr1+1
|
||||
inc ZPPtr2+1
|
||||
bra .1
|
||||
|
||||
.7 lda (ZPPtr2),y
|
||||
bne .9
|
||||
|
||||
tay
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
.9 sec
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
*/--------------------------------------
|
||||
* # StrVSet
|
||||
* ## ASM
|
||||
* `>PUSHB hSTRV`
|
||||
* `>PUSHW id`
|
||||
* `>PUSHW ptr`
|
||||
* `>SYSCALL StrVSet`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.StrVSet
|
||||
*/--------------------------------------
|
||||
* # StrVGet
|
||||
* ## ASM
|
||||
* `>PUSHB hSTRV`
|
||||
* `>PUSHB index`
|
||||
* `>PUSHW id`
|
||||
* `>PUSHW ptr`
|
||||
* `>SYSCALL StrVGet`
|
||||
* ## RETURN VALUE
|
||||
|
@ -12,61 +22,24 @@ NEW
|
|||
* CS: Y,A = NULL
|
||||
*\--------------------------------------
|
||||
K.StrVGet >PULLW FORPNT ptr
|
||||
*/--------------------------------------
|
||||
* # StrVShift
|
||||
* ## ASM
|
||||
* `>PUSHB hSTRV`
|
||||
* `>PUSHB index`
|
||||
* `>SYSCALL StrVShift`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.StrVShift >PULLA index
|
||||
eor #$ff
|
||||
tay
|
||||
|
||||
>PULLA hSTRV
|
||||
jmp K.SYSCALL.JMPX
|
||||
*/--------------------------------------
|
||||
* # StrVAdd
|
||||
* ## ASM
|
||||
* `>PUSHB hSTRV`
|
||||
* `>PUSHW str`
|
||||
* `>SYSCALL StrVAdd`
|
||||
* ## RETURN VALUE
|
||||
* CC : str added to hSTRV
|
||||
* CS : hSTRV full
|
||||
*\--------------------------------------
|
||||
K.StrVAdd >PULLW TXTPTR str
|
||||
>PULLW TXTPTR id
|
||||
>PULLA
|
||||
jmp K.SYSCALL.JMPX
|
||||
*--------------------------------------
|
||||
STRV.Ptr1Ptr2cpy
|
||||
ldx #0
|
||||
ldy #0
|
||||
|
||||
.4 lda (ZPPtr1),y
|
||||
sta (ZPPtr2),y
|
||||
beq .6
|
||||
|
||||
.5 iny
|
||||
bne .4
|
||||
|
||||
inc ZPPtr1+1
|
||||
inc ZPPtr2+1
|
||||
bra .4
|
||||
|
||||
.6 inx
|
||||
|
||||
iny
|
||||
bne .7
|
||||
|
||||
inc ZPPtr1+1
|
||||
inc ZPPtr2+1
|
||||
|
||||
.7 lda (ZPPtr1),y
|
||||
sta (ZPPtr2),y Ending \0 ?
|
||||
bne .5
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # StrVNew
|
||||
* ## ASM
|
||||
* `>LDYA size`
|
||||
* `>SYSCALL StrVNew`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.StrVNew
|
||||
*/--------------------------------------
|
||||
* # StrVFree
|
||||
* ## ASM
|
||||
* `lda hSTRV`
|
||||
* `>SYSCALL StrVFree`
|
||||
* ## RETURN VALUE
|
||||
*\--------------------------------------
|
||||
K.StrVFree jmp K.SYSCALL.JMPX
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.strv
|
||||
|
|
|
@ -1,56 +1,140 @@
|
|||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
STRVX.StrVShift phy
|
||||
STRVX.StrVNew jsr K.GetMem
|
||||
bcs .9
|
||||
|
||||
jsr K.GetMemPtr
|
||||
>STYA ZPPtr1 strV
|
||||
|
||||
lda #0
|
||||
sta (ZPPtr1)
|
||||
|
||||
txa
|
||||
|
||||
* clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
STRVX.StrVSet jsr STRVX.GetID
|
||||
bcs .7
|
||||
|
||||
plx
|
||||
ldy #$ff
|
||||
|
||||
.1 iny
|
||||
jsr SHARED.FORPNT.GetY
|
||||
bne .1
|
||||
|
||||
tya
|
||||
|
||||
* clc
|
||||
adc #4 LEN+IDlo+IDhi+\0
|
||||
bcs .99
|
||||
|
||||
.1 inx
|
||||
beq .2
|
||||
cmp (ZPPtr1)
|
||||
bne .4
|
||||
|
||||
jsr STRVX.NStrPtr1
|
||||
bcc .1
|
||||
lda ZPPtr1 Same Length, replace
|
||||
clc
|
||||
adc #3
|
||||
sta ZPPtr1
|
||||
bcc .2
|
||||
|
||||
rts
|
||||
inc ZPPtr1+1
|
||||
|
||||
.2 >LDYA ZPPtr1
|
||||
>STYA ZPPtr2
|
||||
.2 ldy #$ff
|
||||
|
||||
.3 iny
|
||||
jsr SHARED.FORPNT.GetY
|
||||
sta (ZPPtr1),y
|
||||
bne .3
|
||||
|
||||
jsr STRVX.NStrPtr1
|
||||
|
||||
jsr STRV.Ptr1Ptr2cpy
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
STRVX.StrVGet phy
|
||||
.4 >LDYA ZPPtr1
|
||||
>STYA ZPPtr2
|
||||
|
||||
jsr STRVX.Next
|
||||
|
||||
jsr K.GetMemPtr
|
||||
>STYA ZPPtr1 strV
|
||||
.40 lda (ZPPtr1)
|
||||
beq .7
|
||||
|
||||
plx
|
||||
ldy #2 LEN+IDlo+IDhi
|
||||
|
||||
.5 lda (ZPPtr1),y
|
||||
sta (ZPPtr2),y
|
||||
dey
|
||||
bpl .5
|
||||
|
||||
.1 inx
|
||||
beq .2
|
||||
ldy #2
|
||||
|
||||
jsr STRVX.NStrPtr1
|
||||
.6 iny
|
||||
|
||||
lda (ZPPtr1),y
|
||||
sta (ZPPtr2),y
|
||||
bne .6
|
||||
|
||||
jsr SHARED.AddYp1ToPtr1
|
||||
jsr SHARED.AddYp1ToPtr2
|
||||
bra .40
|
||||
*--------------------------------------
|
||||
.7 ldy #$ff
|
||||
|
||||
.8 iny
|
||||
jsr SHARED.FORPNT.GetY
|
||||
bne .8
|
||||
|
||||
tya
|
||||
|
||||
clc
|
||||
adc #4
|
||||
bcs .99
|
||||
|
||||
sta (ZPPtr1)
|
||||
ldy #1
|
||||
lda TXTPTR
|
||||
sta (ZPPtr1),y
|
||||
iny
|
||||
lda TXTPTR+1
|
||||
sta (ZPPtr1),y
|
||||
|
||||
lda ZPPtr1
|
||||
clc
|
||||
adc #3
|
||||
sta ZPPtr1
|
||||
bcc .10
|
||||
|
||||
inc ZPPtr1+1
|
||||
|
||||
.10 ldy #$ff
|
||||
|
||||
.11 iny
|
||||
jsr SHARED.FORPNT.GetY
|
||||
sta (ZPPtr1),y
|
||||
bne .11
|
||||
|
||||
iny
|
||||
sta (ZPPtr1),y StrV Ending \0
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.99 lda #E.OOM
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
STRVX.StrVGet jsr STRVX.GetID
|
||||
bcs .9
|
||||
|
||||
lda ZPPtr1
|
||||
* clc
|
||||
adc #3
|
||||
sta ZPPtr1
|
||||
bcc .1
|
||||
|
||||
rts
|
||||
inc ZPPtr1+1
|
||||
|
||||
.2 lda (ZPPtr1)
|
||||
tay
|
||||
bne .3
|
||||
|
||||
sec
|
||||
rts Y,A = 0
|
||||
|
||||
.3 lda FORPNT+1
|
||||
beq .8
|
||||
|
||||
.4 ldy #$ff
|
||||
.1 ldy #$ff
|
||||
|
||||
.5 iny
|
||||
lda (ZPPtr1),y
|
||||
|
@ -63,91 +147,49 @@ STRVX.StrVGet phy
|
|||
|
||||
.8 >LDYA ZPPtr1
|
||||
clc
|
||||
.9 rts
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
STRVX.StrVAdd jsr K.GetMemPtr
|
||||
>STYA ZPPtr1
|
||||
|
||||
lda TXTPTR+1
|
||||
bne .10
|
||||
STRVX.StrVFree jsr K.FreeMem
|
||||
|
||||
sta (ZPPtr1)
|
||||
clc
|
||||
rts
|
||||
|
||||
.10 lda #1 for \0
|
||||
sta ZPPtr2
|
||||
stz ZPPtr2+1
|
||||
|
||||
.1 jsr STRVX.NStrPtr1
|
||||
bcs .2
|
||||
|
||||
jsr SHARED.AddYp1ToPtr2
|
||||
bra .1
|
||||
|
||||
.2 ldy #$ff
|
||||
|
||||
.3 iny
|
||||
jsr SHARED.TXTPTR.GetY
|
||||
bne .3
|
||||
|
||||
tya
|
||||
sec
|
||||
adc ZPPtr2
|
||||
bcc .4
|
||||
|
||||
inc ZPPtr2+1
|
||||
|
||||
ldy #S.MEM.LEN
|
||||
lda (ZPMemMgrSPtr),y
|
||||
cmp ZPPtr2
|
||||
|
||||
iny
|
||||
lda (ZPMemMgrSPtr),y
|
||||
sbc ZPPtr2+1
|
||||
bcs .4
|
||||
|
||||
lda #E.OOM
|
||||
sec
|
||||
rts
|
||||
|
||||
.4 ldy #$ff
|
||||
|
||||
.5 iny
|
||||
jsr SHARED.TXTPTR.GetY
|
||||
sta (ZPPtr1),y
|
||||
bne .5
|
||||
|
||||
iny
|
||||
sta (ZPPtr1),y StrV Ending \0
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
STRVX.NStrPtr1 ldy #$ff
|
||||
STRVX.GetID jsr K.GetMemPtr
|
||||
>STYA ZPPtr1 strV
|
||||
|
||||
.1 iny
|
||||
|
||||
lda (ZPPtr1)
|
||||
beq .2
|
||||
|
||||
inc ZPPtr1
|
||||
bne .1
|
||||
inc ZPPtr1+1
|
||||
bra .1
|
||||
|
||||
.2 tya
|
||||
.1 lda (ZPPtr1)
|
||||
beq .9
|
||||
|
||||
ldy #1
|
||||
|
||||
lda (ZPPtr1),y
|
||||
cmp TXTPTR
|
||||
bne .2
|
||||
|
||||
iny
|
||||
lda (ZPPtr1),y
|
||||
cmp TXTPTR+1
|
||||
beq .8
|
||||
|
||||
.2 jsr STRVX.Next
|
||||
bra .1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
inc ZPPtr1
|
||||
bne .8
|
||||
inc ZPPtr1+1 skip \0
|
||||
|
||||
.8 clc
|
||||
.9 lda #E.NOKEY
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
STRVX.Next lda (ZPPtr1)
|
||||
sec
|
||||
adc ZPPtr1
|
||||
sta ZPPtr1
|
||||
bcc .8
|
||||
|
||||
.9 sec Y,A = 0
|
||||
rts
|
||||
inc ZPPtr1+1
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sys/kernel.s.strvx
|
||||
|
|
|
@ -67,7 +67,7 @@ TERMX.STATUS tya
|
|||
jsr TERMX.ISOPENED
|
||||
beq TERMX.OPEN.E
|
||||
|
||||
jsr TERMX.CURBLNK
|
||||
jsr TERMX.CBLNK
|
||||
ldy #S.DCB.TTY.OUTTAIL
|
||||
lda (ZPDCBPtr),y
|
||||
iny
|
||||
|
@ -178,7 +178,7 @@ TERMX.ISOPENED ldy #S.DCB.TTY.STATUS
|
|||
*--------------------------------------
|
||||
TERMX.READ bit bActive is screen active?
|
||||
bpl .6 no....go check flush...
|
||||
jsr TERMX.CURBLNK
|
||||
jsr TERMX.CBLNK
|
||||
|
||||
bit OPENAPPLE
|
||||
bpl .1
|
||||
|
@ -200,9 +200,9 @@ TERMX.READ bit bActive is screen active?
|
|||
|
||||
lda #3
|
||||
|
||||
.10 ldx #KeyRemapped.cnt-1
|
||||
.10 ldx #3
|
||||
|
||||
.2 cmp KeyRemapped,x
|
||||
.2 cmp KeyMap,x
|
||||
beq .3
|
||||
|
||||
dex
|
||||
|
@ -220,7 +220,7 @@ TERMX.READ bit bActive is screen active?
|
|||
.21 jsr Char.Out.Put no remap....send char....
|
||||
bra .7 and flush
|
||||
|
||||
.3 lda KeyRemapped.Tbl,x
|
||||
.3 lda KeyMap.Tbl,x
|
||||
pha
|
||||
lda #C.ESC
|
||||
jsr Char.Out.Put
|
||||
|
@ -457,14 +457,14 @@ TERMX.ESC jsr TERM.GetBufByte y = #S.DCB.TTY.MODE
|
|||
TERMX.SETM0 lda #0
|
||||
TERMX.SETM ldy #S.DCB.TTY.MODE
|
||||
sta (ZPDCBPtr),y
|
||||
ldy #S.DCB.TTY.INBUFFER
|
||||
lda #S.DCB.TTY.INBUFFER
|
||||
ldy #S.DCB.TTY.INBUF
|
||||
lda #S.DCB.TTY.INBUF
|
||||
sta (ZPDCBPtr),y
|
||||
clc
|
||||
|
||||
TERMX.SETM.RTS rts
|
||||
*--------------------------------------
|
||||
TERMX.CSI ldy #S.DCB.TTY.INBUFFER
|
||||
TERMX.CSI ldy #S.DCB.TTY.INBUF
|
||||
lda (ZPDCBPtr),y
|
||||
inc
|
||||
sta (ZPDCBPtr),y
|
||||
|
@ -475,7 +475,7 @@ TERMX.CSI ldy #S.DCB.TTY.INBUFFER
|
|||
sta (ZPDCBPtr),y
|
||||
cmp #64 End of Seq ?
|
||||
bcs TERMX.CSI.Exec
|
||||
cpy #S.DCB.TTY.INBUFFER.MAX-1 buffer full?
|
||||
cpy #S.DCB.TTY.INBUF.MAX-1 buffer full?
|
||||
bne .8
|
||||
|
||||
jsr RESET.MODE
|
||||
|
@ -486,12 +486,12 @@ TERMX.CSI ldy #S.DCB.TTY.INBUFFER
|
|||
TERMX.CSI.Exec stz CsiH
|
||||
stz CsiPCnt
|
||||
|
||||
lda #S.DCB.TTY.INBUFFER+1 EscSeq Ptr
|
||||
lda #S.DCB.TTY.INBUF+1 EscSeq Ptr
|
||||
clc
|
||||
adc ZPDCBPtr
|
||||
sta ZPPtr2
|
||||
|
||||
lda /S.DCB.TTY.INBUFFER+1
|
||||
lda /S.DCB.TTY.INBUF+1
|
||||
adc ZPDCBPtr+1
|
||||
sta ZPPtr2+1
|
||||
|
||||
|
@ -503,7 +503,7 @@ TERMX.CSI.Exec stz CsiH
|
|||
|
||||
.1 jsr SHARED.NextCharPtr2
|
||||
|
||||
.2 jsr MATH32.Dec2ACC32
|
||||
.2 jsr MATH.Dec2ACC32
|
||||
bcs .5
|
||||
|
||||
jsr SHARED.AddYToPtr2
|
||||
|
@ -803,7 +803,7 @@ TERMX.G1 ldx #$40
|
|||
|
||||
jmp TERMX.SETM0
|
||||
*--------------------------------------
|
||||
TERMX.IAC ldy #S.DCB.TTY.INBUFFER
|
||||
TERMX.IAC ldy #S.DCB.TTY.INBUF
|
||||
lda (ZPDCBPtr),y
|
||||
inc
|
||||
sta (ZPDCBPtr),y
|
||||
|
@ -812,10 +812,10 @@ TERMX.IAC ldy #S.DCB.TTY.INBUFFER
|
|||
jsr TERM.GetBufByte
|
||||
|
||||
sta (ZPDCBPtr),y
|
||||
cpy #S.DCB.TTY.INBUFFER+1 CMD ?
|
||||
cpy #S.DCB.TTY.INBUF+1 CMD ?
|
||||
beq Csi.Home.8 yes, wait for additional bytes
|
||||
|
||||
ldy #S.DCB.TTY.INBUFFER+1
|
||||
ldy #S.DCB.TTY.INBUF+1
|
||||
lda (ZPDCBPtr),y get back CMD
|
||||
cmp #SB
|
||||
bne .1 not a SB/SE....stop with CMD/SUBCMD
|
||||
|
@ -825,7 +825,7 @@ TERMX.IAC ldy #S.DCB.TTY.INBUFFER
|
|||
cmp #SE
|
||||
bne Csi.Home.8 wait for ending SE....keep bIACMode
|
||||
bra COUT.IAC.SB
|
||||
ldy #S.DCB.TTY.INBUFFER+1
|
||||
ldy #S.DCB.TTY.INBUF+1
|
||||
lda (ZPDCBPtr),y get back CMD
|
||||
.1 cmp #IAC
|
||||
beq COUT.IAC.SB.9
|
||||
|
@ -835,7 +835,7 @@ TERMX.IAC ldy #S.DCB.TTY.INBUFFER
|
|||
asl
|
||||
tax
|
||||
|
||||
ldy #S.DCB.TTY.INBUFFER+2
|
||||
ldy #S.DCB.TTY.INBUF+2
|
||||
lda (ZPDCBPtr),y Get SUBCMD in A
|
||||
|
||||
jmp (.8,x)
|
||||
|
@ -845,7 +845,7 @@ TERMX.IAC ldy #S.DCB.TTY.INBUFFER
|
|||
.DA COUT.IAC.DO
|
||||
.DA COUT.IAC.DONT
|
||||
*--------------------------------------
|
||||
COUT.IAC.SB ldy #S.DCB.TTY.INBUFFER+2
|
||||
COUT.IAC.SB ldy #S.DCB.TTY.INBUF+2
|
||||
lda (ZPDCBPtr),y Get SUBCMD in A
|
||||
|
||||
cmp #TN.O.TTYPE
|
||||
|
@ -929,7 +929,7 @@ RESET ldy #S.DCB.TTY.MODE
|
|||
.1 lda RESET.VALUES-S.DCB.TTY.MODE,y
|
||||
sta (ZPDCBPtr),y
|
||||
iny
|
||||
cpy #S.DCB.TTY.INBUFFER+1
|
||||
cpy #S.DCB.TTY.INBUF+1
|
||||
bne .1
|
||||
jmp TERMX.CLRSCR
|
||||
*--------------------------------------
|
||||
|
@ -1064,33 +1064,33 @@ SCROLL.DN ldy #S.DCB.TTY.SCROLLBOT
|
|||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
TERMX.CURBLNK bit bActive
|
||||
TERMX.CBLNK bit bActive
|
||||
bpl .9
|
||||
|
||||
lda DevMgr.Timer
|
||||
and #CURSOR.BLINK.SPEED
|
||||
ldy #S.DCB.TTY.bCURON
|
||||
eor (ZPDCBPtr),y
|
||||
bne TERMX.CURBLNK.1
|
||||
bne TERMX.CBLNK.1
|
||||
|
||||
.9 rts
|
||||
|
||||
TERMX.CUROFF bit bActive
|
||||
bpl TERMX.CURBLNK.RTS
|
||||
bpl TERMX.CBLNK.RTS
|
||||
ldy #S.DCB.TTY.bCURON
|
||||
lda (ZPDCBPtr),y
|
||||
beq TERMX.CURBLNK.RTS
|
||||
beq TERMX.CBLNK.RTS
|
||||
|
||||
TERMX.CURBLNK.1 lda (ZPDCBPtr),y
|
||||
bne TERMX.CURBLNK.OFF
|
||||
TERMX.CBLNK.1 lda (ZPDCBPtr),y
|
||||
bne TERMX.CBLNK.OFF
|
||||
|
||||
jsr GetCharAtCurPos
|
||||
bcs TERMX.CURBLNK.RTS Out of screen
|
||||
bcs TERMX.CBLNK.RTS Out of screen
|
||||
|
||||
and #$80
|
||||
eor #" "
|
||||
|
||||
TERMX.CURBLNK.SET
|
||||
TERMX.CBLNK.SET
|
||||
jsr SetCharAtY.SCR
|
||||
ldy #S.DCB.TTY.bCURON
|
||||
lda (ZPDCBPtr),y
|
||||
|
@ -1098,17 +1098,17 @@ TERMX.CURBLNK.SET
|
|||
sta (ZPDCBPtr),y
|
||||
rts
|
||||
|
||||
TERMX.CURBLNK.OFF
|
||||
TERMX.CBLNK.OFF
|
||||
jsr GetCharAtCurPos
|
||||
bcc TERMX.CURBLNK.SET if not Out of screen
|
||||
TERMX.CURBLNK.RTS
|
||||
bcc TERMX.CBLNK.SET if not Out of screen
|
||||
TERMX.CBLNK.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
DecOut jsr MATH32.A2STR10NP
|
||||
DecOut jsr MATH.A2STR10NP
|
||||
|
||||
ldx #0
|
||||
.1 lda A2osX.NumStrBuf,x
|
||||
beq TERMX.CURBLNK.RTS
|
||||
beq TERMX.CBLNK.RTS
|
||||
inx
|
||||
jsr Char.Out.Put
|
||||
bra .1
|
||||
|
@ -1119,9 +1119,9 @@ Char.Out.Put pha save char
|
|||
lda (ZPDCBPtr),y
|
||||
pha save actual HEAD
|
||||
inc
|
||||
cmp #S.DCB.TTY.OUTBUFFER.MAX
|
||||
cmp #S.DCB.TTY.OUTBUF.MAX
|
||||
bne .1
|
||||
lda #S.DCB.TTY.OUTBUFFER
|
||||
lda #S.DCB.TTY.OUTBUF
|
||||
|
||||
.1 dey OUTTAIL
|
||||
cmp (ZPDCBPtr),y HEAD+1 = TAIL ?
|
||||
|
@ -1147,9 +1147,9 @@ Char.Out.Get ldy #S.DCB.TTY.OUTTAIL
|
|||
pha
|
||||
tya
|
||||
inc
|
||||
cmp #S.DCB.TTY.OUTBUFFER.MAX
|
||||
cmp #S.DCB.TTY.OUTBUF.MAX
|
||||
bne .1
|
||||
lda #S.DCB.TTY.OUTBUFFER
|
||||
lda #S.DCB.TTY.OUTBUF
|
||||
|
||||
.1 ldy #S.DCB.TTY.OUTTAIL
|
||||
sta (ZPDCBPtr),y
|
||||
|
@ -1159,20 +1159,20 @@ Char.Out.Get ldy #S.DCB.TTY.OUTTAIL
|
|||
*--------------------------------------
|
||||
TERMX.SETUP.L1X lda ZPDCBPtr
|
||||
clc
|
||||
adc BUF.BASEL,x
|
||||
adc BUF.BL,x
|
||||
sta ZPBufBL1
|
||||
|
||||
lda ZPDCBPtr+1
|
||||
adc BUF.BASEH,x
|
||||
adc BUF.BH,x
|
||||
sta ZPBufBL1+1
|
||||
|
||||
bit bActive
|
||||
bpl TERMX.SETUP.L1X.8
|
||||
|
||||
TERMX.SETUP.L1X.SCR
|
||||
lda SCR.BASEL,x
|
||||
lda SCR.BL,x
|
||||
sta ZPScrBL1
|
||||
lda SCR.BASEH,x
|
||||
lda SCR.BH,x
|
||||
sta ZPScrBL1+1
|
||||
TERMX.SETUP.L1X.8
|
||||
rts
|
||||
|
@ -1278,11 +1278,11 @@ TERMX.SCRCPY ldx #23
|
|||
|
||||
.1 lda ZPDCBPtr
|
||||
clc
|
||||
adc BUF.BASEL,x
|
||||
adc BUF.BL,x
|
||||
sta .80+1
|
||||
|
||||
lda ZPDCBPtr+1
|
||||
adc BUF.BASEH,x
|
||||
adc BUF.BH,x
|
||||
sta .80+2
|
||||
jsr TERMX.SETUP.L1X.SCR
|
||||
|
||||
|
@ -1323,11 +1323,11 @@ TERMX.SCRCPY ldx #23
|
|||
TERMX.COPY.XtoL1
|
||||
lda ZPDCBPtr
|
||||
clc
|
||||
adc BUF.BASEL,x
|
||||
adc BUF.BL,x
|
||||
sta ZPBufBL2
|
||||
|
||||
lda ZPDCBPtr+1
|
||||
adc BUF.BASEH,x
|
||||
adc BUF.BH,x
|
||||
sta ZPBufBL2+1
|
||||
|
||||
ldy #79
|
||||
|
@ -1340,9 +1340,9 @@ TERMX.COPY.XtoL1
|
|||
bit bActive
|
||||
bpl .8
|
||||
|
||||
lda SCR.BASEL,x
|
||||
lda SCR.BL,x
|
||||
sta ZPScrBL2
|
||||
lda SCR.BASEH,x
|
||||
lda SCR.BH,x
|
||||
sta ZPScrBL2+1
|
||||
|
||||
sta SETPAGE2
|
||||
|
@ -1459,9 +1459,8 @@ EscModes .DA #0,#0,#0,#0,#0,#S.DCB.TTY.MODE.CSI,#S.DCB.TTY.MODE.G0,#S.DCB.TTY.M
|
|||
CsiCodes .AS "hlmnrABCDJKH"
|
||||
CsiCodes.Cnt .EQ *-CsiCodes
|
||||
*--------------------------------------
|
||||
KeyRemapped .HS 080A0B15 Left,Down,Up,Right
|
||||
KeyRemapped.Cnt .EQ *-KeyRemapped
|
||||
KeyRemapped.Tbl .HS 44424143 esc[D,esc[B,esc[A,esc[C
|
||||
KeyMap .HS 080A0B15 Left,Down,Up,Right
|
||||
KeyMap.Tbl .HS 44424143 esc[D,esc[B,esc[A,esc[C
|
||||
*--------------------------------------
|
||||
WILLDO .DA #TN.O.BINARY,#TN.O.SGA,#TN.O.ECHO
|
||||
WILLDO.CNT .EQ *-WILLDO
|
||||
|
@ -1501,9 +1500,9 @@ RESET.VALUES .DA #0 MODE
|
|||
.DA #0 bG0G1
|
||||
.DA #0 bG0G1ALT
|
||||
|
||||
.DA #S.DCB.TTY.OUTBUFFER OUTTAIL
|
||||
.DA #S.DCB.TTY.OUTBUFFER OUTHEAD
|
||||
.DA #S.DCB.TTY.INBUFFER INBUFFER
|
||||
.DA #S.DCB.TTY.OUTBUF OUTTAIL
|
||||
.DA #S.DCB.TTY.OUTBUF OUTHEAD
|
||||
.DA #S.DCB.TTY.INBUF INBUFFER
|
||||
*--------------------------------------
|
||||
TERMX.DIB .DA #S.DIB.S.WRITE+S.DIB.S.READ
|
||||
.DA #0,#0,#0
|
||||
|
@ -1517,10 +1516,10 @@ REMAP.E0.FF .HS 5B4142434445464748495FA0DF544e4f
|
|||
* p q r s t u v w x y z { | } ~ DEL
|
||||
.HS 50DF5253545556575F595a5b5c5d5e5f
|
||||
*--------------------------------------
|
||||
SCR.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
|
||||
SCR.BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07
|
||||
SCR.BL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
|
||||
SCR.BH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07
|
||||
*--------------------------------------
|
||||
BUF.BASEL .DA #S.DCB.TTY+0
|
||||
BUF.BL .DA #S.DCB.TTY+0
|
||||
.DA #S.DCB.TTY+80
|
||||
.DA #S.DCB.TTY+160
|
||||
.DA #S.DCB.TTY+240
|
||||
|
@ -1544,7 +1543,7 @@ BUF.BASEL .DA #S.DCB.TTY+0
|
|||
.DA #S.DCB.TTY+1680
|
||||
.DA #S.DCB.TTY+1760
|
||||
.DA #S.DCB.TTY+1840
|
||||
BUF.BASEH .DA /S.DCB.TTY+0
|
||||
BUF.BH .DA /S.DCB.TTY+0
|
||||
.DA /S.DCB.TTY+80
|
||||
.DA /S.DCB.TTY+160
|
||||
.DA /S.DCB.TTY+240
|
||||
|
|
|
@ -138,7 +138,7 @@ K.StrFTime.addDecA
|
|||
ldx #2
|
||||
ldy #'0'
|
||||
clc
|
||||
jsr MATH32.A2STR10
|
||||
jsr MATH.A2STR10
|
||||
lda A2osX.NumStrBuf
|
||||
jsr SHARED.FORPNT.PutNext
|
||||
lda A2osX.NumStrBuf+1
|
||||
|
@ -344,7 +344,7 @@ TIMEX.CTime2Time
|
|||
lda ^SECSDAY
|
||||
sta ACC32+2
|
||||
stz ACC32+3
|
||||
jsr MATH32.DIVMOD ARG32 = Days, TMP32 = remaining secs
|
||||
jsr M32.DIVMOD ARG32 = Days, TMP32 = remaining secs
|
||||
|
||||
lda ARG32 WDAY computation : (ARG32 + DAY0) mod 7
|
||||
clc
|
||||
|
@ -475,8 +475,8 @@ K.CTime2Time.HMS
|
|||
.2 phy
|
||||
|
||||
lda #60
|
||||
jsr MATH32.A2ACC32
|
||||
jsr MATH32.DIVMOD
|
||||
jsr M32.A2ACC32
|
||||
jsr M32.DIVMOD
|
||||
ply
|
||||
lda TMP32
|
||||
jsr SHARED.FORPNT.PutY
|
||||
|
|
|
@ -20,10 +20,9 @@ NEW
|
|||
.INB usr/src/sys/kernel.s.init
|
||||
.INB usr/src/shared/x.printf.s
|
||||
|
||||
A2osX.Unpak >STYA ZPOutBufPtr
|
||||
A2osX.Unpak >STYA ZPOutBufPtr
|
||||
.INB usr/src/shared/x.unpak.s
|
||||
|
||||
PAKME.Table
|
||||
PAKME.MAIN .DA A2osX.MAIN
|
||||
PAKME.AUX .DA A2osX.AUX
|
||||
PAKME.GP .DA A2osX.GP
|
||||
|
@ -42,7 +41,7 @@ A2osX.MAIN.B .PH A2osX.EndTables
|
|||
Mem.MLoMem .EQ *
|
||||
.EP
|
||||
A2osX.MAIN.S .EQ *-A2osX.MAIN.B
|
||||
|
||||
|
||||
A2osX.AUX .DA #0
|
||||
.DA A2osX.AUX.S
|
||||
|
||||
|
@ -58,10 +57,11 @@ A2osX.AUX.B .PH Mem.XHiMem
|
|||
.INB usr/src/sys/kernel.s.md5x
|
||||
.INB usr/src/sys/kernel.s.pwdx
|
||||
.INB usr/src/sys/kernel.s.slistx
|
||||
.INB usr/src/sys/kernel.s.errorx
|
||||
* .INB usr/src/sys/kernel.s.blistx
|
||||
.INB usr/src/sys/kernel.s.errorx
|
||||
.EP
|
||||
A2osX.AUX.S .EQ *-A2osX.AUX.B
|
||||
|
||||
|
||||
A2osX.GP .DA #0
|
||||
.DA A2osX.GP.S
|
||||
|
||||
|
@ -107,8 +107,9 @@ A2osX.E0.B .PH $E000
|
|||
.INB usr/src/sys/kernel.s.jmp
|
||||
.INB usr/src/sys/kernel.s.irq
|
||||
.INB usr/src/sys/kernel.s.shared
|
||||
.INB usr/src/sys/kernel.s.math32
|
||||
.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
|
||||
|
||||
.INB usr/src/sys/kernel.s.strv
|
||||
|
@ -117,7 +118,7 @@ A2osX.E0.B .PH $E000
|
|||
.INB usr/src/sys/kernel.s.md5
|
||||
.INB usr/src/sys/kernel.s.pwd
|
||||
.INB usr/src/sys/kernel.s.slist
|
||||
|
||||
|
||||
.INB usr/src/sys/kernel.s.mem
|
||||
|
||||
DevMgr.Timer .BS 1
|
||||
|
@ -131,7 +132,7 @@ A2osX.E0.S .EQ *-A2osX.E0.B
|
|||
.AS "PAKME" TAG
|
||||
.DA $2000 BIN ORG
|
||||
.DA #6 Chunk Count
|
||||
.DA PAKME.Table Chunks
|
||||
.DA PAKME.MAIN Chunks
|
||||
|
||||
.INB usr/src/sys/kernel.s.ctrl
|
||||
MAN
|
||||
|
|
Loading…
Reference in New Issue
Block a user