Kernel version 0.8 : API finalized and dispatched in LCBNK1/2, now fits in BNK1/BNK2

This commit is contained in:
Rémy GIBERT 2016-09-28 17:34:15 +02:00
parent 127f89cedc
commit 270098e108
11 changed files with 438 additions and 445 deletions

Binary file not shown.

Binary file not shown.

View File

@ -13,11 +13,9 @@ AUTO 6
* X = hMem of Code Segment * X = hMem of Code Segment
*-------------------------------------- *--------------------------------------
BIN.LoadEXEYA >STYA BIN.LoadExe.Filename BIN.LoadEXEYA >STYA BIN.LoadExe.Filename
jsr K.PStrUprYA jsr K.PStrUprYA Y,A unmodified
>LDYA BIN.LoadExe.Filename
jsr K.GetMemByNameYA jsr K.GetMemByNameYA
bcs .1 not already loaded bcs BIN.LoadEXEYA.1 not already loaded
>STYA ZPQuickPtr1 Save base address >STYA ZPQuickPtr1 Save base address
ldy #S.MEM.REFCNT ldy #S.MEM.REFCNT
@ -25,38 +23,56 @@ BIN.LoadEXEYA >STYA BIN.LoadExe.Filename
inc inc
sta (ZPQuickPtr1),y sta (ZPQuickPtr1),y
ldy #S.MEM.PTR txa
lda (ZPQuickPtr1),y jmp K.GetMemPtrA X=hMem from K.GetMemByNameA
pha Y,A = MEM PTR... *--------------------------------------
iny BIN.LoadEXEYA.1 >PUSHWI KrnBuf256
lda (ZPQuickPtr1),y
ply X=hMem from K.GetMemByNameA
clc
rts
.1 >PUSHWI KrnBuf256
>PUSHW BIN.LoadExe.Filename >PUSHW BIN.LoadExe.Filename
jsr K.STAT Look for AUXTYPE jsr K.STAT Look for AUXTYPE
bcs .99 bcs .9
>LDYA KrnBuf256+S.STAT.AUXTYPE >LDYA KrnBuf256+S.STAT.AUXTYPE
>STYA BIN.LoadExe.OldBase >STYA BIN.Relocate.Start
>PUSHYA >PUSHYA Push AUXTYPE
>PUSHBI 6 S.FILEINFO.TYPE.BIN >PUSHBI 6 S.FILEINFO.TYPE.BIN
>PUSHBI SYS.FOPEN.R >PUSHBI SYS.FOPEN.R
>PUSHW BIN.LoadExe.Filename >PUSHW BIN.LoadExe.Filename
jsr K.LoadFile jsr K.LoadFile
bcs .99 Error Loading file .9 bcs .99 Error Loading file
>STYA BIN.LoadExe.SegLen >STYA BIN.Relocate.SegLen
stx BIN.LoadExe.hMem save hMem stx BIN.LoadExe.hMem save hMem
txa txa
jsr K.GetMemPtrA jsr K.GetMemPtrA
>STYA BIN.LoadExe.NewBase >STYA ZPQuickPtr1
jsr BIN.InstallEXE
ldy #H.BIN.CODE.LEN+1 get Code Len
lda (ZPQuickPtr1),y
tax
dey
lda (ZPQuickPtr1),y
jsr BIN.Relocate.SetCodeLenAX
lda BIN.Relocate.Start Get AUXTYPE for actual Base Address
clc
adc BIN.Relocate.SegLen
sta BIN.Relocate.End compute Range End=AUXTYPE+FILELEN
lda BIN.Relocate.Start+1
adc BIN.Relocate.SegLen+1
sta BIN.Relocate.End+1
lda ZPQuickPtr1
sec
sbc BIN.Relocate.Start
sta BIN.Relocate.Offset Offset=ZPQuickPtr1-AUXTYPE
lda ZPQuickPtr1+1
sbc BIN.Relocate.Start+1
sta BIN.Relocate.Offset+1
jsr Bin.RelocateEXE
bcs .98 relocation error, dicard Code segment bcs .98 relocation error, dicard Code segment
>LDYA BIN.LoadExe.Filename get back bin path >LDYA BIN.LoadExe.Filename get back bin path
@ -92,78 +108,34 @@ BIN.LoadEXEYA >STYA BIN.LoadExe.Filename
*-------------------------------------- *--------------------------------------
BIN.LoadExe.Filename .BS 2 BIN.LoadExe.Filename .BS 2
BIN.LoadExe.hMem .BS 1 BIN.LoadExe.hMem .BS 1
BIN.LoadExe.OldBase .BS 2
BIN.LoadExe.NewBase .BS 2
BIN.LoadExe.SegLen .BS 2
*-------------------------------------- *--------------------------------------
* BIN.InstallEXE * BIN.InstallDRV
*--------------------------------------
BIN.InstallEXE >LDYA BIN.LoadExe.NewBase
>STYA ZPQuickPtr1
ldy #H.BIN.CODE.LEN get Code Len
lda (ZPQuickPtr1),y
sta Rel.CodeLen
iny
lda (ZPQuickPtr1),y
sta Rel.CodeLen+1
lda BIN.LoadExe.OldBase
sta Rel.Start Get AUXTYPE for actual Base Address
clc
adc BIN.LoadExe.SegLen
sta Rel.End compute Range End=AUXTYPE+FILELEN
lda BIN.LoadExe.OldBase+1
sta Rel.Start+1
adc BIN.LoadExe.SegLen+1
sta Rel.End+1
lda ZPQuickPtr1
sec
sbc BIN.LoadExe.OldBase
sta Rel.Offset Offset=ZPQuickPtr1-AUXTYPE
lda ZPQuickPtr1+1
sbc BIN.LoadExe.OldBase+1
sta Rel.Offset+1
jmp Bin.RelocateEXE
*--------------------------------------
* K.InsDrv
* pDrv = .DRV File Loaded Address * pDrv = .DRV File Loaded Address
*-------------------------------------- *--------------------------------------
BIN.InstallDRV ldy #H.BIN.DRV.CODE.LEN BIN.InstallDRV ldy #H.BIN.DRV.CODE.LEN+1
lda (pDrv),y lda (pDrv),y
sta Rel.CodeLen tax
iny dey
lda (pDrv),y lda (pDrv),y
sta Rel.CodeLen+1 jsr BIN.Relocate.SetCodeLenAX
ldy #H.BIN.DRV.CODE.O ldy #H.BIN.DRV.CODE.O
lda (pDrv),y lda (pDrv),y
clc clc
adc BIN.LoadExe.OldBase adc BIN.Relocate.Start Advance start From Bin code to DRV code
sta Rel.Start sta BIN.Relocate.Start
iny iny
lda (pDrv),y lda (pDrv),y
adc BIN.LoadExe.OldBase+1 adc BIN.Relocate.Start+1
sta Rel.Start+1 sta BIN.Relocate.Start+1
lda BIN.LoadExe.OldBase
clc
adc BIN.LoadExe.SegLen
sta Rel.End
lda BIN.LoadExe.OldBase+1
adc BIN.LoadExe.SegLen+1
sta Rel.End+1
ldy #H.BIN.DRV.CODE.O ldy #H.BIN.DRV.CODE.O
lda BIN.LoadExe.SegLen lda BIN.Relocate.SegLen
sec sec
sbc (pDrv),y sbc (pDrv),y
sta K.InsDrv.DRVLen sta K.InsDrv.DRVLen
iny iny
lda BIN.LoadExe.SegLen+1 lda BIN.Relocate.SegLen+1
sbc (pDrv),y sbc (pDrv),y
sta K.InsDrv.DRVLen+1 Compute DRV Len sta K.InsDrv.DRVLen+1 Compute DRV Len
@ -178,8 +150,7 @@ BIN.InstallDRV ldy #H.BIN.DRV.CODE.LEN
bcs .98 we crossed $FFFF, out of mem bcs .98 we crossed $FFFF, out of mem
lda K.InsDrv.DRVEnd lda K.InsDrv.DRVEnd
sec cmp #DevMgr.HiMem
sbc #DevMgr.HiMem
lda K.InsDrv.DRVEnd+1 lda K.InsDrv.DRVEnd+1
sbc /DevMgr.HiMem sbc /DevMgr.HiMem
bcs .98 No More Room to load Driver.... bcs .98 No More Room to load Driver....
@ -206,11 +177,11 @@ BIN.InstallDRV ldy #H.BIN.DRV.CODE.LEN
lda DevMgr.Free lda DevMgr.Free
sec sec
sbc (ZPQuickPtr1),y sbc (ZPQuickPtr1),y
sta Rel.Offset sta BIN.Relocate.Offset
lda DevMgr.Free+1 lda DevMgr.Free+1
iny iny
sbc (ZPQuickPtr1),y sbc (ZPQuickPtr1),y
sta Rel.Offset+1 sta BIN.Relocate.Offset+1
ldy #H.BIN.DRV.CODE.O ldy #H.BIN.DRV.CODE.O
lda (pDrv),y lda (pDrv),y
@ -253,11 +224,11 @@ BIN.MoveDRV ldy #H.BIN.DEV.HEADER.O
ldy #S.DEV.JMP Relocate Main JMP ldy #S.DEV.JMP Relocate Main JMP
lda (ZPQuickPtr1),y lda (ZPQuickPtr1),y
clc clc
adc Rel.Offset adc BIN.Relocate.Offset
sta (ZPQuickPtr1),y sta (ZPQuickPtr1),y
iny iny
lda (ZPQuickPtr1),y lda (ZPQuickPtr1),y
adc Rel.Offset+1 adc BIN.Relocate.Offset+1
sta (ZPQuickPtr1),y sta (ZPQuickPtr1),y
lda DevMgr.LastDevID lda DevMgr.LastDevID
@ -267,6 +238,7 @@ BIN.MoveDRV ldy #H.BIN.DEV.HEADER.O
ldy #S.DEV.SIZE Make sure DevMgr.Table Ends with 0 ldy #S.DEV.SIZE Make sure DevMgr.Table Ends with 0
lda #0 lda #0
sta (pDev),y sta (pDev),y
dey dey
.1 lda (ZPQuickPtr1),y Copy DRV.Header .1 lda (ZPQuickPtr1),y Copy DRV.Header
@ -293,171 +265,183 @@ BIN.MoveDRV ldy #H.BIN.DEV.HEADER.O
lda DevMgr.Free+1 lda DevMgr.Free+1
sta ZPQuickPtr2+1 Make ZPQuickPtr2=Dest Ram Location sta ZPQuickPtr2+1 Make ZPQuickPtr2=Dest Ram Location
ldy K.InsDrv.DrvLen lda K.InsDrv.DrvLen+1
ldx K.InsDrv.DrvLen+1 eor #$ff
pha
lda K.InsDrv.DrvLen
eor #$ff
tax
.2 lda (ZPQuickPtr1) ldy #0
sta (ZPQuickPtr2)
inc ZPQuickPtr1 .2 inx
bne .3 bne .3
inc ZPQuickPtr1+1 pla
inc
.3 inc ZPQuickPtr2
bne .4
inc ZPQuickPtr2+1
.4 tya
bne .5
txa
beq .8 beq .8
dex pha
.5 dey .3 lda (ZPQuickPtr1),y
bra .2 sta (ZPQuickPtr2),y
.8 rts iny
bne .2
inc ZPQuickPtr1+1
inc ZPQuickPtr2+1
bra .2
.8 rts CC from last ADC
*-------------------------------------- *--------------------------------------
K.InsDrv.DrvLen .BS 2 K.InsDrv.DrvLen .BS 2
K.InsDrv.DrvEnd .BS 2 K.InsDrv.DrvEnd .BS 2
*-------------------------------------- *--------------------------------------
BIN.Relocate.SetCodeLenAX
eor #$ff
sta BIN.Relocate.nCodeLen
txa
eor #$ff
sta BIN.Relocate.nCodeLen+1
rts
*--------------------------------------
* BIN.Relocate___ : * BIN.Relocate___ :
* ZPQuickPtr1 = Ptr to Code * In :
* ZPQuickPtr1 = Ptr to Code
*--------------------------------------
BIN.Relocate.SegLen .BS 2 Code+Data Len
BIN.Relocate.Start .BS 2
BIN.Relocate.End .BS 2
BIN.Relocate.Offset .BS 2
BIN.Relocate.nCodeLen .BS 2 !Code length
*-------------------------------------- *--------------------------------------
BIN.RelocateEXE ldy #H.BIN.JMP relocate Main JMP BIN.RelocateEXE ldy #H.BIN.JMP relocate Main JMP
lda (ZPQuickPtr1),y lda (ZPQuickPtr1),y
clc clc
adc Rel.Offset adc BIN.Relocate.Offset
sta (ZPQuickPtr1),y sta (ZPQuickPtr1),y
iny iny
lda (ZPQuickPtr1),y lda (ZPQuickPtr1),y
adc Rel.Offset+1 adc BIN.Relocate.Offset+1
sta (ZPQuickPtr1),y sta (ZPQuickPtr1),y
ldy #H.BIN.RELOC.TABLE skip Header, CS.SIZE & DS.SIZE... (16 bytes) ldy #H.BIN.RELOC.TABLE skip Header, CS.SIZE & DS.SIZE... (16 bytes)
.HS 2C bit abs .HS 2C bit abs
*--------------------------------------
BIN.RelocateDRV ldy #0 BIN.RelocateDRV ldy #0
.1 lda (ZPQuickPtr1),y Start Relocate JMP table .1 lda (ZPQuickPtr1),y Start Relocate JMP table
tax tax LO in X
iny iny
ora (ZPQuickPtr1),y ora (ZPQuickPtr1),y ORA with HI
beq .2 $0000 = end of table beq .2 $0000 = end of table
dey dey
txa txa get back LO
clc clc
adc Rel.Offset adc BIN.Relocate.Offset
sta (ZPQuickPtr1),y sta (ZPQuickPtr1),y
iny iny
lda (ZPQuickPtr1),y lda (ZPQuickPtr1),y
adc Rel.Offset+1 adc BIN.Relocate.Offset+1
sta (ZPQuickPtr1),y sta (ZPQuickPtr1),y
iny iny
bra .1 bra .1
*--------------------------------------
.2 tya add current offset in Y to Ptr
sec + 1 to skip last 00 from beq .2
.2 lda ZPQuickPtr1
clc
adc Rel.CodeLen Make ZPQuickPtr2=End of code
sta ZPQuickPtr2 =ZPQuickPtr1+AX (code len)
lda ZPQuickPtr1+1
adc Rel.CodeLen+1
sta ZPQuickPtr2+1
iny
tya add current offset in Y to Ptr
clc
adc ZPQuickPtr1 adc ZPQuickPtr1
sta ZPQuickPtr1 sta ZPQuickPtr1
bcc .5 bcc .3
inc ZPQuickPtr1+1 ZPQuickPtr1=Current Code PTR inc ZPQuickPtr1+1 ZPQuickPtr1=Current Code PTR
clc
.5 lda (ZPQuickPtr1) get OPCODE .3 inc BIN.Relocate.nCodeLen
bne .4 nCodeLen reached 0 ?
inc BIN.Relocate.nCodeLen+1
beq .8 no, continue relocating
.4 lda (ZPQuickPtr1) get OPCODE
lsr /2
tax tax
lda BIN.OPCODES,x get OPCODE definition lda BIN.OPCODES,x get OPCODE definition
bpl .7 abs addressing? bcs .5 go get LO nibble
lsr
lsr move HI -> LO
lsr
lsr
.5 and #$0f
and #3 save Opcode length... bit #$8 abs addressing?
beq .7 no....
and #7 save Opcode length...
pha pha
ldy #1 ldy #1
lda (ZPQuickPtr1),y Get LO lda (ZPQuickPtr1),y Get LO
sec tax save LO in X
sbc Rel.Start
iny
lda (ZPQuickPtr1),y Get HI
sbc Rel.Start+1
bcc .6 addr < AX, out of range
dey iny make Y point to HI
lda (ZPQuickPtr1),y Get LO
sec cpx BIN.Relocate.Start
sbc Rel.End
iny
lda (ZPQuickPtr1),y Get HI lda (ZPQuickPtr1),y Get HI
sbc Rel.End+1 sbc BIN.Relocate.Start+1
bcs .6 addr > CX, out of range bcc .6 addr < BIN.Relocate.Start, out of range
txa Get back LO
cpx BIN.Relocate.End
lda (ZPQuickPtr1),y Get HI
sbc BIN.Relocate.End+1
bcs .6 addr > BIN.Relocate.End, out of range
txa Get back LO
* clc CC from bcs .6
adc BIN.Relocate.Offset add Offset to abs address
dey dey
lda (ZPQuickPtr1),y Get LO
clc
adc Rel.Offset add DX to abs address
sta (ZPQuickPtr1),y store relocated addr LO sta (ZPQuickPtr1),y store relocated addr LO
iny iny
lda (ZPQuickPtr1),y Get HI lda (ZPQuickPtr1),y Get HI
adc Rel.Offset+1 adc BIN.Relocate.Offset+1
sta (ZPQuickPtr1),y store relocated addr HI sta (ZPQuickPtr1),y store relocated addr HI
.6 pla .6 pla get back Opcode length...
.7 clc A = OPCODE length .7 clc A = OPCODE length
adc ZPQuickPtr1 adc ZPQuickPtr1
sta ZPQuickPtr1 sta ZPQuickPtr1
bcc .8 bcc .3
inc ZPQuickPtr1+1 inc ZPQuickPtr1+1
bra .3 next opcode....
.8 lda ZPQuickPtr1 is Current PTR < Code Limit ? .8 clc
sec
sbc ZPQuickPtr2
lda ZPQuickPtr1+1
sbc ZPQuickPtr2+1
bcc .5 yes, continue relocating
clc
rts rts
*-------------------------------------- *--------------------------------------
* 65C02 OPCODES * 65C02 OPCODES
* Bit 7 : 1 absolute addressing * Bit 3 : 1 = absolute addressing
* Bit 1-0 : opcode + @ length * Bit 2-1-0 : opcode + @ length
*-------------------------------------- *--------------------------------------
* x0.x1.x2.x3.x4.x5.x6.x7.x8.x9.xA.xB.xC.xD.xE.xF * 0.1.2.3.4.5.6.7.8.9.A.B.C.D.E.F
BIN.OPCODES .HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 BIN.OPCODES .HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
.HS 83.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 .HS B.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
.HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 .HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 .HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
.HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 .HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 .HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
.HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 .HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
.HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 .HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
*--------------------------------------
Rel.CodeLen .BS 2
Rel.Start .BS 2
Rel.End .BS 2
Rel.Offset .BS 2
*-------------------------------------- *--------------------------------------
MAN MAN
SAVE SYS/KERNEL.S.BIN SAVE SYS/KERNEL.S.BIN

