Kernel 0.9.1 : ASM rewrite...more directives

This commit is contained in:
Rémy GIBERT 2018-01-31 16:20:20 +00:00
parent e8db11ec59
commit 9f979e44eb
12 changed files with 243 additions and 87 deletions

Binary file not shown.

Binary file not shown.

View File

@ -25,9 +25,9 @@ DIR.AT clc
DIR.AZ clc
rts
*---------------------------------------
DIR.BS jsr SRC.GetNextCharNB
DIR.BS jsr SRC.GetNextChar
bcs .98
jsr EXP.Eval
bcs .9
@ -35,9 +35,10 @@ DIR.BS jsr SRC.GetNextCharNB
ora SRC.ACC+2
bne .99
lda SRC.ACC
eor #$ff
sta DIR.Counter
lda SRC.ACC+1
bmi .99
eor #$ff
sta DIR.Counter+1
stz DIR.Byte
@ -59,27 +60,14 @@ DIR.BS jsr SRC.GetNextCharNB
lda SRC.ACC
sta DIR.Byte
.1 ldy #ASM.PC
lda (pData),y
clc
adc DIR.Counter
sta (pData),y
iny
lda (pData),y
adc DIR.Counter+1
sta (pData),y
.2 lda DIR.Counter
bne .3
lda DIR.Counter+1
.1 inc DIR.Counter
bne .2
inc DIR.Counter+1
beq .8
dec DIR.Counter+1
.3 dec DIR.Counter
lda DIR.Byte
jsr FIO.EmitByte
bcc .2
.2 lda DIR.Byte
jsr OUT.EmitByte
bcc .1
rts
.8 clc
@ -93,7 +81,28 @@ DIR.BS jsr SRC.GetNextCharNB
sec
rts
*---------------------------------------
DIR.DA clc
DIR.DA
.1 jsr SRC.GetNextChar
bcs .98
jsr EXP.Eval
bcs .9
lda SRC.ACC.SIZE
jsr SRC.GetNextChar
bcs .8
cmp #' '
beq .8
cmp #','
beq .1
.98 lda #ERR.SYNTAX.ERROR
clc
.9 rts
.8 clc
rts
*---------------------------------------
DIR.DO ldy #ASM.DO.Count
@ -213,7 +222,52 @@ DIR.FI ldy #ASM.DO.Count
sec
rts
*---------------------------------------
DIR.HS clc
DIR.HS jsr SRC.GetNextCharNB
bcs .99
jsr SRC.IsDigit16
bcs .99
.1 asl
asl
asl
asl
>STA.G DIR.Byte
jsr SRC.GetNextChar
bcs .99
jsr SRC.IsDigit16
bcs .99
>ORA.G DIR.Byte
jsr OUT.EmitByte
bcs .9
jsr SRC.GetNextChar
bcs .8
cmp #' '
beq .8
jsr SRC.IsDigit16
bcc .1
cmp #','
beq .2
cmp #'.'
bne .99
.2 jsr SRC.GetNextChar
bcs .99
jsr SRC.IsDigit16
bcc .1
.99 lda #ERR.SYNTAX.ERROR
sec
.9 rts
.8 clc
rts
*---------------------------------------
DIR.IN jsr SRC.GetNextCharNB

View File

@ -333,9 +333,6 @@ FIO.FileClose ldy #SRC.COUNT
.8 clc
rts
*---------------------------------------
FIO.EmitByte clc
rts
*---------------------------------------
MAN
SAVE /A2OSX.BUILD/BIN/DEV/ASM.S.FIO
LOAD /A2OSX.BUILD/BIN/DEV/ASM.S

71
BIN/ASM.S.OUT.txt Normal file
View File

@ -0,0 +1,71 @@
NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*---------------------------------------
OUT.Reset ldx #4
ldy #ASM.PC
.1 lda (pData),y
pha
iny
dex
bne .1
ldx #4
ldy #OUT.PC+3
.2 pla
sta (pData),y
dey
dex
bne .2
>STZ.G OUT.Buf
rts
*---------------------------------------
OUT.EmitByte pha
>LDA.G OUT.Buf
cmp #3
bne .2
jsr SCR.PrintLineOn
bcs .1
jsr SRC.PrintLineOutBuf
lda #13
>SYSCALL PutChar.A
lda #10
>SYSCALL PutChar.A
jsr OUT.Reset
.1 lda #0
ldy #OUT.Buf
.2 inc
sta (pData),y
clc
adc #OUT.Buf
tay
pla
sta (pData),y
.8 >INC.G ASM.PC
bne .80
>INC.G ASM.PC+1
bne .80
>INC.G ASM.PC+2
bne .80
>INC.G ASM.PC+3
.80 clc
rts
*---------------------------------------
MAN
SAVE /A2OSX.BUILD/BIN/DEV/ASM.S.OUT
LOAD /A2OSX.BUILD/BIN/DEV/ASM.S
ASM

