diff --git a/A2OSX.BOOT.po b/A2OSX.BOOT.po index 51ec34ab..a52b716c 100644 Binary files a/A2OSX.BOOT.po and b/A2OSX.BOOT.po differ diff --git a/A2OSX.SRC.po b/A2OSX.SRC.po index 62e4b32f..66d7b589 100644 Binary files a/A2OSX.SRC.po and b/A2OSX.SRC.po differ diff --git a/INC/A2osX.I.txt b/INC/A2osX.I.txt index 08c385c0..371c7b23 100644 --- a/INC/A2osX.I.txt +++ b/INC/A2osX.I.txt @@ -136,15 +136,14 @@ H.BIN.RELOC.TABLE .EQ 16 *-------------------------------------- * A2osX.SYSCALL Functions Indexes *-------------------------------------- -SYS.GetMem .EQ $00 -SYS.FreeMemA .EQ $02 -SYS.GetMemPtrA .EQ $04 -SYS.GetMemByIDA .EQ $06 - -SYS.GetMemByNameYA .EQ $08 -SYS.LoadStockObjectYA .EQ $0A -SYS.GetStockObjectA .EQ $0C -SYS.FreeStockObject .EQ $0E +SYS.COutA .EQ $00 SYS.FPUTCA +* .EQ $02 SYS.FGETC +SYS.PStrOutYA .EQ $04 SYS.FPUTSYA +* .EQ $06 SYS.FGETS +SYS.HexOutA .EQ $08 +SYS.HexOutYA .EQ $0A +SYS.DecOutA .EQ $0C +SYS.DecOutYA .EQ $0E *-------------------------------------- SYS.NewPStrYA .EQ $10 SYS.PStrCpy .EQ $12 @@ -153,31 +152,48 @@ SYS.PStrMatch .EQ $16 SYS.PStrUprYA .EQ $18 SYS.PStrLwrYA .EQ $1A - +* .EQ $1C SYS.PStr2StrArrayYA .EQ $1E *-------------------------------------- -SYS.LoadDrvYA .EQ $20 -SYS.LoadLibYA .EQ $22 -SYS.UnloadLibA .EQ $24 +SYS.ExecProcessNewEnvYA .EQ $20 +SYS.ExecProcessYA .EQ $22 +SYS.CreateProcessNewEnvYA .EQ $24 +SYS.CreateProcessYA .EQ $26 -SYS.TimeYA .EQ $28 -SYS.CTime2Time .EQ $2A -SYS.PTime2Time .EQ $2C -SYS.StrFTime .EQ $2E +SYS.GetPSByIDA .EQ $28 +* .EQ $2A +SYS.Sleep .EQ $2C +* .EQ $2E *-------------------------------------- - -SYS.ExpandPStrYA .EQ $32 -SYS.GetArgC .EQ $34 -SYS.GetArgA .EQ $36 +SYS.GetArgC .EQ $30 +SYS.GetArgA .EQ $32 +SYS.ExpandPStrYA .EQ $34 +* .EQ $36 SYS.PutEnvYA .EQ $38 SYS.SetEnv .EQ $3A SYS.GetEnvYA .EQ $3C SYS.UnsetEnvYA .EQ $3E *-------------------------------------- +SYS.FileSearch .EQ $40 +SYS.GetFullPathYA .EQ $42 +SYS.LoadFile .EQ $44 +SYS.SaveFile .EQ $46 +* .EQ $48 +* .EQ $4A +* .EQ $4C +* .EQ $4E *-------------------------------------- +SYS.LoadDrvYA .EQ $50 +SYS.LoadLibYA .EQ $52 +SYS.UnloadLibA .EQ $54 +* .EQ $56 +SYS.TimeYA .EQ $58 +SYS.CTime2Time .EQ $5A +SYS.PTime2Time .EQ $5C +SYS.StrFTime .EQ $5E *-------------------------------------- SYS.FOPEN .EQ $60 SYS.FOPEN.R .EQ $01 Open For Read @@ -201,51 +217,31 @@ SYS.FEOF .EQ $6E SYS.REMOVE .EQ $70 SYS.RENAME .EQ $72 SYS.STAT .EQ $74 - +* .EQ $76 SYS.OPENDIRYA .EQ $78 SYS.READDIRA .EQ $7A SYS.CLOSEDIRA .EQ $7C SYS.MKDIRYA .EQ $7E *-------------------------------------- -SYS.GetDevByIDA .EQ $80 +SYS.GetMem .EQ $80 +SYS.FreeMemA .EQ $82 +SYS.GetMemPtrA .EQ $84 +SYS.GetMemByIDA .EQ $86 -SYS.GetDevByNameYA .EQ $84 -SYS.GetDevInfoA .EQ $86 - -SYS.GetKeyboardEvent .EQ $88 -SYS.MKNOD .EQ $8C -SYS.MKFIFO .EQ $8E +SYS.GetMemByNameYA .EQ $88 +SYS.LoadStockObjectYA .EQ $8A +SYS.GetStockObjectA .EQ $8C +SYS.FreeStockObject .EQ $8E *-------------------------------------- -SYS.ExecProcessNewEnvYA .EQ $90 -SYS.ExecProcessYA .EQ $92 -SYS.CreateProcessNewEnvYA .EQ $94 -SYS.CreateProcessYA .EQ $96 +SYS.GetDevByIDA .EQ $90 +SYS.GetDevByNameYA .EQ $94 +SYS.GetDevInfoA .EQ $96 +SYS.GetKeyboardEvent .EQ $98 -SYS.GetPSByIDA .EQ $98 - -SYS.Sleep .EQ $9C +SYS.MKNOD .EQ $FF +SYS.MKFIFO .EQ $FF *-------------------------------------- - -SYS.FileSearch .EQ $A2 -SYS.GetFullPathYA .EQ $A4 - -SYS.LoadFile .EQ $A8 -SYS.SaveFile .EQ $AA -*-------------------------------------- -SYS.COutA .EQ $D0 - -SYS.PStrOutYA .EQ $D4 - -SYS.HexOutA .EQ $D8 -SYS.HexOutYA .EQ $DA -SYS.DecOutA .EQ $DC -SYS.DecOutYA .EQ $DE - -*SYS.FGETC .EQ $F0 -*SYS.FGETS .EQ $F2 -*SYS.FPUTC .EQ $F4 -*SYS.FPUTS .EQ $F6 *-------------------------------------- * ProDOS ERROR CODES : $00->$5F * Lib ERROR CODES : $80->$BF diff --git a/SYS/KERNEL.S.BIN.txt b/SYS/KERNEL.S.BIN.txt index 7e4d3d08..8235ea05 100644 --- a/SYS/KERNEL.S.BIN.txt +++ b/SYS/KERNEL.S.BIN.txt @@ -5,19 +5,19 @@ INC 1 AUTO 6 .LIST OFF *-------------------------------------- -* K.LoadBinYA +* BIN.LoadExeYA * in : * A = hMem of FilePath (PSTRING) * out : * Y,A = MEMPTR * X = hMem of Code Segment *-------------------------------------- -K.LoadBinYA >STYA K.LoadBin.Filename +BIN.LoadEXEYA >STYA BIN.LoadExe.Filename jsr K.PStrUprYA - >LDYA K.LoadBin.Filename + >LDYA BIN.LoadExe.Filename jsr K.GetMemByNameYA - bcs .3 not already loaded + bcs .1 not already loaded >STYA ZPQuickPtr1 Save base address ldy #S.MEM.REFCNT @@ -34,37 +34,37 @@ K.LoadBinYA >STYA K.LoadBin.Filename clc rts -.3 >PUSHWI KrnBuf256 - >PUSHW K.LoadBin.Filename +.1 >PUSHWI KrnBuf256 + >PUSHW BIN.LoadExe.Filename jsr K.STAT Look for AUXTYPE bcs .99 >LDYA KrnBuf256+S.STAT.AUXTYPE - >STYA K.LoadBin.OldBase + >STYA BIN.LoadExe.OldBase >PUSHYA >PUSHBI 6 S.FILEINFO.TYPE.BIN >PUSHBI SYS.FOPEN.R - >PUSHW K.LoadBin.Filename + >PUSHW BIN.LoadExe.Filename jsr K.LoadFile bcs .99 Error Loading file - >STYA K.LoadBin.SegLen - stx K.LoadBin.hMem save hMem + >STYA BIN.LoadExe.SegLen + stx BIN.LoadExe.hMem save hMem txa jsr K.GetMemPtrA - >STYA K.LoadBin.NewBase + >STYA BIN.LoadExe.NewBase - jsr K.InsBin + jsr BIN.InstallEXE bcs .98 relocation error, dicard Code segment - >LDYA K.LoadBin.Filename get back bin path + >LDYA BIN.LoadExe.Filename get back bin path jsr K.NewPStrYA make a copy of this string bcs .98 phx save copy - lda K.LoadBin.hMem + lda BIN.LoadExe.hMem jsr K.GetMemByIDA >STYA ZPQuickPtr1 @@ -76,25 +76,388 @@ K.LoadBinYA >STYA K.LoadBin.Filename ldy #S.MEM.BIN sta (ZPQuickPtr1),y - lda K.LoadBin.hMem + lda BIN.LoadExe.hMem tax return hMEM to Caller... jsr K.GetMemPtrA clc ...and Y,A=PTR to CS rts .98 pha - lda K.LoadBin.hMem + lda BIN.LoadExe.hMem jsr K.FreeMemA Discard Loaded Code pla sec .99 rts *-------------------------------------- -K.LoadBin.Filename .BS 2 -K.LoadBin.hMem .BS 1 -K.LoadBin.OldBase .BS 2 -K.LoadBin.NewBase .BS 2 -K.LoadBin.SegLen .BS 2 +BIN.LoadExe.Filename .BS 2 +BIN.LoadExe.hMem .BS 1 +BIN.LoadExe.OldBase .BS 2 +BIN.LoadExe.NewBase .BS 2 +BIN.LoadExe.SegLen .BS 2 +*-------------------------------------- +* BIN.InstallEXE +*-------------------------------------- +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 +*-------------------------------------- +BIN.InstallDRV ldy #H.BIN.DRV.CODE.LEN + lda (pDrv),y + sta Rel.CodeLen + iny + lda (pDrv),y + sta Rel.CodeLen+1 + + ldy #H.BIN.DRV.CODE.O + lda (pDrv),y + clc + adc BIN.LoadExe.OldBase + sta Rel.Start + iny + lda (pDrv),y + adc BIN.LoadExe.OldBase+1 + sta Rel.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 + lda BIN.LoadExe.SegLen + sec + sbc (pDrv),y + sta K.InsDrv.DRVLen + iny + lda BIN.LoadExe.SegLen+1 + sbc (pDrv),y + sta K.InsDrv.DRVLen+1 Compute DRV Len + + lda DevMgr.Free + clc + adc K.InsDrv.DRVLen + sta K.InsDrv.DRVEnd + lda DevMgr.Free+1 + adc K.InsDrv.DRVLen+1 + sta K.InsDrv.DRVEnd+1 + + bcs .98 we crossed $FFFF, out of mem + + lda K.InsDrv.DRVEnd + sec + sbc #DevMgr.HiMem + lda K.InsDrv.DRVEnd+1 + sbc /DevMgr.HiMem + bcs .98 No More Room to load Driver.... + + lda DevMgr.LastDevID + inc + cmp #K.DEV.MAX + beq .99 No Device Handle Left + + sta DevMgr.LastDevID + + ldy #H.BIN.DEV.HEADER.O + lda (pDrv),y + clc + adc pDrv + sta ZPQuickPtr1 + iny + lda (pDrv),y + adc pDrv+1 + sta ZPQuickPtr1+1 + + ldy #S.DEV.JMP + + lda DevMgr.Free + sec + sbc (ZPQuickPtr1),y + sta Rel.Offset + lda DevMgr.Free+1 + iny + sbc (ZPQuickPtr1),y + sta Rel.Offset+1 + + ldy #H.BIN.DRV.CODE.O + lda (pDrv),y + clc + adc pDrv + sta ZPQuickPtr1 + + iny + lda (pDrv),y + adc pDrv+1 + sta ZPQuickPtr1+1 + + jsr BIN.RelocateDRV + + jsr BIN.MoveDRV + + >LDYA K.InsDrv.DrvEnd + >STYA DevMgr.Free + clc + rts + +.98 lda #DEVMGR.ERROOM + sec + rts + +.99 lda #DEVMGR.ERROOH + sec + rts +*-------------------------------------- +BIN.MoveDRV ldy #H.BIN.DEV.HEADER.O + lda (pDrv),y + clc + adc pDrv + sta ZPQuickPtr1 + iny + lda (pDrv),y + adc pDrv+1 + sta ZPQuickPtr1+1 + + ldy #S.DEV.JMP Relocate Main JMP + lda (ZPQuickPtr1),y + clc + adc Rel.Offset + sta (ZPQuickPtr1),y + iny + lda (ZPQuickPtr1),y + adc Rel.Offset+1 + sta (ZPQuickPtr1),y + + lda DevMgr.LastDevID + jsr K.GetDevByIDA + >STYA pDev + + ldy #S.DEV.SIZE Make sure DevMgr.Table Ends with 0 + lda #0 + sta (pDev),y + dey + +.1 lda (ZPQuickPtr1),y Copy DRV.Header + sta (pDev),y + dey + bpl .1 + + lda DevMgr.LastDevID Save Dev.ID in the driver for SELECT + ldy #S.DEV.ID + sta (pDev),y + + ldy #H.BIN.DRV.CODE.O + lda (pDrv),y + clc + adc pDrv + sta ZPQuickPtr1 + iny + lda (pDrv),y + adc pDrv+1 + sta ZPQuickPtr1+1 Make ZPQuickPtr1=DRV.CODE + + lda DevMgr.Free + sta ZPQuickPtr2 + lda DevMgr.Free+1 + sta ZPQuickPtr2+1 Make ZPQuickPtr2=Dest Ram Location + + ldy K.InsDrv.DrvLen + ldx K.InsDrv.DrvLen+1 + +.2 lda (ZPQuickPtr1) + sta (ZPQuickPtr2) + + inc ZPQuickPtr1 + bne .3 + inc ZPQuickPtr1+1 + +.3 inc ZPQuickPtr2 + bne .4 + inc ZPQuickPtr2+1 + +.4 tya + bne .5 + txa + beq .8 + dex + +.5 dey + bra .2 +.8 rts +*-------------------------------------- +K.InsDrv.DrvLen .BS 2 +K.InsDrv.DrvEnd .BS 2 +*-------------------------------------- +* BIN.Relocate___ : +* ZPQuickPtr1 = Ptr to Code +*-------------------------------------- +BIN.RelocateEXE ldy #H.BIN.JMP relocate Main JMP + lda (ZPQuickPtr1),y + clc + adc Rel.Offset + sta (ZPQuickPtr1),y + + iny + lda (ZPQuickPtr1),y + adc Rel.Offset+1 + sta (ZPQuickPtr1),y + + ldy #H.BIN.RELOC.TABLE skip Header, CS.SIZE & DS.SIZE... (16 bytes) + + .HS 2C bit abs + +BIN.RelocateDRV ldy #0 + +.1 lda (ZPQuickPtr1),y Start Relocate JMP table + tax + iny + ora (ZPQuickPtr1),y + beq .2 $0000 = end of table + + dey + txa + clc + adc Rel.Offset + sta (ZPQuickPtr1),y + + iny + lda (ZPQuickPtr1),y + adc Rel.Offset+1 + sta (ZPQuickPtr1),y + + iny + + bra .1 + +.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 + sta ZPQuickPtr1 + bcc .5 + inc ZPQuickPtr1+1 ZPQuickPtr1=Current Code PTR + clc + +.5 lda (ZPQuickPtr1) get OPCODE + tax + lda BIN.OPCODES,x get OPCODE definition + bpl .7 abs addressing? + + and #3 save Opcode length... + pha + + ldy #1 + lda (ZPQuickPtr1),y Get LO + sec + sbc Rel.Start + iny + lda (ZPQuickPtr1),y Get HI + sbc Rel.Start+1 + bcc .6 addr < AX, out of range + + dey + lda (ZPQuickPtr1),y Get LO + sec + sbc Rel.End + iny + lda (ZPQuickPtr1),y Get HI + sbc Rel.End+1 + bcs .6 addr > CX, out of range + + dey + lda (ZPQuickPtr1),y Get LO + clc + adc Rel.Offset add DX to abs address + sta (ZPQuickPtr1),y store relocated addr LO + iny + lda (ZPQuickPtr1),y Get HI + adc Rel.Offset+1 + sta (ZPQuickPtr1),y store relocated addr HI + +.6 pla + +.7 clc A = OPCODE length + adc ZPQuickPtr1 + sta ZPQuickPtr1 + bcc .8 + inc ZPQuickPtr1+1 + +.8 lda ZPQuickPtr1 is Current PTR < Code Limit ? + sec + sbc ZPQuickPtr2 + lda ZPQuickPtr1+1 + sbc ZPQuickPtr2+1 + bcc .5 yes, continue relocating + + clc + rts +*-------------------------------------- +* 65C02 OPCODES +* Bit 7 : 1 absolute addressing +* Bit 1-0 : opcode + @ length +*-------------------------------------- +* x0.x1.x2.x3.x4.x5.x6.x7.x8.x9.xA.xB.xC.xD.xE.xF +BIN.OPCODES .HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 + .HS 83.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 + .HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 + .HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 + .HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 +*-------------------------------------- +Rel.CodeLen .BS 2 +Rel.Start .BS 2 +Rel.End .BS 2 +Rel.Offset .BS 2 *-------------------------------------- MAN SAVE SYS/KERNEL.S.BIN diff --git a/SYS/KERNEL.S.DRV.txt b/SYS/KERNEL.S.DRV.txt index ca20d6d0..9360c673 100644 --- a/SYS/KERNEL.S.DRV.txt +++ b/SYS/KERNEL.S.DRV.txt @@ -25,7 +25,7 @@ K.LoadDrvYA >STYA K.LoadDrv.CmdArray bcs .99 stx K.LoadDrv.hFullName - jsr K.LoadBinYA Y,A =filename full path + jsr BIN.LoadExeYA Y,A =filename full path bcs .98 >STYA pDrv @@ -46,7 +46,7 @@ K.LoadDrvYA >STYA K.LoadDrv.CmdArray bcs .97 - jsr K.InsDrv + jsr BIN.InstallDRV bcs .97 diff --git a/SYS/KERNEL.S.FILE.txt b/SYS/KERNEL.S.FILE.txt index ac0d9c7a..ecc184fa 100644 --- a/SYS/KERNEL.S.FILE.txt +++ b/SYS/KERNEL.S.FILE.txt @@ -143,14 +143,8 @@ K.FCLOSEA.1 ldy #S.FILE.PRODOS.REF * Y,A = Bytes Read *-------------------------------------- K.FREAD jsr K.PFTCheckFileSTK - >PULLA - jsr FILE.SetupPrt1A - >PULLW MLICALL.PARAMS+4 - >PULLW MLICALL.PARAMS+2 - >MLICALL MLIREAD - bcs .9 - >LDYA MLICALL.PARAMS+6 -.9 rts + ldx #MLIREAD + bra K.FREAD.1 *-------------------------------------- * K.FWRITE * In : @@ -162,10 +156,15 @@ K.FREAD jsr K.PFTCheckFileSTK *-------------------------------------- K.FWRITE jsr K.PFTCheckFileSTK >PULLA - jsr FILE.SetupPrt1A + ldx #MLIWRITE +K.FREAD.1 jsr FILE.SetupPrt1A >PULLW MLICALL.PARAMS+4 >PULLW MLICALL.PARAMS+2 - >MLICALL MLIWRITE + +* >MLICALL MLIWRITE + + lda #4 Param Count = 4 for MLIREAD & MLIWRITE + jsr A2osX.MLICALL bcs .9 >LDYA MLICALL.PARAMS+6 .9 rts diff --git a/SYS/KERNEL.S.JMP.txt b/SYS/KERNEL.S.JMP.txt index d0147c40..4d71a0c8 100644 --- a/SYS/KERNEL.S.JMP.txt +++ b/SYS/KERNEL.S.JMP.txt @@ -7,14 +7,18 @@ AUTO 6 *-------------------------------------- * $D000-D0FF KERNEL.SYSCALL Jmp Table *-------------------------------------- -KERNEL.SYSCALL .DA K.GetMem $00 - .DA K.FreeMemA - .DA K.GetMemPtrA - .DA K.GetMemByIDA - .DA K.GetMemByNameYA - .DA K.LoadStockObjectYA - .DA K.GetStockObjectA - .DA K.FreeStockObject +KERNEL.SYSCALL +*-------------------------------------- +* Bank 1 +*-------------------------------------- + .DA K.COutA $00 + .DA 0 + .DA K.PStrOutYA + .DA 0 + .DA K.HexOutA + .DA K.HexOutYA + .DA K.DecOutA + .DA K.DecOutYA *-------------------------------------- .DA K.NewPStrYA $10 .DA K.PStrCpy @@ -25,7 +29,36 @@ KERNEL.SYSCALL .DA K.GetMem $00 .DA 0 .DA K.PStr2StrArrayYA *-------------------------------------- - .DA K.LoadDrvYA $20 + .DA K.ExecProcessNewEnvYA $20 + .DA K.ExecProcessYA + .DA K.CreateProcessNewEnvYA + .DA K.CreateProcessYA + .DA K.GetPSByIDA + .DA 0 + .DA K.Sleep + .DA 0 +*-------------------------------------- + .DA K.GetArgC $30 + .DA K.GetArgA + .DA K.ExpandPStrYA $32 + .DA 0 + .DA K.PutEnvYA + .DA K.SetEnv + .DA K.GetEnvYA + .DA K.UnsetEnvYA +*-------------------------------------- +* Bank 2 +*-------------------------------------- + .DA K.FileSearch $40 + .DA K.GetFullPathYA + .DA K.LoadFile + .DA K.SaveFile + .DA 0 + .DA 0 + .DA 0 + .DA 0 +*-------------------------------------- + .DA K.LoadDrvYA $50 .DA K.LoadLibYA .DA K.UnloadLibA .DA 0 @@ -33,33 +66,6 @@ KERNEL.SYSCALL .DA K.GetMem $00 .DA K.CTime2Time .DA K.PTime2Time .DA K.StrFTime -*-------------------------------------- - .DA 0 $30 - .DA K.ExpandPStrYA - .DA K.GetArgC - .DA K.GetArgA - .DA K.PutEnvYA - .DA K.SetEnv - .DA K.GetEnvYA - .DA K.UnsetEnvYA -*-------------------------------------- - .DA 0 $40 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $50 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 *-------------------------------------- .DA K.FOPEN $60 .DA K.FCLOSEA @@ -79,78 +85,21 @@ KERNEL.SYSCALL .DA K.GetMem $00 .DA K.CLOSEDIRA .DA K.MKDIRYA *-------------------------------------- - .DA K.GetDevByIDA $80 - .DA 0 +* $E000 +*-------------------------------------- + .DA K.GetMem $80 + .DA K.FreeMemA + .DA K.GetMemPtrA + .DA K.GetMemByIDA + .DA K.GetMemByNameYA + .DA K.LoadStockObjectYA + .DA K.GetStockObjectA + .DA K.FreeStockObject +*-------------------------------------- + .DA K.GetDevByIDA $90 .DA K.GetDevByNameYA .DA K.GetDevInfoA .DA K.GetKeyboardEvent - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA K.ExecProcessNewEnvYA $90 - .DA K.ExecProcessYA - .DA K.CreateProcessNewEnvYA - .DA K.CreateProcessYA - .DA K.GetPSByIDA - .DA 0 - .DA K.Sleep - .DA 0 -*-------------------------------------- - .DA 0 $A0 - .DA K.FileSearch - .DA K.GetFullPathYA - .DA 0 - .DA K.LoadFile - .DA K.SaveFile - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $B0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $C0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA K.COutA $D0 - .DA 0 - .DA K.PStrOutYA - .DA 0 - .DA K.HexOutA - .DA K.HexOutYA - .DA K.DecOutA - .DA K.DecOutYA -*-------------------------------------- - .DA 0 $E0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $F0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - *-------------------------------------- * LO Byte : * #RRAMWRAMBNK1 or #RRAMWRAMBNK2 @@ -158,157 +107,179 @@ KERNEL.SYSCALL .DA K.GetMem $00 *-------------------------------------- KERNEL.SYSCALL.FLAGS *-------------------------------------- - .DA 0 $00 : MEM $E000 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $10 : STR $D001 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA #RRAMWRAMBNK2 $20 : BIN,DRV,LIB (REL) $D002 - .DA #0 - .DA #RRAMWRAMBNK2 - .DA #0 - .DA #RRAMWRAMBNK2 - .DA #0 - .DA 0 + .DA #$80 $00 : CIO $D001 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 - .DA #RRAMWRAMBNK2 $28 : TIME $D002 - .DA #0 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 +*-------------------------------------- + .DA #$80 $10 : STR $D001 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 +*-------------------------------------- + .DA #$80 $20 : + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + + .DA #$80 $28 : + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 +*-------------------------------------- + .DA #$80 $30 : ARG + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 $32 : ENV + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 + .DA #$80 + .DA #RRAMWRAMBNK1 +*-------------------------------------- +* $40 -> $7E +*-------------------------------------- + .DA #$80 $40 : FIO .DA #RRAMWRAMBNK2 - .DA #0 + .DA #$80 .DA #RRAMWRAMBNK2 - .DA #0 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 .DA #RRAMWRAMBNK2 - .DA #0 *-------------------------------------- - .DA 0 $30 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 + .DA #$80 $50 : + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 *-------------------------------------- - .DA 0 $40 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 + .DA #$80 $60 : + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 *-------------------------------------- - .DA 0 $50 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 + .DA #$80 $70 : + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 *-------------------------------------- - .DA 0 $60 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 + .DA #$80 $80 : + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 *-------------------------------------- - .DA 0 $70 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 + .DA #$80 $90 : + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 + .DA #$80 + .DA #RRAMWRAMBNK2 *-------------------------------------- - .DA 0 $80 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $90 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $A0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $B0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $C0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $D0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $E0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 -*-------------------------------------- - .DA 0 $F0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 - .DA 0 MAN SAVE SYS/KERNEL.S.JMP LOAD SYS/KERNEL.S diff --git a/SYS/KERNEL.S.LIB.txt b/SYS/KERNEL.S.LIB.txt index d338c833..1f66adeb 100644 --- a/SYS/KERNEL.S.LIB.txt +++ b/SYS/KERNEL.S.LIB.txt @@ -25,7 +25,7 @@ K.LoadLibYA >STYA K.LoadLib.Name save libname for K.FileSearch stx K.LoadLib.hFullName - jsr K.LoadBinYA Y,A = filename full path + jsr BIN.LoadExeYA Y,A=filename full path bcs .98 stx K.LoadLib.hMem diff --git a/SYS/KERNEL.S.PS.txt b/SYS/KERNEL.S.PS.txt index 674c4f33..6bd6cda6 100644 --- a/SYS/KERNEL.S.PS.txt +++ b/SYS/KERNEL.S.PS.txt @@ -5,43 +5,62 @@ INC 1 AUTO 6 .LIST OFF *-------------------------------------- -* K.SelectProcessA -* In : A=PSID +* K.ExecProcessNewEnvYA +* K.ExecProcessYA (Blocking Parent PID) +* K.CreateProcessNewEnvYA +* K.CreateProcessYA (Non Blocking) +* in : +* Y,A = PTR To Cmd Line +* out : +* A = Child PSID *-------------------------------------- -K.SelectProcessA - tay - bne K.SelectProcessN -K.SelectProcess0 - >LDYAI TskMgr.Table Make PS #0 as current process - >STYA pPs - bra K.SelectProcessDev -K.SelectProcessN - jsr K.GetPSByIDA - bcs * - >STYA pPs +K.ExecProcessNewEnvYA + ldx #S.PS.F.ENV+S.PS.F.HOLD + .HS 2C bit abs +K.ExecProcessYA ldx #S.PS.F.HOLD + .HS 2C bit abs +K.CreateProcessNewEnvYA + ldx #S.PS.F.ENV + .HS 2C bit abs +K.CreateProcessYA + ldx #0 + stx K.CreateProcess.Flags -K.SelectProcess ldy #S.PS.hCS - lda (pPs),y - jsr K.GetMemPtrA - >STYA pCode + jsr K.ExpandPStrYA + bcs .99 - ldy #S.PS.hDS - lda (pPs),y - beq K.SelectProcessDev - - jsr K.GetMemPtrA - >STYA pData - -K.SelectProcessDev - ldy #S.PS.hOUTDEV - lda (pPs),y - beq .8 + stx K.CreateProcess.hCmdLine + >STYA K.CreateProcess.CmdLine - jsr K.GetDevByIDA - >STYA pDev + jsr K.CreateProcess.Child + bcs .98 -.8 clc + sta K.CreateProcess.CPSID + + jsr K.CreateProcess.Init + bcs .97 + + lda K.CreateProcess.CPSID + clc rts + +.97 pha save error code + lda K.CreateProcess.CPSID + jsr K.FreeProcessA + pla get back error code + +.98 pha + lda K.CreateProcess.hCmdLine + jsr K.FreeMemA + pla + +.99 sec + rts +*-------------------------------------- +K.CreateProcess.Flags .BS 1 +K.CreateProcess.hCmdLine .BS 1 +K.CreateProcess.CmdLine .BS 2 +K.CreateProcess.CPSID .BS 1 *-------------------------------------- * K.GetPSByIDA * In : @@ -104,63 +123,6 @@ K.Sleep pla get PC LO clc No error, rts back to Kernel *-------------------------------------- -* K.ExecProcessNewEnvYA -* K.ExecProcessYA (Blocking Parent PID) -* K.CreateProcessNewEnvYA -* K.CreateProcessYA (Non Blocking) -* in : -* Y,A = PTR To Cmd Line -* out : -* A = Child PSID -*-------------------------------------- -K.ExecProcessNewEnvYA - ldx #S.PS.F.ENV+S.PS.F.HOLD - .HS 2C bit abs -K.ExecProcessYA ldx #S.PS.F.HOLD - .HS 2C bit abs -K.CreateProcessNewEnvYA - ldx #S.PS.F.ENV - .HS 2C bit abs -K.CreateProcessYA - ldx #0 - stx K.CreateProcess.Flags - - jsr K.ExpandPStrYA - bcs .99 - - stx K.CreateProcess.hCmdLine - >STYA K.CreateProcess.CmdLine - - jsr K.CreateProcess.Child - bcs .98 - - sta K.CreateProcess.CPSID - - jsr K.CreateProcess.Init - bcs .97 - - lda K.CreateProcess.CPSID - clc - rts - -.97 pha save error code - lda K.CreateProcess.CPSID - jsr K.FreeProcessA - pla get back error code - -.98 pha - lda K.CreateProcess.hCmdLine - jsr K.FreeMemA - pla - -.99 sec - rts -*-------------------------------------- -K.CreateProcess.Flags .BS 1 -K.CreateProcess.hCmdLine .BS 1 -K.CreateProcess.CmdLine .BS 2 -K.CreateProcess.CPSID .BS 1 -*-------------------------------------- * K.CreateProcess.Child * in : * out : @@ -297,7 +259,7 @@ K.CreateProcess.Init pla Restore PTR... ply - jsr K.LoadBinYA A = BinPath hMem + jsr BIN.LoadEXEYA Y,A=filename full path bcs .9 >STYA ZPQuickPtr4 save PTR to Code Segment @@ -374,6 +336,44 @@ K.FreeProcessA jsr K.GetPSByIDA clc rts *-------------------------------------- +* K.SelectProcessA +* In : A=PSID +*-------------------------------------- +K.SelectProcessA + tay + bne K.SelectProcessN +K.SelectProcess0 + >LDYAI TskMgr.Table Make PS #0 as current process + >STYA pPs + bra K.SelectProcessDev +K.SelectProcessN + jsr K.GetPSByIDA + bcs * + >STYA pPs + +K.SelectProcess ldy #S.PS.hCS + lda (pPs),y + jsr K.GetMemPtrA + >STYA pCode + + ldy #S.PS.hDS + lda (pPs),y + beq K.SelectProcessDev + + jsr K.GetMemPtrA + >STYA pData + +K.SelectProcessDev + ldy #S.PS.hOUTDEV + lda (pPs),y + beq .8 + + jsr K.GetDevByIDA + >STYA pDev + +.8 clc + rts +*-------------------------------------- * S.DupEnvA * In: * A = ENV hMem To Duplicate diff --git a/SYS/KERNEL.S.REL.txt b/SYS/KERNEL.S.REL.txt deleted file mode 100644 index e5aebbea..00000000 --- a/SYS/KERNEL.S.REL.txt +++ /dev/null @@ -1,378 +0,0 @@ -PR#3 -PREFIX /A2OSX.SRC -NEW -INC 1 -AUTO 6 - .LIST OFF -*-------------------------------------- -* K.InsBin -*-------------------------------------- -K.InsBin >LDYA K.LoadBin.NewBase - >STYA ZPQuickPtr1 - - ldy #H.BIN.CODE.LEN make AX = Code Len - lda (ZPQuickPtr1),y - sta Rel.CodeLen - iny - lda (ZPQuickPtr1),y - sta Rel.CodeLen+1 - - lda K.LoadBin.OldBase - sta Rel.Start Make BX=Range Start=AUXTYPE - clc - adc K.LoadBin.SegLen - sta Rel.End Make CX=Range End=AUXTYPE+FILELEN - - lda K.LoadBin.OldBase+1 - sta Rel.Start+1 - adc K.LoadBin.SegLen+1 - sta Rel.End+1 - - lda ZPQuickPtr1 Compute relocation offset in DX - sec - sbc K.LoadBin.OldBase - sta Rel.Offset DX=Offset=ZPQuickPtr1-AUXTYPE - lda ZPQuickPtr1+1 - sbc K.LoadBin.OldBase+1 - sta Rel.Offset+1 - - jmp S.BinRelocate -*-------------------------------------- -* K.InsDrv -* pDrv = .DRV File Loaded Address -*-------------------------------------- -K.InsDrv ldy #H.BIN.DRV.CODE.LEN - lda (pDrv),y - sta Rel.CodeLen - iny - lda (pDrv),y - sta Rel.CodeLen+1 - - ldy #H.BIN.DRV.CODE.O - lda (pDrv),y - clc - adc K.LoadBin.OldBase - sta Rel.Start - iny - lda (pDrv),y - adc K.LoadBin.OldBase+1 - sta Rel.Start+1 set BX=End Of Code - - lda K.LoadBin.OldBase - clc - adc K.LoadBin.SegLen - sta Rel.End - lda K.LoadBin.OldBase+1 - adc K.LoadBin.SegLen+1 - sta Rel.End+1 set CX=End Of Range - - ldy #H.BIN.DRV.CODE.O - lda K.LoadBin.SegLen - sec - sbc (pDrv),y - sta K.InsDrv.DRVLen - iny - lda K.LoadBin.SegLen+1 - sbc (pDrv),y - sta K.InsDrv.DRVLen+1 Compute DRV Len - - lda DevMgr.Free - clc - adc K.InsDrv.DRVLen - sta K.InsDrv.DRVEnd - lda DevMgr.Free+1 - adc K.InsDrv.DRVLen+1 - sta K.InsDrv.DRVEnd+1 - - bcs .98 we crossed $FFFF, out of mem - - lda K.InsDrv.DRVEnd - sec - sbc #DevMgr.HiMem - lda K.InsDrv.DRVEnd+1 - sbc /DevMgr.HiMem - bcs .98 No More Room to load Driver.... - - lda DevMgr.LastDevID - inc - cmp #K.DEV.MAX - beq .99 No Device Handle Left - - sta DevMgr.LastDevID - - ldy #H.BIN.DEV.HEADER.O - lda (pDrv),y - clc - adc pDrv - sta ZPQuickPtr1 - iny - lda (pDrv),y - adc pDrv+1 - sta ZPQuickPtr1+1 - - ldy #S.DEV.JMP - - lda DevMgr.Free - sec - sbc (ZPQuickPtr1),y - sta Rel.Offset - lda DevMgr.Free+1 - iny - sbc (ZPQuickPtr1),y - sta Rel.Offset+1 set DX=Offset - - ldy #H.BIN.DRV.CODE.O - lda (pDrv),y - clc - adc pDrv - sta ZPQuickPtr1 - - iny - lda (pDrv),y - adc pDrv+1 - sta ZPQuickPtr1+1 - - jsr S.DrvRelocate - - jsr K.InsDrv.Move - - >LDYA K.InsDrv.DrvEnd - >STYA DevMgr.Free - clc - rts - -.98 lda #DEVMGR.ERROOM - sec - rts - -.99 lda #DEVMGR.ERROOH - sec - rts -*-------------------------------------- -K.InsDrv.Move ldy #H.BIN.DEV.HEADER.O - lda (pDrv),y - clc - adc pDrv - sta ZPQuickPtr1 - iny - lda (pDrv),y - adc pDrv+1 - sta ZPQuickPtr1+1 - - ldy #S.DEV.JMP Relocate Main JMP - lda (ZPQuickPtr1),y - clc - adc Rel.Offset - sta (ZPQuickPtr1),y - iny - lda (ZPQuickPtr1),y - adc Rel.Offset+1 - sta (ZPQuickPtr1),y - - lda DevMgr.LastDevID - jsr K.GetDevByIDA - >STYA pDev - - ldy #S.DEV.SIZE Make sure DevMgr.Table Ends with 0 - lda #0 - sta (pDev),y - dey - -.1 lda (ZPQuickPtr1),y Copy DRV.Header - sta (pDev),y - dey - bpl .1 - - lda DevMgr.LastDevID Save Dev.ID in the driver for SELECT - ldy #S.DEV.ID - sta (pDev),y - - ldy #H.BIN.DRV.CODE.O - lda (pDrv),y - clc - adc pDrv - sta ZPQuickPtr1 - iny - lda (pDrv),y - adc pDrv+1 - sta ZPQuickPtr1+1 Make ZPQuickPtr1=DRV.CODE - - lda DevMgr.Free - sta ZPQuickPtr2 - lda DevMgr.Free+1 - sta ZPQuickPtr2+1 Make ZPQuickPtr2=Dest Ram Location - - ldy K.InsDrv.DrvLen - ldx K.InsDrv.DrvLen+1 - -.2 lda (ZPQuickPtr1) - sta (ZPQuickPtr2) - - inc ZPQuickPtr1 - bne .3 - inc ZPQuickPtr1+1 - -.3 inc ZPQuickPtr2 - bne .4 - inc ZPQuickPtr2+1 - -.4 tya - bne .5 - txa - beq .8 - dex - -.5 dey - bra .2 -.8 rts -*-------------------------------------- -K.InsDrv.DrvLen .BS 2 -K.InsDrv.DrvEnd .BS 2 -*-------------------------------------- -* S.BinRelocate : -* ZPQuickPtr1 = Ptr to Code -* R.AX = Code Length -* R.BX = Range Start address to relocate -* R.CX = Range End address to relocate -* R.DX = offset to apply to all abs addresses between R.BX and R.CX -*-------------------------------------- -S.BinRelocate ldy #H.BIN.JMP relocate Main JMP - lda (ZPQuickPtr1),y - clc - adc Rel.Offset - sta (ZPQuickPtr1),y - - iny - lda (ZPQuickPtr1),y - adc Rel.Offset+1 - sta (ZPQuickPtr1),y - - ldy #H.BIN.RELOC.TABLE skip Header, CS.SIZE & DS.SIZE... (16 bytes) - - .HS 2C bit abs - -S.DrvRelocate ldy #0 - -.1 lda (ZPQuickPtr1),y Start Relocate JMP table - tax - iny - ora (ZPQuickPtr1),y - beq .2 $0000 = end of table - - dey - txa - clc - adc Rel.Offset - sta (ZPQuickPtr1),y - - iny - lda (ZPQuickPtr1),y - adc Rel.Offset+1 - sta (ZPQuickPtr1),y - - iny - - bra .1 - -.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 - sta ZPQuickPtr1 - bcc .5 - inc ZPQuickPtr1+1 ZPQuickPtr1=Current Code PTR - clc - -.5 lda (ZPQuickPtr1) get OPCODE - tax - lda OPCODES,x get OPCODE definition - bpl .7 abs addressing? - - and #3 save Opcode length... - pha - - ldy #1 - lda (ZPQuickPtr1),y Get LO - sec - sbc Rel.Start - iny - lda (ZPQuickPtr1),y Get HI - sbc Rel.Start+1 - bcc .6 addr < AX, out of range - - dey - lda (ZPQuickPtr1),y Get LO - sec - sbc Rel.End - iny - lda (ZPQuickPtr1),y Get HI - sbc Rel.End+1 - bcs .6 addr > CX, out of range - - dey - lda (ZPQuickPtr1),y Get LO - clc - adc Rel.Offset add DX to abs address - sta (ZPQuickPtr1),y store relocated addr LO - iny - lda (ZPQuickPtr1),y Get HI - adc Rel.Offset+1 - sta (ZPQuickPtr1),y store relocated addr HI - -.6 pla - -.7 clc A = OPCODE length - adc ZPQuickPtr1 - sta ZPQuickPtr1 - bcc .8 - inc ZPQuickPtr1+1 - -.8 lda ZPQuickPtr1 is Current PTR < Code Limit ? - sec - sbc ZPQuickPtr2 - lda ZPQuickPtr1+1 - sbc ZPQuickPtr2+1 - bcc .5 yes, continue relocating - - clc - rts -*-------------------------------------- -* 65C02 OPCODES -* Bit 7 : 1 absolute addressing -* Bit 1-0 : opcode + @ length -*-------------------------------------- -* x0.x1.x2.x3.x4.x5.x6.x7.x8.x9.xA.xB.xC.xD.xE.xF -OPCODES .HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 - .HS 83.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 - .HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 - .HS 01.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.83.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.02.01.01.83.83.83.03 - .HS 02.02.02.01.02.02.02.02.01.83.01.01.01.83.83.03 -*-------------------------------------- -Rel.CodeLen .BS 2 -Rel.Start .BS 2 -Rel.End .BS 2 -Rel.Offset .BS 2 -*-------------------------------------- -MAN -SAVE SYS/KERNEL.S.REL -LOAD SYS/KERNEL.S -ASM diff --git a/SYS/KERNEL.S.txt b/SYS/KERNEL.S.txt index da058559..0c5e5052 100644 --- a/SYS/KERNEL.S.txt +++ b/SYS/KERNEL.S.txt @@ -57,40 +57,41 @@ A2osX.BE00 .EQ * .EP A2osX.BE00.END .EQ * *-------------------------------------- -* LC AUX $D000 BANK1 +* LC AUX $D000 BANK1 API Calls $00-$3E *-------------------------------------- A2osX.D001 .EQ * .PH $D000 .DA #RRAMWRAMBNK1 - .INB SYS/KERNEL.S.RUN + .INB SYS/KERNEL.S.CIO .INB SYS/KERNEL.S.STR + .INB SYS/KERNEL.S.PS .INB SYS/KERNEL.S.ARG .INB SYS/KERNEL.S.ENV - .INB SYS/KERNEL.S.CIO - .INB SYS/KERNEL.S.FIO +*-------------------------------------- + .INB SYS/KERNEL.S.RUN .INB SYS/KERNEL.S.EVT .INB SYS/KERNEL.S.TSK - .INB SYS/KERNEL.S.PS .EP A2osX.D001.END .EQ * *-------------------------------------- -* LC AUX $D000 BANK2 +* LC AUX $D000 BANK2 API Calls $40-$7E *-------------------------------------- A2osX.D002 .EQ * .PH $D000 .DA #RRAMWRAMBNK2 - .INB SYS/KERNEL.S.BIN + .INB SYS/KERNEL.S.FIO .INB SYS/KERNEL.S.DRV .INB SYS/KERNEL.S.LIB - .INB SYS/KERNEL.S.REL .INB SYS/KERNEL.S.TIME .INB SYS/KERNEL.S.FILE .INB SYS/KERNEL.S.DIR +*-------------------------------------- .INB SYS/KERNEL.S.PFT + .INB SYS/KERNEL.S.BIN .EP A2osX.D002.END .EQ * *-------------------------------------- -* LC AUX $E000 +* LC AUX $E000 API Calls $80-$FE *-------------------------------------- A2osX.E000 .EQ * .PH $E000