View File

@ -211,13 +211,10 @@ K.SaveFile >PULLW K.LoadFile.Mem
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
K.LoadFile.Filename .BS 2
K.LoadFile.hFile .BS 1 K.LoadFile.hFile .BS 1
K.LoadFile.hMem .BS 1 K.LoadFile.hMem .BS 1
K.LoadFile.Mem .BS 2 K.LoadFile.Mem .BS 2
K.LoadFile.Len .BS 2 K.LoadFile.Len .BS 2
K.LoadFile.hRef .BS 1
K.LoadFile.hBuf .BS 1
*-------------------------------------- *--------------------------------------
MAN MAN
SAVE SYS/KERNEL.S.FIO SAVE SYS/KERNEL.S.FIO

View File

@ -131,7 +131,7 @@ GO.A2osX php
sta CLRALTZP sta CLRALTZP
bra GO.EXIT bra GO.EXIT
GO.A2osX.BNK ldx #$FF Self Modified GO.A2osX.BNK ldx #RRAMWRAMBNK1 Self Modified, initialized to BNK1 for INIT3
bit $C000,x bit $C000,x
bit $C000,x bit $C000,x

View File

@ -56,7 +56,7 @@ Kernel.Init2 >LDAXI MSG.Init2
>STYA pStack init Soft Stack >STYA pStack init Soft Stack
sta CLRALTZP Make MAIN ZP is enabled for X.PRINT.F sta CLRALTZP Make MAIN ZP is enabled for X.PRINT.F
lda RROMBNK1 Make sure ROM is enabled for X.PRINT.F bit RROMBNK1 Make sure ROM is enabled for X.PRINT.F
cli cli
lda #6 lda #6
@ -71,7 +71,9 @@ Kernel.Init2 >LDAXI MSG.Init2
>LDAXI MSG.Setup >LDAXI MSG.Setup
jsr PrintCStrAX jsr PrintCStrAX
jsr GO.A2osX sta SETALTZP
lda RRAMWRAMBNK1
lda RRAMWRAMBNK1
jsr K.IrqMgrInit jsr K.IrqMgrInit
bcs * bcs *
@ -86,8 +88,8 @@ Kernel.Init2 >LDAXI MSG.Init2
jsr K.TskMgrInit jsr K.TskMgrInit
bcs * bcs *
jsr GO.ProDOS Make sure MAIN ZP... sta CLRALTZP Make MAIN ZP is enabled for X.PRINT.F
lda RROMBNK1 ... & ROM is enabled for X.PRINT.F bit RROMBNK1 Make sure ROM is enabled for X.PRINT.F
>LDAXI MSG.Init2.OK >LDAXI MSG.Init2.OK
jsr PrintCStrAX jsr PrintCStrAX
@ -391,6 +393,12 @@ K.EvtMgrInit lda #10
clc clc
rts rts
*-------------------------------------- *--------------------------------------
* K.FltMgrInit
*--------------------------------------
K.FltMgrInit stz FltMgr.Table
clc
rts
*--------------------------------------
* K.TskMgrInit * K.TskMgrInit
*-------------------------------------- *--------------------------------------
K.TskMgrInit stz TSKMGR.LASTID K.TskMgrInit stz TSKMGR.LASTID
@ -430,6 +438,8 @@ K.TskMgrInit stz TSKMGR.LASTID
ldy #S.PS.hERRDEV ldy #S.PS.hERRDEV
sta (pPs),y Make ERR DEV = SYS sta (pPs),y Make ERR DEV = SYS
>DEBUG
>SYSCALL SYS.GetDevByIDA >SYSCALL SYS.GetDevByIDA
>STYA pDev >STYA pDev
ldx #DEVMGR.OPEN ldx #DEVMGR.OPEN
@ -474,10 +484,6 @@ K.TskMgrInit stz TSKMGR.LASTID
>SYSCALL SYS.PutEnvYA >SYSCALL SYS.PutEnvYA
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
K.FltMgrInit stz FltMgr.Table
clc
rts
*--------------------------------------
I.ENV.A2osX >PSTRING "A2OSX" I.ENV.A2osX >PSTRING "A2OSX"
I.ENV.PATH >PSTRING "PATH=${A2OSX}SBIN/;${A2OSX}BIN/" I.ENV.PATH >PSTRING "PATH=${A2OSX}SBIN/;${A2OSX}BIN/"
I.ENV.LIB >PSTRING "LIB=${A2OSX}LIB/" I.ENV.LIB >PSTRING "LIB=${A2OSX}LIB/"