View File

@ -2,7 +2,18 @@ NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
*---------------------------------------
SRC.PrintLine >LDA.G ASM.LI.ON
SRC.PrintLine jsr SCR.PrintLineOn
bcs .9
jsr SRC.PrintLineOutBuf
bcs .9
>PUSHW ZPLineBuf
>PUSHW.G SRC.LINENUM
>LDYA L.MSG.SRCLINE
>SYSCALL PrintF.YA
.9 rts
*---------------------------------------
SCR.PrintLineOn >LDA.G ASM.LI.ON
bpl .9
>LDA.G MAC.bAdd
bpl .1
@ -11,16 +22,39 @@ SRC.PrintLine >LDA.G ASM.LI.ON
bpl .9
bmi .8
.1
.8 >PUSHW ZPLineBuf
>PUSHW.G SRC.LINENUM
ldy #ASM.PC+1
.1
.8 clc
rts
.9 sec
rts
*---------------------------------------
SRC.PrintLineOutBuf >LDA.G OUT.Buf
beq .2
tax
clc
adc #OUT.Buf
tay
.1 >PUSHB (pData),y
dey
dex
bne .1
.2 ldy #OUT.PC+1
>PUSHB (pData),y
dey
>PUSHB (pData),y
>LDYA L.MSG.SRCLINE
>LDA.G OUT.Buf
asl
tax
ldy L.MSG.OUT0,x
lda L.MSG.OUT0+1,x
>SYSCALL PrintF.YA
.9 rts
.9 rts
*---------------------------------------
SRC.PrintLineErr >PUSHW ZPLineBuf
>LDYA L.MSG.LINECR
@ -61,6 +95,8 @@ SRC.ParseLine jsr SRC.GetChar
cmp #';' Comment?
beq .8
jsr OUT.Reset
>LDA.G MAC.bAdd
bmi SRC.ParseLine.MACRO

View File

@ -77,6 +77,10 @@ CS.START cld
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.HELP .DA MSG.HELP
L.MSG.OUT0 .DA MSG.OUT0
.DA MSG.OUT1
.DA MSG.OUT2
.DA MSG.OUT3
L.MSG.SRCLINE .DA MSG.SRCLINE
L.MSG.LINECR .DA MSG.LINECR
L.MSG.ERROR .DA MSG.ERROR
@ -321,6 +325,7 @@ CS.QUIT jsr FIO.FileClose
.INB /A2OSX.BUILD/BIN/DEV/ASM.S.EXP
.INB /A2OSX.BUILD/BIN/DEV/ASM.S.FIO
.INB /A2OSX.BUILD/BIN/DEV/ASM.S.MAC
.INB /A2OSX.BUILD/BIN/DEV/ASM.S.OUT
.INB /A2OSX.BUILD/BIN/DEV/ASM.S.SRC
.INB /A2OSX.BUILD/BIN/DEV/ASM.S.SYM
*---------------------------------------
@ -380,7 +385,11 @@ MSG.PASS >CSTR "Pass:#%d\r\n"
MSG.SRC.FILE >CSTR "Reading SRC File:%s\r\n"
MSG.OBJ.FILE >CSTR "Writing OBJ File:%s, Type=%02x\r\n"
MSG.T.FILE >CSTR "Loading CPU File:%s\r\n"
MSG.SRCLINE >CSTR "%H- %05D %s\r\n"
MSG.OUT0 >CSTR "%H- "
MSG.OUT1 >CSTR "%H-%h "
MSG.OUT2 >CSTR "%H-%h %h "
MSG.OUT3 >CSTR "%H-%h %h %h "
MSG.SRCLINE >CSTR "%05D %s\r\n"
MSG.LINECR >CSTR "%s\r\n"
MSG.ERROR >CSTR "%05D-Error:$%h\r\n"
MSG.SYMBOLS >CSTR "Symbol Table:\r\n"
@ -395,10 +404,11 @@ ASM.T.FILENAME .BS 65
FIO.Stat .BS S.STAT
EXP.Operator .BS 1
EXP.Modifier .BS 1
EXP.Operator .BS 1
SRC.Keyword.ID .BS 1
SRC.ACC.SIZE .BS 1
SRC.ACC .BS 4
SRC.ACCTMP .BS 4
SRC.ARG .BS 4
@ -455,6 +465,9 @@ MAC.hMacros .BS 1
MAC.hBuf .BS 1
MAC.bAdd .BS 1
OUT.PC .BS 4
OUT.Buf .BS 4
DS.END .ED
*---------------------------------------
.DO DS.END-DS.START>$FF

