Kernel 0.94++

This commit is contained in:
Rémy GIBERT 2021-05-09 14:39:40 +02:00
parent f5adf865c2
commit 80f0627240
26 changed files with 370 additions and 164 deletions

View File

@ -26,8 +26,8 @@ This document lists all of the **ACOS Words** supported in the A2osX implementat
| FOR | FOR *numvar*=*startvalue* TO *targetvalue* [STEP *number*]<br>...<br>NEXT | Not Yet Implemented | Program loop iteration declaration. | Creates a loop in program execution that sets a variable *numvar* to initially *startvalue* and increments its value with each iteration and will repeat until that variable reaches *targetvalue*. The <tt>STEP</tt> keyword is optional, but allows you to specify *number* which overrides the typical +1 increment of the loop, i.e. you can count by 2 by specifying <code>STEP 2</code> or you can *decrement* by specifying a negative step number. In general, operates much the same way as AppleSoft FOR-NEXT loops, However, you can only have ONE for loop active at a time, i.e. the <tt>NEXT</tt> command does not allow for a variable, it only operates on the currently active FOR loop. | |
| FREE | FREE | Not Yet Implemented | Return amount of free memory. | Has the same function as the AppleSoft <tt>FRE(0)</tt> command, in that it returns the amount of free memory. REMY TODO: Does this garbage collect? | |
| GET | GET *varstr* | Not Yet Implemented | Get a single character from user. | The <tt>GET</tt> statement is used to get a single keypress from the user. This is a blocking call in that the system will wait until a key is pressed. The key will be returned in *varstr*. Control characters will not be filtered out as they are with <tt>INPUT.</tt> | |
| GOSUB | GOSUB *label* | In Development | Call subroutine at specified label. | Calls subroutine *label* in the program and sets the point in code so that when a <tt>RETURN</tt> function is encountered, execution will resume after the <code>GOSUB</code> statement. While behaves the same way as AppleSoft basic, it is worth pointing out that ACOS uses labels as targets instead of line numbers. | |
| GOTO | GOTO *label* | Working | Redirect program execution to specified label. | Redirects program execution to continue from *label*. Unlike <tt>GOSUB</tt>, no record of where the <tt>GOTO</tt> call occurred. As with <tt>GOSUB</tt>, it is worth pointing out that ACOS uses labels as targets intead of line number. | |
| GOSUB | GOSUB *label* | Impl. | Call subroutine at specified label. | Calls subroutine *label* in the program and sets the point in code so that when a <tt>RETURN</tt> function is encountered, execution will resume after the <code>GOSUB</code> statement. While behaves the same way as AppleSoft basic, it is worth pointing out that ACOS uses labels as targets instead of line numbers. | |
| GOTO | GOTO *label* | Impl. | Redirect program execution to specified label. | Redirects program execution to continue from *label*. Unlike <tt>GOSUB</tt>, no record of where the <tt>GOTO</tt> call occurred. As with <tt>GOSUB</tt>, it is worth pointing out that ACOS uses labels as targets intead of line number. | |
| HOME | HOME | Not Yet Implemented | Clear screen. | Clears the screen and positions the cursor at the top left. REMY TODO: Does this clear the remote session as well? | |
| IF | IF *condition* [THEN] *statement1* [ELSE] *statement2* | In Development | Logical condition test and execution. | Evaluate *condition* and if true (or greater than zero), execute *statement1*. If optional <tt>ELSE</tt> keyword is specified, then a false condition will execute *statement2*. If <tt>ELSE</tt> is used, it must appear on the same line as the <tt>IF</tt> statement, i.e. there is no multi-line if/then/else construct like some other languages. Logical constructs for *condition* supports parenthesis, <tt>AND</tt>, and <tt>OR</tt>.<p><tt>THEN</tt> is optional (as it is in AppleSoft BASIC) but if you use THEN, it cannot be followed by a label directly.(use IF arg THEN GOTO label). | |
| INFO | *expression*=INFO(*optional*)<br>INFO(*optional*)=*expression* | Not Yet Implemented | Byte-level data manipulation function, specific to ACOS internals. | INFO can be used as either a statement or as a function. It is really a 'catch-all' of ACOS state value functions in nature in that many values that are more or less unrelated are accessible through it. The following table gives the meanings of all the INFO data.<p><pre>argument r/w function<br>-------- ---- -----------------<br>INFO(0) r is there a caller online? (0=no)<br>INFO(1) r capacity of current message file.<br>INFO(2) r callers baud rate /300 (1=300)<br>INFO(3) r/w current number of nulls.<br>INFO(4) w top screen stats. (1=chat, 2=exec)<br>INFO(5) r/w executive user online? (1=yes)<br>INFO(6) r checks bit map for mail/msg bases for room.</pre> | |
@ -35,8 +35,8 @@ This document lists all of the **ACOS Words** supported in the A2osX implementat
| INSTR | *expression*=INSTR(*match*, *source*) | Not Yet Implemented | Find a string within another and return offset if found. | The <tt>INSTR</tt> function is used to search within a *source* string for the existence of the specified *match* string. The search is case insensitive. The function will return the numerical position of the first character in the *source* string where the *match* was found. Note that the first character in *source* string starts at <tt>1</tt>, not <tt>0</tt> like many other languages. So in other words, if the function returns zero, no match was found. | |
| KEY | *expression*=KEY(0)<br>*expression*=KEY(1)<br>*expression*=KEY(2) | Not Yet Implemented | Return what key from the interrupt table was caught. | The <tt>KEY</tt> function is used to check and see what if any keys have been pressed. It is generally used to check to see if a routine needs to be interrupted and is used in conjunction with the <tt>SETINT</tt> and <tt>ADDINT</tt> statements. This routine is not blocking and does not wait for a key; it returns either a zero for no key or the ASCII value of the key. In the <tt>KEY(1)</tt> form, a non-zero byte will be returned if the key pressed was the 'file stop' character. In the <tt>KEY(2)</tt> form, a non-zero byte will be returned if the pressed key is the 'file next' key defined in config. | |
| KILL | KILL *filename*<br>KILL #MSG(*expression*) | Not Yet Implemented | Delete a file or message. | The <tt>KILL</tt> statement can be used in two different ways. In both ways it is used to delete data. In the first form, with the *filename,* it will delete the file from disk. In its second form, it will delete a message within the currently active message base. After using <tt>KILL</tt> on a message, it is always a good idea to follow it with an <tt>UPDATE</tt> to make sure the modified message database is persisted to disk. | |
| LEFT$ | *string*=LEFT$(*source*, *length*) | Not Yet Implemented | Return a number of characters from the start of a string. | Returns the first *length* characters of *source* string. | |
| LEN | *expression*=LEN(*string*) | Not Yet Implemented | Return the length of a string. | Returns the length of the supplied *string*. A result of zero means the string is empty. | |
| LEFT$ | *string*=LEFT$(*source*, *length*) |Impl. | Return a number of characters from the start of a string. | Returns the first *length* characters of *source* string. | |
| LEN | *expression*=LEN(*string*) | Impl. | Return the length of a string. | Returns the length of the supplied *string*. A result of zero means the string is empty. | |
| LINK | LINK *filename* [,*label*] | Not Yet Implemented | Load and execute another ACOS script. | The <tt>LINK</tt> statement allows you to load a different program segment and execute that one, optionally starting at a specified *label*. The purpose of this is to allow for your code to be split up into multiple segments, but also to support additional code to be used without modifying the other. The *filename* argument is mandatory and is in the standard filename syntax. If you wish the execution to begin at a point other than the beginning of the module, then the *label* argument can be specified in string form (e.g. <code>LINK "A:MSG.SEG","BULLETINS"</code>). The label must be enclosed in quotes or must be in a string variable. Note that for the label to be usable by the <tt>LINK</tt> command, the label must be declared as <tt>PUBLIC</tt> in the target file. | |
| LOG | LOG *drivespec* | Not Yet Implemented | Change current filesystem drive. | The <tt>LOG</tt> statement simply changes the default disk drive to the *drivespec* drive. If the drive is not legal, a BAD DRIVE SPECIFIER error will occur. | |
| MARK | *expression*=MARK(*device*)<br>MARK(*device*)=*number* | Not Yet Implemented | Set/get current file position offset. | The <tt>MARK</tt> function will allow you to either set or check the offset within the current file I/O. If you want to go to the beginning of a file, you would issue a <code>MARK(1)=0</code> assuming it was file device #1. <tt>MARK</tt> has a second function in that it can be used to see if a file exists. Normally ACOS will not generate an error if a file exists, so it can be hard to tell if there is one. To see if a file exists: <p><code>OPEN #1,filename<br>IF MARK(1) PRINT "FILE EXISTS"<br>CLOSE #1</code> | |
@ -54,7 +54,7 @@ This document lists all of the **ACOS Words** supported in the A2osX implementat
| POKE | POKE *address*, *value* | Not Yet Implemented | Set the value for a specified memory location. | Sets the value of the memory location specified at *address* with *value*. REMY TODO: Does this work in A2osX? Perhaps limit it to $C000-CFFF? | |
| POP | POP | Not Yet Implemented | Remove the most recent address from the return stack. | Removes the last execution address from the stack, i.e. if a <tt>PUSH</tt> or <tt>GOSUB</tt> was called which put an execution address on the stack, the <tt>POP</tt> command can be used to remove it (and render that <tt>PUSH</tt> or <tt>GOSUB</tt> 'forgotten'). Works the same as the AppleSoft <tt>POP</tt> statement with the exception of it also can be used with the ACOS <tt>PUSH</tt> command. | |
| POSITION | POSITION #*device,* *record_length,* *record_number* [,*offset*] | Not Yet Implemented | Set the file position offset for a device. | The <tt>POSITION</tt> statement is used to position within a random access file. The *device* argument is the disk device channel number that was used to open the file. The *record_length* argument is the length of each record. The *record_number* argument is the record number to be positioned to. The optional *offset* argument is the offset within the record that is to be positioned to. Note that there is no check to see if files actually conform to *record_length*; it along with the other *record_number* and *offset* arguments simply form a means of providing a calculation for a byte offset in the file as a while. For example, <code>POSITION #1, 1000, 3, 50</code> would result in seeking file device #1 to the 3050'th byte in the file. | |
| PRINT | PRINT [#*device*,] [*expression*] [,*expression*] [;] | In Development | Output data to a device, session, or screen. | Sends/displays text or data to the screen, remote user, or specified device handler. There are a few rules for <tt>PRINT</tt>:<p><ul><li>control: '<tt>,</tt>' - the comma is used to separate expressions within the print statement and will be printed literally, i.e. this is for creating comma-separated file output.<li>control: '<tt>;</tt>' - the semi-colon is also used to separate expressions it will not be printed when encountered, if a semi-colon is the last character in the line, then the carriage return will be suppressed.<li>control: '<tt>\\</tt>' - the backslash is used to generate a newline character. Using the backslash, there is no need to put a bunch of <code>print:print...</code> statements.<li>exprs: TEXT - text must be contained within quotes and will be printed exactly as typed. Within quotes, you may have any special characters including return. Note that you MUST close quotes on the same line - multi-line quotes are not allowed.<li>exprs: STRING- the contents of the listed string will be printed.<li>exprs: NUMBER- the content of the listed number will be printed.</ul> | |
| PRINT | PRINT [#*device*,] [*expression*] [,*expression*] [;] | Impl. | Output data to a device, session, or screen. | Sends/displays text or data to the screen, remote user, or specified device handler. There are a few rules for <tt>PRINT</tt>:<p><ul><li>control: '<tt>,</tt>' - the comma is used to separate expressions within the print statement and will be printed literally, i.e. this is for creating comma-separated file output.<li>control: '<tt>;</tt>' - the semi-colon is also used to separate expressions it will not be printed when encountered, if a semi-colon is the last character in the line, then the carriage return will be suppressed.<li>control: '<tt>\\</tt>' - the backslash is used to generate a newline character. Using the backslash, there is no need to put a bunch of <code>print:print...</code> statements.<li>exprs: TEXT - text must be contained within quotes and will be printed exactly as typed. Within quotes, you may have any special characters including return. Note that you MUST close quotes on the same line - multi-line quotes are not allowed.<li>exprs: STRING- the contents of the listed string will be printed.<li>exprs: NUMBER- the content of the listed number will be printed.</ul> | |
| PUBLIC | PUBLIC *label* | Not Yet Implemented | Declare a label to be accessible via the LINK command. | The <tt>PUBLIC</tt> statement is used to make a label within a program module available to other modules to <tt>LINK</tt> to. If you wish to link to another program module, and start execution at a point other than the beginning of the module, you will need to make that point public. You can have a maximum of 8 public labels within a program module. | |
| PUSH | PUSH *label* | Not Yet Implemented | Push the current execution address to the return stack. | The <tt>PUSH</tt> statement is a subset of the <tt>GOSUB</tt> statement. It does not actually change the current point of execution, but places a return address on the stack so that the next time a <tt>RETURN</tt> statement is encountered, control will return to this present point. A <tt>POP</tt> statement will remove the last address added to the return table. | |
| RAM | RAM | Not Yet Implemented | Keyword representing the primary 64-byte scratch RAM. | The <tt>RAM</tt> function is really just a constant pointer. It just points to a free 64 bytes of memory that has been set aside for program use. | |
@ -62,7 +62,7 @@ This document lists all of the **ACOS Words** supported in the A2osX implementat
| RANDOM | *expression*=RANDOM(*number*) | Not Yet Implemented | Returns a random number between 0 and specified number. | The <tt>RANDOM</tt> function is used to generate a random number within the range 0-*number*. It is important to note that the random number generator only runs when the system goes to get input. In other words, if you take two random numbers in a row without some kind of user input in the middle, the random numbers will always be the same. If you need more than one, use the <tt>RND$</tt> string between. The <tt>RND$</tt> string will cause the random number generator to re-random. REMY TODO: Is there an A2osX random number service that would be used instead? | |
| READ | READ #*device*, *memloc*, *number* | Not Yet Implemented | Reads binary data. | The <tt>READ</tt> statement is used to load data from a file into memory in its binary form without any processing or changing. The input does not have to come from a file, it can come from the editor or a message file. It is similar to an Apple DOS BLOAD command. BJB TODO: Need to improve this to describe memloc, number. | |
| READY | READY *filename*<br>READY #MSG(*number*) | Not Yet Implemented | Prepare a message database for use. | The <tt>READY</tt> statement is used to make a message file ready for use. It is similar to an <tt>OPEN</tt> statement being used before a file is accessed. After a message file is ready, all the following references to <tt>MSG</tt> will be directed to that file. Once a message file has been made ready, it can also be used in its second syntax to ready a specific message within the file. This is generally used if further references to the file will use the device channel associated with the message base. | |
| RETURN | RETURN | In Development | Return from a subroutine. | Return from a subroutine. More specifically, it retrieves the last execution point off the stack and continues program execution from that point. Used in conjunction with <tt>GOSUB</tt> and <tt>PUSH</tt> statements. | |
| RETURN | RETURN | Impl. | Return from a subroutine. | Return from a subroutine. More specifically, it retrieves the last execution point off the stack and continues program execution from that point. Used in conjunction with <tt>GOSUB</tt> and <tt>PUSH</tt> statements. | |
| REWIND | REWIND | Not Yet Implemented | Set file position to a previously set location. | The <tt>REWIND</tt> statement is to change the pointer within a message file to some previously accessed point within the file. Normally this is used in conjunction with the <code>READY MSG(x):COPY #7</code> statements. Using <tt>REWIND</tt> will put the internal pointer back to where it was before the last message operation took place. This is generally used for doing a 're-read' function of sorts. | |
| RIGHT$ | *string*=RIGHT$(*source*, *length*) | Not Yet Implemented | Return a number of characters from the end of a string. | Returns the last *length* number of characters from the *source*. | |
| RND$ | *char*=RND$ | Not Yet Implemented | Returns a random character. | The <tt>RND$</tt> function is used to generate random characters. Each time <tt>RND$</tt> is accessed a new random character will be returned. Be warned: the random number is generated from timing how long a user takes to enter his input. This is really a pretty random number since it is based on the users typing skill and speed. The only problem is that the random character generator can start repeating patterns after about 15-20 characters have been generated and before another input has taken place. REMY TODO: Is this how your implementation works or are you using an A2osX random generator? | |

View File

@ -716,7 +716,7 @@ CS : not found
# SListFree
## ASM
`>PUSHB hSList`
`lda hSList`
`>SYSCALL SListFree`
## RETURN VALUE

Binary file not shown.

View File

@ -149,20 +149,6 @@ 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
jsr CODE.EmitByte
inx
cpx #CCODE.PULLA.LEN
bne .1
rts
*--------------------------------------
CODE.FPRINTSTR ldx #0
.1 lda CCODE.FPRINTSTR,x

View File

@ -2,7 +2,10 @@ NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
CORE.Init >LDYAI CODESEG
CORE.Init ldy #CCS.MAX
sty pCCS
>LDYAI CODESEG
>SYSCALL GetMem
bcs .9
@ -86,7 +89,6 @@ CORE.Cleanup ldy #hFWRefBuf
>LDA.G hVars
beq .1
>PUSHA
>SYSCALL SListFree
>STZ.G hVars
@ -94,7 +96,6 @@ CORE.Cleanup ldy #hFWRefBuf
.1 >LDA.G hLabels
beq .8
>PUSHA
>SYSCALL SListFree
>STZ.G hLabels
@ -122,13 +123,15 @@ CORE.Compile jsr CORE.GetChar
beq .80 #/bin/acos....
cmp #';'
beq .80 Comment: skip line...
bne .1
cmp #C.CR
.80 jmp CORE.SkipLine Comment: skip line...
.1 cmp #C.CR
beq .88 EOL
jsr CORE.CheckCharNB
bcs .1 CS=SPACE -> go check VAR or KW
bcs .2 CS=SPACE -> go check VAR or KW
jsr CORE.IsLetter LABEL must start with a letter
bcs .99
@ -138,20 +141,23 @@ CORE.Compile jsr CORE.GetChar
bra .8
*--------------------------------------
.1 jsr CORE.GetNextCharNB skip SPACE(s) or ":"
.2 jsr CORE.GetNextCharNB skip SPACE(s) or ":"
bcs .99
cmp #C.CR
.21 cmp #C.CR
beq .88 EOL
jsr CORE.IsLetter
bcs .90
>LDYA L.ACOS.KW
jsr CORE.Lookup
jsr CORE.LookupSkip
bcs .3
jmp (J.ACOS.KW,x)
jsr CORE.KW.JMP
bcs .99
bra .8
*--------------------------------------
.3 jsr CORE.CreateOrGetVar
bcs .90
@ -181,20 +187,23 @@ CORE.Compile jsr CORE.GetChar
.4 jsr CODE.INTSET Store Int16 result in DATASEG
*--------------------------------------
.8 jsr CORE.GetCharNB
bcs .99
bcs .88
cmp #':'
beq .1
beq .2 go skip : and continue
cmp #C.CR
bne .90
bra .21
.88 clc
.88 ldy pCCS
bmi .89
jsr KW.ENDIF
bcs .99
.89 clc
jmp CORE.GetNextChar skip char
.80 jmp CORE.SkipLine
.90 lda #E.CSYN
sec
.99 rts
@ -203,6 +212,8 @@ CORE.Compile jsr CORE.GetChar
sec
rts
*--------------------------------------
CORE.KW.JMP jmp (J.ACOS.KW,x)
*--------------------------------------
CORE.FWREF >LDA.G hFWRefBuf
>SYSCALL GetMemPtr
>STYA ZPInputBufPtr
@ -337,7 +348,12 @@ CORE.LookupOPS lda (ZPInputBufPtr)
.19 sec
.99 rts
*--------------------------------------
CORE.Lookup >STYA ZPPtr1
CORE.LookupSkip sec
.HS 90 BCC
CORE.Lookup clc
php
>STYA ZPPtr1
ldx #0
@ -356,7 +372,10 @@ CORE.Lookup >STYA ZPPtr1
jsr .10 next char in text...
bcc .4 valid....failed
.3 tya Keyword Len
.3 plp
bcc .8
tya Keyword Len
jmp CORE.SkipA
@ -377,8 +396,10 @@ CORE.Lookup >STYA ZPPtr1
lda (ZPPtr1) Array Ending 0, lookup failed
bne .1
plp
.9 sec
rts
.8 rts
*--------------------------------------
.10 iny
lda (ZPInputBufPtr),y Get Src text char...
@ -603,7 +624,15 @@ CORE.IsOPSChar phx
clc
rts
*--------------------------------------
CORE.IsEndExp cmp #')'
CORE.IsKW jsr CORE.IsLetter
bcs .9
>LDYA L.ACOS.KW
jmp CORE.Lookup
.9 rts
*--------------------------------------
CORE.IsEndExp cmp #')' CS = true
beq CORE.ToUpperCase.RTS
cmp #','
@ -612,9 +641,9 @@ CORE.IsEndExp cmp #')'
cmp #';'
beq CORE.ToUpperCase.RTS
CORE.IsEndInst cmp #':' CS=TRUE
CORE.IsEndInst cmp #':' CS = true
beq .8
cmp #C.CR
beq .8
@ -630,7 +659,7 @@ CORE.IsLetterOrDigit
jsr CORE.IsDigit10
bcc CORE.IsLetterRTS
*---------------------------------------
CORE.IsLetter cmp #'_'
CORE.IsLetter cmp #'_' CC = true
bne .1
clc

View File

@ -3,7 +3,7 @@ NEW
.LIST OFF
*--------------------------------------
* In: A = current CHAR
* Out: CC, longint on stack or pSTR in stack
* Out: CC, int16 on stack or pSTR in stack
*--------------------------------------
EXP.Eval stz EXP.TYPE
@ -39,16 +39,19 @@ EXP.Eval.R lda EXP.AOPS
bne .20
jsr EXP.CreateStrConst
bcs .99
bcs .37
bra .40
*--------------------------------------
.20 jsr CORE.IsLetter
bcs .30 FN or VAR
bcs .30 No, go check for number...
>LDYA L.ACOS.KW Yes, KW, FN or VAR ?
jsr CORE.Lookup
bcc .80 KW, end of exp
>LDYA L.ACOS.FN
jsr CORE.Lookup
jsr CORE.LookupSkip
bcs .21
jsr EXP.FNjmpX
@ -74,35 +77,38 @@ EXP.Eval.R lda EXP.AOPS
.39 bcs .90
jsr EXP.Int16
bcs .99
.37 bcs .99
*--------------------------------------
.40 jsr CORE.GetCharNB
.41 bcs .80
.50 jsr CORE.IsEndExp
bcs .80
jsr CORE.IsKW
bcc .80
jsr CORE.LookupOPS
bcs .90
stx EXP.AOPS
.61 lda (pStack) get op context
bmi .62 no prev op, go get arg2
lda (pStack) get op context
bmi .60 no prev op, go get arg2
cmp EXP.AOPS we have arg1 A=op1 arg2 X=op2
bcc .62
bcc .60
inc pStack prev op has precedence
tay
ldx ACOS.OPS.MAP-1,y
ldx ACOS.OPS2FPU,y
jsr CODE.FPUCALL go compute (arg1 op1 arg2)
.62 lda EXP.AOPS we must compute arg2 op2 arg3 before
.60 lda EXP.AOPS we must compute arg2 op2 arg3 before
>PUSHA
.63 jsr CORE.GetNextCharNB
jsr CORE.GetCharNB
bcs .90
jmp .11
*--------------------------------------
@ -110,7 +116,7 @@ EXP.Eval.R lda EXP.AOPS
tay
bmi .88 nothing to do
ldx ACOS.OPS.MAP-1,y
ldx ACOS.OPS2FPU,y
jsr CODE.FPUCALL
bra .80

View File

@ -12,6 +12,10 @@ KW.COPY
KW.CREATE
KW.ECHO
KW.EDIT
lda #E.CSYN
sec
rts
*--------------------------------------
*KW.END
KW.FILL
KW.FLAG
@ -54,10 +58,125 @@ KW.HOME
*--------------------------------------
* IP exp THEN st1 ELSE st2
*--------------------------------------
KW.IF
KW.IF jsr EXP.Eval
bcs .99
lda EXP.TYPE
bne .91
lda #E.CSYN
ldx #0
.1 lda CCODE.TESTTRUE,x
jsr CODE.EmitByte
inx
cpx #CCODE.TESTTRUE.LEN
bne .1
lda #$4C JMP abs
jsr CODE.EmitByte
ldy pCCS
dey
lda ZPCodeBufPtr+1
sta (pData),y
dey
lda ZPCodeBufPtr
sta (pData),y
dey
lda #KWID.IF
sta (pData),y
sty pCCS
lda ZPCodeBufPtr
clc
adc #2
sta ZPCodeBufPtr
bcc .8
inc ZPCodeBufPtr+1
.8 clc
rts
.90 lda #E.CSYN
sec
rts
.91 lda #E.TMISMATCH
sec
.99 rts
*--------------------------------------
KW.ENDIF sec
.HS 90 BCC
*--------------------------------------
KW.ELSE clc
ldy pCCS
lda (pData),y
eor #KWID.IF
bne .9
iny
lda (pData),y
sta ZPPtr1
iny
lda (pData),y
sta ZPPtr1+1 ZPPtr1 = JMP if FALSE
bcs .5 ENDIF
lda #$4C JMP abs
jsr CODE.EmitByte
ldy pCCS
iny
lda ZPCodeBufPtr
sta (pData),y
iny
lda ZPCodeBufPtr+1
sta (pData),y
lda ZPCodeBufPtr
clc
adc #2
sta ZPCodeBufPtr
bcc .1
inc ZPCodeBufPtr+1
.1 lda ZPCodeBufPtr
sta (ZPPtr1)
lda ZPCodeBufPtr+1
ldy #1
sta (ZPPtr1),y
clc
rts
.5 lda ZPCodeBufPtr
sta (ZPPtr1)
ldy #1
lda ZPCodeBufPtr+1
sta (ZPPtr1),y
lda pCCS
clc
adc #3
sta pCCS
clc
rts
.9 lda #E.NOIF
sec
rts
*--------------------------------------
@ -85,33 +204,34 @@ KW.POSITION
*--------------------------------------
KW.PRINT stz hOut reset to hStdOut
stz ZPPtr2 put ending CR
* ldy #S.PS.hStdOut
* lda (pPS),y
* sta hOut Default to screen
.10 jsr CORE.GetNextCharNB
bcs .8
.11 jsr CORE.IsEndInst
bcs .8
jsr CORE.IsKW
bcc .8
stz bFlag put ending CR
*--------------------------------------
.5 jsr EXP.Eval
stz ZPPtr2 put ending CR
jsr EXP.Eval
bcs .99
lda EXP.TYPE
beq .6
jsr CODE.PULLYA
jsr CODE.FPRINTSTR
bra .7
.6 jsr CODE.PULLYA
jsr CODE.FPRINTINT
.6 jsr CODE.FPRINTINT
*--------------------------------------
.7 jsr CORE.GetCharNB
bcs .8
@ -119,6 +239,10 @@ KW.PRINT stz hOut reset to hStdOut
.70 jsr CORE.IsEndInst
bcs .8
jsr CORE.IsKW
bcc .8
lda (ZPInputBufPtr)
cmp #','
bne .71
@ -129,13 +253,13 @@ KW.PRINT stz hOut reset to hStdOut
.71 cmp #';'
bne .90
dec bFlag suppress ending CR
ror ZPPtr2 suppress ending CR
jsr CORE.GetNextCharNB skip ;
bcc .11
.8 bit bFlag
.8 bit ZPPtr2
bmi .80
jsr CODE.FPRINTCRLF

View File

@ -11,6 +11,7 @@ DATASEG .EQ 256
STRVSEG .EQ 2048
FWREF .EQ 1024
EXP.DEPTH.MAX .EQ 16
CCS.MAX .EQ 128
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
@ -33,7 +34,8 @@ ZPStrBuf .BS 2
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ArgIndex .BS 1
ArgIndex .EQ *
pCCS .BS 1
bFlag .BS 1
ZPCodeBufPtr .BS 2
@ -96,6 +98,7 @@ J.ACOS.KW .DA KW.ADDINT
.DA KW.CREATE
.DA KW.ECHO
.DA KW.EDIT
.DA KW.ELSE
.DA KW.END
.DA KW.FILL
.DA KW.FLAG
@ -105,6 +108,7 @@ J.ACOS.KW .DA KW.ADDINT
.DA KW.GOSUB
.DA KW.GOTO
.DA KW.HOME
KWID.IF .EQ *-J.ACOS.KW
.DA KW.IF
.DA KW.INFO
.DA KW.INPUT
@ -336,10 +340,12 @@ PrintDebugMsg >LDYA pStack
>STYA ZPPtr2
>PUSHW L.MSG.DEBUG
>PUSHW ZPPtr2
>PUSHW ZPCodeBufPtr
>PUSHW ZPConstBufPtr
>PUSHW ZPDataBufPtr
>PUSHW ZPPtr2
>PUSHBI 4
>PUSHBI 8
>SYSCALL PrintF
rts
*--------------------------------------
@ -365,7 +371,7 @@ PrintErrorMsg >LDA.G bTrace
sec
>SBC.G InputBufPtr
tax
bcc *
>LDYA.G InputBufPtr
>STYA ZPInputBufPtr
@ -429,24 +435,37 @@ CCODE.PUSHA.LEN .EQ *-CCODE.PUSHA
CCODE.PULLA >PULLA
CCODE.PULLA.LEN .EQ *-CCODE.PULLA
*--------------------------------------
CCODE.FPRINTSTR pha
>PUSHW L.MSG.STR
pla
CCODE.TESTTRUE lda (pStack)
inc pStack
ora (pStack)
php
inc pStack
plp
.1 bne .1+5
CCODE.TESTTRUE.LEN .EQ *-CCODE.TESTTRUE
*--------------------------------------
CCODE.FPRINTSTR >PUSHW L.MSG.STR
ldy #3
lda (pStack),y
>PUSHA
tya
lda (pStack),y
>PUSHA
>PUSHBI 2
>SYSCALL PrintF
inc pStack
inc pStack
CCODE.FPRINTSTR.LEN .EQ *-CCODE.FPRINTSTR
*--------------------------------------
CCODE.FPRINTINT pha
>PUSHW L.MSG.INT16
pla
CCODE.FPRINTINT >PUSHW L.MSG.INT16
ldy #3
lda (pStack),y
>PUSHA
tya
lda (pStack),y
>PUSHA
>PUSHBI 2
>SYSCALL PrintF
inc pStack
inc pStack
CCODE.FPRINTINT.LEN .EQ *-CCODE.FPRINTINT
*--------------------------------------
CCODE.LEN >PULLW ZPPtr1
@ -498,7 +517,7 @@ MSG.USAGE .AS "Usage : ACOS <option> file\r\n"
.AS " -T : Trace On"
MSG.ECHOCRLF .AZ "\r\n"
MSG.COMPILING .AZ "Compiling : %s...\r\n"
MSG.DEBUG .AZ "pStack=%H CodePtr=%H\r\n"
MSG.DEBUG .AZ "CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n"
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"
@ -531,7 +550,7 @@ ACOS.OPS .AT "*"
.AT "OR"
.HS 00
*--------------------------------------
ACOS.OPS.MAP .DA #FPU.iMUL,#FPU.iDIV,#FPU.iMOD,#FPU.iADD,#FPU.iSUB
ACOS.OPS2FPU .DA #FPU.iMUL,#FPU.iDIV,#FPU.iMOD,#FPU.iADD,#FPU.iSUB
.DA #FPU.iL,#FPU.iLE,#FPU.iLE
.DA #FPU.iG,#FPU.iGE,#FPU.iGE
.DA #FPU.iNE,#FPU.iNE,#FPU.iE
@ -547,6 +566,7 @@ ACOS.KW .AT "ADDINT"
.AT "CREATE"
.AT "ECHO"
.AT "EDIT"
.AT "ELSE"
.AT "END"
.AT "FILL"
.AT "FLAG"
@ -621,6 +641,7 @@ ACOS.FN .AT "BYTE"
.DUMMY
.OR 0
DS.START
CCS .BS CCS.MAX
bDebug .BS 1
bTrace .BS 1
LineCounter .BS 2

View File

@ -55,7 +55,6 @@ MAC.Quit >LDA.G MAC.StkPtr
.3 >LDA.G MAC.hList
beq .8
>PUSHA
>SYSCALL SListFree
.8 clc

View File

@ -35,7 +35,6 @@ SYM.Quit >LDA.G SYM.hBuf
.1 >LDA.G SYM.hList
beq .8
>PUSHA
>SYSCALL SListFree
.8 rts

View File

@ -58,19 +58,16 @@ CSH.Init >SYSCALL SListNew
CSH.Quit >LDA.G CSH.hSymbols
beq .1
>PUSHA
>SYSCALL SListFree
.1 >LDA.G CSH.hTags
beq .2
>PUSHA
>SYSCALL SListFree
.2 >LDA.G CSH.hDefines
beq .3
>PUSHA
>SYSCALL SListFree
.3 lda hInclude

View File

@ -705,7 +705,6 @@ CS.QUIT jsr GFX.Close
.10 >LDA.G hSList
beq .1
>PUSHA
>SYSCALL SListFree
.1 >LDA.G hFile

View File

@ -10,7 +10,6 @@ CORE.Init lda #PUSHD.STACK
CORE.FUNCRESET >LDA.G hFuncList
beq .8
>PUSHA
>SYSCALL SListFree
>STZ.G hFuncList

View File

@ -22,15 +22,9 @@ ERRORX.GetErrMsg
lda (ZPPtr1),y
bpl .2
tya
sec
adc ZPPtr1
sta ZPPtr1
bcc .3
inc ZPPtr1+1
jsr SHARED.AddYp12P1
.3 inx
inx
cpx #ERRORX.CNT
bne .1

View File

@ -485,14 +485,22 @@ K.SYSCALL2.BANK bpl K.SYSCALL.JMP 0, E000, no BNK change
K.SYSCALL.JMP jmp (K.SYSCALL,x)
*--------------------------------------
K.SYSCALL.JMPX2A
sec
.HS 90 BCC
K.SYSCALL.JMPX2 clc
>PULLW FORPNT
>PULLW TXTPTR
bcc K.SYSCALL.JMPX
>PULLA
K.SYSCALL.JMPX sta SETREADAUX
sta SETWRITEAUX
jsr .1
jsr JMPX
sta CLRREADAUX
sta CLRWRITEAUX
rts
.1 jmp (KX.SYSCALL-SYS.StrVNew,x)
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.jmp

View File

@ -1,7 +1,9 @@
NEW
AUTO 3,1
*--------------------------------------
KX.SYSCALL .DA STRVX.StrVNew
JMPX jmp (.1-SYS.StrVNew,x)
.1 .DA STRVX.StrVNew
.DA STRVX.StrVSet
.DA STRVX.StrVGet
.DA STRVX.StrVFree

View File

@ -70,18 +70,21 @@ M16.SHR clc
rts
*--------------------------------------
M16.L ldx #0
bra M16.CMP
.HS 2C BIT ABS
M16.LE ldx #1
bra M16.CMP
.HS 2C BIT ABS
M16.G ldx #2
bra M16.CMP
.HS 2C BIT ABS
M16.GE ldx #3
bra M16.CMP
.HS 2C BIT ABS
M16.E ldx #4
bra M16.CMP
.HS 2C BIT ABS
M16.NE ldx #5
*--------------------------------------
M16.CMP jsr M16.SUB
M16.CMP lda MATH.CMPT,x
sta .3+1
jsr M16.SUB
tay A = BYTE 1
bmi .1
@ -96,9 +99,8 @@ M16.CMP jsr M16.SUB
.HS 2C BIT ABS
.2 lda #%010
.HS 2C BIT ABS
and MATH.CMPT,x
.3 and #$ff SELF MODIFIED
bra M16.LOR2
*--------------------------------------
M16.LAND jsr M16.AND
@ -106,7 +108,7 @@ M16.LAND jsr M16.AND
M16.LOR jsr M16.OR
M16.LOR1 dey y = 1
M16.LOR1 ldy #1
lda (pStack)
ora (pStack),y
@ -118,6 +120,9 @@ M16.LOR2 beq .1
.1 sta (pStack)
lda #0
ldy #1
sta (pStack),y
rts

View File

@ -77,18 +77,21 @@ M32.SHR clc
rts
*--------------------------------------
M32.L ldx #0
bra M32.CMP
.HS 2C BIT ABS
M32.LE ldx #1
bra M32.CMP
.HS 2C BIT ABS
M32.G ldx #2
bra M32.CMP
.HS 2C BIT ABS
M32.GE ldx #3
bra M32.CMP
.HS 2C BIT ABS
M32.E ldx #4
bra M32.CMP
.HS 2C BIT ABS
M32.NE ldx #5
*--------------------------------------
M32.CMP jsr M32.SUB
M32.CMP lda MATH.CMPT,x
sta .3+1
jsr M32.SUB
tay A = BYTE 3
bmi .1
@ -109,9 +112,8 @@ M32.CMP jsr M32.SUB
.HS 2C BIT ABS
.2 lda #%010
.HS 2C BIT ABS
and MATH.CMPT,x
.3 and #$ff SELF MODIFIED
bra M32.LOR2
*--------------------------------------
M32.LAND jsr M32.AND

View File

@ -12,8 +12,10 @@ NEW
* ## RETURN VALUE
* CC
*\--------------------------------------
K.MD5 >PULLW FORPNT
>PULLW TXTPTR
K.MD5 .EQ K.SYSCALL.JMPX2
* >PULLW FORPNT
* >PULLW TXTPTR
*/--------------------------------------
* ## MD5Init
* Initialize a MD5 computation
@ -24,7 +26,9 @@ K.MD5 >PULLW FORPNT
* ## RETURN VALUE
* A = hMem To S.MD5
*\--------------------------------------
K.MD5Init jmp K.SYSCALL.JMPX
K.MD5Init .EQ K.SYSCALL.JMPX
* jmp K.SYSCALL.JMPX
*/--------------------------------------
* ## MD5Update
* Add Data to MD5 computation
@ -37,11 +41,12 @@ K.MD5Init jmp K.SYSCALL.JMPX
* `>SYSCALL MD5Update`
* ## RETURN VALUE
*\--------------------------------------
K.MD5Update >PULLW ZPDataLen get LEN
>PULLW TXTPTR get DATA
>PULLA
K.MD5Update .EQ K.SYSCALL.JMPX2A
* >PULLW FORPNT get LEN
* >PULLW TXTPTR get DATA
* >PULLA
jmp K.SYSCALL.JMPX
* jmp K.SYSCALL.JMPX
*/--------------------------------------
* ## MD5Finalize
* # C

View File

@ -4,7 +4,6 @@ NEW
.DUMMY ZPTMP,6
.OR ZPTMP 29 bytes
ZPCtxPtr .BS 2
ZPDataLen .BS 2
ZPChunkLen .BS 2
.ED
*--------------------------------------
@ -83,8 +82,8 @@ MD5X.MD5 ldy #$ff
jsr SHARED.TXTPTRgY
bne .1
sty ZPDataLen
stz ZPDataLen+1
sty FORPNT
stz FORPNT+1
jsr MD5X.Init
bcs .9
@ -98,7 +97,7 @@ MD5X.MD5 ldy #$ff
.9 rts
*--------------------------------------
MD5X.Init >LDYAI S.MD5
>SYSCALL2 getmem
jsr K.GetMem
bcs .9
>STYA ZPCtxPtr
@ -123,7 +122,7 @@ MD5X.Init >LDYAI S.MD5
clc
.9 rts
*--------------------------------------
MD5X.Update >SYSCALL2 GetMemPtr get MD5 Context
MD5X.Update jsr K.GetMemPtr get MD5 Context
>STYA ZPCtxPtr
MD5X.Update.I ldy #S.MD5.FINALIZED
@ -133,10 +132,10 @@ MD5X.Update.I ldy #S.MD5.FINALIZED
sec
rts
.1 lda ZPDataLen+1 More than 256 Bytes remaining to hash ?
.1 lda FORPNT+1 More than 256 Bytes remaining to hash ?
bne .3 yes
lda ZPDataLen
lda FORPNT
bne .2 Len = O ?
clc All data processed
@ -176,15 +175,19 @@ MD5X.Update.I ldy #S.MD5.FINALIZED
lda ZPChunkLen
cmp #56 Enough room for BITCOUNT ?
bcs .58 no
jsr MD5AppBC
.58 jsr MD5Transform
jsr MD5UpdateABCD0
.8 lda ZPDataLen Substract Bytes processed from LEN
.8 lda FORPNT Substract Bytes processed from LEN
sec
sbc ZPChunkLen get back chunk Len
sta ZPDataLen
sta FORPNT
bcs .81
dec ZPDataLen+1
dec FORPNT+1
.81 lda TXTPTR Add Bytes processed to DATA
clc
@ -195,7 +198,7 @@ MD5X.Update.I ldy #S.MD5.FINALIZED
bra .1
*--------------------------------------
MD5X.Finalize pha
>SYSCALL2 GetMemPtr
jsr K.GetMemPtr
>STYA ZPCtxPtr get MD5 Context
MD5X.Finalize.I ldy #S.MD5.FINALIZED
@ -435,7 +438,6 @@ MD5.XXXX.END >MOV32 MD5.D,MD5.DTemp
>MOV32 MD5.DTemp,MD5.A
rts
*--------------------------------------
CS.END
MD5.ABCDINIT .HS 01234567.89ABCDEF.FEDCBA98.76543210
*--------------------------------------
MD5.s .DA #7,#12,#17,#22,#7,#12,#17,#22,#7,#12,#17,#22,#7,#12,#17,#22

View File

@ -22,7 +22,8 @@ K.GetPWUID
* ## RETURN VALUE
*\--------------------------------------
K.GetGRGID >PULLW FORPNT
>PULLB ZPPtr1+1 UID/GID
>PULLA UID/GID
jmp K.SYSCALL.JMPX
*/--------------------------------------
* # CloseSession
* ## C
@ -32,7 +33,7 @@ K.GetGRGID >PULLW FORPNT
* `>SYSCALL CloseSession`
* ## RETURN VALUE
*\--------------------------------------
K.CloseSession jmp K.SYSCALL.JMPX
K.CloseSession .EQ K.SYSCALL.JMPX
*/--------------------------------------
* # OpenSession
* ## C
@ -43,7 +44,8 @@ K.CloseSession jmp K.SYSCALL.JMPX
* `>SYSCALL OpenSession`
* ## RETURN VALUE
*\--------------------------------------
K.OpenSession
K.OpenSession .EQ K.SYSCALL.JMPX2
* >PULLW FORPNT passwd
* >PULLW TXTPTR name
@ -58,7 +60,11 @@ K.OpenSession
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
K.GetPWName
K.GetPWName .EQ K.SYSCALL.JMPX2
* >PULLW FORPNT
* >PULLW TXTPTR
* jmp K.SYSCALL.JMPX
*/--------------------------------------
* # GetGRName
* ## C
@ -69,10 +75,11 @@ K.GetPWName
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
K.GetGRName >PULLW FORPNT
>PULLW TXTPTR
K.GetGRName .EQ K.SYSCALL.JMPX2
jmp K.SYSCALL.JMPX
* >PULLW FORPNT
* >PULLW TXTPTR
* jmp K.SYSCALL.JMPX
*/--------------------------------------
* # PutPW
* ## C

View File

@ -9,7 +9,9 @@ NEW
* ....\CR
* \0
*--------------------------------------
PWDX.GetPWUID lda PWD.hUsrDB
PWDX.GetPWUID sta ZPPtr1+1
lda PWD.hUsrDB
beq PWDX.GetPW.9
jsr K.GetmemPtr
@ -32,6 +34,7 @@ PWDX.GetPWUID lda PWD.hUsrDB
PWDX.GetPW.8 ldx FORPNT+1
beq .8 Dry run, no output
jmp PWDX.Rec2PW
.8 clc a = UID
@ -219,7 +222,9 @@ PWDX.PutPW.1 jsr K.GetmemPtr
sec
.99 rts
*--------------------------------------
PWDX.GetGRGID lda PWD.hGrpDB
PWDX.GetGRGID sta ZPPtr1+1
lda PWD.hGrpDB
beq PWDX.GetGR.9
jsr K.GetmemPtr
@ -240,6 +245,7 @@ PWDX.GetGRGID lda PWD.hGrpDB
PWDX.GetGR.8 ldx FORPNT+1
beq .8 Dry run, no output
jmp PWDX.Rec2GR
.8 clc a = UID

View File

@ -10,11 +10,13 @@ SHARED.IsIDValid
SHARED.IsDigitOrL
cmp #'z'+1
bcs SHARED.RTS
cmp #'a'
bcs SHARED.IsDigit.8
SHARED.IsDigitOrUC
cmp #'Z'+1
bcs SHARED.RTS
cmp #'A'
bcs SHARED.IsDigit.8

View File

@ -36,6 +36,7 @@ K.SListAddData
* ## RETURN VALUE
*\--------------------------------------
K.SListSetData >PULLW ZPSListDataLen
jmp K.SYSCALL.JMPX2A
*/--------------------------------------
* # SListGetByID
* ## ASM
@ -46,7 +47,7 @@ K.SListSetData >PULLW ZPSListDataLen
* ## RETURN VALUE
* Y,A = Next KeyID
*\--------------------------------------
K.SListGetByID >PULLW FORPNT
K.SListGetByID .EQ K.SYSCALL.JMPX2A
*/--------------------------------------
* # SListNewKey
* ## ASM
@ -69,14 +70,15 @@ K.SListNewKey
* X = Key Length
*\--------------------------------------
K.SListLookup >PULLW TXTPTR
>PULLA
*/--------------------------------------
* # SListFree
* ## ASM
* `>PUSHB hSList`
* `lda hSList`
* `>SYSCALL SListFree`
* ## RETURN VALUE
*\--------------------------------------
K.SListFree >PULLA
K.SListFree
*/--------------------------------------
* # SListNew
* ## ASM

View File

@ -9,7 +9,11 @@ NEW
* `>SYSCALL StrVSet`
* ## RETURN VALUE
*\--------------------------------------
K.StrVSet
K.StrVSet .EQ K.SYSCALL.JMPX2A
* >PULLW FORPNT ptr
* >PULLW TXTPTR id
* >PULLA
* jmp K.SYSCALL.JMPX
*/--------------------------------------
* # StrVGet
* ## ASM
@ -21,9 +25,11 @@ K.StrVSet
* CC: Y,A = Ptr
* CS: Y,A = NULL
*\--------------------------------------
K.StrVGet >PULLW FORPNT ptr
>PULLW TXTPTR id
>PULLA
K.StrVGet .EQ K.SYSCALL.JMPX2A
* >PULLW FORPNT ptr
* >PULLW TXTPTR id
* >PULLA
* jmp K.SYSCALL.JMPX
*/--------------------------------------
* # StrVNew
* ## ASM
@ -31,7 +37,7 @@ K.StrVGet >PULLW FORPNT ptr
* `>SYSCALL StrVNew`
* ## RETURN VALUE
*\--------------------------------------
K.StrVNew
K.StrVNew .EQ K.SYSCALL.JMPX
*/--------------------------------------
* # StrVFree
* ## ASM
@ -39,7 +45,7 @@ K.StrVNew
* `>SYSCALL StrVFree`
* ## RETURN VALUE
*\--------------------------------------
K.StrVFree jmp K.SYSCALL.JMPX
K.StrVFree .EQ K.SYSCALL.JMPX
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.strv

View File

@ -59,7 +59,11 @@ K.StrFTime >PULLW ZPPtr3 S.TIME
* `>SYSCALL PTime2Time`
* ## RETURN VALUE
*\--------------------------------------
K.PTime2Time
K.PTime2Time .EQ K.SYSCALL.JMPX2
* >PULLW FORPNT S.TIME
* >PULLW TXTPTR ptime
* jmp K.SYSCALL.JMPX
*/--------------------------------------
* # CTime2Time
* Convert CTime Time To S.TIME
@ -71,9 +75,11 @@ K.PTime2Time
* `>SYSCALL CTime2Time`
* ## RETURN VALUE
*\--------------------------------------
K.CTime2Time >PULLW FORPNT S.TIME
>PULLW TXTPTR ptime/ctime
jmp K.SYSCALL.JMPX
K.CTime2Time .EQ K.SYSCALL.JMPX2
* >PULLW FORPNT S.TIME
* >PULLW TXTPTR ctime
* jmp K.SYSCALL.JMPX
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.time