View File

@ -26,7 +26,7 @@ KERNEL.SYSCALL
.DA K.PStrMatch .DA K.PStrMatch
.DA K.PStrUprYA .DA K.PStrUprYA
.DA K.PStrLwrYA .DA K.PStrLwrYA
.DA 0 .DA K.PStrFTime
.DA K.PStr2StrArrayYA .DA K.PStr2StrArrayYA
*-------------------------------------- *--------------------------------------
.DA K.ExecProcessNewEnvYA $20 .DA K.ExecProcessNewEnvYA $20
@ -65,7 +65,7 @@ KERNEL.SYSCALL
.DA K.TimeYA .DA K.TimeYA
.DA K.CTime2Time .DA K.CTime2Time
.DA K.PTime2Time .DA K.PTime2Time
.DA K.StrFTime .DA 0
*-------------------------------------- *--------------------------------------
.DA K.FOPEN $60 .DA K.FOPEN $60
.DA K.FCLOSEA .DA K.FCLOSEA

View File

@ -78,11 +78,11 @@ K.UnloadLibA pha
.1 ldy #S.MEM.PTR .1 ldy #S.MEM.PTR
lda (ZPQuickPtr1),y lda (ZPQuickPtr1),y
pha sta pLib
iny iny
lda (ZPQuickPtr1),y lda (ZPQuickPtr1),y
ply sta pLib+1
>STYA pLib
ldx #LIBMGR.UNLOAD ldx #LIBMGR.UNLOAD
jsr pLibJmp Call LIB.UNLOAD function jsr pLibJmp Call LIB.UNLOAD function