View File

@ -1,7 +1,6 @@
NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
*--------------------------------------
ZPDRV .EQ $30
ZPLIB .EQ $40 32 bytes for TCPIP

View File

@ -1,7 +1,6 @@
NEW
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
*--------------------------------------
.MA DEBUG
:1 bit $C000

View File

@ -26,32 +26,32 @@ ZPSListData .EQ ZPMEMMGR+14
* Buffer filled with memory stats
*\--------------------------------------
K.GetMemStat.YA >STYA ZPMemMgrTmp1
ldy #22
ldx #6
>LDYAI Mem.Table
>STYA .2+1
ldy #6
jsr .1
.1 lda DevMgr.Stat,x
sta (ZPMemMgrTmp1),y
dey
dex
bpl .1
sta SETREADAUX
ldy #14
jsr .1
jsr .2
sta CLRREADAUX
>LDYAI DevMgr.Stat
>STYA .2+1
ldy #22
ldy #6
.1 ldx #6
.2 ldx #6
.2 lda $FFFF,x SELF MODIFIED
.3 lda Mem.Table,x
sta (ZPMemMgrTmp1),y
dey
dex
bpl .2
bpl .3
rts
*/--------------------------------------
* # GetMem0.YA
@ -584,17 +584,19 @@ MEM.GetKeyCharY sta CLRREADAUX
.9 sec
rts
*--------------------------------------
MEM.GetDataByteY
sta CLRREADAUX
lda (ZPSListData),y
MEM.GetDataByte sta CLRREADAUX
lda (ZPSListData)
sta SETREADAUX
rts
bra MEM.SetDataByte.1
*--------------------------------------
MEM.SetDataByteY
sta CLRWRITEAUX
sta (ZPSListData),y
MEM.SetDataByte sta CLRWRITEAUX
sta (ZPSListData)
sta SETWRITEAUX
rts
MEM.SetDataByte.1
inc ZPSListData
bne .8
inc ZPSListData+1
.8 rts
*/--------------------------------------
* # LoadStkObj
* Load a file in AUX memory (Stock Objects)

View File

@ -36,16 +36,13 @@ SLIST.Add jsr SLIST.Search
iny
bra .2
.3 ldy #0
jsr MEM.GetDataByteY
.3 jsr MEM.GetDataByte
tax
jsr SLIST.AddBlockByte
bcs .9
.4 iny
jsr MEM.GetDataByteY
.4 jsr MEM.GetDataByte
jsr SLIST.AddBlockByte
bcs .9
@ -68,23 +65,21 @@ SLIST.Lookup jsr SLIST.Search
bcs .9
sty .8+1
sty .8+1 Save Key Length
ldy #0
jsr SLIST.GetBlockByte
tax
jsr MEM.SetDataByteY
jsr MEM.SetDataByte
.1 jsr SLIST.GetNextBlockByte
iny
jsr MEM.SetDataByteY
jsr MEM.SetDataByte
dex
bne .1
.8 lda #$ff SELF MODIFIED
ldx SLIST.ID
ldy SLIST.ID+1
clc
.9 rts
*--------------------------------------
@ -95,13 +90,10 @@ SLIST.GetByID jsr SLIST.Select
tax
beq .9
ldy #0
jsr MEM.SetDataByteY
jsr MEM.SetDataByte
.1 jsr SLIST.GetNextBlockByte
iny
jsr MEM.SetDataByteY
jsr MEM.SetDataByte
dex
bne .1
@ -109,12 +101,10 @@ SLIST.GetByID jsr SLIST.Select
tax
iny
jsr MEM.SetDataByteY
jsr MEM.SetDataByte
.2 jsr SLIST.GetNextBlockByte
iny
jsr MEM.SetDataByteY
jsr MEM.SetDataByte
dex
bne .2
@ -139,18 +129,13 @@ SLIST.UpdateByID
jsr SLIST.GetNextBlockByte set pos at DATALEN
ldy #0
jsr MEM.GetDataByteY
jsr MEM.GetDataByte
tax
jsr SLIST.SetBlockByte
.4 iny
jsr MEM.GetDataByteY
.4 jsr MEM.GetDataByte
jsr SLIST.SetBlockByte
dex
bne .4

View File

@ -119,7 +119,7 @@ FLOAT4 .HS 8100000000 1
FLOAT5 .HS 9080000000 -32768
CONST1 >CSTR "3.141592653"
CONST2 >CSTR "3"
LONG1 .DA 123456789
LONG1 .DA >123456789
MSG2 >CSTR "PI/3=%e\r\n"
MSG3 >CSTR "COS(PI/3)=%e\r\n"
MSG4 >CSTR "Long=%L\r\n"