View File

@ -178,7 +178,10 @@ K.PStrUprYA ldx #0
.HS 2C bit abs .HS 2C bit abs
K.PStrLwrYA ldx #2 K.PStrLwrYA ldx #2
>STYA ZPQuickPtr1 >STYA ZPQuickPtr1
pha save Y,A to restore them at exit
phy
lda (ZPQuickPtr1) lda (ZPQuickPtr1)
tay tay
@ -192,11 +195,255 @@ K.PStrLwrYA ldx #2
.2 dey .2 dey
bne .1 bne .1
ply
pla
clc clc
rts rts
*-------------------------------------- *--------------------------------------
K.PStrUprLwr .AS "azAZ" K.PStrUprLwr .AS "azAZ"
*-------------------------------------- *--------------------------------------
* K.PStrFTime
* In :
* PULLW = Src PTR To S.Time
* PULLW = Src PTR To Format String
* PULLW = Dst PTR To PSTR Buf
* %a Abbreviated weekday name : Thu
* %A Full weekday name : Thursday
* %b Abbreviated month name : Aug
* %B Full month name : August
* %d Day of the month, zero-padded (01-31)
* %H Hour in 24h format (00-23) 14
* %I Hour in 12h format (01-12) 02
* %m Month as a decimal number (01-12) 08
* %M Minute (00-59) 55
* %p AM or PM designation PM
* %S Second (00-61) 02
* %w Weekday as a decimal number with Sunday as 0 (0-6)
* %y Year, last two digits (00-99)
* %Y Year four digits 2001
* PULLW = Dst PSTR Buffer
*--------------------------------------
K.PStrFTime >PULLW ZPQuickPtr1
>PULLW ZPQuickPtr2
>PULLW ZPQuickPtr3
lda #0
sta (ZPQuickPtr3) Reset target PSTR length
tay
.1 iny
lda (ZPQuickPtr2),y
cmp #'%'
beq .2
phy
jsr K.PStrFTime.addChar
ply
.10 tya
cmp (ZPQuickPtr2)
bne .1
rts
.2 tya
cmp (ZPQuickPtr2)
beq .8
iny
ldx #K.PStrFTime.JMPL-K.PStrFTime.Tbl-1
.3 lda (ZPQuickPtr2),y
cmp K.PStrFTime.Tbl,x
beq .4
dex
bpl .3
beq .10
.4 lda K.PStrFTime.JMPL,x
sta .5+1
lda K.PStrFTime.JMPH,x
sta .5+2
phy
.5 jsr $ffff
ply
bra .10
.8 rts
*--------------------------------------
K.PStrFTime.TBL .AS "aAbBdHImMpSwyY"
K.PStrFTime.JMPL .DA #K.PStrFTime.A
.DA #K.PStrFTime.AA
.DA #K.PStrFTime.B
.DA #K.PStrFTime.BB
.DA #K.PStrFTime.D
.DA #K.PStrFTime.HH
.DA #K.PStrFTime.II
.DA #K.PStrFTime.M
.DA #K.PStrFTime.MM
.DA #K.PStrFTime.P
.DA #K.PStrFTime.SS
.DA #K.PStrFTime.W
.DA #K.PStrFTime.Y
.DA #K.PStrFTime.YY
*--------------------------------------
K.PStrFTime.JMPH .DA /K.PStrFTime.A
.DA /K.PStrFTime.AA
.DA /K.PStrFTime.B
.DA /K.PStrFTime.BB
.DA /K.PStrFTime.D
.DA /K.PStrFTime.HH
.DA /K.PStrFTime.II
.DA /K.PStrFTime.M
.DA /K.PStrFTime.MM
.DA /K.PStrFTime.P
.DA /K.PStrFTime.SS
.DA /K.PStrFTime.W
.DA /K.PStrFTime.Y
.DA /K.PStrFTime.YY
*--------------------------------------
K.PStrFTime.A ldx #3 Max Len
.HS 2C Bit abs
K.PStrFTime.AA ldx #15
>LDYAI K.PStrFTime.DAY
>STYA ZPQuickPtr4
ldy #S.Time.WDAY
bra K.PStrFTime.STR
K.PStrFTime.B ldx #3
.HS 2C Bit abs
K.PStrFTime.BB ldx #15
>LDYAI K.PStrFTime.MON
>STYA ZPQuickPtr4
ldy #S.Time.MONTH
K.PStrFTime.STR lda (ZPQuickPtr1),y get required S.Time field value
tay
beq .8 Illegal value
.1 dey range 0..x
beq .2
lda (ZPQuickPtr4)
sec
adc ZPQuickPtr4
sta ZPQuickPtr4
bcc .1
inc ZPQuickPtr4+1
bra .1
.2 ldy #0
.3 iny
lda (ZPQuickPtr4),y
phy
jsr K.PStrFTime.addChar
pla
cmp (ZPQuickPtr4)
beq .8
tay
dex
bne .3
.8 rts
K.PStrFTime.D ldy #S.Time.DAY
bra K.PStrFTime.addDecPtr1Y
K.PStrFTime.HH ldy #S.Time.HOUR
bra K.PStrFTime.addDecPtr1Y
K.PStrFTime.II ldy #S.Time.HOUR
lda (ZPQuickPtr1),y
cmp #12
bcc .1
sbc #12
.1 bra K.PStrFTime.addDecA
K.PStrFTime.M ldy #S.Time.MONTH
bra K.PStrFTime.addDecPtr1Y
K.PStrFTime.MM ldy #S.Time.MINUTE
bra K.PStrFTime.addDecPtr1Y
K.PStrFTime.P ldy #S.Time.HOUR
lda (ZPQuickPtr1),y
cmp #12
bcc .1
lda #'p'
.HS 2C bit abs
.1 lda #'a'
jsr K.PStrFTime.addChar
lda #'m'
bra K.PStrFTime.addChar
K.PStrFTime.SS ldy #S.Time.SECOND
bra K.PStrFTime.addDecPtr1Y
K.PStrFTime.W ldy #S.Time.WDAY
bra K.PStrFTime.addDecPtr1Y
K.PStrFTime.YY ldy #S.Time.CENTURY
jsr K.PStrFTime.addDecPtr1Y
K.PStrFTime.Y ldy #S.Time.YEAR
*--------------------------------------
K.PStrFTime.addDecPtr1Y
lda (ZPQuickPtr1),y
K.PStrFTime.addDecA
sta K.PStrFTime.BIN
stz K.PStrFTime.DEC
sed
ldx #8
.1 asl K.PStrFTime.BIN
lda K.PStrFTime.DEC
adc K.PStrFTime.DEC
sta K.PStrFTime.DEC
dex
bne .1
cld
* lda K.PStrFTime.DEC already in A
lsr
lsr
lsr
lsr
ora #$30
jsr K.PStrFTime.addChar
lda K.PStrFTime.DEC
and #$0f
ora #$30
*--------------------------------------
K.PStrFTime.addChar
pha
lda (ZPQuickPtr3)
inc
sta (ZPQuickPtr3)
tay
pla
sta (ZPQuickPtr3),y
rts
*--------------------------------------
K.PStrFTime.DAY >PSTRING "Monday"
>PSTRING "Tuesday"
>PSTRING "Wednesday"
>PSTRING "Thursday"
>PSTRING "Friday"
>PSTRING "Saturday"
>PSTRING "Sunday"
*--------------------------------------
K.PStrFTime.MON >PSTRING "January"
>PSTRING "February"
>PSTRING "March"
>PSTRING "April"
>PSTRING "May"
>PSTRING "June"
>PSTRING "July"
>PSTRING "August"
>PSTRING "September"
>PSTRING "October"
>PSTRING "November"
>PSTRING "December"
*--------------------------------------
K.PStrFTime.BIN .BS 1
K.PStrFTime.DEC .BS 1 always < 100
*--------------------------------------
* K.PStr2StrArrayYA * K.PStr2StrArrayYA
* In : * In :
* Y,A = PTR to String * Y,A = PTR to String

View File

@ -95,7 +95,7 @@ K.ComputeWDAY lda #3 Thursday : 4 (-1 for mod 7)
cmp K.CTime.Year cmp K.CTime.Year
beq .4 beq .4
.2 jsr K.IsLeapYearYA CC = Leap .2 jsr TIME.IsLeapYearYA CC = Leap
lda #0 lda #0
rol rol
eor #1 eor #1
@ -126,7 +126,7 @@ K.ComputeWDAY lda #3 Thursday : 4 (-1 for mod 7)
ldy K.CTime.Century ldy K.CTime.Century
lda K.CTime.Year lda K.CTime.Year
jsr K.IsLeapYearYA CC = Leap jsr TIME.IsLeapYearYA CC = Leap
lda #0 lda #0
rol rol
eor #1 eor #1
@ -309,7 +309,7 @@ K.CTime2Time >PULLW ZPQuickPtr1
K.CTime2Time.Year K.CTime2Time.Year
.1 ldy K.CTime.Century .1 ldy K.CTime.Century
lda K.CTime.Year lda K.CTime.Year
jsr K.IsLeapYearYA if Leap year CC jsr TIME.IsLeapYearYA if Leap year CC
lda K.CTime.DivDay lda K.CTime.DivDay
sbc #365 sbc #365
pha pha
@ -340,245 +340,6 @@ K.CTime2Time.Year
clc clc
rts rts
*-------------------------------------- *--------------------------------------
* K.StrFTime
* In :
* PULLW = Src PTR To K.Time
* PULLW = Src PTR To Format String
* PULLW = Dst PTR To PSTR Buf
* %a Abbreviated weekday name : Thu
* %A Full weekday name : Thursday
* %b Abbreviated month name : Aug
* %B Full month name : August
* %d Day of the month, zero-padded (01-31)
* %H Hour in 24h format (00-23) 14
* %I Hour in 12h format (01-12) 02
* %m Month as a decimal number (01-12) 08
* %M Minute (00-59) 55
* %p AM or PM designation PM
* %S Second (00-61) 02
* %w Weekday as a decimal number with Sunday as 0 (0-6)
* %y Year, last two digits (00-99)
* %Y Year four digits 2001
* PULLW = Dst PSTR Buffer
*--------------------------------------
K.StrFTime >PULLW ZPQuickPtr1
>PULLW ZPQuickPtr2
>PULLW ZPQuickPtr3
lda #0
sta (ZPQuickPtr3) Reset target PSTR length
tay
.1 iny
lda (ZPQuickPtr2),y
cmp #'%'
beq .2
phy
jsr K.StrFTime.addChar
ply
.10 tya
cmp (ZPQuickPtr2)
bne .1
rts
.2 tya
cmp (ZPQuickPtr2)
beq .8
iny
ldx #K.StrFTime.JMPL-K.StrFTime.Tbl-1
.3 lda (ZPQuickPtr2),y
cmp K.StrFTime.Tbl,x
beq .4
dex
bpl .3
beq .10
.4 lda K.StrFTime.JMPL,x
sta .5+1
lda K.StrFTime.JMPH,x
sta .5+2
phy
.5 jsr $ffff
ply
bra .10
.8 rts
*--------------------------------------
K.StrFTime.A ldx #3 Max Len
.HS 2C Bit abs
K.StrFTime.AA ldx #15
>LDYAI K.StrFTime.DAY
>STYA ZPQuickPtr4
ldy #S.Time.WDAY
bra K.StrFTime.STR
K.StrFTime.B ldx #3
.HS 2C Bit abs
K.StrFTime.BB ldx #15
>LDYAI K.StrFTime.MON
>STYA ZPQuickPtr4
ldy #S.Time.MONTH
K.StrFTime.STR lda (ZPQuickPtr1),y get required S.Time field value
tay
beq .8 Illegal value
.1 dey range 0..x
beq .2
lda (ZPQuickPtr4)
sec
adc ZPQuickPtr4
sta ZPQuickPtr4
bcc .1
inc ZPQuickPtr4+1
bra .1
.2 ldy #0
.3 iny
lda (ZPQuickPtr4),y
phy
jsr K.StrFTime.addChar
pla
cmp (ZPQuickPtr4)
beq .8
tay
dex
bne .3
.8 rts
K.StrFTime.D ldy #S.Time.DAY
bra K.StrFTime.addDecPtr1Y
K.StrFTime.HH ldy #S.Time.HOUR
bra K.StrFTime.addDecPtr1Y
K.StrFTime.II ldy #S.Time.HOUR
lda (ZPQuickPtr1),y
cmp #12
bcc .1
sbc #12
.1 bra K.StrFTime.addDecA
K.StrFTime.M ldy #S.Time.MONTH
bra K.StrFTime.addDecPtr1Y
K.StrFTime.MM ldy #S.Time.MINUTE
bra K.StrFTime.addDecPtr1Y
K.StrFTime.P ldy #S.Time.HOUR
lda (ZPQuickPtr1),y
cmp #12
bcc .1
lda #'p'
.HS 2C bit abs
.1 lda #'a'
jsr K.StrFTime.addChar
lda #'m'
bra K.StrFTime.addChar
K.StrFTime.SS ldy #S.Time.SECOND
bra K.StrFTime.addDecPtr1Y
K.StrFTime.W ldy #S.Time.WDAY
bra K.StrFTime.addDecPtr1Y
K.StrFTime.YY ldy #S.Time.CENTURY
jsr K.StrFTime.addDecPtr1Y
K.StrFTime.Y ldy #S.Time.YEAR
*--------------------------------------
K.StrFTime.addDecPtr1Y
lda (ZPQuickPtr1),y
K.StrFTime.addDecA
sta K.StrFTime.BIN
stz K.StrFTime.DEC
sed
ldx #8
.1 asl K.StrFTime.BIN
lda K.StrFTime.DEC
adc K.StrFTime.DEC
sta K.StrFTime.DEC
dex
bne .1
cld
* lda K.StrFTime.DEC already in A
lsr
lsr
lsr
lsr
ora #$30
jsr K.StrFTime.addChar
lda K.StrFTime.DEC
and #$0f
ora #$30
*--------------------------------------
K.StrFTime.addChar
pha
lda (ZPQuickPtr3)
inc
sta (ZPQuickPtr3)
tay
pla
sta (ZPQuickPtr3),y
rts
*--------------------------------------
K.StrFTime.TBL .AS "aAbBdHImMpSwyY"
K.StrFTime.JMPL .DA #K.StrFTime.A
.DA #K.StrFTime.AA
.DA #K.StrFTime.B
.DA #K.StrFTime.BB
.DA #K.StrFTime.D
.DA #K.StrFTime.HH
.DA #K.StrFTime.II
.DA #K.StrFTime.M
.DA #K.StrFTime.MM
.DA #K.StrFTime.P
.DA #K.StrFTime.SS
.DA #K.StrFTime.W
.DA #K.StrFTime.Y
.DA #K.StrFTime.YY
*--------------------------------------
K.StrFTime.JMPH .DA /K.StrFTime.A
.DA /K.StrFTime.AA
.DA /K.StrFTime.B
.DA /K.StrFTime.BB
.DA /K.StrFTime.D
.DA /K.StrFTime.HH
.DA /K.StrFTime.II
.DA /K.StrFTime.M
.DA /K.StrFTime.MM
.DA /K.StrFTime.P
.DA /K.StrFTime.SS
.DA /K.StrFTime.W
.DA /K.StrFTime.Y
.DA /K.StrFTime.YY
*--------------------------------------
K.StrFTime.DAY >PSTRING "Monday"
>PSTRING "Tuesday"
>PSTRING "Wednesday"
>PSTRING "Thursday"
>PSTRING "Friday"
>PSTRING "Saturday"
>PSTRING "Sunday"
*--------------------------------------
K.StrFTime.MON >PSTRING "January"
>PSTRING "February"
>PSTRING "March"
>PSTRING "April"
>PSTRING "May"
>PSTRING "June"
>PSTRING "July"
>PSTRING "August"
>PSTRING "September"
>PSTRING "October"
>PSTRING "November"
>PSTRING "December"
*--------------------------------------
* In : * In :
* Y = Century * Y = Century
* A = Year (0..99) * A = Year (0..99)
@ -589,7 +350,8 @@ K.StrFTime.MON >PSTRING "January"
* CC = Leap * CC = Leap
* CS = Not Leap * CS = Not Leap
*-------------------------------------- *--------------------------------------
K.IsLeapYearYA cmp #0 Year = 00 ? TIME.IsLeapYearYA
cmp #0 Year = 00 ?
bne .1 no bne .1 no
tya year = 00, get century in a tya year = 00, get century in a
@ -605,6 +367,7 @@ K.IsLeapYearYA cmp #0 Year = 00 ?
.9 clc Leap .9 clc Leap
rts rts
*-------------------------------------- *--------------------------------------
K.StrFTime.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
K.CTime.DWORD .BS 4 K.CTime.DWORD .BS 4
K.CTime.DivDay .BS 2 K.CTime.DivDay .BS 2
K.CTime.ModDay .BS 3 K.CTime.ModDay .BS 3
@ -613,11 +376,6 @@ K.CTime.Div3600 .BS 1
K.CTime.Mod .BS 1 K.CTime.Mod .BS 1
K.CTime.Century .BS 1 K.CTime.Century .BS 1
K.CTime.Year .BS 1 K.CTime.Year .BS 1
*--------------------------------------
K.StrFTime.BIN .BS 1
K.StrFTime.DEC .BS 1 always < 100
*--------------------------------------
K.StrFTime.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
MAN MAN
SAVE SYS/KERNEL.S.Time SAVE SYS/KERNEL.S.Time
LOAD SYS/KERNEL.S LOAD SYS/KERNEL.S

View File

@ -38,8 +38,9 @@ ZPQuickPtr4 .EQ ZPKERNEL+6
*-------------------------------------- *--------------------------------------
* Kernel Init Stage 3 * Kernel Init Stage 3
*-------------------------------------- *--------------------------------------
jsr GO.A2osX sta SETALTZP
bit RRAMWRAMBNK1
bit RRAMWRAMBNK1
jsr Kernel.Init3 jsr Kernel.Init3
>DEBUGOA >DEBUGOA
*-------------------------------------- *--------------------------------------