diff --git a/A2OSX.BOOT.DSK b/A2OSX.BOOT.DSK index 9ef7597a..9a99ed16 100644 Binary files a/A2OSX.BOOT.DSK and b/A2OSX.BOOT.DSK differ diff --git a/A2OSX.BUILD.HDV b/A2OSX.BUILD.HDV index 1cc4490e..d62b61cc 100644 Binary files a/A2OSX.BUILD.HDV and b/A2OSX.BUILD.HDV differ diff --git a/A2OSX.SRC.po b/A2OSX.SRC.po new file mode 100644 index 00000000..28e6e3ce Binary files /dev/null and b/A2OSX.SRC.po differ diff --git a/A2osX.S.GP.txt b/A2osX.S.GP.txt index c485c421..9cc14cd3 100644 --- a/A2osX.S.GP.txt +++ b/A2osX.S.GP.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -12,36 +12,16 @@ A2osX.GP.B.start .PH $BE00 *-------------------------------------- A2osX.GP.Start bra A2osX.SYSCALL1 - bra A2osX.MLICALL1 bra A2osX.LIBCALL1 bra A2osX.SLEEP1 - bra Kernel.MLICALL1 - bra Kernel.DRVCALL1 - bra Kernel.BINCALL1 - bra Kernel.LIBCALL1 - .BS A2osX.GPCODE-* + bra A2osX.MLICALL1 *-------------------------------------- * A2osX.SYSCALL (MAINLC to AUXLC) * In: * X = SYSfnc.Index * Y,A = free for Inline param *-------------------------------------- -A2osX.SYSCALL1 jsr GO.AUXLC - jsr $E003 - jsr GO.MAINLC - rts -*-------------------------------------- -* A2osX.MLICALL (MAINLC to MAINLC) -* In: -* X = MLI Function -* A = Param Count -*-------------------------------------- -A2osX.MLICALL1 stx .1 - sta MLICALL.PARAMS - jsr MLI -.1 .BS 1 - .DA MLICALL.PARAMS - rts +A2osX.SYSCALL1 jmp KERNEL.SYSCALL *-------------------------------------- * LIBCALL (MAINLC to MAINLC) * In: @@ -58,49 +38,41 @@ A2osX.LIBCALL1 pha pla .1 jmp $FFFF *-------------------------------------- -A2osX.SLEEP1 jmp A2osX.SLEEP2 -*-------------------------------------- * SLEEP (MAINLC to AUXLC) * In: *-------------------------------------- +A2osX.SLEEP1 ldy #S.PS.hCS + lda (pPs),y + >SYSCALL SYS.GetMemPtrA + >STYA A2osX.SaveCS + ldy #S.PS.PC + pla get PC LO + plx get PC HI + inc Advance PC one Byte + bne .1 + inx + +.1 sec + sbc A2osX.SaveCS + sta (pPs),y + iny + txa + sbc A2osX.SaveCS+1 + sta (pPs),y + clc No error, + rts back to Kernel +*-------------------------------------- * Kernel.MLICALL (AUXLC to MAINLC) * In: * X = MLI Function * A = Param Count *-------------------------------------- -Kernel.MLICALL1 jsr GO.MAINLC - jsr A2osX.MLICALL1 - jsr GO.AUXLC - rts -*-------------------------------------- -* Kernel.DRVCALL (AUXLC to MAINLC) -* In: -* X = DRV Function Index -* Y,A = pDevContext -*-------------------------------------- -Kernel.DRVCALL1 jsr GO.MAINLC - >STYA pDevContext - jsr GO.Kernel - jsr GO.AUXLC - rts -*-------------------------------------- -* Kernel.BINCALL (AUXLC to MAINLC) -* In: -* X = BIN Function Index -* Y,A = pPsContext -*-------------------------------------- -Kernel.BINCALL1 jsr GO.MAINLC - >STYA pPsContext - jsr GO.Kernel - jsr GO.AUXLC - rts -*-------------------------------------- -* Kernel.LIBCALL (AUXLC to MAINLC) -* In: -* X = Lib Function Index -*-------------------------------------- -Kernel.LIBCALL1 jsr GO.MAINLC - jsr GO.Kernel +A2osX.MLICALL1 jsr GO.MAINLC + stx .1 + sta MLICALL.PARAMS + jsr MLI +.1 .BS 1 + .DA MLICALL.PARAMS jsr GO.AUXLC rts *-------------------------------------- @@ -123,28 +95,27 @@ GO.SAVE.REG sta A2osX.SaveA .1 stx GO.EXIT.JMP+1 sty GO.EXIT.JMP+2 sei - ldy R.SP + ldy pStack bcs GO.AUXLC1 GO.MAINLC1 tsx stx A2osX.SaveSX - stx CLRALTZP - ldx RROMBNK2 ldx A2osX.SaveSM txs - sty R.SP + stx CLRALTZP + ldx RROMBNK1 bra GO.EXIT *-------------------------------------- -GO.AUXLC1 tsx +GO.AUXLC1 stx SETALTZP + tsx stx A2osX.SaveSM - stx SETALTZP - ldx RRAMWRAMBNK1 - ldx RRAMWRAMBNK1 ldx A2osX.SaveSX txs - sty R.SP + ldx RRAMWRAMBNK1 + ldx RRAMWRAMBNK1 *-------------------------------------- -GO.EXIT pha push P on stack +GO.EXIT sty pStack + pha push P on stack ldy A2osX.SaveY ldx A2osX.SaveX lda A2osX.SaveA @@ -152,30 +123,12 @@ GO.EXIT pha push P on stack GO.EXIT.JMP jmp $FFFF *-------------------------------------- GO.Reset jsr GO.AUXLC - jsr $E000 + jmp KERNEL.COLDBOOT *-------------------------------------- -GO.Kernel jmp (Kernel.JMP) -*-------------------------------------- -A2osX.SLEEP2 ldy #S.PS.hCS - lda (pPsContext),y - >SYSCALL SYS.GetMemPtrA - >STYA Kernel.JMP - ldy #S.PS.PC - pla get PC LO - plx get PC HI - inc Advance PC one Byte - bne .1 - inx - -.1 sec - sbc Kernel.JMP - sta (pPsContext),y - iny - txa - sbc Kernel.JMP+1 - sta (pPsContext),y - clc No error, - rts back to Kernel +A2osX.SaveCS .BS 2 +A2osX.SaveA .BS 1 +A2osX.SaveX .BS 1 +A2osX.SaveY .BS 1 *-------------------------------------- A2osX.GP.End .EQ * A2osX.GP.SIZE .EQ A2osX.GP.END-A2osX.GP.START diff --git a/A2osX.S.QC.txt b/A2osX.S.QC.txt index f6cbb23b..f0239d73 100644 --- a/A2osX.S.QC.txt +++ b/A2osX.S.QC.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -20,10 +20,16 @@ A2osX.QC.B.Start *-------------------------------------- A2osX.QC.Start .EQ * A2osX.QC cld - jmp A2osX.QC.init -A2osX.QC.Prefix .BS 32 -*-------------------------------------- -A2osX.QC.init bit RROMBNK1 + jmp A2osX.QC.Start1 + +A2osX.QC.Prefix .BS 32 + +A2osX.QC.Start1 sei + ldx #$FF + txs + cli + + bit RROMBNK1 >LDYAI A2osX.QC >STYA POWERUP jsr SETPWRC @@ -53,11 +59,14 @@ A2osX.QC.init bit RROMBNK1 .DA #MLISETPREFIX .DA MLISETPREFIX00 bcc .4 + >LDAXI MSG.SETPREFIXKO jsr A2osX.QC.PrintAX >LDAXI A2osX.QC.Prefix jsr A2osX.QC.PrintAX + >DEBUG + bra .3 .4 >LDAXI MSG.SETPREFIXOK @@ -69,26 +78,18 @@ A2osX.QC.init bit RROMBNK1 jsr A2osX.QC.KLoad bcs .9 - >LDAXI MSG.KLOADING.OK - jsr A2osX.QC.PrintAX - >LDYAI GO.Reset >STYA POWERUP + bit RROMBNK1 jsr SETPWRC - php - pla - sei - tsx - stx A2osX.SaveSM - stx SETALTZP - ldx A2osX.SaveSX - txs - bit RRAMWRAMBNK1 - bit RRAMWRAMBNK1 - pha - plp - jmp $E000 + >LDAXI MSG.STAGE1OK + jsr A2osX.QC.PrintAX + + >DEBUG + + jmp (POWERUP) + .9 >LDAXI MSG.KLOADING.KO jsr A2osX.QC.PrintAX bra * @@ -136,11 +137,11 @@ A2osX.QC.KLoad ldx A2osX.QC.Prefix lda RRAMWRAMBNK1 lda RRAMWRAMBNK1 - >LDYAI MLIREAD00.ADDR+$1F00 + >LDYAI MLIREAD00.ADDR+$2F00 >STYA TmpPtr1 - >LDYAI $E000+$1F00 + >LDYAI $D000+$2F00 >STYA TmpPtr2 - ldx #$20 + ldx #$30 ldy #$F9 do not trash NMI,BRK,IRQ Vectors .3 lda (TmpPtr1),y @@ -186,7 +187,7 @@ MLIOPEN00 .DA #3 MLIREAD00 .DA #4 .BS 1 .DA MLIREAD00.ADDR - .DA $1FFA + .DA $2FFA .BS 2 MLICLOSE00 .DA #1 .BS 1 @@ -197,7 +198,6 @@ MSG.STAGE1 >PSTRING "A2osX[Stage1]:Init" MSG.SETPREFIXOK >PSTRING "Set Prefix OK" MSG.SETPREFIXKO >PSTRING "Insert Vol:" MSG.KLOADING >PSTRING "Loading Kernel..." -MSG.KLOADING.OK >PSTRING "OK" MSG.KLOADING.KO >PSTRING "Error While Loading Kernel." MSG.STAGE1OK >PSTRING "A2osX[Stage1]:Complete." *-------------------------------------- diff --git a/A2osX.S.TOOLS.txt b/A2osX.S.TOOLS.txt index 0f601112..482cdcc9 100644 --- a/A2osX.S.TOOLS.txt +++ b/A2osX.S.TOOLS.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/A2osX.S.txt b/A2osX.S.txt index aacd4051..9610fc04 100644 --- a/A2osX.S.txt +++ b/A2osX.S.txt @@ -1,15 +1,17 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF A + .TF /A2OSX.BOOT/A *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I + .INB INC/KERNEL.I .INB INC/IO.I .INB INC/MONITOR.I .INB INC/PRODOS.I @@ -27,11 +29,15 @@ A2osX.ReadBuff .EQ $6800 512 Buffer for MLIREAD01 Boot.Prefix .EQ $6A00 MLI.MAXPATH KM.Filename .EQ $6A80 MLI.MAXPATH *-------------------------------------- +Z80STACK .EQ $0FFF (0FFFFh) Down to $0F00 +Z80JMP .EQ $1000 +*-------------------------------------- A2osX.Start .EQ * .PH A2osX.RelocAddr -A2osX.Init0 ldx #$FF init 6502 stack to highest +A2osX.Init0 + + ldx #$FF init 6502 stack to highest txs - stx A2osX.SaveSM >LDYAI A2osX.Start >STYA TmpPtr1 @@ -50,16 +56,14 @@ A2osX.Init0 ldx #$FF init 6502 stack to highest inc TmpPtr2+1 dex bne .1 - + jmp A2osX.Init1 *-------------------------------------- -A2osX.Init1 jsr HOME +A2osX.Init1 bit RROMBNK1 + jsr HOME >LDAXI MSG.STAGE0 jsr PrintCStrAX - >LDYAI D.STACKSEG - >STYA R.SP init Soft Stack - >LDAXI MSG.SYSMEM jsr PrintCStrAX @@ -78,7 +82,10 @@ A2osX.Init1 jsr HOME >LDAXI MSG.CPU jsr PrintCStrAX jsr Init6502 Y = CPU type - sty A2osX.CPUTYPE + tya + ora #$60 + sta A2osX.CPUTYPE + lda MSG.CPUTYPEH,y tax lda MSG.CPUTYPEL,y @@ -110,17 +117,20 @@ A2osX.Prefix >LDAXI MSG.BOOTPREFIX *-------------------------------------- A2osX.RamDrv >LDAXI MSG.RAMDRV jsr PrintCStrAX + jsr DisableRamDRV bcc .2 + tax - beq .1 - >LDAXI MSG.RAMDRV.KO1 + bne .1 + >LDAXI MSG.RAMDRV.KO0 jsr PrintCStrAX bra A2osX.Z80 -.1 >LDAXI MSG.RAMDRV.KO0 +.1 >LDAXI MSG.RAMDRV.KO1 jsr PrintCStrAX bra A2osX.Z80 + .2 >LDAXI MSG.RAMDRV.OK jsr PrintCStrAX *-------------------------------------- @@ -137,8 +147,6 @@ A2osX.Z80 >LDAXI MSG.Z80 .1 >LDAXI MSG.Z80.KO jsr PrintCStrAX *-------------------------------------- -* WARNING : -*-------------------------------------- A2osX.SetupQC lda RRAMWRAMBNK2 lda RRAMWRAMBNK2 @@ -162,7 +170,7 @@ A2osX.MLIQuit >LDAXI MSG.STAGE0OK jsr PrintCStrAX >DEBUG - + jsr MLI .DA #MLIQUIT .DA MLIQUIT01 @@ -213,24 +221,30 @@ DisableRamDRV php beq .9 S3D2=NODEV, nothing to do .1 ldx DEVCNT + .2 lda DEVLST,x LOOKING FOR $BF, $BB, $B7, $B3 and #$F3 cmp #$B3 beq .3 + dex bpl .2 + plp lda #1 No device found, exit with error sec rts -.3 ldx #0 +.3 cpx DEVCNT + beq .5 + .4 lda DEVLST+1,x sta DEVLST,x inx cpx DEVCNT bne .4 +.5 ldx DEVCNT stz DEVLST,x dec DEVCNT @@ -239,6 +253,10 @@ DisableRamDRV php lda DEVPTRS0D1+1 sta DEVPTRS3D2+1 plp + + jsr MLI + .DA #MLIONLINE + .DA MLIONLINE01 clc Success!! rts @@ -247,7 +265,10 @@ DisableRamDRV php sec rts *-------------------------------------- -InitZ80 ldx #Z80Code.Size +InitZ80 sec + rts + + ldx #Z80Code.Size .1 lda Z80Code.Start-1,x sta $1000-1,x 00000H for Z80 dex @@ -435,7 +456,7 @@ MSG.Z80 >CSTRING "Detecting Z80 CPU..." MSG.Z80.OK >CSTRING "Detected In Slot %d.\n" MSG.Z80.KO >CSTRING "Not Detected.\n" MSG.KMENUM >CSTRING "Looking For Kernel Modules...\n" -MSG.KMLOAD >CSTRING "Loading KM : " +MSG.KMLOAD >CSTRING "\nLoading KM : " MSG.STAGE0OK >CSTRING "A2osX[Stage0]:Complete.\n" MSG.CPUTYPEL .DA #MSG.6502 .DA #MSG.65C02 @@ -452,6 +473,10 @@ MSG.65C816 >CSTRING "65C816.\n" *-------------------------------------- MLIGETPREFIX01 .DA #1 .DA Boot.Prefix +MLIONLINE01 .DA #2 + .DA #0 + .DA MLIONLINE01BUF +MLIONLINE01BUF .BS 256 MLIOPEN01 .DA #3 For DIR listing .DA Boot.Prefix .DA A2osX.OpenBuff1 diff --git a/A2osX.STARTUP.txt b/A2osX.STARTUP.txt index debf90fc..d903c454 100644 --- a/A2osX.STARTUP.txt +++ b/A2osX.STARTUP.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.BOOT NEW INC 1 AUTO 6 @@ -8,15 +8,16 @@ SET DRV=%A2OSX%DRV/ SET ETC=%A2OSX%ETC/ SET LIB=%A2OSX%LIB/ LOAD CONSOLE.DRV -EXEC GETTY KBD CON SHELL -*LOAD SSC.DRV 9600 N 8 1 -*EXEC GETTY COM2 COM2 SHELL +EXEC GETTY KBD CON LOGIN +*LOAD SSC.DRV 9600 N 8 1 X +*EXEC GETTY COM2 COM2 LOGIN *LOAD PPIC.DRV LOAD UTHERNET.DRV 000E3A123456 EXEC TCPIP ETH3 EXEC DHCPCLNT *EXEC TELNETD -*MOUNT TFTP 192.168.1.5:/AO2SX /TFTP +*MOUNT TFTP 192.168.1.5:/AO2SX /MNT/A2OSX +*MOUNT CIFS 192.168.1.5:/MSSHARE /MNT/MSSHARE LOAD DHGR.DRV LOAD MOUSE.DRV EXEC GUI diff --git a/BIN/ARP.S.txt b/BIN/ARP.S.txt index 42b0b187..b249c860 100644 --- a/BIN/ARP.S.txt +++ b/BIN/ARP.S.txt @@ -1,15 +1,16 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF BIN/ARP + .TF /A2OSX.BOOT/BIN/ARP *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/KERNEL.I .INB INC/LIBSTR.I .INB INC/LIBTCPIP.I @@ -18,20 +19,23 @@ ARP.TIMEOUT .EQ 50 50*100ms = 5 sec. *-------------------------------------- ZPPTR1 .EQ ZPBIN *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START + .DA DS.END-DS.START Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN - .DA CS.EVENT + .DA CS.DOEVENT .DA CS.QUIT L.LIBSTR .DA LIBSTR L.LIBTCPIP .DA LIBTCPIP @@ -42,17 +46,17 @@ L.MSG0 .DA MSG0 L.MSG1 .DA MSG1 L.MSG2 .DA MSG2 .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate *-------------------------------------- -CS.INIT >LIBLOADP L.LIBSTR +CS.INIT >LDYA L.LIBSTR + >LOADLIBYA sta hLIBSTR - >LIBLOADP L.LIBTCPIP + >LDYA L.LIBTCPIP + >LOADLIBYA sta hLIBTCPIP ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y beq CS.INIT.CACHE pha @@ -66,9 +70,9 @@ CS.INIT >LIBLOADP L.LIBSTR stz bCTRLC - lda (pPsContext) + lda (pPs) ora #S.PS.F.EVENT Now accept events - sta (pPsContext) + sta (pPs) rts CC,Give back control to CS.RUN @@ -152,8 +156,7 @@ CS.RUN lda #ARP.TIMEOUT .9 sec rts *-------------------------------------- -CS.EVENT >PULLW pEvent - lda (pEvent) +CS.DOEVENT lda (pEvent) and #S.EVT.F.TIMER is it a TIMER event? beq .1 no.... @@ -170,7 +173,7 @@ CS.EVENT >PULLW pEvent ldy #S.EVT.hDEV is Event from active IN device? lda (pEvent),y ldy #S.PS.hINDEV - cmp (pPsContext),y + cmp (pPs),y bne .9 ldy #S.EVT.DATAHI is it an O or SAPPLE key ? diff --git a/BIN/ASM.S.txt b/BIN/ASM.S.txt index 3369950b..16ebd1d3 100644 --- a/BIN/ASM.S.txt +++ b/BIN/ASM.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/BIN/CHTYP.S.txt b/BIN/CHTYP.S.txt index 306edfc3..c5559891 100644 --- a/BIN/CHTYP.S.txt +++ b/BIN/CHTYP.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/BIN/DNS.S.txt b/BIN/DNS.S.txt index 111862e2..ef9d6749 100644 --- a/BIN/DNS.S.txt +++ b/BIN/DNS.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/BIN/LS.S.txt b/BIN/LS.S.txt index f282604b..8da59e68 100644 --- a/BIN/LS.S.txt +++ b/BIN/LS.S.txt @@ -1,33 +1,37 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF BIN/LS + .TF /A2OSX.BOOT/BIN/LS *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/LIBSTR.I *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA DS.END-DS.START Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT .DA CS.QUIT -L.LIB.LIBSTR .DA LIB.LIBSTR +L.LIBSTR .DA LIBSTR L.MSG.VOL.HEADER .DA MSG.VOL.HEADER L.MSG.DIR.HEADER .DA MSG.DIR.HEADER L.MSG.VOL .DA MSG.VOL @@ -37,21 +41,21 @@ L.MSG.VOL.END .DA MSG.VOL.END L.MSG.DIR.END .DA MSG.DIR.END L.PRODOS.FT.TXT .DA PRODOS.FT.TXT .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate *-------------------------------------- -CS.INIT >LIBLOADP L.LIB.LIBSTR +CS.INIT >LDYA L.LIBSTR + >LOADLIBYA sta hLIBSTR - stz hDIRPATH - stz hS.LISTDIR - stz hVOLHEADER - stz hDIRHEADER - stz bSTOP - stz bCANCEL + + lda #0 + ldy #DS.END-DS.START-1 +.11 sta (pData),y + dey + bpl .11 ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y beq .1 + >SYSCALL SYS.GetMemPtrA >STYA ZPQuickPtr1 lda (ZPQuickPtr1) @@ -60,50 +64,52 @@ CS.INIT >LIBLOADP L.LIB.LIBSTR lda (ZPQuickPtr1),y cmp #'/' bne .10 + ldy #S.PS.hARGS - bra .2 + lda (pPs),y + bra .3 .10 ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >PUSHA ldy #S.PS.hPREFIX - lda (pPsContext),y + lda (pPs),y >PUSHA >SYSCALL SYS.PStrCat sta hDIRPATH bra .3 .1 ldy #S.PS.hPREFIX -.2 lda (pPsContext),y + lda (pPs),y .3 >SYSCALL SYS.ListDirInitA - bcs .98 - sta hS.LISTDIR + bcs .9 + ldy #hS.LISTDIR + sta (pData),y - lda (pPsContext) + lda (pPs) ora #S.PS.F.EVENT Now accept events - sta (pPsContext) + sta (pPs) clc rts -.98 pha - lda hLIBSTR - >SYSCALL SYS.FreeMemA - pla - sec +.9 sec rts *-------------------------------------- -CS.RUN lda bCANCEL +CS.RUN ldy #bCANCEL + lda (pData),y beq .1 sec rts -.1 lda bSTOP +.1 ldy #bSTOP + lda (pData),y beq .2 clc rts -.2 lda hS.LISTDIR +.2 ldy #hS.LISTDIR + lda (pData),y >SYSCALL SYS.ListDirNextA bcc .3 @@ -124,7 +130,8 @@ CS.RUN lda bCANCEL bne .31 pla - sta hVOLHEADER + ldy #hVOLHEADER + sta (pData),y >PUSHW ZPQuickPtr1 >PUSHW L.MSG.VOL.HEADER >LIBCALL hLIBSTR,LIBSTR.PRINTF @@ -135,8 +142,9 @@ CS.RUN lda bCANCEL bne .4 pla - sta hDIRHEADER - + ldy #hDIRHEADER + sta (pData),y + >PUSHW ZPQuickPtr1 >PUSHW L.MSG.DIR.HEADER >LIBCALL hLIBSTR,LIBSTR.PRINTF @@ -145,6 +153,7 @@ CS.RUN lda bCANCEL .4 cmp #$D0 Directory ? bne .5 + jsr Push.Dates jsr Push.Dir >PUSHW L.MSG.DIR @@ -263,13 +272,14 @@ Push.Dates ldy #$24 get modification time >PUSHA rts *-------------------------------------- -Push.Footer lda hVOLHEADER +Push.Footer ldy #hVOLHEADER + lda (pData),y beq .20 >SYSCALL SYS.GetMemPtrA >STYA ZPQuickPtr1 - ldy #22 file_count + ldy #$22 file_count lda (ZPQuickPtr1),y >PUSHA dey @@ -279,13 +289,14 @@ Push.Footer lda hVOLHEADER >PUSHW L.MSG.VOL.END >LIBCALL hLIBSTR,LIBSTR.PRINTF -.20 lda hDIRHEADER +.20 ldy #hDIRHEADER + lda (pData),y beq .21 >SYSCALL SYS.GetMemPtrA >STYA ZPQuickPtr1 - ldy #22 file_count + ldy #$22 file_count lda (ZPQuickPtr1),y >PUSHA dey @@ -301,47 +312,60 @@ Push.Footer lda hVOLHEADER CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device? lda (pEvent),y ldy #S.PS.hINDEV - cmp (pPsContext),y + cmp (pPs),y bne .9 + lda (pEvent) and #S.EVT.F.KEY is it a KEY event? beq .9 + ldy #S.EVT.DATAHI is it an O or SAPPLE key ? lda (pEvent),y bne .9 + ldy #S.EVT.DATALO lda (pEvent),y cmp #$03 Ctrl-C bne .1 + lda #$FF - sta bCANCEL + ldy #bCANCEL + sta (pData),y bra .8 + .1 cmp #$13 Ctrl-S bne .8 - lda bSTOP + + ldy #bSTOP + lda (pData),y eor #$FF - sta bSTOP -.8 >SYSCALL SYS.DestroyEvent - clc + sta (pData),y + +.8 clc rts .9 sec rts *-------------------------------------- -CS.QUIT lda hVOLHEADER +CS.QUIT ldy #hVOLHEADER + lda (pData),y beq .1 >SYSCALL SYS.FreeMemA -.1 lda hDIRHEADER +.1 ldy #hDIRHEADER + lda (pData),y beq .2 >SYSCALL SYS.FreeMemA -.2 lda hS.LISTDIR +.2 ldy #hS.LISTDIR + lda (pData),y + >SYSCALL SYS.ListDirCloseA - lda hDIRPATH + ldy #hDIRPATH + lda (pData),y beq .3 >SYSCALL SYS.FreeMemA @@ -352,7 +376,7 @@ CS.QUIT lda hVOLHEADER rts *-------------------------------------- CS.END -LIB.LIBSTR >PSTRING "libstr.o" +LIBSTR >PSTRING "libstr.o" MSG.VOL.HEADER >CSTRING "Volume Listing Of %S\n" MSG.DIR.HEADER >CSTRING "Directory Listing Of %S\n" MSG.VOL >CSTRING "/%S\n" @@ -373,9 +397,11 @@ TE2 >PSTRING "ATK" TFF >PSTRING "SYS" PRODOS.FT.DFLT >PSTRING "$ " HEXDIGIT .AS '0123456789ABCDEF' -*-------------------------------------- -DS.START hLIBSTR .BS 1 +*-------------------------------------- + .DUMMY + .OR 0 +DS.START hDIRPATH .BS 1 hS.LISTDIR .BS 1 hVOLHEADER .BS 1 @@ -383,6 +409,7 @@ hDIRHEADER .BS 1 bSTOP .BS 1 bCANCEL .BS 1 DS.END + .ED *-------------------------------------- MAN SAVE BIN/LS.S diff --git a/BIN/LSDEV.S.txt b/BIN/LSDEV.S.txt index c716cc40..ce666f40 100644 --- a/BIN/LSDEV.S.txt +++ b/BIN/LSDEV.S.txt @@ -1,15 +1,16 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF BIN/LSDEV + .TF /A2OSX.BOOT/BIN/LSDEV *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/KERNEL.I .INB INC/LIBSTR.I *-------------------------------------- @@ -17,17 +18,20 @@ ZPPTR1 .EQ ZPBIN ZPPTR2 .EQ ZPBIN+2 ZPPTR3 .EQ ZPBIN+4 *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA 0 Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.EVENT @@ -35,46 +39,25 @@ CS.START cld L.LIBSTR .DA LIBSTR L.MSG0 .DA MSG0 L.MSG1 .DA MSG1 -L.MSG2 .DA MSG2 .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA 0 Data Segment to Allocate *-------------------------------------- -CS.INIT >LIBLOADP L.LIBSTR -* bcs .9 +CS.INIT >LDYA L.LIBSTR + >LOADLIBYA + bcs .9 sta hLIBSTR - >SYSCALL SYS.GetDevTable + >LDYAI DevMgr.Table >STYA ZPPTR1 - stz DEV.COUNT + stz DEV.ID -L0 >PUSHW L.MSG0 + >PUSHW L.MSG0 >LIBCALL hLIBSTR,LIBSTR.PRINTF - lda #22 - sta LINE.COUNT -L1 lda (ZPPTR1) - bmi .1 - jmp L41 - -.1 ldy #S.DEV.hARGS - lda (ZPPTR1),y - beq L10 - >SYSCALL SYS.GetMemPtrA - >PUSHYA - bra L11 - -L10 >PUSHW L.MSG2 -L11 ldy #S.DEV.hCMD - lda (ZPPTR1),y - beq L12 - >SYSCALL SYS.GetMemPtrA - >PUSHYA - bra L13 +.1 lda (ZPPTR1) + cmp #$D8 + bne .8 -L12 >PUSHW L.MSG2 - -L13 lda ZPPTR1 + lda ZPPTR1 clc adc #S.DEV.NAME sta ZPPTR2 @@ -83,35 +66,27 @@ L13 lda ZPPTR1 sta ZPPTR2+1 >PUSHW ZPPTR2 - ldy #S.DEV.hOWNERPS - lda (ZPPTR1),y - >PUSHA Owner PSID - lda (ZPPTR1) push flags + ldy #S.DEV.F + lda (ZPPTR1),y push flags >PUSHA - ldy #S.DEV.ID - lda (ZPPTR1),y - >PUSHA DevID + >PUSHB DEV.ID >PUSHW L.MSG1 >LIBCALL hLIBSTR,LIBSTR.PRINTF -L4 dec LINE.COUNT -L41 lda ZPPTR1 + + lda ZPPTR1 clc adc #S.DEV.SIZE sta ZPPTR1 - bcc L5 + bcc .3 inc ZPPTR1+1 -L5 inc DEV.COUNT - lda DEV.COUNT + +.3 inc DEV.ID + lda DEV.ID cmp #K.DEV.MAX - beq L8 - lda LINE.COUNT - beq L6 - jmp L1 -L6 >DEBUG - jmp L0 + bne .1 -L8 lda #0 tell TSKMGR that all done ok, but - sec we do not want to stay in memory +.8 lda #0 tell TSKMGR that all done ok, but +.9 sec we do not want to stay in memory rts *-------------------------------------- CS.RUN @@ -119,21 +94,16 @@ CS.EVENT clc rts *-------------------------------------- CS.QUIT lda hLIBSTR - - bra * - >SYSCALL SYS.UnloadLibA clc rts *-------------------------------------- CS.END -hLIBSTR .BS 1 -DEV.COUNT .BS 1 -LINE.COUNT .BS 1 LIBSTR >PSTRING "libstr.o" -MSG0 >CSTRING "hDev Flags PID NAME CMD ARGS\n" -MSG1 >CSTRING " %03d %b $%h %4S %16S %32S\n" -MSG2 >PSTRING "(none)" +MSG0 >CSTRING "ID Flags Name\n" +MSG1 >CSTRING "%03d %b %4S\n" +hLIBSTR .BS 1 +DEV.ID .BS 1 MAN SAVE BIN/LSDEV.S ASM diff --git a/BIN/MD.S.txt b/BIN/MD.S.txt index e69de29b..ef70d7e6 100644 --- a/BIN/MD.S.txt +++ b/BIN/MD.S.txt @@ -0,0 +1,133 @@ +PR#3 +PREFIX /A2OSX.SRC +NEW +INC 1 +AUTO 6 + .LIST OFF + .OP 65C02 + .OR $2000 + .TF /A2OSX.BOOT/BIN/MD +*-------------------------------------- + .INB INC/MACROS.I + .INB INC/KERNEL.I + .INB INC/A2OSX.I + .INB INC/A2OSX.API.I + .INB INC/LIBSTR.I +*-------------------------------------- +ZPPTR1 .EQ ZPBIN +ZPPTR2 .EQ ZPBIN+2 +*-------------------------------------- +* File Header (16 Bytes) +*-------------------------------------- +CS.START cld + jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA 0 + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- +.1 .DA CS.INIT + .DA CS.RUN + .DA CS.DOEVENT + .DA CS.QUIT + .DA 0 +*-------------------------------------- +CS.INIT stz hFullPath + ldy #S.PS.hARGS + lda (pPs),y + beq .9 + + >SYSCALL SYS.GetMemPtrA + >STYA ZPQuickPtr1 + lda (ZPQuickPtr1) + beq .9 + + ldy #1 + lda (ZPQuickPtr1),y + cmp #'/' + bne .1 + + ldy #S.PS.hARGS + lda (pPs),y + bra .2 + +.1 ldy #S.PS.hARGS + lda (pPs),y + >PUSHA + ldy #S.PS.hPREFIX + lda (pPs),y + >PUSHA + >SYSCALL SYS.PStrCat + sta hFullPath + +.2 >SYSCALL SYS.MLICreateDirA + bcc .8 + + pha + jsr .8 + pla + sec + rts + +.8 lda hFullPath + beq .88 + >SYSCALL SYS.FreeMemA +.88 clc + rts + +.9 lda hFullPath + beq .99 + >SYSCALL SYS.FreeMemA +.99 lda #SYSMGR.ERRSYN + sec + rts +*-------------------------------------- +CS.RUN sec + rts +*-------------------------------------- +CS.DOEVENT sec + rts +*-------------------------------------- +CS.QUIT clc + rts +*-------------------------------------- +PRBYTE pha + lsr + lsr + lsr + lsr + ora #$B0 + cmp #$BA + bcc .1 + adc #6 +.1 jsr COUT + pla + and #$0F + ora #$B0 + cmp #$BA + bcc COUT + adc #6 + bra COUT +*-------------------------------------- +CROUT lda #13 +*-------------------------------------- +COUT phx + phy + ldx #DEVMGR.COUT + jsr pDevJmp + ply + plx + rts +pDevJmp jmp (pDev) +*-------------------------------------- +CS.END +hFullPath .BS 1 +*-------------------------------------- +MAN +SAVE BIN/MD.S +ASM diff --git a/BIN/MEM.S.txt b/BIN/MEM.S.txt index ea3af86e..51e121f0 100644 --- a/BIN/MEM.S.txt +++ b/BIN/MEM.S.txt @@ -1,31 +1,38 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF BIN/MEM + .TF /A2OSX.BOOT/BIN/MEM *-------------------------------------- .INB INC/MACROS.I + .INB INC/KERNEL.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/LIBSTR.I *-------------------------------------- +PAGELEN .EQ 22 +*-------------------------------------- ZPPTR1 .EQ ZPBIN ZPPTR2 .EQ ZPBIN+2 *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA DS.END-DS.START Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT @@ -38,55 +45,120 @@ L.MSG3 .DA MSG3 L.MSG4 .DA MSG4 L.MSG5 .DA MSG5 L.MSG6 .DA MSG6 -L.MSG7 .DA MSG7 .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate *-------------------------------------- -CS.INIT >LIBLOADP L.LIBSTR +CS.INIT >LDYA L.LIBSTR + >LOADLIBYA bcs .9 sta hLIBSTR - stz LINE.COUNT - stz MEM.COUNT - stz USED.COUNT - stz bSTOP - stz bCANCEL + lda #0 + ldy #DS.END-DS.START-1 - lda (pPsContext) +.1 sta (pData),y + dey + bpl .1 + + ldy #MEM.COUNT Skip SLOT0 + lda (pData),y + inc + sta (pData),y + + lda (pPs) ora #S.PS.F.EVENT Now accept events - sta (pPsContext) + sta (pPs) clc .9 rts *-------------------------------------- -CS.RUN lda bCANCEL - bne .99 - lda bSTOP +CS.RUN ldy #bCANCEL + lda (pData),y + bne .9 + + ldy #bSTOP + lda (pData),y bne .8 - lda LINE.COUNT + + ldy #LINE.COUNT + lda (pData),y bne .1 + >PUSHW L.MSG0 >LIBCALL hLIBSTR,LIBSTR.PRINTF -.1 lda MEM.COUNT +.1 ldy #MEM.COUNT + lda (pData),y >SYSCALL SYS.GetMemByIDA >STYA ZPPTR1 lda (ZPPTR1) bpl .2 - inc USED.COUNT + + ldy #USED.COUNT + lda (pData),y + inc + sta (pData),y + .2 jsr CS.RUN.PRINTMEM - inc MEM.COUNT - lda MEM.COUNT - cmp MEMMGR.TABLESIZE + ldy #MEM.COUNT + lda (pData),y + inc + sta (pData),y + cmp MemMgr.LastSlot beq .9 -.8 - clc +.8 clc rts .9 jsr CS.RUN.PRINTEND -.99 sec + sec + rts +*-------------------------------------- +CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device? + lda (pEvent),y + ldy #S.PS.hINDEV + cmp (pPs),y + bne .9 + + lda (pEvent) + and #S.EVT.F.KEY is it a KEY event? + beq .9 + + ldy #S.EVT.DATAHI is it an O or SAPPLE key ? + lda (pEvent),y + bne .9 + + ldy #S.EVT.DATALO + lda (pEvent),y + cmp #$03 Ctrl-C + bne .1 + + lda #$FF + ldy #bCANCEL + sta (pData),y + bra .8 + +.1 cmp #$13 Ctrl-S + bne .2 + + ldy #bSTOP + lda (pData),y + eor #$FF + sta (pData),y + bra .8 + +.2 ldy #bSTOP + lda #0 + sta (pData),y + +.8 clc + rts + +.9 sec + rts +*-------------------------------------- +CS.QUIT lda hLIBSTR + >SYSCALL SYS.UnloadLibA + clc rts *-------------------------------------- CS.RUN.PRINTMEM ldy #S.MEM.LEN @@ -96,6 +168,7 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN lda (ZPPTR1),y ply >PUSHYA + ldy #S.MEM.PTR lda (ZPPTR1),y pha @@ -103,18 +176,25 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN lda (ZPPTR1),y ply >PUSHYA + ldy #S.MEM.REFCNT lda (ZPPTR1),y >PUSHA + ldy #S.MEM.OWNERPID lda (ZPPTR1),y >PUSHA + lda (ZPPTR1) >PUSHA - lda MEM.COUNT + + ldy #MEM.COUNT + lda (pData),y >PUSHA + >PUSHW L.MSG1 >LIBCALL hLIBSTR,LIBSTR.PRINTF + ldy #S.MEM.BIN lda (ZPPTR1),y bne .3 @@ -132,15 +212,18 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN lda #"|" jsr COUT ldy #1 + .1 lda (ZPPTR2),y ora #$80 cmp #$A0 bcs .2 + ora #$20 .2 jsr COUT iny cpy #40 bne .1 + lda #"}" jsr COUT bra .4 @@ -150,84 +233,52 @@ CS.RUN.PRINTMEM ldy #S.MEM.LEN >LIBCALL hLIBSTR,LIBSTR.PRINTP .4 jsr CROUT - inc LINE.COUNT - lda LINE.COUNT - cmp #22 + ldy #LINE.COUNT + lda (pData),y + inc + sta (pData),y + cmp #PAGELEN bne .5 + lda #$FF - sta bSTOP - stz LINE.COUNT + ldy #bSTOP + sta (pData),y + + ldy #LINE.COUNT + lda #0 + sta (pData),y + .5 rts *-------------------------------------- -CS.RUN.PRINTEND >PUSHB MEM.COUNT - >PUSHB USED.COUNT +CS.RUN.PRINTEND ldy #MEM.COUNT + >PUSHB (pData),y + ldy #USED.COUNT + >PUSHB (pData),y >PUSHW L.MSG2 >LIBCALL hLIBSTR,LIBSTR.PRINTF - >PUSHW MEMMGR.LOMEM + >PUSHW MemMgr.HiMem >PUSHW L.MSG3 >LIBCALL hLIBSTR,LIBSTR.PRINTF - >PUSHW MEMMGR.MLLIMIT + >PUSHW MemMgr.Free >PUSHW L.MSG4 >LIBCALL hLIBSTR,LIBSTR.PRINTF - - >PUSHW MEMMGR.MHLIMIT + + >PUSHW MemMgr.LoMem >PUSHW L.MSG5 >LIBCALL hLIBSTR,LIBSTR.PRINTF - - >PUSHW MEMMGR.HIMEM + + lda MemMgr.Free + sec + sbc MemMgr.LoMem + tay + lda MemMgr.Free+1 + sbc MemMgr.LoMem+1 + + >PUSHYA >PUSHW L.MSG6 >LIBCALL hLIBSTR,LIBSTR.PRINTF - - >PUSHW MEMMGR.MFREE - >PUSHW L.MSG7 - >LIBCALL hLIBSTR,LIBSTR.PRINTF - rts -*-------------------------------------- -CS.DOEVENT >PULLW pEvent - ldy #S.EVT.hDEV is Event from active IN device? - lda (pEvent),y - ldy #S.PS.hINDEV - cmp (pPsContext),y - bne .9 - - lda (pEvent) - and #S.EVT.F.KEY is it a KEY event? - beq .9 - - ldy #S.EVT.DATAHI is it an O or SAPPLE key ? - lda (pEvent),y - bne .9 - - ldy #S.EVT.DATALO - lda (pEvent),y - cmp #$03 Ctrl-C - bne .1 - lda #$FF - sta bCANCEL - bra .8 - -.1 cmp #$13 Ctrl-S - bne .2 - lda bSTOP - eor #$FF - sta bSTOP - bra .8 - -.2 lda bSTOP - beq .8 - stz bSTOP - -.8 >SYSCALL SYS.DestroyEvent - clc - rts -.9 sec - rts -*-------------------------------------- -CS.QUIT lda hLIBSTR - >SYSCALL SYS.UnloadLibA - clc rts *-------------------------------------- PRBYTE pha @@ -252,33 +303,34 @@ CROUT lda #13 *-------------------------------------- COUT phx phy - >PUSHA - ldy #S.PS.hOUTDEV - lda (pPsContext),y - >SYSCALL SYS.DevOutA + ldx #DEVMGR.COUT + jsr pDevJmp ply plx rts +pDevJmp jmp (pDev) *-------------------------------------- CS.END -DS.START -*-------------------------------------- +LIBSTR >PSTRING "libstr.o" +MSG0 >CSTRING "hMem Flags PID REF PTR LEN BINPATH/DATA\n" +MSG1 >CSTRING " %03d %b $%h $%h $%H $%H " +MSG2 >CSTRING "\nAllocated hMem:%d, Total:%d\n" +MSG3 >CSTRING "High Memory: $%H\n" +MSG4 >CSTRING "Free ULimit: $%H\n" +MSG5 >CSTRING "Low Memory: $%H\n" +MSG6 >CSTRING "\nFree Memory: %D Bytes.\n" hLIBSTR .BS 1 +*-------------------------------------- + .DUMMY + .OR 0 +DS.START LINE.COUNT .BS 1 MEM.COUNT .BS 1 USED.COUNT .BS 1 bSTOP .BS 1 bCANCEL .BS 1 -LIBSTR >PSTRING "libstr.o" -MSG0 >CSTRING "hMem Flags PID REF PTR LEN BINPATH/DATA\n" -MSG1 >CSTRING " %03d %b $%h $%h $%H $%H " -MSG2 >CSTRING "\nAllocated hMem:%d, Total:%d\n" -MSG3 >CSTRING "Low Memory: $%H\n" -MSG4 >CSTRING "Low Free PTR: $%H\n" -MSG5 >CSTRING "High Free PTR: $%H\n" -MSG6 >CSTRING "High Memory: $%H\n" -MSG7 >CSTRING "\nFree Memory: %D Bytes.\n" DS.END + .ED *-------------------------------------- MAN SAVE BIN/MEM.S diff --git a/BIN/NETCFG.S.txt b/BIN/NETCFG.S.txt index eea2293c..3ad69086 100644 --- a/BIN/NETCFG.S.txt +++ b/BIN/NETCFG.S.txt @@ -1,15 +1,16 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF BIN/NETCFG + .TF /A2OSX.BOOT/BIN/NETCFG *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/KERNEL.I .INB INC/LIBSTR.I .INB INC/LIBTCPIP.I @@ -17,17 +18,20 @@ AUTO 6 ZPPTR1 .EQ ZPBIN ZPPTR2 .EQ ZPBIN+2 *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA 0 Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT @@ -49,10 +53,9 @@ L.MSG1.HOSTNAME .DA MSG1.HOSTNAME L.MSG1.DOMAIN .DA MSG1.DOMAIN L.MSG1.END .DA MSG1.END .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segemnt to Allocate *-------------------------------------- -CS.INIT >LIBLOADP L.LIBSTR +CS.INIT >LDYA L.LIBSTR + >LOADLIBYA sta hLIBSTR lda #K.PROTOID.IP @@ -195,12 +198,7 @@ MSG1.DNS >CSTRING " DNS : %d.%d.%d.%d,%d.%d.%d.%d\n" MSG1.HOSTNAME >CSTRING " Hostname : %s" MSG1.DOMAIN >CSTRING ".%s" MSG1.END >CSTRING "\nEnd of network configuration.\n" -*-------------------------------------- -DS.START -*-------------------------------------- hLIBSTR .BS 1 -*-------------------------------------- -DS.END MAN SAVE BIN/NETCFG.S ASM diff --git a/BIN/PING.S.txt b/BIN/PING.S.txt index d72929be..b37a6aee 100644 --- a/BIN/PING.S.txt +++ b/BIN/PING.S.txt @@ -1,15 +1,16 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF BIN/PING + .TF /A2OSX.BOOT/BIN/PING *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/KERNEL.I .INB INC/LIBSTR.I .INB INC/LIBTCPIP.I @@ -20,44 +21,44 @@ ZPFrameBase1 .EQ ZPBIN ZPFrameLen1 .EQ ZPBIN+2 ZPFramePtr1 .EQ ZPBIN+4 *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA DS.END-DS.START Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN - .DA CS.EVENT + .DA CS.DOEVENT .DA CS.QUIT L.LIBSTR .DA LIBSTR L.LIBTCPIP .DA LIBTCPIP L.SSCANF.IP .DA SSCANF.IP -L.DST.IP .DA DST.IP L.MSG0 .DA MSG0 L.MSG1 .DA MSG1 L.MSG2 .DA MSG2 L.MSG3 .DA MSG3 .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate *-------------------------------------- CS.INIT ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y bne .1 lda #SYSMGR.ERRSYN sec rts -.1 >LIBLOADP L.LIBSTR +.1 >LDYA L.LIBSTR + >LOADLIBYA sta hLIBSTR - >LIBLOADP L.LIBTCPIP + >LDYA L.LIBTCPIP + >LOADLIBYA sta hLIBTCPIP >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ? @@ -72,45 +73,52 @@ CS.INIT ldy #S.PS.hARGS sta hDev lda A2OSX.RANDOM16 - sta Identifier + ldy #Identifier + sta (pData),y lda A2OSX.RANDOM16+1 - sta Identifier+1 + iny + sta (pData),y - stz Sequence - stz Sequence+1 + lda #0 + ldy #Sequence + sta (pData),y + iny + sta (pData),y - lda (pPsContext) + lda (pPs) ora #S.PS.F.EVENT Now accept events - sta (pPsContext) + sta (pPs) clc .9 rts *-------------------------------------- -CS.RUN >PUSHW L.DST.IP +CS.RUN >PUSHW pData DST.IP >PUSHW L.SSCANF.IP ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >SYSCALL SYS.GetMemPtrA >PUSHYA >LIBCALL hLIBSTR,LIBSTR.SSCANF bcc CS.RUN.IPOK lda #PING.TIMEOUT - sta TimeOut - -CS.RUN.DNSQUERY >PUSHW L.DST.IP + ldy #TimeOut + sta (pData),y + +CS.RUN.DNSQUERY >PUSHW pData DST.IP ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >PUSHA >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.QUERY bcc CS.RUN.IPOK jsr A2osX.SLEEP - lda TimeOut + ldy #TimeOut + lda (pData),y bne CS.RUN.DNSQUERY ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >SYSCALL SYS.GetMemPtrA >PUSHYA >PUSHW L.MSG0 @@ -120,24 +128,37 @@ CS.RUN.DNSQUERY >PUSHW L.DST.IP CS.RUN.RTS rts CS.RUN.IPOK ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >SYSCALL SYS.GetMemPtrA >PUSHYA - >PUSHB DST.IP+3 - >PUSHB DST.IP+2 - >PUSHB DST.IP+1 - >PUSHB DST.IP + ldy #3 + >PUSHB (pData),y DST.IP+3 + dey + >PUSHB (pData),y DST.IP+2 + dey + >PUSHB (pData),y DST.IP+1 + >PUSHB (pData) DST.IP >PUSHW L.MSG1 >LIBCALL hLIBSTR,LIBSTR.PRINTF CS.RUN.ECHO >LIBCALL hLIBTCPIP,LIBTCPIP.NEW.ICMP.FRAME bcs CS.RUN.RTS >STYA ZPFrameBase1 - stx hFrame + txa + ldy #hFrame + sta (pData),y + + ldx #3 + ldy #0 +.10 lda (pData),y + pha + iny + dex + bpl .10 ldx #3 ldy #S.IP.DST+3 -.1 lda DST.IP,x +.1 pla sta (ZPFrameBase1),y dey dex @@ -147,63 +168,92 @@ CS.RUN.ECHO >LIBCALL hLIBTCPIP,LIBTCPIP.NEW.ICMP.FRAME lda #S.ICMP.TYPE.ECHOREQ sta (ZPFrameBase1),y - ldy #S.ICMP.IDENTIFIER - lda Identifier - sta (ZPFrameBase1),y + ldy #Identifier + lda (pData),y + tax iny - lda Identifier+1 + lda (pData),y + + ldy #S.ICMP.IDENTIFIER+1 + sta (ZPFrameBase1),y + dey + txa sta (ZPFrameBase1),y - inc Sequence + ldy #Sequence+1 + lda (pData),y + tax + dey + lda (pData),y + inc + sta (pData),y bne .2 - inc Sequence+1 + pha + inx + txa + sta (pData),y + pla .2 ldy #S.ICMP.SEQUENCE - lda Sequence sta (ZPFrameBase1),y iny - lda Sequence+1 + txa sta (ZPFrameBase1),y lda #PING.TIMEOUT - sta TimeOut + ldy #TimeOut + sta (pData),y .3 >PUSHWI S.ICMP+32 - lda hFrame + ldy #hFrame + lda (pData),y >SYSCALL SYS.GetMemPtrA >PUSHYA >LIBCALL hLIBTCPIP,LIBTCPIP.SEND.ICMP.FRAME bcc .4 jsr A2osX.SLEEP - lda TimeOut + ldy #TimeOut + lda (pData),y bne .3 -.4 lda hFrame +.4 ldy #hFrame + lda (pData),y >SYSCALL SYS.FreeMemA - stz bReply + ldy #bReply + lda #0 + sta (pData),y lda #PING.TIMEOUT - sta TimeOut + ldy #TimeOut + sta (pData),y CS.RUN.WAIT jsr A2osX.SLEEP - lda bReply + ldy #bReply + lda (pData),y bne .1 - lda bCTRLC + ldy #bCTRLC + lda (pData),y bne CS.RUN.ERROR - lda TimeOut + ldy #TimeOut + lda (pData),y bne CS.RUN.WAIT - >PUSHB DST.IP+3 - >PUSHB DST.IP+2 - >PUSHB DST.IP+1 - >PUSHB DST.IP + ldy #3 + >PUSHB (pData),y DST.IP+3 + dey + >PUSHB (pData),y DST.IP+2 + dey + >PUSHB (pData),y DST.IP+1 + >PUSHB (pData) DST.IP >PUSHW L.MSG2 >LIBCALL hLIBSTR,LIBSTR.PRINTF -.1 lda bCTRLC +.1 ldy #bCTRLC + lda (pData),y bne CS.RUN.ERROR - lda TimeOut + ldy #TimeOut + lda (pData),y beq .2 jsr A2osX.SLEEP @@ -214,14 +264,16 @@ CS.RUN.WAIT jsr A2osX.SLEEP CS.RUN.ERROR sec rts *-------------------------------------- -CS.EVENT lda (pEvent) +CS.DOEVENT lda (pEvent) and #S.EVT.F.TIMER is it a TIMER event? beq .1 no.... - lda TimeOut + ldy #TimeOut + lda (pData),y beq .10 - dec TimeOut + dec + sta (pData),y .10 sec do not discard TIMER event rts @@ -232,7 +284,7 @@ CS.EVENT lda (pEvent) ldy #S.EVT.hDEV is Event from active IN device? lda (pEvent),y ldy #S.PS.hINDEV - cmp (pPsContext),y + cmp (pPs),y bne .9 ldy #S.EVT.DATAHI is it an O or SAPPLE key ? @@ -245,7 +297,8 @@ CS.EVENT lda (pEvent) bne .8 lda #$FF - sta bCTRLC + ldy #bCTRLC + sta (pData),y bra .8 .2 lda (pEvent) @@ -275,15 +328,19 @@ CS.EVENT lda (pEvent) ldy #S.ICMP.IDENTIFIER lda (ZPFrameBase1),y - cmp Identifier - bne .9 + tax iny lda (ZPFrameBase1),y - cmp Identifier+1 + ldy #Identifier+1 + cmp (pData),y bne .9 + dey + txa + cmp (pData),y + bne .9 + jsr CS.EVENT.REPLY -.8 >SYSCALL SYS.DestroyEvent - clc +.8 clc rts .9 sec @@ -304,7 +361,7 @@ CS.EVENT.REPLY lda #PING.TIMEOUT adc #K.TIMER16RESOLUTION*20 sta TimeOut.ms bcc .2 - inc TimeOut+1+1 + inc TimeOut .2 dey bne .1 @@ -329,7 +386,10 @@ CS.EVENT.REPLY lda #PING.TIMEOUT >PUSHW L.MSG3 >LIBCALL hLIBSTR,LIBSTR.PRINTF - inc bReply + ldy #bReply + lda (pData),y + inc + sta (pData),y rts *-------------------------------------- CS.QUIT lda hLIBTCPIP @@ -347,20 +407,23 @@ MSG0 >CSTRING "%S: Unknown host\n" MSG1 >CSTRING "PING %d.%d.%d.%d (%S)\n" MSG2 >CSTRING "%d.%d.%d.%d: TimeOut/Host unreachable\n" MSG3 >CSTRING "32 bytes from %d.%d.%d.%d, icmp_seq=%D, ttl=%d, time=%D ms\n" -*-------------------------------------- -DS.START hLIBSTR .BS 1 hLIBTCPIP .BS 1 hDev .BS 1 +TimeOut.ms .BS 2 +*-------------------------------------- + .DUMMY + .OR 0 +DS.START DST.IP .BS 4 hFrame .BS 1 TimeOut .BS 1 -TimeOut.ms .BS 2 Identifier .BS 2 Sequence .BS 2 bCTRLC .BS 1 bReply .BS 1 DS.END + .ED *-------------------------------------- MAN SAVE BIN/PING.S diff --git a/BIN/PS.S.txt b/BIN/PS.S.txt index 49dce0d7..26d1bf63 100644 --- a/BIN/PS.S.txt +++ b/BIN/PS.S.txt @@ -1,15 +1,16 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF BIN/PS + .TF /A2OSX.BOOT/BIN/PS *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/KERNEL.I .INB INC/LIBSTR.I *-------------------------------------- @@ -17,17 +18,20 @@ ZPPTR1 .EQ ZPBIN ZPPTR2 .EQ ZPBIN+2 ZPPTR3 .EQ ZPBIN+4 *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA 0 Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT @@ -37,13 +41,14 @@ L.MSG0 .DA MSG0 L.MSG1 .DA MSG1 L.MSG2 .DA MSG2 .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA 0 Data Segment to Allocate *-------------------------------------- -CS.INIT >LIBLOADP L.LIBSTR +CS.INIT >LDYA L.LIBSTR + >LOADLIBYA sta hLibStr - - >LDYAI TSKMGR.TABLE + clc + rts +*-------------------------------------- +CS.RUN >LDYAI TSKMGR.TABLE+S.PS.SIZE >STYA ZPPTR1 stz PS.COUNT @@ -52,13 +57,17 @@ CS.INIT >LIBLOADP L.LIBSTR .1 lda (ZPPTR1) bpl .4 + ldy #S.PS.hARGS lda (ZPPTR1),y beq .2 + >SYSCALL SYS.GetMemPtrA >PUSHYA bra .3 + .2 >PUSHW L.MSG2 + .3 ldy #S.PS.hCMD lda (ZPPTR1),y >SYSCALL SYS.GetMemPtrA @@ -83,17 +92,16 @@ CS.INIT >LIBLOADP L.LIBSTR sta ZPPTR1 bcc .5 inc ZPPTR1+1 + .5 inc PS.COUNT lda PS.COUNT cmp #K.PS.MAX - beq .8 - jmp .1 + bne .1 -.8 lda #0 tell TSKMGR that all done ok, but + lda #0 tell TSKMGR that all done ok, but sec we do not want to stay in memory rts *-------------------------------------- -CS.RUN CS.DOEVENT clc rts *-------------------------------------- @@ -106,8 +114,8 @@ CS.END hLibStr .BS 1 PS.COUNT .BS 1 LIBSTR >PSTRING "libstr.o" -MSG0 >CSTRING "hPS Flags PID CMD ARGS\n" -MSG1 >CSTRING " %03d %b $%h %16S %32S\n" +MSG0 >CSTRING "ID Flags PID CMD ARGS\n" +MSG1 >CSTRING "%03d %b %03d %16S %32S\n" MSG2 >PSTRING "(none)" MAN SAVE BIN/PS.S diff --git a/BIN/TEST.S.txt b/BIN/TEST.S.txt index 97daaeb7..9a244b65 100644 --- a/BIN/TEST.S.txt +++ b/BIN/TEST.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/BIN/_TEMPLATE.S.txt b/BIN/_TEMPLATE.S.txt index aa02877d..0f6d986b 100644 --- a/BIN/_TEMPLATE.S.txt +++ b/BIN/_TEMPLATE.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/DRV/CONSOLE.DRV.S.txt b/DRV/CONSOLE.DRV.S.txt index b84ee5ba..f2ddf4cd 100644 --- a/DRV/CONSOLE.DRV.S.txt +++ b/DRV/CONSOLE.DRV.S.txt @@ -1,45 +1,73 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF DRV/CONSOLE.DRV + .TF /A2OSX.BOOT/DRV/CONSOLE.DRV *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I + .INB INC/KERNEL.I .INB INC/IO.I *-------------------------------------- +CURSOR.BLINK.SPEED .EQ 2 +*-------------------------------------- ZPBASL1 .EQ ZPDRV ZPBASL2 .EQ ZPDRV+2 *-------------------------------------- -* Main DRV entry point -* input : -* X = CMD -* 0 : OPEN -* 2 : GETEVENT -* 6 : OUT -* 8 : CLOSE -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE -*-------------------------------------- -CURSOR.BLINK.SPEED .EQ 2 +* File Header (16 Bytes) *-------------------------------------- CS.START cld - jmp (.1,x) -.1 .DA OPEN + jmp Dev.Detect cld,jmp abs=DRV + .DA #$61 6502,Level 1 (65c02) + .DA #1 DRV Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length + .DA DEV.HEADER-CS.START Device Header Offset + .DA DRV.CS.START-CS.START Driver Code Offset + .DA DRV.CS.END-DRV.CS.START Drv Code Length +*-------------------------------------- +* Relocation Table +*-------------------------------------- +L.MSG.DETECT .DA MSG.DETECT + .DA 0 End Of Reloc Table +*-------------------------------------- +Dev.Detect >LDYA L.MSG.DETECT + >SYSCALL SYS.SysScrPPSTRYA + + lda A2osX.SCREENS + ora #A2osX.SCREENS.C + sta A2osX.SCREENS + + clc + rts +CS.END +MSG.DETECT >PSTRING "\nApple IIe/IIc 80 Col Driver." +*-------------------------------------- +* Device Header (16 Bytes) +*-------------------------------------- +DEV.HEADER cld + jmp (DRV.CS.START,x) + .DA #S.DEV.F.EVENT+S.DEV.F.COUT+S.DEV.F.CHAR + >PSTRING "CON" NAME + .HS 00 NAME must Be 5 bytes long + .HS 00.00 + .HS 00.00.00.00 +*-------------------------------------- +* Driver Code +*-------------------------------------- +DRV.CS.START .DA OPEN .DA GETEVENT - .DA OUT + .DA COUT .DA CLOSE .DA GETINFO + .DA IRQ +L.DEVINFO .DA DEVINFO .DA 0 end or relocation - .DA CS.END-CS.START Code Length To Relocate - .DA 0 Data Segemnt to Allocate *-------------------------------------- OPEN stz CURON lda #$80 @@ -47,31 +75,10 @@ OPEN stz CURON jsr HOME - lda #S.DEV.F.CHAR+S.DEV.F.EVENT+S.DEV.F.OUT - sta (pDevContext) - - ldy #S.DEV.NAME - ldx #0 -.1 lda DEVNAME,x - sta (pDevContext),y - cpx DEVNAME - beq .8 - inx - iny - bne .1 - -.8 lda A2osX.SCREENS - ora #A2osX.SCREENS.C - sta A2osX.SCREENS - - lda #A2osX.SCREENS.C - >SYSCALL SYS.ScreenSelectA - clc rts *-------------------------------------- -GETEVENT >PULLW pEvent - lda A2osX.TIMER16 +GETEVENT lda A2osX.TIMER16 and #CURSOR.BLINK.SPEED eor CURON beq .9 @@ -81,24 +88,24 @@ GETEVENT >PULLW pEvent sec rts *-------------------------------------- -OUT >PULLA - jsr COUT +COUT jsr COUT1 clc rts *-------------------------------------- -CLOSE lda A2osX.SCREENS - and #$FF^A2osX.SCREENS.C - sta A2osX.SCREENS +CLOSE +* lda A2osX.SCREENS +* and #$FF^A2osX.SCREENS.C +* sta A2osX.SCREENS clc rts *-------------------------------------- -GETINFO clc +GETINFO >LDYA L.DEVINFO +IRQ clc rts - *-------------------------------------- * PRIVATE *-------------------------------------- -COUT cmp #8 +COUT1 cmp #8 bne .2 ldx CH beq .10 @@ -113,7 +120,8 @@ COUT cmp #8 sta CH dec CV -.12 lda #$A0 +.12 lda #$20 + ora INVFLG ldx CH ldy CV jsr SetCharAtXY @@ -121,6 +129,7 @@ COUT cmp #8 .2 cmp #13 beq CROUT + ora INVFLG ldx CH ldy CV jsr SetCharAtXY @@ -131,14 +140,19 @@ FSOUT ldx CH rts *-------------------------------------- CROUT jsr CLREOL +*-------------------------------------- CROUT1 stz CH ldy CV cpy #23 beq SCROLL.UP inc CV rts - +*-------------------------------------- SCROLL.UP ldx #0 + + lda RD80STORE + pha + sta SET80STORE .1 lda BASEL,x @@ -169,13 +183,18 @@ SCROLL.UP ldx #0 cpx #23 bne .1 + jsr CLREOL + pla + bmi .8 + sta CLR80STORE - +.8 rts *-------------------------------------- CLREOL ldx CH .1 phx ldy CV - lda #$A0 + lda #$20 + ora INVFLG jsr SetCharAtXY plx inx @@ -186,8 +205,6 @@ CLREOL ldx CH HOME stz CH stz CV - lda RDPAGE2 - pha lda RD80STORE pha @@ -221,23 +238,15 @@ HOME stz CH bpl .1 pla - bmi .4 + bmi .8 sta CLR80STORE - bra .5 -.4 sta SET80STORE - -.5 pla - bmi .6 - sta CLRPAGE2 - bra .8 -.6 sta SETPAGE2 .8 rts *-------------------------------------- CUROFF lda CURON beq CUREXIT.RTS -CURBLNK lda A2osX.ACTIVESCRN +CURBLNK lda A2osX.ASCREEN and #A2osX.SCREENS.C bne CURBLNK1 @@ -268,8 +277,6 @@ CUREXIT lda CURON CUREXIT.RTS rts *-------------------------------------- SetCharAtXY pha - lda RDPAGE2 - pha lda RD80STORE pha sta SET80STORE @@ -287,23 +294,16 @@ SetCharAtXY pha lda BASEH,y sta ZPBASL1+1 - ply plx pla sta (ZPBASL1) - tya - bmi .3 + txa + bmi .8 sta CLR80STORE -.3 txa - bpl .4 - sta SETPAGE2 - rts -.4 sta CLRPAGE2 - rts + +.8 rts *-------------------------------------- -GetCharAtXY lda RDPAGE2 - pha - lda RD80STORE +GetCharAtXY lda RD80STORE pha sta SET80STORE txa @@ -323,28 +323,22 @@ GetCharAtXY lda RDPAGE2 lda (ZPBASL1) plx - bmi .3 + bmi .8 sta CLR80STORE -.3 plx - bpl .4 - - sta SETPAGE2 - rts - -.4 sta CLRPAGE2 - rts +.8 rts *-------------------------------------- -CS.END -DEVNAME >PSTRING "CON" +DRV.CS.END +BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0 +BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07 CH .BS 1 CV .BS 1 INVFLG .BS 1 CURON .BS 1 CURCHAR .BS 1 -*-------------------------------------- -BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0 -BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07 +DEVINFO .DA #S.DEVINFO.TYPE.CHAR + .DA #80 + .DA #24 *-------------------------------------- MAN SAVE DRV/CONSOLE.DRV.S diff --git a/DRV/DHGR.DRV.S.txt b/DRV/DHGR.DRV.S.txt index b6881735..47ee3248 100644 --- a/DRV/DHGR.DRV.S.txt +++ b/DRV/DHGR.DRV.S.txt @@ -1,73 +1,81 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF DRV/DHGR.DRV + .TF /A2OSX.BOOT/DRV/DHGR.DRV *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I + .INB INC/KERNEL.I .INB INC/IO.I *-------------------------------------- ZPBASE .EQ ZPDRV ZPCOLOR .EQ ZPDRV+2 *-------------------------------------- -* Main DRV entry point -* input : -* X = CMD -* 0 : OPEN -* 2 : GETEVENT -* 6 : OUT -* 8 : CLOSE -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld - jmp (.1,x) -.1 .DA OPEN + jmp Dev.Detect cld,jmp abs=DRV + .DA #$61 6502,Level 1 (65c02) + .DA #1 DRV Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length + .DA DEV.HEADER-CS.START Device Header Offset + .DA DRV.CS.START-CS.START Driver Code Offset + .DA DRV.CS.END-DRV.CS.START Drv Code Length +*-------------------------------------- +* Relocation Table +*-------------------------------------- +L.MSG.DETECT .DA MSG.DETECT + .DA 0 End Of Reloc Table +*-------------------------------------- +Dev.Detect >LDYA L.MSG.DETECT + >SYSCALL SYS.SysScrPPSTRYA + + lda A2osX.SCREENS + ora #A2osX.SCREENS.G + sta A2osX.SCREENS + + clc + rts +CS.END +MSG.DETECT >PSTRING "\nApple IIe/IIc DoubleHGR Driver." +*-------------------------------------- +* Device Header (16 Bytes) +*-------------------------------------- +DEV.HEADER cld + jmp (DRV.CS.START,x) + .DA #0 + >PSTRING "GFX" NAME + .HS 00 NAME must Be 5 bytes long + .HS 00.00 + .HS 00.00.00.00 +*-------------------------------------- +* Driver Code +*-------------------------------------- +DRV.CS.START .DA OPEN .DA GETEVENT - .DA OUT + .DA COUT .DA CLOSE .DA GETINFO + .DA IRQ .DA SETPIXEL .DA GETPIXEL .DA HLINE .DA VLINE - .DA FILLREC .DA BITBLT + .DA FILLREC L.DEVINFO .DA DEVINFO .DA 0 end or relocation - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate *-------------------------------------- -OPEN lda #S.DEV.F.GFX - sta (pDevContext) +OPEN sta SETHIRES + sta SET80STORE prepare for page switching - ldy #S.DEV.NAME - ldx #0 -.1 lda DEVNAME,x - sta (pDevContext),y - cpx DEVNAME - beq .8 - inx - iny - bne .1 - - -.8 lda A2osX.SCREENS - ora #A2osX.SCREENS.G - sta A2osX.SCREENS - - lda #A2osX.SCREENS.G - >SYSCALL SYS.ScreenSelectA - - sta SET80STORE ldx #192 .81 dex @@ -77,61 +85,37 @@ OPEN lda #S.DEV.F.GFX lda BASEH,x sta ZPBASE+1 - lda #$D5 - + lda #$55 +* lda #$00 + ldy #39 sta SETPAGE2 .82 sta (ZPBASE),y dey bpl .82 - lda #$AA - + lda #$2A +* lda #$00 + ldy #39 sta CLRPAGE2 .83 sta (ZPBASE),y dey bpl .83 - dex - - lda BASEL,x - sta ZPBASE - lda BASEH,x - sta ZPBASE+1 - - lda #$2A - - ldy #39 - sta SETPAGE2 -.84 sta (ZPBASE),y - dey - bpl .84 - - lda #$55 - - ldy #39 - sta CLRPAGE2 -.85 sta (ZPBASE),y - dey - bpl .85 - txa bne .81 >DEBUG - clc rts *-------------------------------------- GETEVENT -OUT clc +COUT +IRQ sec rts *-------------------------------------- -CLOSE lda A2osX.SCREENS - and #$FF^A2osX.SCREENS.G - sta A2osX.SCREENS - clc +CLOSE clc rts *-------------------------------------- GETINFO >LDYA L.DEVINFO @@ -139,104 +123,139 @@ GETINFO >LDYA L.DEVINFO rts *-------------------------------------- * SETPIXEL -*-------------------------------------- -* PULLB = X.LO -* PULLB = X.HI -* PULLB = Y * PULLB = Mode -* 00000001=mono +* 00000001=B/W * 00000010=16 colors * 1000000=xor (mono on 1 bit) +* PULLW = X +* PULLB = Y * PULLB = Color (if not xor) *-------------------------------------- -SETPIXEL >PULLA X.LO - tax - >PULLA X.HI +SETPIXEL sta SETHIRES + sta SET80STORE prepare for page switching + + >PULLA Pull Mode + and #$FF + bpl SETPIXEL.1 + +SETPIXEL.XOR >PULLYA Y=X.LO,A=X.HI lsr if 256 =< x < 511 bcs .1 lsr bcs .2 if 512 < x - ldy DIV7.0,x - lda MOD7.0,x + lda DIV7.0,y + ldx MOD7.0,y bra .3 -.1 ldy DIV7.256,x - lda MOD7.256,x +.1 lda DIV7.256,y + ldx MOD7.256,y bra .3 -.2 ldy DIV7.512,x - lda MOD7.512,x +.2 lda DIV7.512,y + ldx MOD7.512,y -.3 pha save MOD,y=DIV +.3 lsr + tay + bcs .4 odd=main ram + sta SETPAGE2 + bra .5 +.4 sta CLRPAGE2 + +.5 >PULLA Pull Y + tax + lda BASEL,x setup line Base Ptr + sta ZPBASE + lda BASEH,x + sta ZPBASE+1 + lda (ZPBASE),y + eor Mono.Masks,x + sta (ZPBASE),y + rts +*-------------------------------------- +SETPIXEL.1 lsr + bcc SETPIXEL.COLOR + + >PULLYA Y=X.LO,A=X.HI + lsr if 256 =< x < 511 + bcs .1 + lsr + bcs .2 if 512 < x + lda DIV7.0,y + ldx MOD7.0,y + bra .3 + +.1 lda DIV7.256,y + ldx MOD7.256,y + bra .3 + +.2 lda DIV7.512,y + ldx MOD7.512,y + +.3 lsr + tay + bcs .4 odd=main ram + sta SETPAGE2 + bra .5 +.4 sta CLRPAGE2 + +.5 phx >PULLA Pull Y tax lda BASEL,x setup line Base Ptr sta ZPBASE lda BASEH,x sta ZPBASE+1 - - sta SET80STORE and prepare for page switching - sta SETHIRES - plx get back MOD in x - - >PULLA Pull Mode - and #$FF - bpl SETPIXEL.SOLID - -SETPIXEL.XOR tya - lsr - tay - bcs .1 odd=main ram - sta SETPAGE2 - bra .2 -.1 sta CLRPAGE2 -.2 lda (ZPBASE),y - eor Mono.Masks,x - sta (ZPBASE),y - rts -*-------------------------------------- -* A=Mode,X=MOD,Y=DIV -*-------------------------------------- -SETPIXEL.SOLID dec - bne SETPIXEL.COLOR - tya - lsr - tay - bcs .1 odd=main ram - sta SETPAGE2 - bra .2 -.1 sta CLRPAGE2 - -.2 >PULLA get COLOR + plx + + >PULLA Pull Color lsr - bcs .3 set white pixel + bcs .6 set white pixel lda (ZPBASE),y and Mono.NMasks,x includes And $7F for mono sta (ZPBASE),y rts -.3 lda (ZPBASE),y +.6 lda (ZPBASE),y and #$7F switch back this byte to mono ora Mono.Masks,x sta (ZPBASE),y rts *-------------------------------------- -* X=MOD,Y=DIV -*-------------------------------------- -SETPIXEL.COLOR tya - lsr Divide Col by 2 to get in range 0->39 - and #$FE make it 0->38 as color mask on 4 bytes - clc +SETPIXEL.COLOR >PULLA Get X.LO... + pha + >PULLB GBYTE Get X.HI in temp location + pla + lsr GBYTE divide by 4 (range 0->139) + ror + lsr GBYTE + ror + tay + + >PULLA Pull Y + tax + lda BASEL,x setup line Base Ptr + sta ZPBASE + lda BASEH,x + sta ZPBASE+1 + + lda DIV7.0,y + + asl Carry Cleared, by ASL adc ZPBASE ZPBASE now point to first of the 4 columns sta ZPBASE + + + ldx MOD7.0,y + txa get MOD asl times 4 to compute index in color tables - asl + asl tax set in X for Masks,NMasks >PULLA get COLOR + asl asl tay @@ -310,7 +329,68 @@ FILLREC BITBLT rts *-------------------------------------- -CS.END +DRV.CS.END +*-------------------------------------- +Mono.NMasks .DA #%01111110 + .DA #%01111101 + .DA #%01111011 + .DA #%01110111 + .DA #%01101111 + .DA #%01011111 + .DA #%00111111 +*-------------------------------------- +Mono.Masks .DA #%00000001 + .DA #%00000010 + .DA #%00000100 + .DA #%00001000 + .DA #%00010000 + .DA #%00100000 + .DA #%01000000 +*-------------------------------------- +* bits to "and" to reset color of pixel (0 means nothing to do) +*-------------------------------------- +* c1110000 c3322221 c5444433 c6666555 +Color.NMasks .DA #%01110000,#%00000000,#%00000000,#%00000000 + .DA #%00001111,#%01111110,#%00000000,#%00000000 + .DA #%00000000,#%01100001,#%00000000,#%00000000 + .DA #%00000000,#%00011111,#%01111100,#%00000000 + .DA #%00000000,#%00000000,#%01000011,#%00000000 + .DA #%00000000,#%00000000,#%00111111,#%01111000 + .DA #%00000000,#%00000000,#%00000000,#%00000111 +*-------------------------------------- +* bits to "and" to Get color of pixel (0 means nothing to do) +* 4 bytes * 7 mods +*-------------------------------------- +* c1110000 c3322221 c5444433 c6666555 +Color.Masks .DA #%10001111,#%00000000,#%00000000,#%00000000 + .DA #%11110000,#%00000001,#%00000000,#%00000000 + .DA #%00000000,#%10011110,#%00000000,#%00000000 + .DA #%00000000,#%11100000,#%00000011,#%00000000 + .DA #%00000000,#%00000000,#%10111100,#%00000000 + .DA #%00000000,#%00000000,#%11000000,#%00000111 + .DA #%00000000,#%00000000,#%00000000,#%11111000 +*-------------------------------------- +* bits to "ora" to set color of pixel (including "color bit set" for byte hosting bit0) +* 4 bytes * 16 Colors +*-------------------------------------- +* c1110000 c3322221 c5444433 c6666555 +Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 black (color bit disable) + .DA #%10010001,#%10100010,#%11000100,#%10001000 dark blue + .DA #%10100010,#%11000100,#%10001000,#%10010001 dark green + .DA #%10110011,#%11100110,#%11001100,#%10011001 medium blue + .DA #%11000100,#%10001000,#%10010001,#%10100010 brown + .DA #%11010101,#%10101010,#%11010101,#%10101010 grey2 + .DA #%11100110,#%11001100,#%10011001,#%10110011 green + .DA #%11110111,#%11101110,#%11011101,#%10111011 aqua + .DA #%10001000,#%10010001,#%10100010,#%11000100 Magenta + .DA #%10011001,#%10110011,#%11100110,#%11001100 violet + .DA #%10101010,#%11010101,#%10101010,#%11010101 grey1 + .DA #%10111011,#%11110111,#%11101110,#%11011101 light blue + .DA #%11001100,#%10011001,#%10110011,#%11100110 orange + .DA #%11011101,#%10111011,#%11110111,#%11101110 pink + .DA #%11101110,#%11011101,#%10111011,#%11110111 yellow + .DA #%01111111,#%01111111,#%01111111,#%01111111 white (color bit disable) +*-------------------------------------- DIV7.0 .HS 0000000000000001010101010101 .HS 0202020202020203030303030303 .HS 0404040404040405050505050505 @@ -447,98 +527,12 @@ BASEH .HS 20.24.28.2C.30.34.38.3C .HS 23.27.2B.2F.33.37.3B.3F .HS 23.27.2B.2F.33.37.3B.3F *-------------------------------------- -Mono.NMasks .DA #%01111110 - .DA #%01111101 - .DA #%01111011 - .DA #%01110111 - .DA #%01101111 - .DA #%01011111 - .DA #%00111111 -*-------------------------------------- -Mono.Masks .DA #%00000001 - .DA #%00000010 - .DA #%00000100 - .DA #%00001000 - .DA #%00010000 - .DA #%00100000 - .DA #%01000000 -*-------------------------------------- -* bits to "and" to reset color of pixel (0 means nothing to do) -*-------------------------------------- -Color.NMasks .DA #%01110000,#%00000000,#%00000000,#%00000000 - .DA #%00001111,#%01111110,#%00000000,#%00000000 - .DA #%00000000,#%01100001,#%00000000,#%00000000 - .DA #%00000000,#%00011111,#%01111100,#%00000000 - .DA #%00000000,#%00000000,#%01000011,#%00000000 - .DA #%00000000,#%00000000,#%00111111,#%01111000 - .DA #%00000000,#%00000000,#%00000000,#%00000111 -*-------------------------------------- -* bits to "and" to Get color of pixel (0 means nothing to do) -* 4 bytes * 7 mods -*-------------------------------------- -Color.Masks.DEL .DA #%00001111,#%00000000,#%00000000,#%00000000 (nothing to do) - .DA #%01110000,#%00000001,#%00000000,#%00000000 asl0,asl0,rol1,asl0,rol1,asl0,rol1 - .DA #%00000000,#%00011110,#%00000000,#%00000000 lsr1 - .DA #%00000000,#%01100000,#%00000011,#%00000000 asl1,asl1,rol2,asl1,rol2 - .DA #%00000000,#%00000000,#%00111100,#%00000000 lsr2,lsr2 - .DA #%00000000,#%00000000,#%01000000,#%00000111 asl2,asl2,rol3 - .DA #%00000000,#%00000000,#%00000000,#%01111000 lsr3,lsr3,lsr3 -*-------------------------------------- -Color.Masks .DA #%10001111,#%00000000,#%00000000,#%00000000 - .DA #%11110000,#%00000001,#%00000000,#%00000000 - .DA #%00000000,#%10011110,#%00000000,#%00000000 - .DA #%00000000,#%11100000,#%00000011,#%00000000 - .DA #%00000000,#%00000000,#%10111100,#%00000000 - .DA #%00000000,#%00000000,#%11000000,#%00000111 - .DA #%00000000,#%00000000,#%00000000,#%11111000 -*-------------------------------------- -* bits to "ora" to set color of pixel (including "color bit set " for byte hosting bit0) -* 4 bytes * 16 Colors -* pixel masks c1110000.c3322221.c5444433.c6666555 -*-------------------------------------- -Color.Pixels .DA #%00000000,#%00000000,#%00000000,#%00000000 (color bit disable) - .DA #%10010001,#%10100010,#%11000100,#%10001000 - .DA #%10100010,#%11000100,#%10001000,#%10010001 - .DA #%10110011,#%11100110,#%11001100,#%10011001 - .DA #%11000100,#%10001000,#%10010001,#%10100010 - .DA #%11010101,#%10101010,#%11010101,#%10101010 - .DA #%11100110,#%11001100,#%10011001,#%10110011 - .DA #%11110111,#%11101110,#%11011101,#%10111011 - .DA #%10001000,#%10010001,#%10100010,#%11000100 - .DA #%10011001,#%10110011,#%11100110,#%11001100 - .DA #%10101010,#%11010101,#%10101010,#%11010101 - .DA #%10111011,#%11110111,#%11101111,#%11011101 - .DA #%11001100,#%10011001,#%10110011,#%11100110 - .DA #%11011101,#%10111011,#%11110111,#%11101110 - .DA #%11101110,#%11011101,#%10111011,#%11110111 - .DA #%01111111,#%01111111,#%01111111,#%01111111 (color bit disable) - -*Black 00 00 00 00 0000 -*Magenta 08 11 22 44 0001 -*Brown 44 08 11 22 0010 -*Orange 4C 19 33 66 0011 -*Dark Green 22 44 08 11 0100 -*Grey1 2A 55 2A 55 0101 -*Green 66 4C 19 33 0110 -*Yellow 6E 5D 3B 77 0111 -*Dark Blue 11 22 44 08 1000 -*Violet 19 33 66 4C 1001 -*Grey2 55 2A 55 2A 1010 -*Pink 5D 3B 77 6E 1011 -*Medium Blue 33 66 4C 19 1100 -*Light Blue 3B 77 6E 5D 1101 -*Aqua 77 6E 5D 3B 1110 -*White 7F 7F 7F 7F 1111 -*-------------------------------------- -DEVNAME >PSTRING "GFX" GBYTE .BS 1 *-------------------------------------- -DS.START -DEVINFO .DA #S.DEV.F.GFX type of DEVINFO STRUCT +DEVINFO .DA #S.DEVINFO.TYPE.GFX type of DEVINFO STRUCT DEVINFO.MODES .DA #%10000011 XOR,16 & B/W DEVINFO.W .DA 560 X.SIZE DEVINFO.H .DA 192 Y.SIZE -DS.END *-------------------------------------- MAN SAVE DRV/DHGR.DRV.S diff --git a/DRV/MOUSE.DRV.S.txt b/DRV/MOUSE.DRV.S.txt index 11c1b508..9ad10cec 100644 --- a/DRV/MOUSE.DRV.S.txt +++ b/DRV/MOUSE.DRV.S.txt @@ -1,16 +1,17 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF DRV/MOUSE.DRV + .TF /A2OSX.BOOT/DRV/MOUSE.DRV *-------------------------------------- .INB INC/MACROS.I .INB INC/IO.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I *-------------------------------------- ZPGoMouse .EQ ZPDRV ZPTmpPtr1 .EQ ZPDRV+2 @@ -43,29 +44,30 @@ MOUSESTSx.DOWN .EQ %10000000 MOUSESTSx.LDOWN .EQ %01000000 MOUSESTSx.MOVED .EQ %00100000 *-------------------------------------- -* Main DRV entry point -* input : -* X = CMD -* 0 : OPEN -* 2 : GETEVENT -* 4 : OUT -* 6 : CLOSE -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld - jmp (.1,x) -.1 .DA OPEN - .DA GETEVENT - .DA OUT - .DA CLOSE - .DA 0 end or relocation - .DA CS.END-CS.START + jmp Dev.Detect cld,jmp abs=DRV + .DA #$61 6502,Level 1 (65c02) + .DA #1 DRV Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length + .DA DEV.HEADER-CS.START Device Header Offset + .DA DRV.CS.START-CS.START Driver Code Offset + .DA DRV.CS.END-DRV.CS.START Drv Code Length *-------------------------------------- -OPEN stz ZPTmpPtr1 +* Relocation Table +*-------------------------------------- +L.MSG.DETECT .DA MSG.DETECT +L.MSG.DETECT.OK .DA MSG.DETECT.OK +L.MSG.DETECT.KO .DA MSG.DETECT.KO +L.DEV.HEADER.NAME .DA DEV.HEADER.NAME + .DA 0 End Of Reloc Table +*-------------------------------------- +Dev.Detect >LDYA L.MSG.DETECT + >SYSCALL SYS.SysScrPPSTRYA + + stz ZPTmpPtr1 lda #$C1 sta ZPTmpPtr1+1 @@ -77,44 +79,66 @@ OPEN stz ZPTmpPtr1 bne .3 dex bpl .2 - bra .10 + bra .4 .3 inc ZPTmpPtr1+1 no match, try next slot.... lda ZPTmpPtr1+1 cmp #$C8 bne .1 + >LDYA L.MSG.DETECT.KO + >SYSCALL SYS.SysScrPPSTRYA + lda #DEVMGR.ERRNOHW Not Found in any slot, exiting sec rts -.10 lda ZPTmpPtr1+1 +.4 lda ZPTmpPtr1+1 + sta DEVSLOTCn and #$0F sta DEVSLOT0n - pha ora #$30 - sta DEVNAME+4 - pla - ora #$C0 - sta DEVSLOTCn + sta DEV.HEADER.NAME+4 asl asl asl asl sta DEVSLOTn0 - ldx #0 - ldy #S.DEV.NAME - -.4 lda DEVNAME,x - sta (pDevContext),y - cpx DEVNAME - beq .5 - inx - iny - bne .4 - -.5 bit RROMBNK2 Renable ROM to allow MOUSE II firmware + >LDYA L.MSG.DETECT.OK + >SYSCALL SYS.SysScrPPSTRYA + >LDYA L.DEV.HEADER.NAME + >SYSCALL SYS.SysScrPPSTRYA + clc + rts +*-------------------------------------- +CS.END +MSG.DETECT >PSTRING "\nApple II Mouse Driver." +MSG.DETECT.OK >PSTRING "\nMouse Card Driver Installed As Device : " +MSG.DETECT.KO >PSTRING "\nMouse Card Not Found." +*-------------------------------------- +* Device Header (16 Bytes) +*-------------------------------------- +DEV.HEADER cld + jmp (DRV.CS.START,x) + .DA #S.DEV.F.EVENT +DEV.HEADER.NAME >PSTRING "MOU1" NAME + .HS 00.00 + .HS 00.00.00.00 +*-------------------------------------- +* Driver Code +*-------------------------------------- +DRV.CS.START .DA OPEN + .DA GETEVENT + .DA COUT + .DA CLOSE + .DA GETINFO + .DA IRQ +L.DEVINFO .DA DEVINFO + .DA 0 end or relocation +*-------------------------------------- +OPEN +* bit RROMBNK2 Renable ROM to allow MOUSE II firmware php to read IIe ROM ID bytes sei @@ -156,19 +180,15 @@ OPEN stz ZPTmpPtr1 jsr GOMOUSE pla - bpl .6 + bpl .1 sta SET80STORE -.6 plp +.1 plp - lda #S.DEV.F.MOUSE+S.DEV.F.EVENT - sta (pDevContext) clc rts *-------------------------------------- -GETEVENT >PULLW pEvent - - php +GETEVENT php sei lda RD80STORE @@ -205,7 +225,7 @@ GETEVENT >PULLW pEvent ora #EVENT.MOUSEMOVE sta (pEvent),y - ldy #S.EVT.DATAW1 +.4 ldy #S.EVT.DATAW1 lda MOUSEXLOx,x sta (pEvent),y iny @@ -218,7 +238,7 @@ GETEVENT >PULLW pEvent lda MOUSEYHIx,x sta (pEvent),y -.4 pla + pla bpl .5 sta SET80STORE @@ -235,7 +255,8 @@ GETEVENT >PULLW pEvent .9 sec A=0 : no event rts *-------------------------------------- -OUT clc +COUT +IRQ sec rts *-------------------------------------- CLOSE php @@ -247,6 +268,10 @@ CLOSE php clc rts *-------------------------------------- +GETINFO >LDYA L.DEVINFO + clc + rts +*-------------------------------------- GOMOUSE pha stz ZPGoMouse ldx DEVSLOTCn @@ -257,15 +282,15 @@ GOMOUSE pha pla jmp (ZPGoMouse) *-------------------------------------- -CS.END +DRV.CS.END DEVSIG.Offset .HS 05070B0CFB DEVSIG.Value .HS 38180120D6 DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset -DEVNAME >PSTRING "MOU0" DEVSLOT0n .BS 1 DEVSLOTCn .BS 1 DEVSLOTn0 .BS 1 *-------------------------------------- +DEVINFO .DA #S.DEVINFO.TYPE.XY MAN SAVE DRV/MOUSE.DRV.S ASM diff --git a/DRV/PPIC.DRV.S.txt b/DRV/PPIC.DRV.S.txt index 80e8ccd0..e91731ea 100644 --- a/DRV/PPIC.DRV.S.txt +++ b/DRV/PPIC.DRV.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -69,12 +69,12 @@ OPEN stz ZPTmpPtr1 sta DEVNAME+4 lda #S.DEV.F.CHAR+S.DEV.F.OUT - sta (DEVMGR.DEVPTR) + sta (pDev) ldy #S.DEV.NAME ldx #0 .7 lda DEVNAME,x - sta (DEVMGR.DEVPTR),y + sta (pDev),y cpx DEVNAME beq .8 inx diff --git a/DRV/SSC.DRV.S.txt b/DRV/SSC.DRV.S.txt index 072052d3..f5f26e6a 100644 --- a/DRV/SSC.DRV.S.txt +++ b/DRV/SSC.DRV.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -11,12 +11,46 @@ AUTO 6 .INB INC/MACROS.I .INB INC/A2OSX.I *-------------------------------------- -ZPTmpPtr1 .EQ ZPDRV +BUF.SIZE .EQ $20 +BUF.MASK .EQ $1F *-------------------------------------- -SIG.05 .EQ $38 -SIG.07 .EQ $18 -SIG.0B .EQ $01 -SIG.0C .EQ $31 +ZPGoCard .EQ ZPDRV +ZPTmpPtr1 .EQ ZPDRV+2 +*-------------------------------------- +* Pascal 1.1 Protocol +*-------------------------------------- +SSC.INIT .EQ $0D +SSC.READ .EQ $0E +SSC.WRITE .EQ $0F +SSC.STATUS .EQ $10 +*-------------------------------------- +* SSC/ACIA I/O +*-------------------------------------- +SSC.REG.DIPSW1 .EQ $C081 R +SSC.REG.DIPSW2 .EQ $C082 R +SSC.REG.DATA .EQ $C088 R,W +SSC.REG.RESET .EQ $C089 W +SSC.REG.STATUS .EQ $C089 R +SSC.REG.STATUS.IRQ .EQ %10000000 +SSC.REG.STATUS.DSR .EQ %01000000 +SSC.REG.STATUS.DCD .EQ %00100000 +SSC.REG.STATUS.TDRF .EQ %00010000 +SSC.REG.STATUS.RDRF .EQ %00001000 +SSC.REG.STATUS.OE .EQ %00000100 +SSC.REG.STATUS.FE .EQ %00000010 +SSC.REG.STATUS.PE .EQ %00000001 +SSC.REG.CMD .EQ $C08A W +SSC.REG.CMD.ODDP .EQ %00100000 +SSC.REG.CMD.EVENP .EQ %01100000 +SSC.REG.CMD.MARKP .EQ %10100000 +SSC.REG.CMD.SPACEP .EQ %11100000 +SSC.REG.CMD.ECHO .EQ %00010000 +SSC.REG.CMD.TE .EQ %00001000 +SSC.REG.CMD.TEIRQ .EQ %00000100 +SSC.REG.CMD.TBRK .EQ %00001100 +SSC.REG.CMD.RIRQDIS .EQ %00000010 +SSC.REG.CMD.DTR .EQ %00000001 +SSC.REG.CTL .EQ $C08B W *-------------------------------------- * Main DRV entry point * input : @@ -25,6 +59,8 @@ SIG.0C .EQ $31 * 2 : GETEVENT * 4 : OUT * 6 : CLOSE +* 8 : GETINFO +* 10 : IRQ *-------------------------------------- * CLD $D8 * JMP (*,x) $7C @@ -33,53 +69,81 @@ SIG.0C .EQ $31 *-------------------------------------- CS.START cld jmp (.1,x) + .DA CS.END-CS.START + .DA 0 .1 .DA OPEN .DA GETEVENT .DA OUT .DA CLOSE + .DA GETINFO +L.IRQ .DA IRQ +L.DEVINFO .DA DEVINFO .DA 0 end or relocation - .DA CS.END-CS.START *-------------------------------------- OPEN stz ZPTmpPtr1 lda #$C1 sta ZPTmpPtr1+1 -.1 ldy #5 - lda (ZPTmpPtr1),y - cmp #SIG.05 - bne .2 - ldy #7 - lda (ZPTmpPtr1),y - cmp #SIG.07 - bne .2 - - ldy #$B - lda (ZPTmpPtr1),y - cmp #SIG.0B - bne .2 - - ldy #$C - lda (ZPTmpPtr1),y - cmp #SIG.0C - beq .3 +.1 ldx #DEVSIG.Length-1 -.2 inc ZPTmpPtr1+1 +.2 ldy DEVSIG.Offset,x + lda (ZPTmpPtr1),y + cmp DEVSIG.Value,x + bne .3 + dex + bpl .2 + bra .4 + +.3 inc ZPTmpPtr1+1 no match, try next slot.... lda ZPTmpPtr1+1 cmp #$C8 bne .1 - beq .99 -.3 lda ZPTmpPtr1+1 + lda #DEVMGR.ERRNOHW Not Found in any slot, exiting + sec + rts + +.4 lda ZPTmpPtr1+1 + sta DEVSLOTCn and #$0F - sta DEVSLOT + sta DEVSLOT0n ora #$30 sta DEVNAME+4 + asl + asl + asl + asl + sta DEVSLOTn0 - lda #S.DEV.F.CHAR+S.DEV.F.OUT - sta (pDevContext) - ldy #S.DEV.NAME +* ldy #SSC.INIT +* jsr GoCard + ldx DEVSLOTn0 + + stz SSC.REG.RESET,x + lda #$1E + sta SSC.REG.CTL,x + + stz INBUF.PTR + stz INBUF.CNT + stz OUTBUF.PTR + stz OUTBUF.CNT + + >PUSHW L.IRQ + >PUSHBI 4 + >SYSCALL SYS.MLIAllocIRQ + bcs * + + php + sei + ldx DEVSLOTn0 + lda #SSC.REG.CMD.TEIRQ+SSC.REG.CMD.DTR + sta SSC.REG.CMD,x + + lda SSC.REG.STATUS,x clear any IRQ pending + plp ldx #0 + ldy #S.DEV.NAME .7 lda DEVNAME,x sta (pDevContext),y cpx DEVNAME @@ -87,25 +151,166 @@ OPEN stz ZPTmpPtr1 inx iny bne .7 + + lda #S.DEV.F.CHAR+S.DEV.F.OUT+S.DEV.F.EVENT + sta (pDevContext) + .8 clc rts -.99 lda #DEVMGR.ERRNOHW - sec - rts *-------------------------------------- -GETEVENT lda #0 +GETEVENT >PULLW pEvent + + php + sei + lda INBUF.CNT + beq .9 + + ldx INBUF.PTR + lda INBUF,x + ldy #S.EVT.DATA + sta (pEvent),y + + iny + lda #0 + sta (pEvent),y + + lda #S.EVT.F.KEY + sta (pEvent) + + inx + cpx #BUF.SIZE + bne .1 + ldx #0 + +.1 stx INBUF.PTR + dec INBUF.CNT + + + plp + clc + rts + +.9 plp + lda #0 sec rts *-------------------------------------- -OUT clc +OUT php + sei + + ldx DEVSLOTn0 + lda SSC.REG.STATUS,x + and #SSC.REG.STATUS.DCD+SSC.REG.STATUS.DSR + beq .9 + + ldx OUTBUF.CNT + cpx #BUF.SIZE + beq .9 + + >PULLA + ldx OUTBUF.PTR + sta OUTBUF,x + inx + cpx #BUF.SIZE + bne .1 + ldx #0 + +.1 stx OUTBUF.PTR + inc OUTBUF.CNT + + plp + clc + rts + +.9 >PULLA + plp + sec rts *-------------------------------------- CLOSE clc rts *-------------------------------------- +GETINFO >LDYA L.DEVINFO + clc + rts +*-------------------------------------- +* IRQ Handler +* on exit, CS if handled +*-------------------------------------- +IRQ cld + + ldx DEVSLOTn0 + lda SSC.REG.STATUS,x IRQ from this device ? +* bpl .9 no, exit + pha save status ... + and #SSC.REG.STATUS.RDRF incoming char? + beq .1 + + ldy SSC.REG.DATA,x read data to clear IRQ + lda INBUF.CNT + cmp #BUF.SIZE + beq .1 buffer full, discard + phy + clc + adc INBUF.PTR + and #BUF.MASK + tay + pla get back data + sta INBUF,y + inc INBUF.CNT + +.1 pla get back status + and #SSC.REG.STATUS.TDRF + beq .8 + + lda OUTBUF.CNT something to transmit ? + beq .8 no, exit + + clc + adc OUTBUF.PTR + and #BUF.MASK + tay + + lda OUTBUF,Y + sta SSC.REG.DATA,x + + dec INBUF.CNT + +.8 clc + rts + +.9 sec + rts +*-------------------------------------- +* PRIVATE +*-------------------------------------- +GOCARD sta $CFFF Prevent SSC firmware bug + pha + stz ZPGoCard + ldx DEVSLOTCn + stx ZPGoCard+1 + lda (ZPGoCard),y + sta ZPGoCard + ldy DEVSLOTn0 + pla + jmp (ZPGoCard) +*-------------------------------------- CS.END +DEVSIG.Offset .HS 05070B0C +DEVSIG.Value .HS 38180131 +DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset DEVNAME >PSTRING "COM0" -DEVSLOT .BS 1 +DEVSLOT0n .BS 1 +DEVSLOTCn .BS 1 +DEVSLOTn0 .BS 1 +INBUF.PTR .BS 1 +INBUF.CNT .BS 1 +OUTBUF.PTR .BS 1 +OUTBUF.CNT .BS 1 +INBUF .BS BUF.SIZE +OUTBUF .BS BUF.SIZE +DEVINFO .DA #S.DEV.F.CHAR+S.DEV.F.OUT+S.DEV.F.EVENT + .DA #0 *-------------------------------------- MAN SAVE DRV/SSC.DRV.S diff --git a/DRV/UTHERNET.DRV.S.txt b/DRV/UTHERNET.DRV.S.txt index b0303e76..0a2ad0d5 100644 --- a/DRV/UTHERNET.DRV.S.txt +++ b/DRV/UTHERNET.DRV.S.txt @@ -1,16 +1,17 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF DRV/UTHERNET.DRV + .TF /A2OSX.BOOT/DRV/UTHERNET.DRV *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I -* .INB INC/ZP.I + .INB INC/A2OSX.API.I + .INB INC/KERNEL.I *-------------------------------------- ZPTmpPTR .EQ ZPDRV *-------------------------------------- @@ -110,39 +111,28 @@ ERRTNOFRAME .EQ 0 ERRNOBUFFER .EQ 1 ERRTIMEOUT .EQ 2 *-------------------------------------- -* Main DRV entry point -* input : -* X = CMD -* 0 : OPEN -* 2 : GETEVENT -* 4 : OUT -* 6 : CLOSE -* 8 : GETINFO -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld - jmp (.1,x) -.1 .DA OPEN - .DA GETEVENT - .DA OUT - .DA CLOSE - .DA GETINFO -L.DEVINFO .DA DEVINFO - .DA 0 end or relocation - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate + jmp Dev.Detect cld,jmp abs=DRV + .DA #$61 6502,Level 1 (65c02) + .DA #1 DRV Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length + .DA DEV.HEADER-CS.START Device Header Offset + .DA DRV.CS.START-CS.START Driver Code Offset + .DA DRV.CS.END-DRV.CS.START Drv Code Length *-------------------------------------- -* input : -* none -* output : -* CC on success -* CS on error -*-------------------------------------- -OPEN ldx #$10 +* Relocation Table +*-------------------------------------- +L.MSG.DETECT .DA MSG.DETECT + .DA 0 End Of Reloc Table +*-------------------------------------- +Dev.Detect sta hArgs + >LDYA L.MSG.DETECT + >SYSCALL SYS.SysScrPPSTRYA + + ldx #$10 .1 stx DEVSLOTx0 >LDYAI PP.ID >STYA PacketPagePTR,x @@ -151,18 +141,21 @@ OPEN ldx #$10 bne .2 cmp /DEVID beq .3 -.2 inc DEVNAME+4 + +.2 inc DEV.HEADER.NAME+4 txa clc adc #$10 tax cpx #$80 bne .1 + lda #DEVMGR.ERRNOHW sec rts -.3 ldy #S.DEV.hARGS - lda (pDevContext),y + +.3 lda hARGS + beq .4 >SYSCALL SYS.GetMemPtrA >STYA ZPTmpPTR @@ -172,8 +165,93 @@ OPEN ldx #$10 sec rts -.4 jsr Reset - +.4 clc + rts +*-------------------------------------- +DecodeMac lda (ZPTmpPTR) + cmp #12 + bne .9 + + ldy #1 + ldx #0 + +.1 lda (ZPTmpPTR),y + jsr Asc2NibbleA + bcs .9 + + asl + asl + asl + asl + sta MAC,x + + iny + lda (ZPTmpPTR),y + jsr Asc2NibbleA + bcs .9 + + ora MAC,x + sta MAC,x + inx + iny + cpy #13 + bne .1 + + clc + rts + +.9 sec + rts +*-------------------------------------- +Asc2NibbleA cmp #$30 + bcc .9 + cmp #$3A + bcs .1 + and #$0F + clc + rts +.1 cmp #$41 + bcc .9 + cmp #$47 + bcs .9 + sbc #$36 + clc + rts +.9 sec + rts +*-------------------------------------- +CS.END +MSG.DETECT >PSTRING "\nUtherNet/CS8900A Driver." +hArgs .BS 1 +*-------------------------------------- +* Device Header (16 Bytes) +*-------------------------------------- +DEV.HEADER cld + jmp (DRV.CS.START,x) + .DA #S.DEV.F.SHARE+S.DEV.F.EVENT +DEV.HEADER.NAME >PSTRING "ETH1" NAME + .HS 00.00 + .HS 00.00.00.00 +*-------------------------------------- +* Driver Code +*-------------------------------------- +DRV.CS.START .DA OPEN + .DA GETEVENT + .DA $FFFF no COUT + .DA CLOSE + .DA GETINFO + .DA $FFFF no IRQ + .DA SEND +L.DEVINFO .DA DEVINFO + .DA 0 end or relocation +*-------------------------------------- +* input : +* none +* output : +* CC on success +* CS on error +*-------------------------------------- +OPEN jsr Reset >LDYAI PP.RxCTL >STYA PacketPagePTR,x >LDYAI PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA @@ -197,18 +275,7 @@ OPEN ldx #$10 >LDYAI PP.LineCTL.LID+PP.LineCTL.SerRxOn+PP.LineCTL.SerTxOn+PP.LineCTL.Auto >STYA PacketPageDATA,x - lda #S.DEV.F.NET+S.DEV.F.EVENT+S.DEV.F.OUT - sta (pDevContext) - ldy #S.DEV.NAME - ldx #0 -.7 lda DEVNAME,x - sta (pDevContext),y - cpx DEVNAME - beq .8 - inx - iny - bne .7 -.8 clc + clc rts *-------------------------------------- * input : @@ -217,8 +284,7 @@ OPEN ldx #$10 * CC no event * CS event *-------------------------------------- -GETEVENT >PULLW pEvent - ldx DEVSLOTx0 +GETEVENT ldx DEVSLOTx0 >LDYAI PP.RxEvent >STYA PacketPagePTR,x >LDYA PacketPageDATA,x @@ -237,7 +303,7 @@ GETEVENT.RxOK >LDYA RTDATA,x get RxLength >STYA FRAMELEN >PUSHYA - >PUSHB 0 + >PUSHBI 0 >SYSCALL SYS.GetMem bcs .99 >STYA ZPTmpPTR @@ -254,6 +320,7 @@ GETEVENT.RxOK sta (pEvent) ldy #0 ldx DEVSLOTx0 + .1 lda RTDATA,x sta (ZPTmpPTR),y iny @@ -267,13 +334,26 @@ GETEVENT.RxOK bne .3 inc ZPTmpPTR+1 .3 jsr DecFrameLen - beq .8 - bra .1 + bne .1 .8 clc rts .99 sec rts +*-------------------------------------- +CLOSE jsr Reset + clc + rts +*-------------------------------------- +* in: +* out: +* Y,A = BUFFER PTR +* CC on success +* CS on error +*-------------------------------------- +GETINFO >LDYA L.DEVINFO + clc + rts *-------------------------------------- * in: * PULLW = FRAME PTR @@ -282,7 +362,7 @@ GETEVENT.RxOK * CC on success * CS on error *-------------------------------------- -OUT >PULLW ZPTmpPTR +SEND >PULLW ZPTmpPTR >PULLW FRAMELEN ldy #11 Add Src MAC Address @@ -341,20 +421,6 @@ SENDPREADY ldy #0 .8 clc rts *-------------------------------------- -CLOSE jsr Reset - clc - rts -*-------------------------------------- -* in: -* out: -* Y,A = BUFFER PTR -* CC on success -* CS on error -*-------------------------------------- -GETINFO >LDYA L.DEVINFO - clc - rts -*-------------------------------------- * PRIVATE *-------------------------------------- Reset ldx DEVSLOTx0 @@ -363,74 +429,25 @@ Reset ldx DEVSLOTx0 >LDYAI PP.SelfCTL.LID+PP.SelfCTL.RESET >STYA PacketPageDATA,x rts -*-------------------------------------- -DecodeMac lda (ZPTmpPTR) - cmp #12 - bne .9 - ldy #1 - ldx #0 -.1 lda (ZPTmpPTR),y - jsr Asc2NibbleA - bcs .9 - asl - asl - asl - asl - sta MAC,x - iny - lda (ZPTmpPTR),y - jsr Asc2NibbleA - bcs .9 - ora MAC,x - sta MAC,x - inx - iny - cpy #13 - bne .1 - clc - rts -.9 sec - rts -*-------------------------------------- -Asc2NibbleA cmp #$30 - bcc .9 - cmp #$3A - bcs .1 - and #$0F - clc - rts -.1 cmp #$41 - bcc .9 - cmp #$47 - bcs .9 - sbc #$36 - clc - rts -.9 sec - rts *-------------------------------------- DecFrameLen lda FRAMELEN bne .1 lda FRAMELEN+1 - beq .2 + beq .8 dec FRAMELEN+1 .1 dec FRAMELEN -.2 lda FRAMELEN - ora FRAMELEN+1 - rts + lda #1 Make something NZ +.8 rts *-------------------------------------- -CS.END -DEVNAME >PSTRING "ETH1" -*-------------------------------------- -DS.START +DRV.CS.END *-------------------------------------- DEVSLOTx0 .BS 1 FRAMELEN .BS 2 *-------------------------------------- -DEVINFO +DEVINFO .DA #S.DEVINFO.TYPE.NET MAC .BS 6 -*-------------------------------------- -DS.END +LINK.STATUS .BS 1 +LINK.SPEED .BS 1 SPEED/DUPLEX *-------------------------------------- MAN SAVE DRV/UTHERNET.DRV.S diff --git a/ETC/TCPIP.CONF b/ETC/TCPIP.CONF index 305e8a3f..b28034df 100644 --- a/ETC/TCPIP.CONF +++ b/ETC/TCPIP.CONF @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.BOOT NEW INC 1 AUTO 6 diff --git a/INC/A2osX.API.I.txt b/INC/A2osX.API.I.txt new file mode 100644 index 00000000..dbda570b --- /dev/null +++ b/INC/A2osX.API.I.txt @@ -0,0 +1,268 @@ +PR#3 +PREFIX /A2OSX.SRC +NEW +INC 1 +AUTO 6 + .LIST OFF +*-------------------------------------- +************ A2osX API **************** +*-------------------------------------- +* A2osX.SYSCALL Functions Indexes +*-------------------------------------- +SYS.GetMem .EQ $00 +SYS.FreeMemA .EQ $02 +SYS.GetMemPtrA .EQ $04 +SYS.GetMemByIDA .EQ $06 + +SYS.GetMemByNameA .EQ $08 +SYS.GetMemByNameYA .EQ $0A +*-------------------------------------- +SYS.NewPStrYA .EQ $10 +SYS.PStrCpyA .EQ $12 +SYS.PStrCat .EQ $14 +SYS.PStrCmp .EQ $16 + +SYS.PStrGetTkn .EQ $18 +SYS.GetPStrIndex .EQ $1A +*-------------------------------------- +SYS.LoadBinA .EQ $20 +SYS.LoadLibYA .EQ $22 +SYS.UnloadLibA .EQ $24 +SYS.LoadDrvA .EQ $26 +*-------------------------------------- +SYS.ExpandPStrA .EQ $30 +SYS.ExpandPStrYA .EQ $32 +SYS.GetEnvVarH .EQ $34 +SYS.GetEnvVarP .EQ $36 + +SYS.SetEnvVarH .EQ $38 +SYS.SetEnvVarP .EQ $3A +*-------------------------------------- +SYS.MLICreateFile .EQ $40 +SYS.MLICreateDirA .EQ $42 +SYS.MLICreateDirYA .EQ $44 +SYS.MLIDestroyA .EQ $46 + +SYS.MLIDestroyYA .EQ $48 +SYS.MLIRename .EQ $4A +SYS.MLISetFileInfo .EQ $4C +SYS.MLIGetFileInfoA .EQ $4E + +SYS.MLIGetFileInfoYA .EQ $50 +SYS.MLIOnline .EQ $52 +SYS.MLISetPrefixA .EQ $54 +SYS.MLISetPrefixYA .EQ $56 + +SYS.MLIGetPrefixA .EQ $58 +SYS.MLIGetPrefixYA .EQ $5A +SYS.MLIOpenA .EQ $5C +SYS.MLIOpenYA .EQ $5E + +SYS.MLINewLine .EQ $60 +SYS.MLIRead .EQ $62 +SYS.MLIWrite .EQ $64 +SYS.MLICloseA .EQ $66 + +SYS.MLIFlushA .EQ $68 +SYS.MLISetMark .EQ $6A +SYS.MLIGetMarkA .EQ $6A +SYS.MLISetEOF .EQ $6C + +SYS.MLIGetEOFA .EQ $70 +SYS.MLISetBuf .EQ $72 +SYS.MLIGetBuf .EQ $74 +SYS.MLIGetTime .EQ $76 + +SYS.MLIAllocIRQ .EQ $78 +SYS.MLIDeallocIRQ .EQ $7A +SYS.MLIReadBlock .EQ $7C +SYS.MLIWriteBlock .EQ $7E +*-------------------------------------- +SYS.GetDevByIDA .EQ $80 +SYS.GetDevByNameA .EQ $82 +SYS.GetDevByNameYA .EQ $84 +*-------------------------------------- +SYS.ExecProcessA .EQ $90 +SYS.CreateProcessA .EQ $92 + +SYS.GetPSByIDA .EQ $98 +*-------------------------------------- +SYS.CheckPrefixA .EQ $A0 +SYS.FileSearch .EQ $A2 +SYS.LoadFileA .EQ $A4 +SYS.ListDirInitA .EQ $A6 + +SYS.ListDirNextA .EQ $A8 +SYS.ListDirCloseA .EQ $AA +*-------------------------------------- +SYS.AddNetCfg .EQ $B0 +SYS.SetNetCfg .EQ $B2 +SYS.GetNetCfgA .EQ $B4 +SYS.ClrNetCfgA .EQ $B6 +*-------------------------------------- +SYS.ScreenSelectA .EQ $C0 + +SYS.SysScrPPSTRA .EQ $C4 +SYS.SysScrPPSTRYA .EQ $C6 +*-------------------------------------- +* ERROR CODES +*-------------------------------------- +MEMMGR.ERROOM .EQ $FF Out Of Memory Error +MEMMGR.ERROOH .EQ $FE Out Of Handle Error +*-------------------------------------- +DEVMGR.ERROOM .EQ $EF Out Of Memory Error +DEVMGR.ERROOH .EQ $EE Out Of Handle Error +DEVMGR.ERRNICL .EQ $ED Invalid Command Line +DEVMGR.ERRNOHW .EQ $EC No Hardware +DEVMGR.ERRDNF .EQ $EB Device Not Found Error +*-------------------------------------- +TSKMGR.ERROOH .EQ $DF Out Of Handle Error +TSKMGR.ERRNSP .EQ $DD No Such Process Error +*-------------------------------------- +SYSMGR.ERRSYN .EQ $CF Syntax Error +SYSMGR.ERRENVF .EQ $CE Env is Full +SYSMGR.ERRIDIR .EQ $CD Invalid Directory +SYSMGR.ERRFTB .EQ $CC File Too Big Error +SYSMGR.ERRFNF .EQ $CB File Not Found Error +*-------------------------------------- +* MEM STRUCT +*-------------------------------------- +S.MEM.F .EQ 0 +S.MEM.F.AUX .EQ %10000000 Request Stock Object +S.MEM.F.INIT0 .EQ %01000000 Fill with "0" +S.MEM.F.CODE .EQ %00100000 +S.MEM.F.NOMOVE .EQ %00010000 +S.MEM.F.ALIGN .EQ %00001000 +S.MEM.F.INUSE .EQ %10000000 (Internal Flag) +S.MEM.REFCNT .EQ 1 +S.MEM.OWNERPID .EQ 2 +S.MEM.BIN .EQ 3 +S.MEM.PTR .EQ 4 +S.MEM.LEN .EQ 6 +* +S.MEM.SIZE .EQ 8 +*-------------------------------------- +* BIN STRUCT +*-------------------------------------- +S.BIN.CODE .EQ 0 +*-------------------------------------- +* DEV STRUCT +*-------------------------------------- +S.DEV.CODE .EQ 0 +S.DEV.JMP .EQ 2 +S.DEV.F .EQ 4 +S.DEV.F.INUSE .EQ %10000000 +S.DEV.F.BUSY .EQ %01000000 +S.DEV.F.SHARE .EQ %00100000 Device is shareable +S.DEV.F.IRQ .EQ %00010000 Device is irq driven +S.DEV.F.EVENT .EQ %00001000 Device is event driven +S.DEV.F.COUT .EQ %00000100 Device supports Char OUT +S.DEV.F.BLOCK .EQ %00000010 +S.DEV.F.CHAR .EQ %00000001 +S.DEV.NAME .EQ 5 5 Bytes : LEN+NUL KBD CON COMx LPTx ETHx +* +S.DEV.SIZE .EQ 16 +*-------------------------------------- +S.DEVINFO.TYPE .EQ 0 +S.DEVINFO.TYPE.CHAR .EQ %00000001 +S.DEVINFO.TYPE.XY .EQ %00000010 +S.DEVINFO.TYPE.NET .EQ %00000011 +S.DEVINFO.TYPE.GFX .EQ %00000100 +*-------------------------------------- +* Generic Driver Functions +*-------------------------------------- +DEVMGR.OPEN .EQ 0 +DEVMGR.GETEVENT .EQ 2 +DEVMGR.COUT .EQ 4 +DEVMGR.CLOSE .EQ 6 +DEVMGR.GETINFO .EQ 8 +DEVMGR.IRQ .EQ 10 +*-------------------------------------- +* 'XY' Class Driver Functions +*-------------------------------------- +DEVMGR.XY.SETPOS .EQ 12 +*-------------------------------------- +* 'NET' Class Driver Functions +*-------------------------------------- +DEVMGR.NET.SEND .EQ 12 +*-------------------------------------- +* 'GFX' Class Driver Functions +*-------------------------------------- +DEVMGR.GFX.SETPIXEL .EQ 12 +DEVMGR.GFX.GETPIXEL .EQ 14 +DEVMGR.GFX.HLINE .EQ 16 +DEVMGR.GFX.VLINE .EQ 18 +DEVMGR.GFX.BITBLT .EQ 20 +*-------------------------------------- +* PS STRUCT +*-------------------------------------- +S.PS.F .EQ 0 +S.PS.F.INUSE .EQ %10000000 +S.PS.F.HOLD .EQ %01000000 +S.PS.F.EVENT .EQ %00100000 +S.PS.ID .EQ 1 +S.PS.PID .EQ 2 +S.PS.hCS .EQ 3 +S.PS.hDS .EQ 4 +S.PS.hPREFIX .EQ 5 +S.PS.hENV .EQ 6 +S.PS.hCMD .EQ 7 +S.PS.hARGS .EQ 8 +S.PS.hINDEV .EQ 9 +S.PS.hOUTDEV .EQ 10 +S.PS.hERRDEV .EQ 11 +S.PS.CID .EQ 12 +S.PS.LASTERROR .EQ 13 +S.PS.PC .EQ 14 +* +S.PS.SIZE .EQ 16 +*-------------------------------------- +* EVENT STRUCT +*-------------------------------------- +S.EVT.F .EQ 0 +S.EVT.F.SYS .EQ %10000000 +S.EVT.F.WND .EQ %01000000 +S.EVT.F.hMEM2 .EQ %00100000 Indicates That S.EVT.DATAHI is a hMem +S.EVT.F.hMEM1 .EQ %00010000 Indicates That S.EVT.DATALO is a hMem +S.EVT.F.TIMER .EQ %00001000 +S.EVT.F.NET .EQ %00000100 +S.EVT.F.MOUSE .EQ %00000010 +S.EVT.F.KEY .EQ %00000001 +S.EVT.hDEV .EQ 1 +S.EVT.DATA .EQ 2 +S.EVT.DATALO .EQ 2 +S.EVT.DATAHI .EQ 3 +S.EVT.DATAW1 .EQ 4 +S.EVT.DATAW2 .EQ 6 +* +S.EVT.SIZE .EQ 8 +*-------------------------------------- +* S.LISTDIR STRUCT +*-------------------------------------- +S.LISTDIR.hONLINE .EQ 0 +S.LISTDIR.ONLINEPTR .EQ 1 +S.LISTDIR.REFNUM .EQ 2 ref_num file +S.LISTDIR.hIOBUF .EQ 3 hMem to ProDOS IO buffer +S.LISTDIR.hREADBUF .EQ 4 hMem to 512 Read Buffer +S.LISTDIR.EL .EQ 5 entry_length +S.LISTDIR.EIB .EQ 6 ENTRY_INDEX in block +S.LISTDIR.EPB .EQ 7 entry_per_block +S.LISTDIR.BLKPTR .EQ 8 entry PTR in block +S.LISTDIR.FI .EQ 10 FILE_INDEX in DIR +S.LISTDIR.FC .EQ 12 file_count +S.LISTDIR.hPATTERN .EQ 14 Pattern for file filtering +* +S.LISTDIR.SIZE .EQ 16 +*-------------------------------------- +* S.BUFRDR STRUCT +*-------------------------------------- +S.BUFRDR.hMEM .EQ 0 +S.BUFRDR.DELIM .EQ 1 +S.BUFRDR.LEN .EQ 2 +S.BUFRDR.IDX .EQ 4 +* +S.BUFRDR.SIZE .EQ 6 +*-------------------------------------- + +MAN +SAVE INC/A2OSX.API.I diff --git a/INC/A2osX.I.txt b/INC/A2osX.I.txt index f68eae16..32ea09dc 100644 --- a/INC/A2osX.I.txt +++ b/INC/A2osX.I.txt @@ -1,258 +1,77 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF *-------------------------------------- -* KERNEL Reserved ZP Location 00-1F,56-FF +* Aux ZP *-------------------------------------- -ZPQuickPtr1 .EQ $90 Temp Ptrs for use in very limited scope -ZPQuickPtr2 .EQ $92 (could be trashed by any JSR) -ZPQuickPtr3 .EQ $94 -ZPQuickPtr4 .EQ $96 +ZPQuickPtr1 .EQ $0 Temp Ptrs for use in very limited scope +ZPQuickPtr2 .EQ $2 (could be trashed by any JSR) +ZPQuickPtr3 .EQ $4 +ZPQuickPtr4 .EQ $6 -ZPLIB .EQ $A0 Main -ZPDRV .EQ $B0 Main -ZPBIN .EQ $C0 Main -*-------------------------------------- -pPsContext .EQ $F0 -pDevContext .EQ $F2 -pEvent .EQ $F4 -*-------------------------------------- -R.SP .EQ $FE Main -*-------------------------------------- -* A2OS.SYSCALL Functions Indexes -*-------------------------------------- -SYS.GetMem .EQ $00 -SYS.FreeMemA .EQ $02 -SYS.ClrMemA .EQ $04 -SYS.GetMemPtrA .EQ $06 +pCode .EQ $10 +pData .EQ $12 +pStack .EQ $14 -SYS.GetMemLenA .EQ $08 -SYS.GetMemByIDA .EQ $0A -SYS.GetMemByNameA .EQ $0C -*-------------------------------------- -SYS.NewPStr .EQ $10 -SYS.PStrCpyA .EQ $12 -SYS.PStrCat .EQ $14 -SYS.PStrCmp .EQ $16 +pLib .EQ $16 +pDev .EQ $18 -SYS.PStrGetTkn .EQ $18 -SYS.GetPStrIndex .EQ $1A -*-------------------------------------- -SYS.LoadBinA .EQ $20 -SYS.LoadLib .EQ $22 -SYS.UnloadLibA .EQ $24 -SYS.LoadDrvA .EQ $26 -*-------------------------------------- -SYS.ExpandPStrA .EQ $30 -SYS.ExpandPStr .EQ $32 -SYS.GetEnvVarH .EQ $34 -SYS.GetEnvVarP .EQ $36 +pEvent .EQ $1A +pPs .EQ $1C -SYS.SetEnvVarH .EQ $38 -SYS.SetEnvVarP .EQ $3A +ZPDRV .EQ $80 +ZPBIN .EQ $90 +ZPLIB .EQ $A0 *-------------------------------------- -SYS.MLICreate .EQ $40 -SYS.MLIDestroy .EQ $42 -SYS.MLIRename .EQ $44 -SYS.MLISetFileInfo .EQ $46 - -SYS.MLIGetFileInfoA .EQ $48 -SYS.MLIOnline .EQ $4A -SYS.MLISetPrefix .EQ $4C -SYS.MLIGetPrefixA .EQ $4E - -SYS.MLIOpenA .EQ $50 -SYS.MLINewLine .EQ $52 -SYS.MLIRead .EQ $54 -SYS.MLIWrite .EQ $56 - -SYS.MLICloseA .EQ $58 -SYS.MLIFlushA .EQ $5A -SYS.MLISetMark .EQ $5C -SYS.MLIGetMark .EQ $5E - -SYS.MLISetEOF .EQ $60 -SYS.MLIGetEOFA .EQ $62 +* $C0 -> $FF KERNEL RESERVED *-------------------------------------- -SYS.GetDevByIDA .EQ $70 -SYS.GetDevByNameA .EQ $72 -SYS.GetDevTable .EQ $74 -SYS.GetDevInfoA .EQ $76 - -SYS.DevOutA .EQ $78 -SYS.GetDevByNameYA .EQ $7A -*-------------------------------------- -SYS.GetEvent .EQ $80 -SYS.DestroyEvent .EQ $82 -*-------------------------------------- -SYS.ExecProcessA .EQ $90 -SYS.CreateProcessA .EQ $92 - -SYS.GetPSByIDA .EQ $98 -*-------------------------------------- -SYS.CheckPrefixA .EQ $A0 -SYS.FileSearch .EQ $A2 -SYS.LoadFileA .EQ $A4 -SYS.ListDirInitA .EQ $A6 - -SYS.ListDirNextA .EQ $A8 -SYS.ListDirCloseA .EQ $AA -*-------------------------------------- -SYS.AddNetCfg .EQ $B0 -SYS.SetNetCfg .EQ $B2 -SYS.GetNetCfgA .EQ $B4 -SYS.ClrNetCfgA .EQ $B6 -*-------------------------------------- -SYS.ScreenSelectA .EQ $C0 -*-------------------------------------- -A2osX.SaveSM .EQ $100 Main +A2osX.SaveSM .EQ $100 Aux A2osX.SaveSX .EQ $101 Aux *-------------------------------------- -* Main $200 -> 2FF : (Reserved, ProDOS,Clock DRV....) -* Main $300 -> 3EF : -* Main $3F0 -> 3FF : SYS Vectors (reset,IRQ...) -* Aux $200 -> 3FD : /RAM Driver -* Aux $3FE -> 3FF : IRQ Vector +* Main $200 -> 2FF : (Used By ProDOS,Clock DRV....) +* Main $300 -> 3EF : +* Main $3F0 -> 3FF : SYS Vectors (reset,IRQ...) +* Aux $200 -> 3FD : /RAM Driver +* Aux $3FE -> 3FF : IRQ Vector +* Main/Aux $400 -> $7FF : Console Screen +* Main/Aux $800 -> $BFF : System Screen *-------------------------------------- -* Console Screen .EQ $400 -> $7FF -* System Screen .EQ $800 -> $BFF +TmpBuffer256 .EQ $0200 Main *-------------------------------------- -TmpBuffer256 .EQ $0C00 -*-------------------------------------- -D.STACKSEG .EQ $0D00 $0DFF Down to $0D00 -*-------------------------------------- -MLICALL.PARAMS .EQ $0E00 size=$12 (SET_FILE_INFO +1) -*-------------------------------------- -MEMMGR.LOMEM .EQ $0E30 -MEMMGR.MLLIMIT .EQ $0E32 -MEMMGR.MHLIMIT .EQ $0E34 -MEMMGR.HIMEM .EQ $0E36 -MEMMGR.MFREE .EQ $0E38 -MEMMGR.TABLESIZE .EQ $0E3A -*-------------------------------------- -Z80STACK .EQ $0FFF (0FFFFh) Down to $0F00 -Z80JMP .EQ $1000 -*-------------------------------------- -DEVMGR.TABLE .EQ $1200 K.DEV.MAX*S.DEV.SIZE=20*12=240 -TSKMGR.TABLE .EQ $1300 K.PS.MAX*S.PS.SIZE=32*16=512 -*-------------------------------------- -A2osX.LOMEM .EQ $1500 +D.STACK.BASE .EQ $0300 $03EF... +D.STACK.TOP .EQ $03F0 ...Down to $0300 *-------------------------------------- * A2osX GLOBAL PAGE -* $BE00->$BE0F : Public JMP +* $BE00->$BE0F : Public Vetors *-------------------------------------- A2osX.SYSCALL .EQ $BE00 -A2osX.MLICALL .EQ $BE02 -A2osX.LIBCALL .EQ $BE04 -A2osX.SLEEP .EQ $BE06 -Kernel.MLICALL .EQ $BE08 -Kernel.DRVCALL .EQ $BE0A -Kernel.BINCALL .EQ $BE0C -Kernel.LIBCALL .EQ $BE0E +A2osX.LIBCALL .EQ $BE02 +A2osX.SLEEP .EQ $BE04 +A2osX.MLICALL .EQ $BE06 *-------------------------------------- -A2osX.SCREENS .EQ $BE10 -A2osX.SCREENS.G .EQ %00000100 -A2osX.SCREENS.C .EQ %00000010 -A2osX.SCREENS.S .EQ %00000001 -A2osX.ACTIVESCRN .EQ $BE11 +* $BEE0->$BEFF : Public Variables +*-------------------------------------- +A2osX.SCREENS .EQ $BEE0 +A2osX.SCREENS.S .EQ %00000001 System Screen +A2osX.SCREENS.C .EQ %00000010 Console Screen +A2osX.SCREENS.G .EQ %00000100 Graphic Screen +A2osX.ASCREEN .EQ $BEE1 Active Screen -A2osX.TIMER16 .EQ $BE12 -A2osX.RANDOM16 .EQ $BE14 +A2osX.CSCREEN.DEV .EQ $BEE2 +A2osX.GSCREEN.DEV .EQ $BEE3 -A2osX.CPUTYPE .EQ $BE16 -A2osX.Z80SLOT .EQ $BE17 +A2osX.TIMER16 .EQ $BEE4 +A2osX.RANDOM16 .EQ $BEE6 -Kernel.JMP .EQ $BE1A -A2osX.SaveA .EQ $BE1C -A2osX.SaveX .EQ $BE1D -A2osX.SaveY .EQ $BE1E -A2osX.GPCODE .EQ $BE20 +A2osX.CPUTYPE .EQ $BEE8 +A2osX.Z80SLOT .EQ $BEEA *-------------------------------------- -* MEM STRUCT +*** Z80 Reserved *** *-------------------------------------- -S.MEM.F .EQ 0 -S.MEM.F.INUSE .EQ %10000000 -S.MEM.F.CLEAR .EQ %10000000 Fill with "0" -S.MEM.F.CODE .EQ %01000000 -S.MEM.F.NOMOV .EQ %00100000 -S.MEM.F.ALIGN .EQ %00010000 -S.MEM.F.SPARE .EQ %00001000 -S.MEM.F.AUX .EQ %00000100 -S.MEM.REFCNT .EQ 1 -S.MEM.PTR .EQ 2 -S.MEM.LEN .EQ 4 -S.MEM.BIN .EQ 6 -S.MEM.OWNERPID .EQ 7 -* -S.MEM.SIZE .EQ 8 -*-------------------------------------- -MEMMGR.ERROOM .EQ $FF Out Of Memory Error -MEMMGR.ERROOS .EQ $FE Out Of Slot Error -*-------------------------------------- -* DEV STRUCT -*-------------------------------------- -S.DEV.F .EQ 0 -S.DEV.F.INUSE .EQ %10000000 -S.DEV.F.EVENT .EQ %01000000 -S.DEV.F.OUT .EQ %00100000 -S.DEV.F.MOUSE .EQ %00010000 -S.DEV.F.GFX .EQ %00001000 -S.DEV.F.NET .EQ %00000100 -S.DEV.F.BLOCK .EQ %00000010 -S.DEV.F.CHAR .EQ %00000001 -S.DEV.ID .EQ 1 -S.DEV.NAME .EQ 2 5 Bytes : NUL KBD CON COMx LPTx ETHx -S.DEV.hCS .EQ 7 -S.DEV.hDS .EQ 8 -S.DEV.hCMD .EQ 9 -S.DEV.hARGS .EQ 10 -S.DEV.hOWNERPS .EQ 11 -* -S.DEV.SIZE .EQ 12 -*-------------------------------------- -* Generic Driver Functions -*-------------------------------------- -DEVMGR.OPEN .EQ 0 -DEVMGR.GETEVENT .EQ 2 -DEVMGR.OUT .EQ 4 -DEVMGR.CLOSE .EQ 6 -DEVMGR.GETINFO .EQ 8 -*-------------------------------------- -* 'GFX' Class Driver Functions -*-------------------------------------- -DEVMGR.GFX.SETPIXEL .EQ 10 -DEVMGR.GFX.GETPIXEL .EQ 12 -*-------------------------------------- -DEVMGR.ERRNICL .EQ $EB Invalid Command Line -DEVMGR.ERRNOHW .EQ $EC No Hardware -DEVMGR.ERRDNF .EQ $ED Device Not Found Error -DEVMGR.ERROOS .EQ $EE Out Of Slot Error -*-------------------------------------- -* PS STRUCT -*-------------------------------------- -S.PS.F .EQ 0 -S.PS.F.INUSE .EQ %10000000 -S.PS.F.HOLD .EQ %01000000 -S.PS.F.EVENT .EQ %00100000 -S.PS.ID .EQ 1 -S.PS.PID .EQ 2 -S.PS.hCS .EQ 3 -S.PS.hDS .EQ 4 -S.PS.hPREFIX .EQ 5 -S.PS.hENV .EQ 6 -S.PS.hCMD .EQ 7 -S.PS.hARGS .EQ 8 -S.PS.hINDEV .EQ 9 -S.PS.hOUTDEV .EQ 10 -S.PS.hERRDEV .EQ 11 -S.PS.CID .EQ 12 -S.PS.LASTERROR .EQ 13 -S.PS.PC .EQ 14 -* -S.PS.SIZE .EQ 16 +*** IRQ Handler *** *-------------------------------------- * LIB Function Indexes *-------------------------------------- @@ -266,60 +85,5 @@ TSKMGR.RUN .EQ 2 TSKMGR.DOEVENT .EQ 4 TSKMGR.QUIT .EQ 6 *-------------------------------------- -TSKMGR.ERROOS .EQ $DE Out Of Slot Error -TSKMGR.ERRNSP .EQ $DF No Such Process Error -*-------------------------------------- -* EVENT STRUCT -*-------------------------------------- -S.EVT.F .EQ 0 -S.EVT.F.SYS .EQ %10000000 -S.EVT.F.WND .EQ %01000000 -S.EVT.F.hMEM2 .EQ %00100000 Indicates That S.EVT.DATAHI is a hMem -S.EVT.F.hMEM1 .EQ %00010000 Indicates That S.EVT.DATALO is a hMem -S.EVT.F.TIMER .EQ %00001000 -S.EVT.F.NET .EQ %00000100 -S.EVT.F.MOUSE .EQ %00000010 -S.EVT.F.KEY .EQ %00000001 -S.EVT.hDEV .EQ 1 -S.EVT.DATA .EQ 2 -S.EVT.DATALO .EQ 2 -S.EVT.DATAHI .EQ 3 -S.EVT.DATAW1 .EQ 4 -S.EVT.DATAW2 .EQ 6 -* -S.EVT.SIZE .EQ 8 -*-------------------------------------- -SYSMGR.ERRENVF .EQ $CB Env is Full -SYSMGR.ERRIDIR .EQ $CC Invalid Directory -SYSMGR.ERRFTB .EQ $CD File Too Big Error -SYSMGR.ERRFNF .EQ $CE File Not Found Error -SYSMGR.ERRSYN .EQ $CF Syntax Error -*-------------------------------------- -* S.LISTDIR STRUCT -*-------------------------------------- -S.LISTDIR.hONLINE .EQ 0 -S.LISTDIR.ONLINEPTR .EQ 1 -S.LISTDIR.REFNUM .EQ 2 ref_num file -S.LISTDIR.hIOBUF .EQ 3 hMem to ProDOS IO buffer -S.LISTDIR.hREADBUF .EQ 4 hMem to 512 Read Buffer -S.LISTDIR.EL .EQ 5 entry_length -S.LISTDIR.EIB .EQ 6 ENTRY_INDEX in block -S.LISTDIR.EPB .EQ 7 entry_per_block -S.LISTDIR.BLKPTR .EQ 8 entry PTR in block -S.LISTDIR.FI .EQ 10 FILE_INDEX in DIR -S.LISTDIR.FC .EQ 12 file_count -S.LISTDIR.hPATTERN .EQ 14 Pattern for file filtering -* -S.LISTDIR.SIZE .EQ 16 -*-------------------------------------- -* S.BUFRDR STRUCT -*-------------------------------------- -S.BUFRDR.hMEM .EQ 0 -S.BUFRDR.DELIM .EQ 1 -S.BUFRDR.LEN .EQ 2 -S.BUFRDR.IDX .EQ 4 -* -S.BUFRDR.SIZE .EQ 6 -*-------------------------------------- MAN SAVE INC/A2OSX.I diff --git a/INC/IO.I.txt b/INC/IO.I.txt index 0008d291..308a5d50 100644 --- a/INC/IO.I.txt +++ b/INC/IO.I.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/INC/KERNEL.I.txt b/INC/KERNEL.I.txt index 7a3dbd2a..ad4a2bfd 100644 --- a/INC/KERNEL.I.txt +++ b/INC/KERNEL.I.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -7,13 +7,11 @@ AUTO 6 *-------------------------------------- * KERNEL CONSTANTS DEFINITON *-------------------------------------- -K.BIN.MAGICHEADER .EQ $7CD8 -*-------------------------------------- K.TIMER16RESOLUTION .EQ 5 every 5 VBL (50hz), so 100ms *-------------------------------------- K.ENV.SIZE .EQ $100 -K.DEV.MAX .EQ 20 -K.PS.MAX .EQ 32 +K.DEV.MAX .EQ 32 +K.PS.MAX .EQ 64 *-------------------------------------- K.NETCFG.MAX .EQ 4 K.NETCFG.SIZE .EQ 128 @@ -28,17 +26,31 @@ K.TCPTABLE.SIZE .EQ 16 K.ETH.FRAME.LEN .EQ 1514 K.IP.TTL .EQ 64 *-------------------------------------- -* KERNEL Reserved ZP Location 00-1F,56-FF +H.BIN.HEADER .EQ 0 +H.BIN.HEADER.DRV65 .EQ $4C8D 6502:cld,jmp abs +H.BIN.HEADER.LIB65 .EQ $7C8D 6502:cld,jmp (abs,x) +H.BIN.HEADER.BIN65 .EQ $7C8D 6502:cld,jmp (abs,x) +H.BIN.HEADER.DRV80 .EQ $A28D Z80: +H.BIN.HEADER.LIB80 .EQ $A28D Z80: +H.BIN.HEADER.BIN80 .EQ $A28D Z80: +H.BIN.JMP .EQ 2 +H.BIN.CODE.TYPE .EQ 4 +H.BIN.VERSION .EQ 5 +H.BIN.CODE.LEN .EQ 8 +H.BIN.BIN.DS.SIZE .EQ 10 +H.BIN.DEV.HEADER.O .EQ 10 +H.BIN.DRV.CODE.O .EQ 12 +H.BIN.DRV.CODE.LEN .EQ 14 +H.BIN.RELOC.TABLE .EQ 16 *-------------------------------------- -DEVMGR.DEVPTR .EQ $80 -EVTMGR.EVTPTR .EQ $82 -TSKMGR.TSKPTR .EQ $84 -TSKMGR.pNewPS .EQ $86 +* KERNEL Reserved ZP (Aux) Location 00-1F,56-FF *-------------------------------------- -ZPMemMgr .EQ $D0 Aux -ZPSysScr .EQ $E0 Aux +ZPMemMgr .EQ $B0 +ZPSysScr .EQ $C0 +ZPDevMgr .EQ $D0 +ZPTskMgr .EQ $E0 *-------------------------------------- -R.VCPU16 .EQ $F0 Aux +R.VCPU16 .EQ $F0 R.AX .EQ R.VCPU16 R.AL .EQ R.VCPU16 R.AH .EQ R.VCPU16+$1 @@ -51,10 +63,27 @@ R.CH .EQ R.VCPU16+$5 R.DX .EQ R.VCPU16+$6 R.DL .EQ R.VCPU16+$6 R.DH .EQ R.VCPU16+$7 -*R.CS .EQ R.VCPU16+$8 -*R.DS .EQ R.VCPU16+$A -R.LS .EQ R.VCPU16+$C -*R.SP .EQ R.VCPU16+$E +*-------------------------------------- +MLICALL.PARAMS .EQ $1100 +DevMgr.Table .EQ $1200 K.DEV.MAX*S.DEV.SIZE=32*16=512b +*-------------------------------------- +TskMgr.Table .EQ $1400 K.PS.MAX*S.PS.SIZE=64*16=1k +*-------------------------------------- +* MemMgr : $1800->$1FFF MAIN/AUX (2 kBytes) +*-------------------------------------- +MemMgr.Table .EQ $1800 +MemMgr.HiMem .EQ $1800 Slot 0 is Reserved +MemMgr.Free .EQ $1802 +MemMgr.LoMem .EQ $1804 +MemMgr.LastSlot .EQ $1806 +*-------------------------------------- +MemMgr.MLoMem .EQ $2000 +MemMgr.MHiMem .EQ $BE00 +MemMgr.XLoMem .EQ $2000 +MemMgr.XHiMem .EQ $C000 +*-------------------------------------- +KERNEL.COLDBOOT .EQ $D000 +KERNEL.SYSCALL .EQ $D003 *-------------------------------------- MAN SAVE INC/KERNEL.I diff --git a/INC/LIBCRYPT.I.txt b/INC/LIBCRYPT.I.txt index 425e1c93..d32d9751 100644 --- a/INC/LIBCRYPT.I.txt +++ b/INC/LIBCRYPT.I.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/INC/LIBGFX.I.txt b/INC/LIBGFX.I.txt index 266dca32..eee49fb3 100644 --- a/INC/LIBGFX.I.txt +++ b/INC/LIBGFX.I.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/INC/LIBSTR.I.txt b/INC/LIBSTR.I.txt index d4bd7727..d13bc09e 100644 --- a/INC/LIBSTR.I.txt +++ b/INC/LIBSTR.I.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/INC/LIBTCPIP.I.txt b/INC/LIBTCPIP.I.txt index 5f5cf76b..13c858c9 100644 --- a/INC/LIBTCPIP.I.txt +++ b/INC/LIBTCPIP.I.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/INC/MACROS.I.txt b/INC/MACROS.I.txt index c07d4605..07997d9c 100644 --- a/INC/MACROS.I.txt +++ b/INC/MACROS.I.txt @@ -1,13 +1,13 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF *-------------------------------------- .MA DEBUG -.70 bit $C000 - bpl .70 +:1 bit $C000 + bpl :1 sta $C010 .EM *-------------------------------------- @@ -20,6 +20,12 @@ AUTO 6 *-------------------------------------- .MA MLICALL ldx #]1 + .DO ]1=MLIALLOCIRQ + lda #2 + .FIN + .DO ]1=MLIDEALLOCIRQ + lda #1 + .FIN .DO ]1=MLIREADBLOCK lda #3 .FIN @@ -89,78 +95,6 @@ AUTO 6 jsr A2osX.MLICALL .EM -*-------------------------------------- - .MA KMLICALL - ldx #]1 - .DO ]1=MLIREADBLOCK - lda #3 - .FIN - .DO ]1=MLIWRITEBLOCK - lda #3 - .FIN - .DO ]1=MLICREATE - lda #7 - .FIN - .DO ]1=MLIDESTROY - lda #1 - .FIN - .DO ]1=MLIRENAME - lda #2 - .FIN - .DO ]1=MLISETFILEINFO - lda #7 - .FIN - .DO ]1=MLIGETFILEINFO - lda #10 - .FIN - .DO ]1=MLIONLINE - lda #2 - .FIN - .DO ]1=MLISETPREFIX - lda #1 - .FIN - .DO ]1=MLIGETPREFIX - lda #1 - .FIN - .DO ]1=MLIOPEN - lda #3 - .FIN - .DO ]1=MLINEWLINE - lda #3 - .FIN - .DO ]1=MLIREAD - lda #4 - .FIN - .DO ]1=MLIWRITE - lda #4 - .FIN - .DO ]1=MLICLOSE - lda #1 - .FIN - .DO ]1=MLIFLUSH - lda #1 - .FIN - .DO ]1=MLISETMARK - lda #2 - .FIN - .DO ]1=MLIGETMARK - lda #2 - .FIN - .DO ]1=MLISETEOF - lda #2 - .FIN - .DO ]1=MLIGETEOF - lda #2 - .FIN - .DO ]1=MLISETBUF - lda #2 - .FIN - .DO ]1=MLIGETBUF - lda #2 - .FIN - - jsr Kernel.MLICALL - .EM *-------------------------------------- .MA DRVCALL ldy ]1 @@ -168,13 +102,12 @@ AUTO 6 jsr A2osX.DRVCALL .EM *-------------------------------------- - .MA LIBLOADP - >PUSHW ]1 - ldx #SYS.LoadLib + .MA LOADLIBYA + ldx #SYS.LoadLibYA jsr A2osX.SYSCALL .EM *-------------------------------------- - .MA LIBLOADA + .MA LOADLIBA ldx #SYS.LoadLibA jsr A2osX.SYSCALL .EM @@ -185,200 +118,111 @@ AUTO 6 jsr A2osX.LIBCALL .EM *-------------------------------------- -* LOCAL SEGMENT Manipulation Macros -*-------------------------------------- - .MA ADDLOCAL - pha - lda R.LS - dec R.SP - sta (R.SP) - lda R.SP - sec - sbc #]1 - sta R.SP - sta R.LS - pla - .EM -*-------------------------------------- - .MA REMLOCAL - php - pha - lda R.SP - clc - adc #]1 - sta R.SP - lda (R.SP) - inc R.SP - sta R.LS - pla - plp - .EM -*-------------------------------------- - .MA LDAL - ldy #]1 - lda (R.LS),y - .EM -*-------------------------------------- - .MA ADCL - ldy #]1 - adc (R.LS),y - .EM -*-------------------------------------- - .MA SBCL - ldy #]1 - adc (R.LS),y - .EM -*-------------------------------------- - .MA STAL - ldy #]1 - sta (R.LS),y - .EM -*-------------------------------------- - .MA LDYAL - ldy #]1 - lda (R.LS),y - pha - iny - lda (R.LS),y - ply - .EM -*-------------------------------------- - .MA STYAL - phy - ldy #]1+1 - sta (R.LS),y - dey - pla - sta (R.LS),y - tay - .EM -*-------------------------------------- - .MA INCL - ldy #]1 - lda (R.LS),y - inc - sta (R.LS),y - .EM -*-------------------------------------- - .MA INCLW - ldy #]1 - lda (R.LS),y - inc - bne .71 - sta (R.LS),y - iny - lda (R.LS),y - inc -.71 sta (R.LS),y - .EM -*-------------------------------------- - .MA DECL - ldy #]1 - lda (R.LS),y - dec - sta (R.LS),y - .EM -*-------------------------------------- - .MA DECLW - ldy #]1 - lda (R.LS),y - bne .72 - pha - iny - lda (R.LS),y - dec - sta (R.LS),y - dey - pla -.72 dec - sta (R.LS),y - .EM -*-------------------------------------- * D.STACK PUSH/PULL Macros *-------------------------------------- .MA PUSHA - dec R.SP - sta (R.SP) + dec pStack + sta (pStack) .EM *-------------------------------------- .MA PULLA - lda (R.SP) - inc R.SP + lda (pStack) + inc pStack .EM *-------------------------------------- .MA PUSHYA - dec R.SP - sta (R.SP) + dec pStack + sta (pStack) pha tya - dec R.SP - sta (R.SP) + dec pStack + sta (pStack) pla .EM *-------------------------------------- .MA PULLYA - lda (R.SP) - inc R.SP + lda (pStack) + inc pStack tay - lda (R.SP) - inc R.SP + lda (pStack) + inc pStack + .EM +*-------------------------------------- + .MA PUSHAX + pha + txa + dec pStack + sta (pStack) + pla + dec pStack + sta (pStack) + .EM +*-------------------------------------- + .MA PULLAX + lda (pStack) + inc pStack + pha + lda (pStack) + inc pStack + tax + pla .EM *-------------------------------------- .MA PUSHBI - dec R.SP + dec pStack lda #]1 - sta (R.SP) + sta (pStack) .EM *-------------------------------------- .MA PUSHB .DO ]#=2 - dec R.SP + dec pStack lda ]1,]2 - sta (R.SP) + sta (pStack) .ELSE - dec R.SP + dec pStack lda ]1 - sta (R.SP) + sta (pStack) .FIN .EM *-------------------------------------- .MA PULLB .DO ]#=2 - lda (R.SP) + lda (pStack) sta ]1,]2 - inc R.SP + inc pStack .ELSE - lda (R.SP) + lda (pStack) sta ]1 - inc R.SP + inc pStack .FIN .EM *-------------------------------------- .MA PUSHWI - dec R.SP + dec pStack lda /]1 - sta (R.SP) - dec R.SP + sta (pStack) + dec pStack lda #]1 - sta (R.SP) + sta (pStack) .EM *-------------------------------------- .MA PUSHW - dec R.SP + dec pStack lda ]1+1 - sta (R.SP) - dec R.SP + sta (pStack) + dec pStack lda ]1 - sta (R.SP) + sta (pStack) .EM *-------------------------------------- .MA PULLW - lda (R.SP) + lda (pStack) sta ]1 - inc R.SP - lda (R.SP) + inc pStack + lda (pStack) sta ]1+1 - inc R.SP + inc pStack .EM *-------------------------------------- * General WORD Manipulation Macros diff --git a/INC/MONITOR.I.txt b/INC/MONITOR.I.txt index 1182b59f..002f088e 100644 --- a/INC/MONITOR.I.txt +++ b/INC/MONITOR.I.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 1000 diff --git a/INC/PRODOS.I.txt b/INC/PRODOS.I.txt index 22850004..c8b6be71 100644 --- a/INC/PRODOS.I.txt +++ b/INC/PRODOS.I.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 1000 diff --git a/INC/ZP.I.txt b/INC/ZP.I.txt index 8cde0ef8..d2161c96 100644 --- a/INC/ZP.I.txt +++ b/INC/ZP.I.txt @@ -1,9 +1,11 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 *-------------------------------------- +* ProDOS Reserved ZP Location 00-1F,56-FF +*-------------------------------------- WNDLFT .EQ $20 SCROLL WINDOW LEFT WNDWDTH .EQ $21 SCROLL WINDOW WIDTH WNDTOP .EQ $22 SCROLL WINDOW TOP @@ -26,5 +28,15 @@ KSWH .EQ $39 INPUT CHARACTER HOOK HIGH RNDL .EQ $4E RANDOM NUMBER LOW RNDH .EQ $4F RANDOM NUMBER HIGH *-------------------------------------- +* Applesoft FP Registers +*-------------------------------------- +EXPSGN .EQ $9C +FAC .EQ $9D -> A1, MAIN FLT PT ACCUMULATOR +FAC.SIGN .EQ $A2 HOLDS UNPACKED SIGN +ARG .EQ $A5 -> A9, SECONDARY FP ACC +ARG.SIGN .EQ $AA +SGNCPR .EQ $AB FLAGS OPP SIGN IN FP ROUT. +FAC.EXTENSION .EQ $AC FAC EXTENSION BYTE +*-------------------------------------- MAN SAVE INC/ZP.I diff --git a/LIB/LIBCRYPT.S.txt b/LIB/LIBCRYPT.S.txt index a9dfe8a8..b9abd002 100644 --- a/LIB/LIBCRYPT.S.txt +++ b/LIB/LIBCRYPT.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/LIB/LIBGFX.S.txt b/LIB/LIBGFX.S.txt index 67eee76c..213391e6 100644 --- a/LIB/LIBGFX.S.txt +++ b/LIB/LIBGFX.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/LIB/LIBSTR.S.txt b/LIB/LIBSTR.S.txt index f6016821..9bfb534f 100644 --- a/LIB/LIBSTR.S.txt +++ b/LIB/LIBSTR.S.txt @@ -1,33 +1,35 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF LIB/LIBSTR.O + .TF /A2OSX.BOOT/LIB/LIBSTR.O *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I *-------------------------------------- ZPTmpPtr1 .EQ ZPLIB+2 ZPTmpPtr2 .EQ ZPLIB+4 ZPTmpPtr3 .EQ ZPLIB+6 *-------------------------------------- -* Main entry point -* input : -* X = Function -*-------------------------------------- -* Code signature and relocation table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START + .DA 0 + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA LIB.LOAD .DA LIB.UNLOAD .DA PRINTF @@ -53,8 +55,6 @@ PRINTFJMP1 .DA PRINTFA PRINTFJMP2 .DA PRINTFCR,PRINTFBKSLH,PRINTFPERCENT *-------------------------------------- .DA 0 - .DA CS.END-CS.START - .DA 0 *-------------------------------------- LIB.LOAD LIB.UNLOAD clc @@ -756,13 +756,12 @@ CROUT lda #13 *-------------------------------------- COUT phx phy - >PUSHA - ldy #S.PS.hOUTDEV - lda (pPsContext),y - >SYSCALL SYS.DevOutA + ldx #DEVMGR.COUT + jsr pDevJmp ply plx rts +pDevJmp jmp (pDev) *-------------------------------------- CS.END PRINTFTBL1 .AS -"abBdDLeEhHiIsStT" diff --git a/LIB/LIBTCPIP.S.ARP.txt b/LIB/LIBTCPIP.S.ARP.txt index 83e9df38..b24289d3 100644 --- a/LIB/LIBTCPIP.S.ARP.txt +++ b/LIB/LIBTCPIP.S.ARP.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/LIB/LIBTCPIP.S.DNS.txt b/LIB/LIBTCPIP.S.DNS.txt index d18a8a01..13d589da 100644 --- a/LIB/LIBTCPIP.S.DNS.txt +++ b/LIB/LIBTCPIP.S.DNS.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/LIB/LIBTCPIP.S.txt b/LIB/LIBTCPIP.S.txt index c532999d..c78743ea 100644 --- a/LIB/LIBTCPIP.S.txt +++ b/LIB/LIBTCPIP.S.txt @@ -1,15 +1,16 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF LIB/LIBTCPIP.O + .TF /A2OSX.BOOT/LIB/LIBTCPIP.O *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/KERNEL.I .INB INC/LIBTCPIP.I *-------------------------------------- @@ -21,19 +22,20 @@ ZPARPMAC .EQ ZPLIB+8 ZPDNSHostname .EQ ZPLIB+10 ZPDNSIP .EQ ZPLIB+12 *-------------------------------------- -* Main entry point -* input : -* X = Function -*-------------------------------------- -* Code signature and relocation table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START + .DA 0 + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA LIB.LOAD .DA LIB.UNLOAD @@ -73,8 +75,6 @@ L.IPCFG .DA IPCFG L.ARP.CACHE .DA ARP.CACHE L.DNS.CACHE .DA DNS.CACHE .DA 0 - .DA CS.END-CS.START - .DA DS.END-DS.START *-------------------------------------- LIB.LOAD lda bFirstLoad bne .8 @@ -230,14 +230,10 @@ NEW.ARP.FRAME jsr NEW.ETH.FRAME * X = hMem *-------------------------------------- NEW.ETH.FRAME >PUSHWI K.ETH.FRAME.LEN - >PUSHBI 0 + >PUSHBI S.MEM.F.INIT0 >SYSCALL SYS.GetMem bcs .9 >STYA ZPFrameBase1 - phx - txa - >SYSCALL SYS.ClrMemA - plx clc .9 rts *-------------------------------------- @@ -371,7 +367,11 @@ SEND.ETH.FRAME >PUSHW ZPFrameLen1 >PUSHW ZPFrameBase1 ldx #S.IPCFG.HDEV lda IPCFG,x - >SYSCALL SYS.DevOutA + + >SYSCALL SYS.GetDevByIDA + >STYA pDev + ldx #DEVMGR.NET.SEND + jsr pDevJmp rts *-------------------------------------- UDP.LISTENER >PULLW ZPFrameBase1 @@ -461,6 +461,7 @@ ComputeChecksum >PULLA eor #$FF rts *-------------------------------------- +pDevJmp jmp (pDev) CS.END *-------------------------------------- bFirstLoad .DA #0 @@ -474,9 +475,6 @@ DNS.CACHE .BS K.DNSCACHE.SIZE*S.DNSCACHE UDP.TABLE .BS K.UDPTABLE.SIZE*S.LISTENER TCP.TABLE .BS K.TCPTABLE.SIZE*S.LISTENER *-------------------------------------- -DS.START -DS.END -*-------------------------------------- MAN SAVE LIB/LIBTCPIP.S ASM diff --git a/SBIN/DHCPCLNT.S.txt b/SBIN/DHCPCLNT.S.txt index a1d49610..3959d5ed 100644 --- a/SBIN/DHCPCLNT.S.txt +++ b/SBIN/DHCPCLNT.S.txt @@ -1,15 +1,16 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF SBIN/DHCPCLNT + .TF /A2OSX.BOOT/SBIN/DHCPCLNT *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/KERNEL.I .INB INC/LIBSTR.I .INB INC/LIBTCPIP.I @@ -18,17 +19,20 @@ ZPFrameBase1 .EQ ZPBIN ZPFrameLen1 .EQ ZPBIN+2 ZPFramePtr1 .EQ ZPBIN+4 *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START + .DA DS.END-DS.START Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT @@ -37,13 +41,13 @@ L.LIBSTR .DA LIBSTR L.LIBTCPIP .DA LIBTCPIP L.IPCFG .DA IPCFG .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segemnt to Allocate *-------------------------------------- -CS.INIT >LIBLOADP L.LIBSTR +CS.INIT >LDYA L.LIBSTR + >LOADLIBYA sta hLIBSTR - >LIBLOADP L.LIBTCPIP + >LDYA L.LIBTCPIP + >LOADLIBYA sta hLIBTCPIP >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG @@ -79,9 +83,9 @@ CS.INIT >LIBLOADP L.LIBSTR lda #20 sta TimeOut - lda (pPsContext) + lda (pPs) ora #S.PS.F.EVENT Now accept events - sta (pPsContext) + sta (pPs) clc .9 rts @@ -130,8 +134,7 @@ CS.RUN.OK lda #S.IPCFG.STATUS.OK CS.RUN.KO sec rts *-------------------------------------- -CS.DOEVENT >PULLW pEvent - lda (pEvent) +CS.DOEVENT lda (pEvent) and #S.EVT.F.TIMER is it a TIMER event? beq .1 no.... @@ -170,7 +173,8 @@ CS.DOEVENT >PULLW pEvent bcs .9 lda #S.IPCFG.STATUS.ROFFER sta IPCFG - bra .88 + clc + rts .2 lda IPCFG and #S.IPCFG.STATUS.SREQ @@ -180,9 +184,9 @@ CS.DOEVENT >PULLW pEvent lda #S.IPCFG.STATUS.RACK sta IPCFG -.88 >SYSCALL SYS.DestroyEvent -.89 clc + clc rts + .9 sec rts *-------------------------------------- @@ -489,14 +493,14 @@ FRAME.REQ.OPT.SVRIP .BS 4 .HS FF FRAME.REQ.LEN .EQ *-FRAME.REQ *-------------------------------------- -DS.START -*-------------------------------------- hLIBSTR .BS 1 hLIBTCPIP .BS 1 TimeOut .BS 1 IPCFG .BS S.IPCFG *-------------------------------------- +DS.START DS.END +*-------------------------------------- MAN SAVE SBIN/DHCPCLNT.S ASM diff --git a/SBIN/GETTY.S.txt b/SBIN/GETTY.S.txt index cb354af7..5fa30cca 100644 --- a/SBIN/GETTY.S.txt +++ b/SBIN/GETTY.S.txt @@ -1,40 +1,43 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF SBIN/GETTY + .TF /A2OSX.BOOT/SBIN/GETTY *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I + .INB INC/KERNEL.I *-------------------------------------- -* Main entry point +ZPTmp1 .EQ ZPBIN *-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START + .DA DS.END-DS.START Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT .DA CS.QUIT L.MSG.GREETINGS .DA MSG.GREETINGS -L.MSG.LOGIN .DA MSG.LOGIN -L.MSG.PASSWORD .DA MSG.PASSWORD - .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate + .DA 0 End Of Reloc Table *-------------------------------------- CS.INIT ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >PUSHA >PUSHBI $20 Push SEP=' ' >PUSHBI 1 Push 1 for getting INDEV @@ -45,14 +48,16 @@ CS.INIT ldy #S.PS.hARGS >SYSCALL SYS.GetDevByNameA bcs .8 - sta hINDEV + txa ldy #S.PS.hINDEV - sta (pPsContext),y + sta (pPs),y + + lda hDEVNAME >SYSCALL SYS.FreeMemA ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >PUSHA >PUSHBI $20 Push SEP=' ' >PUSHBI 2 Push 1 for getting OUTDEV @@ -63,40 +68,31 @@ CS.INIT ldy #S.PS.hARGS >SYSCALL SYS.GetDevByNameA .8 bcs .98 - sta hOUTDEV + >STYA pDev + txa ldy #S.PS.hOUTDEV - sta (pPsContext),y + sta (pPs),y ldy #S.PS.hERRDEV - sta (pPsContext),y + sta (pPs),y lda hDEVNAME >SYSCALL SYS.FreeMemA ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >PUSHA >PUSHBI $20 Push SEP=' ' >PUSHBI 3 Push 3 for getting BIN >SYSCALL SYS.PStrGetTkn bcs .99 - sta BINID - ldy #S.PS.ID - lda (pPsContext),y -* ldy #S.DEV.hOWNERPS -* sta (DEVMGR.DEVPTR),y - - >LDYA L.MSG.GREETINGS - jsr PRINT.MSG - - lda hOUTDEV - jsr PRBYTE + ldy #hBinName + sta (pData),y + + ldx #DEVMGR.OPEN + jsr pDevJmp if error CS, else... - stz STATUS - lda (pPsContext) - ora #S.PS.F.EVENT Now accept events - sta (pPsContext) - clc Tell TskMgr To stay in memory - rts + rts ...Tell TskMgr To stay in memory + .98 pha lda hDEVNAME @@ -105,200 +101,108 @@ CS.INIT ldy #S.PS.hARGS sec .99 rts *-------------------------------------- -CS.RUN lda STATUS - bne CS.RUN.1 - jsr CROUT - jsr CROUT - >LDYA L.MSG.LOGIN +CS.RUN ldy #S.PS.hOUTDEV + lda (pPs),y + >SYSCALL SYS.GetDevByIDA + >STYA pDev + + lda #13 try send a CR... + + jsr COUT Device Is Ready ? + + bcc .1 + clc no..loop... + rts + +.1 >LDYA L.MSG.GREETINGS jsr PRINT.MSG - jsr INPUT.INIT - inc STATUS - clc - rts -CS.RUN.1 cmp #1 - bne CS.RUN.2 - ldx INSTATUS - beq .9 - ldx INBUFFER - beq .2 -.1 lda INBUFFER,x - sta USERNAME,x - dex - bpl .1 - inc STATUS - clc - rts -.2 dec STATUS -.9 clc - rts -CS.RUN.2 cmp #2 - bne CS.RUN.3 - jsr CROUT - >LDYA L.MSG.PASSWORD - jsr PRINT.MSG - jsr INPUT.INIT - inc STATUS - clc - rts -CS.RUN.3 cmp #3 - bne CS.RUN.4 - ldx INSTATUS - beq .9 - ldx INBUFFER - beq .2 -.1 lda INBUFFER,x - sta PASSWORD,x - dex - bpl .1 -.2 inc STATUS -.9 clc - rts -CS.RUN.4 cmp #4 - bne CS.RUN.5 - jsr CROUT - inc STATUS TODO:CHECK USER/PASS - clc - rts -CS.RUN.5 cmp #5 - bne CS.RUN.6 - lda BINID - ldx pPsContext - stx pPsContext.SAVE - ldx pPsContext+1 - stx pPsContext.SAVE+1 - >SYSCALL SYS.CreateProcessA - ldx pPsContext.SAVE - stx pPsContext - ldx pPsContext.SAVE+1 - stx pPsContext+1 bcs .9 - sta CHILDPSID - inc STATUS - clc - rts -.9 jsr PRBYTE - stz STATUS - clc - rts -CS.RUN.6 dec CHILDPSIDPOLL - bne .8 - lda CHILDPSID Check for CHILDTSKID - >SYSCALL SYS.GetPSByIDA - bcc .8 Still Alive ? - stz STATUS - stz CHILDPSID -.8 clc - rts + + ldy #S.PS.hINDEV + lda (pPs),y + jsr PRBYTE + bcs .9 + lda #',' + + jsr COUT + bcs .9 + + ldy #S.PS.hOUTDEV + lda (pPs),y + jsr PRBYTE + bcs .9 + + ldy #hBinName + lda (pData),y + >SYSCALL SYS.ExecProcessA +.9 rts *-------------------------------------- -CS.DOEVENT >PULLW pEvent - lda CHILDPSID - bne .99 - ldy #S.EVT.hDEV - lda (pEvent),y - cmp hINDEV - bne .99 - lda (pEvent) - and #S.EVT.F.KEY - beq .99 - ldy #S.EVT.DATAHI - lda (pEvent),y - bne .99 - ldy #S.EVT.DATALO - lda (pEvent),y - jsr INPUT.CHARIN - >SYSCALL SYS.DestroyEvent - clc - rts -.99 sec +CS.DOEVENT sec rts *-------------------------------------- -CS.QUIT clc +CS.QUIT ldy #hBinName + lda (pData),y + >SYSCALL SYS.FreeMemA + + ldx #DEVMGR.CLOSE + jsr pDevJmp + + clc rts *-------------------------------------- * PRIVATE *-------------------------------------- -PRINT.MSG >STYA ZPQuickPtr1 +PRINT.MSG >STYA ZPTmp1 ldy #0 -.1 lda (ZPQuickPtr1),y +.1 lda (ZPTmp1),y beq .2 - ora #$80 jsr COUT + bcs .9 iny bne .1 -.2 rts -*-------------------------------------- -INPUT.INIT stz INSTATUS - stz INBUFFER - rts -*-------------------------------------- -INPUT.CHARIN ldx INSTATUS - bne .9 - cmp #$20 - bcc .1 - ldx INBUFFER - inx - cpx #16 - beq .9 - sta INBUFFER,x - stx INBUFFER - ora #$80 - jmp COUT -.1 cmp #$0D - bne .9 - inc INSTATUS -.9 rts +.2 clc +.9 rts *-------------------------------------- PRBYTE pha lsr lsr lsr lsr - ora #$B0 - cmp #$BA + ora #$30 + cmp #$3A bcc .1 adc #6 .1 jsr COUT pla + bcs .9 and #$0F - ora #$B0 - cmp #$BA - bcc COUT + ora #$30 + cmp #$3A + bcc .2 adc #6 - bra COUT +.2 jsr COUT +.9 rts *-------------------------------------- CROUT lda #13 *-------------------------------------- -COUT >PUSHA - phx +COUT phx phy - ldy #S.PS.hOUTDEV - lda (pPsContext),y - >SYSCALL SYS.DevOutA + ldx #DEVMGR.COUT + jsr pDevJmp ply plx rts -*-------------------------------------- -MSG.GREETINGS >CSTRING "A2osX-GeTTY on Dev=" -MSG.LOGIN >CSTRING "login:" -MSG.PASSWORD >CSTRING "password:" +pDevJmp jmp (pDev) *-------------------------------------- CS.END -DS.START -*-------------------------------------- +MSG.GREETINGS >CSTRING "A2osX-GeTTY on Dev=" hDEVNAME .BS 1 -hINDEV .BS 1 -hOUTDEV .BS 1 -BINID .BS 1 -STATUS .BS 1 -CHILDPSID .BS 1 -CHILDPSIDPOLL .BS 1 -INSTATUS .BS 1 -INBUFFER .BS 16 -USERNAME .BS 16 -PASSWORD .BS 16 -pPsContext.SAVE .BS 2 *-------------------------------------- -DS.END + .DUMMY + .OR 0 +DS.START +hBinName .BS 1 +DS.END .ED MAN SAVE SBIN/GETTY.S ASM diff --git a/SBIN/GUI.S.txt b/SBIN/GUI.S.txt index eccb925e..17006f7d 100644 --- a/SBIN/GUI.S.txt +++ b/SBIN/GUI.S.txt @@ -1,74 +1,120 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF SBIN/GUI + .TF /A2OSX.BOOT/SBIN/GUI *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START + .DA 0 + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT .DA CS.QUIT L.DEVNAME.GFX .DA DEVNAME.GFX +L.DEVNAME.MOUSE .DA DEVNAME.MOUSE .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate *-------------------------------------- CS.INIT >LDYA L.DEVNAME.GFX >SYSCALL SYS.GetDevByNameYA bcc .10 rts -.10 sta hDevGFX - >SYSCALL SYS.GetDevByIDA - >STYA ZPQuickPtr1 - - ldy #S.DEV.hCS - lda (ZPQuickPtr1),y - >SYSCALL SYS.GetMemPtrA - - >STYA DevJMP +.10 stx hDevGFX + >STYA pDevGFX - stz C - stz X - stz X+1 +.11 >LDYA L.DEVNAME.MOUSE + >SYSCALL SYS.GetDevByNameYA + bcc .20 -.1 stz Y - >DEBUG -.2 - >PUSHBI C Color - >PUSHBI 2 Mode:1=B/W,2=16 colors,...,128=XOR + inc DEVNAME.MOUSE+4 + lda DEVNAME.MOUSE+4 + cmp #'8' + bne .11 + sec + rts + +.20 stx hDevMouse + >STYA pDevMouse + + lda #A2osX.SCREENS.G + >SYSCALL SYS.ScreenSelectA + + ldx #DEVMGR.OPEN + jsr GoDevGFX + bcs * + + ldx #DEVMGR.OPEN + jsr GoDevMouse + bcs * + + jmp .8 + + lda #2 + sta BW + + stz C + + lda #4 + sta X + lda /4 + sta X+1 + +.1 lda #2 + sta Y + +.2 lda Y + lsr + lsr + lsr + clc + adc C + and #$0F + + >PUSHA + >PUSHB Y >PUSHW X - jsr SetPixel + >PUSHBI 2 Mode:1=B/W,2=16 colors,...,128=XOR + + ldx #DEVMGR.GFX.SETPIXEL + jsr GoDevGFX inc Y lda Y - cmp #192 + cmp #190 bne .2 + dec BW + bne .3 + + lda #2 + sta BW + inc C lda C cmp #16 bne .3 - stz C + stz C .3 lda X clc @@ -77,38 +123,78 @@ CS.INIT >LDYA L.DEVNAME.GFX bcc .4 inc X+1 -.4 lda X - sec - sbc #560 +.4 sec + sbc #556 lda X+1 - sbc /560 + sbc /556 bcc .1 +.8 lda (pPs) + ora #S.PS.F.EVENT Now accept events + sta (pPs) + clc -.9 rts + rts *-------------------------------------- CS.RUN clc rts *-------------------------------------- -CS.DOEVENT clc +CS.DOEVENT ldy #S.EVT.hDEV + lda (pEvent),y + + cmp hDevMouse + bne .99 + + lda (pEvent) + and #S.EVT.F.MOUSE + beq .99 + + ldy #S.EVT.DATALO + lda (pEvent),y + and #4 mouse move + beq .99 + + >PUSHBI 15 COLOR + + ldy #S.EVT.DATAW2 + lda (pEvent),y + >PUSHA Y + + dey + lda (pEvent),y X.HI + >PUSHA + + dey + lda (pEvent),y + >PUSHA X.LO + + >PUSHBI 2 Mode:1=B/W,2=16 colors,...,128=XOR + ldx #DEVMGR.GFX.SETPIXEL + jsr GoDevGFX + + clc rts + +.99 sec + rts *-------------------------------------- CS.QUIT clc rts *-------------------------------------- -SetPixel ldx #DEVMGR.GFX.SETPIXEL - jmp (DevJMP) +GoDevGFX jmp (pDevGFX) +GoDevMouse jmp (pDevMouse) *-------------------------------------- CS.END DEVNAME.GFX >PSTRING "GFX" -DEVNAME.MOU0 >PSTRING "MOU0" -DS.START +DEVNAME.MOUSE >PSTRING "MOU1" hDevGFX .BS 1 -DevJMP .BS 2 +pDevGFX .BS 2 +hDevMouse .BS 1 +pDevMouse .BS 2 X .BS 2 Y .BS 1 C .BS 1 -DS.END +BW .BS 1 MAN SAVE SBIN/GUI.S ASM diff --git a/SBIN/LOGIN.S.txt b/SBIN/LOGIN.S.txt new file mode 100644 index 00000000..00f36601 --- /dev/null +++ b/SBIN/LOGIN.S.txt @@ -0,0 +1,236 @@ +PR#3 +PREFIX /A2OSX.SRC +NEW +INC 1 +AUTO 6 + .LIST OFF + .OP 65C02 + .OR $2000 + .TF /A2OSX.BOOT/SBIN/LOGIN +*-------------------------------------- + .INB INC/MACROS.I + .INB INC/A2OSX.I + .INB INC/A2OSX.API.I +*-------------------------------------- +INPUT.BUFFER.SIZE .EQ 16 +*-------------------------------------- +* File Header (16 Bytes) +*-------------------------------------- +CS.START cld + jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA DS.END-DS.START Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- +.1 .DA CS.INIT + .DA CS.RUN + .DA CS.DOEVENT + .DA CS.QUIT +L.MSG.LOGIN .DA MSG.LOGIN +L.MSG.PASSWORD .DA MSG.PASSWORD +L.SHELL .DA SHELL + .DA 0 +*-------------------------------------- +CS.INIT >LDYA L.SHELL + >SYSCALL SYS.NewPStrYA + bcs .9 + + ldy #hSHELL + sta (pData),y + + lda (pPs) + ora #S.PS.F.EVENT Now accept events + sta (pPs) + clc Tell TskMgr To stay in memory +.9 rts +*-------------------------------------- +CS.RUN lda #0 + ldy #hUSERNAME + sta (pData),y + ldy #hPASSWORD + sta (pData),y + + jsr CROUT + jsr CROUT + >LDYA L.MSG.LOGIN + jsr PRINT.MSG + lda #0 Echo all caracters + jsr INPUT.RESET + +.1 jsr A2osX.Sleep + jsr INPUT.LINEIN + bcc .1 + + jsr CROUT + + >LDYA L.MSG.PASSWORD + jsr PRINT.MSG + lda #'*' + jsr INPUT.RESET + +.2 jsr A2osX.Sleep + jsr INPUT.LINEIN + bcc .2 + + jsr CROUT + + ldy #hSHELL + lda (pData),y + >SYSCALL SYS.ExecProcessA + + bcc .8 + + jsr PRBYTE +.8 clc + rts +*-------------------------------------- +CS.DOEVENT ldy #S.EVT.hDEV + lda (pEvent),y + ldy #S.PS.hINDEV + cmp (pPs),y + bne .99 + + lda (pEvent) + and #S.EVT.F.KEY + beq .99 + + ldy #S.EVT.DATAHI + lda (pEvent),y + bne .99 + + ldy #S.EVT.DATALO + lda (pEvent),y + jsr INPUT.CHARIN + clc + rts + +.99 sec + rts +*-------------------------------------- +CS.QUIT clc + rts +*-------------------------------------- +* PRIVATE +*-------------------------------------- +INPUT.RESET ldy #INPUT.STATUS + sta (pData),y + lda #0 + ldy #INPUT.BUFFER + sta (pData),y + rts +*-------------------------------------- +INPUT.CHARIN tax saver char... + ldy #INPUT.STATUS + lda (pData),y + bmi .9 + + lda #INPUT.BUFFER + clc + adc pData + sta ZPQuickPtr1 + lda pData+1 + adc /INPUT.BUFFER + sta ZPQuickPtr1+1 + + cpx #$20 Control Char? + bcc .2 + + lda (ZPQuickPtr1) + + cmp #INPUT.BUFFER.SIZE Buffer full? + beq .9 + + inc + sta (ZPQuickPtr1) + tay + + txa + sta (ZPQuickPtr1),y + + ldy #INPUT.STATUS + lda (pData),y + bne .1 + txa +.1 jmp COUT + +.2 cpx #$0D + bne .9 + ldy #INPUT.STATUS + lda #$80 + sta (pData),y + +.9 rts +*-------------------------------------- +INPUT.LINEIN ldy #INPUT.STATUS + lda (pData),y + asl CS is a line is in the buffer + rts + ldy #INPUT.BUFFER + lda (pData),y get Line Length + bne .9 if 0, empty line + clc +.9 rts +*-------------------------------------- +PRINT.MSG >STYA ZPQuickPtr1 + ldy #0 +.1 lda (ZPQuickPtr1),y + beq .2 + jsr COUT + iny + bne .1 +.2 rts +*-------------------------------------- +PRBYTE pha + lsr + lsr + lsr + lsr + ora #$30 + cmp #$3A + bcc .1 + adc #6 +.1 jsr COUT + pla + and #$0F + ora #$30 + cmp #$3A + bcc COUT + adc #6 + bra COUT +*-------------------------------------- +CROUT lda #13 +*-------------------------------------- +COUT phx + phy + ldx #DEVMGR.COUT + jsr pDevJmp + ply + plx + rts +pDevJmp jmp (pDev) +CS.END +*-------------------------------------- +MSG.LOGIN >CSTRING "login:" +MSG.PASSWORD >CSTRING "password:" +SHELL >PSTRING "SHELL" +*-------------------------------------- + .DUMMY + .OR 0 +DS.START +INPUT.BUFFER .BS INPUT.BUFFER.SIZE+1 +INPUT.STATUS .BS 1 +hUSERNAME .BS 1 +hPASSWORD .BS 1 +hSHELL .BS 1 +DS.END + .ED +*-------------------------------------- +MAN +SAVE SBIN/LOGIN.S +ASM diff --git a/SBIN/SHELL.S.txt b/SBIN/SHELL.S.txt index a20b2b15..fb93d7f4 100644 --- a/SBIN/SHELL.S.txt +++ b/SBIN/SHELL.S.txt @@ -1,16 +1,17 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF SBIN/SHELL + .TF /A2OSX.BOOT/SBIN/SHELL *-------------------------------------- .INB INC/MACROS.I - .INB INC/A2OSX.I .INB INC/PRODOS.I + .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/LIBSTR.I *-------------------------------------- ZPPTR1 .EQ ZPBIN @@ -19,24 +20,26 @@ ZPPTR3 .EQ ZPBIN+4 *-------------------------------------- CmdBuffer.MAX .EQ 127 *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA DS.END-DS.START Data Segment to Allocate + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT .DA CS.QUIT *-------------------------------------- L.LIBSTR .DA LIBSTR -L.CmdBuffer .DA CmdBuffer L.MSG.GREETINGS .DA MSG.GREETINGS L.MSG.UNKNOWN .DA MSG.UNKNOWN L.MSG.SYNERR .DA MSG.SYNERR @@ -49,60 +52,66 @@ T.INTCMDS .DA EXEC.CMD.CD .DA EXEC.CMD.TYPE .DA EXEC.CMD.EXIT .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate *-------------------------------------- -CS.INIT stz bEXIT - - stz CmdHistory - stz CmdHistory.IDX - stz CmdHistory.END - - >LIBLOADP L.LIBSTR +CS.INIT lda #0 + ldy #bEXIT + sta (pData),y + ldy #CmdHistory + sta (pData),y + ldy #CmdHistory.IDX + sta (pData),y + ldy #CmdHistory.END + sta (pData),y + >LDYA L.LIBSTR + >LOADLIBYA bcs .99 sta hLIBSTR ldy #S.PS.ID - lda (pPsContext),y + lda (pPs),y >PUSHA ldy #S.PS.hOUTDEV - lda (pPsContext),y + lda (pPs),y >PUSHA ldy #S.PS.hINDEV - lda (pPsContext),y + lda (pPs),y >PUSHA >PUSHW L.MSG.GREETINGS >LIBCALL hLIBSTR,LIBSTR.PRINTF - lda (pPsContext) + lda (pPs) ora #S.PS.F.EVENT Now accept events - sta (pPsContext) + sta (pPs) clc .99 rts *-------------------------------------- -CS.RUN stz CmdBuffer +CS.RUN lda #0 + sta (pData) + lda #"$" jsr COUT lda #" " jsr COUT -.1 lda CmdBuffer +.1 lda (pData) bmi .2 jsr A2osX.SLEEP bra .1 .2 and #$7F - sta CmdBuffer + sta (pData) beq CS.RUN Empty line - >PUSHW L.CmdBuffer - >SYSCALL SYS.NewPStr + >LDYA pData + >SYSCALL SYS.NewPStrYA bcs .99 - sta hCMDLINE - jsr HISTORY.ADD + + ldy #hCMDLINE + sta (pData),y +* jsr HISTORY.ADD jsr EXEC.CMD bcc .3 @@ -115,23 +124,27 @@ CS.RUN stz CmdBuffer jsr COUT jsr CROUT -.3 lda hCMDLINE +.3 ldy #hCMDLINE + lda (pData),y >SYSCALL SYS.FreeMemA - stz hCMDLINE + ldy #hCMDLINE + lda #0 + sta (pData),y - lda bEXIT + ldy #bEXIT + lda (pData),y bne .99 + clc rts + .99 sec rts *-------------------------------------- -CS.DOEVENT >PULLW pEvent - - ldy #S.EVT.hDEV is Event from active IN device? +CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device? lda (pEvent),y ldy #S.PS.hINDEV - cmp (pPsContext),y + cmp (pPs),y bne .9 lda (pEvent) @@ -144,27 +157,33 @@ CS.DOEVENT >PULLW pEvent ldy #S.EVT.DATALO lda (pEvent),y - cmp #$1F - bpl .1 + tax + + cpx #$20 + bcs .1 jsr CS.EVENT.CTRL.CHAR bra .8 -.1 cmp #$7f +.1 cpx #$7f bne .2 jsr CmdBuffer.DEL bra .8 -.2 ldx CmdBuffer - cpx #CmdBuffer.MAX +.2 lda (pData) CmdBuffer + + cmp #CmdBuffer.MAX beq .8 - inx - sta CmdBuffer,x - inc CmdBuffer + + inc + sta (pData) + tay + txa + sta (pData),y + ora #$80 jsr COUT -.8 >SYSCALL SYS.DestroyEvent - clc +.8 clc rts .9 sec @@ -174,9 +193,9 @@ CS.EVENT.CTRL.CHAR cmp #13 CR bne .10 jsr CROUT - lda CmdBuffer + lda (pData) CmdBuffer ora #$80 - sta CmdBuffer + sta (pData) clc rts @@ -195,14 +214,14 @@ CS.EVENT.CTRL.CHAR .2 cmp #10 LF (down arrow) bne .3 - jsr HISTORY.GETNEXT +* jsr HISTORY.GETNEXT clc rts .3 cmp #11 VT (up arrow) bne .4 - jsr HISTORY.GETPREV +* jsr HISTORY.GETPREV clc rts @@ -223,17 +242,25 @@ CS.QUIT lda hLIBSTR *-------------------------------------- * PRIVATE *-------------------------------------- -EXEC.CMD >PUSHB hCMDLINE +EXEC.CMD ldy #hCMDLINE + >PUSHB (pData),y >PUSHBI $20 Push SEP=' ' >PUSHBI 0 Push 0 for getting CMD & ARGS >SYSCALL SYS.PStrGetTkn bcs .99 - sta hCMD - stx hARGS + ldy #hCMD + sta (pData),y + pha + txa + ldy #hARGS + sta (pData),y + pla + >SYSCALL SYS.GetMemPtrA >PUSHYA >PUSHYA + >LIBCALL hLIBSTR,LIBSTR.UCASEP >PUSHW L.CMDS >SYSCALL SYS.GetPStrIndex @@ -245,14 +272,17 @@ EXEC.CMD >PUSHB hCMDLINE rts .1 jsr .98 Discard CMD & ARGS - lda hCMDLINE + ldy #hCMDLINE + lda (pData),y >SYSCALL SYS.ExecProcessA rts .98 pha - lda hCMD + ldy #hCMD + lda (pData),y >SYSCALL SYS.FreeMemA - lda hARGS + ldy #hARGS + lda (pData),y >SYSCALL SYS.FreeMemA pla sec @@ -262,10 +292,11 @@ EXEC.CMD.INT asl tax jmp (T.INTCMDS,x) *-------------------------------------- -EXEC.CMD.CD lda hARGS +EXEC.CMD.CD ldy #hARGS + lda (pData),y bne EXEC.CMD.CD.C ldy #S.PS.hPREFIX - lda (pPsContext),y + lda (pPs),y >SYSCALL SYS.GetMemPtrA >PUSHYA >LIBCALL hLIBSTR,LIBSTR.PRINTP @@ -276,15 +307,16 @@ EXEC.CMD.CD lda hARGS EXEC.CMD.CD.C >SYSCALL SYS.GetMemPtrA >STYA ZPPTR2 ldy #S.PS.hPREFIX - lda (pPsContext),y + lda (pPs),y >SYSCALL SYS.GetMemPtrA >STYA ZPPTR1 >PUSHWI MLI.MAXPATH+1 Get a buffer for new PATH >PUSHBI 0 no particular Option >SYSCALL SYS.GetMem bcs .99 - stx hNEWPATH >STYA ZPPTR3 + stx hNEWPATH + lda #0 sta (ZPPTR3) ldy #1 @@ -321,6 +353,7 @@ EXEC.CMD.CD.C >SYSCALL SYS.GetMemPtrA pla sec .99 rts + .2 >PUSHW ZPPTR1 >PUSHW ZPPTR3 >LIBCALL hLIBSTR,LIBSTR.STRCPYP @@ -340,21 +373,45 @@ EXEC.CMD.CD.C >SYSCALL SYS.GetMemPtrA >SYSCALL SYS.CheckPrefixA bcs .98 ldy #S.PS.hPREFIX - lda (pPsContext),y + lda (pPs),y pha lda hNEWPATH - sta (pPsContext),y + sta (pPs),y pla >SYSCALL SYS.FreeMemA clc rts *-------------------------------------- -EXEC.CMD.SET clc +EXEC.CMD.SET ldy #hARGS + lda (pData),y + bne .2 + + ldy #S.PS.hENV + lda (pPs),y + >SYSCALL SYS.GetMemPtrA + >STYA ZPPTR1 + +.1 lda (ZPPTR1) + beq .8 Ending 0 ? + >PUSHW ZPPTR1 + >LIBCALL hLIBSTR,LIBSTR.PRINTP + jsr CROUT + + lda ZPPTR1 + sec + adc (ZPPTR1) Add len+1 to PTR + sta ZPPTR1 + bcc .1 + inc ZPPTR1 + bra .1 + +.2 sec rts + +.8 clc + rts *-------------------------------------- -EXEC.CMD.DATE jsr MLI - .DA #MLIGETTIME - .DA 0 +EXEC.CMD.DATE >SYSCALL SYS.MLIGetTime bcs .9 >PUSHW DATELO >LIBCALL hLIBSTR,LIBSTR.PRINTDATE @@ -362,9 +419,7 @@ EXEC.CMD.DATE jsr MLI clc .9 rts *-------------------------------------- -EXEC.CMD.TIME jsr MLI - .DA #MLIGETTIME - .DA 0 +EXEC.CMD.TIME >SYSCALL SYS.MLIGetTime bcs .9 >PUSHW TIMELO >LIBCALL hLIBSTR,LIBSTR.PRINTTIME @@ -372,14 +427,32 @@ EXEC.CMD.TIME jsr MLI clc .9 rts *-------------------------------------- -EXEC.CMD.ECHO lda #$DD - sec +EXEC.CMD.ECHO ldy #hARGS + lda (pData),y + beq .98 + >SYSCALL SYS.ExpandPStrA + bcs .99 + + pha + >SYSCALL SYS.GetMemPtrA + >PUSHYA + >LIBCALL hLIBSTR,LIBSTR.PRINTP + jsr CROUT + pla + >SYSCALL SYS.FreeMemA + clc rts + +.98 lda #SYSMGR.ERRSYN + sec +.99 rts *-------------------------------------- -EXEC.CMD.TYPE lda hARGS +EXEC.CMD.TYPE ldy #hARGS + lda (pData),y beq .98 >SYSCALL SYS.LoadFileA bcs .99 + >STYA ZPPTR2 store file len phx txa @@ -393,7 +466,6 @@ EXEC.CMD.TYPE lda hARGS .2 dec ZPPTR2 lda (ZPPTR1) - ora #$80 jsr COUT inc ZPPTR1 bne .1 @@ -406,10 +478,12 @@ EXEC.CMD.TYPE lda hARGS rts .98 lda #SYSMGR.ERRSYN + sec .99 rts *-------------------------------------- -EXEC.CMD.EXIT lda #$FF - sta bEXIT +EXEC.CMD.EXIT ldy #bEXIT + lda #$FF + sta (pData),y clc rts *-------------------------------------- @@ -479,14 +553,13 @@ HISTORY.SETBUF jsr CmdBuffer.CLR bne .1 bra CmdBuffer.PRINT *-------------------------------------- -CmdBuffer.PRINT ldx #0 -.1 inx - lda CmdBuffer,x +CmdBuffer.PRINT ldy #0 +.1 iny + lda (pData),y ora #$80 - phx jsr COUT - plx - cpx CmdBuffer + tya + cmp (pData) bne .1 rts *-------------------------------------- @@ -494,11 +567,13 @@ CmdBuffer.CLR jsr CmdBuffer.DEL bne CmdBuffer.CLR .9 rts *-------------------------------------- -CmdBuffer.DEL lda CmdBuffer +CmdBuffer.DEL lda (pData) beq .9 lda #8 jsr COUT - dec CmdBuffer + lda (pData) + dec + sta (pData) .9 rts *-------------------------------------- PRBYTE pha @@ -523,13 +598,12 @@ CROUT lda #13 *-------------------------------------- COUT phx phy - >PUSHA - ldy #S.PS.hOUTDEV - lda (pPsContext),y - >SYSCALL SYS.DevOutA + ldx #DEVMGR.COUT + jsr pDevJmp ply plx rts +pDevJmp jmp (pDev) *-------------------------------------- CS.END *-------------------------------------- @@ -546,22 +620,22 @@ LIBSTR >PSTRING "libstr.o" MSG.GREETINGS >CSTRING "\nA2osX-Shell on Dev=(%h:%h),PS=%h\n\n" MSG.UNKNOWN >CSTRING "Command Not Found\n" MSG.SYNERR >CSTRING "Syntax Error Or Invalid Pathname\n" -*-------------------------------------- -DS.START -*-------------------------------------- hLIBSTR .BS 1 +hNEWPATH .BS 1 +*-------------------------------------- + .DUMMY + .OR 0 +DS.START +CmdBuffer .BS CmdBuffer.MAX+1 bEXIT .BS 1 hCMDLINE .BS 1 hCMD .BS 1 hARGS .BS 1 -hNEWPATH .BS 1 -CmdBuffer .BS CmdBuffer.MAX+1 -CmdBuffer.POS .BS 1 CmdHistory .BS 256 CmdHistory.IDX .BS 1 CmdHistory.END .BS 1 -*-------------------------------------- DS.END + .ED *-------------------------------------- MAN SAVE SBIN/SHELL.S diff --git a/SBIN/TCPIP.S.txt b/SBIN/TCPIP.S.txt index d23f07ec..9a584760 100644 --- a/SBIN/TCPIP.S.txt +++ b/SBIN/TCPIP.S.txt @@ -1,15 +1,16 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF SBIN/TCPIP + .TF /A2OSX.BOOT/SBIN/TCPIP *-------------------------------------- .INB INC/MACROS.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/KERNEL.I .INB INC/LIBTCPIP.I *-------------------------------------- @@ -20,17 +21,20 @@ ZPFrameBase2 .EQ ZPBIN+6 ZPFrameLen2 .EQ ZPBIN+8 ZPFramePtr2 .EQ ZPBIN+10 *-------------------------------------- -* Main entry point -*-------------------------------------- -* Code signature and INIT table -*-------------------------------------- -* CLD $D8 -* JMP (*,x) $7C -* #JMPTABLE -* /JMPTABLE +* File Header (16 Bytes) *-------------------------------------- CS.START cld jmp (.1,x) + .DA #$61 6502,Level 1 (65c02) + .DA #1 BIN Layout Version 1 + .DA 0 + .DA CS.END-CS.START Code Length To Relocate + .DA 0 + .DA 0 + .DA 0 +*-------------------------------------- +* Relocation Table +*-------------------------------------- .1 .DA CS.INIT .DA CS.RUN .DA CS.DOEVENT @@ -39,11 +43,11 @@ L.LIBTCPIP .DA LIBTCPIP L.CFGFILENAME .DA CFGFILENAME L.IPCFG .DA IPCFG .DA 0 - .DA CS.END-CS.START Code Length To Relocate - .DA DS.END-DS.START Data Segment to Allocate *-------------------------------------- -CS.INIT >LIBLOADP L.LIBTCPIP +CS.INIT >LDYA L.LIBTCPIP + >LOADLIBYA bcs .99 + sta hLIBTCPIP ldx #0 .1 stz IPCFG,x @@ -74,15 +78,15 @@ CS.INIT >LIBLOADP L.LIBTCPIP >SYSCALL SYS.AddNetCfg bcs .99 - lda (pPsContext) + lda (pPs) ora #S.PS.F.EVENT Now accept events - sta (pPsContext) + sta (pPs) clc .99 rts *-------------------------------------- CS.INIT.DEV ldy #S.PS.hARGS - lda (pPsContext),y + lda (pPs),y >PUSHA >PUSHBI $20 Push SEP=' ' >PUSHBI 1 Push 1 for getting DEV @@ -91,25 +95,29 @@ CS.INIT.DEV ldy #S.PS.hARGS sta hDEVNAME save DevName for discard >SYSCALL SYS.GetDevByNameA bcs .98 - + >STYA pDev + txa sta hDev ldx #S.IPCFG.HDEV sta IPCFG,x - >SYSCALL SYS.GetDevInfoA - >STYA ZPQuickPtr1 + ldx #DEVMGR.OPEN + jsr pDevJmp - ldy #0 + ldx #DEVMGR.GETINFO + jsr pDevJmp + >STYA ZPQuickPtr1 + + ldy #1 ldx #S.IPCFG.MAC .1 lda (ZPQuickPtr1),y sta IPCFG,x - inx iny - cpy #S.IPCFG.MAC+6 + inx + cpx #S.IPCFG.MAC+6 bne .1 - lda hDEVNAME - >SYSCALL SYS.FreeMemA + jsr .98 clc rts @@ -120,8 +128,8 @@ CS.INIT.DEV ldy #S.PS.hARGS .99 sec rts *-------------------------------------- -CS.INIT.CFGFILE >PUSHW L.CFGFILENAME - >SYSCALL SYS.ExpandPStr +CS.INIT.CFGFILE >LDYA L.CFGFILENAME + >SYSCALL SYS.ExpandPStrYA bcs .99 sta hCfgFileName >SYSCALL SYS.LoadFileA @@ -154,8 +162,7 @@ CS.INIT.CFGFILE >PUSHW L.CFGFILENAME CS.RUN clc rts *-------------------------------------- -CS.DOEVENT >PULLW pEvent - lda (pEvent) +CS.DOEVENT lda (pEvent) and #S.EVT.F.NET beq .9 @@ -221,13 +228,20 @@ CS.DOEVENT.NET ldy #S.EVT.DATALO Get Frame hMem bcc .89 rts -.89 >SYSCALL SYS.DestroyEvent - clc +.89 clc rts + .99 sec rts *-------------------------------------- -CS.QUIT lda hLIBTCPIP +CS.QUIT lda hDev + >SYSCALL SYS.GetDevByIDA + >STYA pDev + + ldx #DEVMGR.OPEN + jsr pDevJmp + + lda hLIBTCPIP >SYSCALL SYS.FreeMemA clc rts @@ -428,14 +442,12 @@ CopyFramePtr12 dey bne CopyFramePtr12 rts *-------------------------------------- +pDevJmp jmp (pDev) CS.END *-------------------------------------- LIBTCPIP >PSTRING "libtcpip.o" CFGFILENAME >PSTRING "%ETC%TCPIP.CONF" DefaultHostName >CSTRING "a2osx-host" -*-------------------------------------- -DS.START -*-------------------------------------- hLIBTCPIP .BS 1 hDEVNAME .BS 1 hDev .BS 1 @@ -444,8 +456,6 @@ hCfgFile .BS 1 hCfgFileLen .BS 2 IPCFG .BS S.IPCFG Get in cache for faster access with ,X *-------------------------------------- -DS.END -*-------------------------------------- MAN SAVE SBIN/TCPIP.S ASM diff --git a/SBIN/TELNETD.S.txt b/SBIN/TELNETD.S.txt index d2ba3ef0..1317abbf 100644 --- a/SBIN/TELNETD.S.txt +++ b/SBIN/TELNETD.S.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/SYS/KERNEL.S.BIN.txt b/SYS/KERNEL.S.BIN.txt index cf142aab..178aa4f3 100644 --- a/SYS/KERNEL.S.BIN.txt +++ b/SYS/KERNEL.S.BIN.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -13,375 +13,227 @@ AUTO 6 * Y,A = MEMPTR * X = hMem of Code Segment *-------------------------------------- -S.LoadBinA sta R.DH save file path +S.LoadBinA sta S.LoadBinA.hFilename save file path jsr S.GetMemByNameA bcs .1 not already loaded - >STYA R.AX Save base address + + >STYA ZPQuickPtr1 Save base address ldy #S.MEM.REFCNT - lda (R.AX),y + lda (ZPQuickPtr1),y inc - sta (R.AX),y + sta (ZPQuickPtr1),y + ldy #S.MEM.PTR - lda (R.AX),y + lda (ZPQuickPtr1),y pha Y,A = MEM PTR... iny - lda (R.AX),y + lda (ZPQuickPtr1),y ply X=hMem from S.GetMemByNameA clc rts -.1 lda R.DH +.1 lda S.LoadBinA.hFilename jsr S.LoadFileA - bcs .99 - >STYA R.BX save file length for relocation - stx R.DL save hMem + bcc .2 + rts Error Loading file + +.2 >STYA S.LoadBinA.FileLen + stx S.LoadBinA.hMem save hMem txa jsr S.GetMemPtrA - >STYA R.AX save base address for relocation - lda R.DH - jsr S.MLIGetFileInfoA Get File Info for AUXTYPE - bcs .98 - >STYA ZPQuickPtr1 - ldy #2 get AUXTYPE + >STYA ZPQuickPtr1 save base address for relocation + + ldy #H.BIN.CODE.LEN make AX = Code Len lda (ZPQuickPtr1),y - sta R.CL + sta R.AL iny lda (ZPQuickPtr1),y - sta R.CH save File load address for relocation - lda R.AL compute offset for relocation.... + sta R.AH + + lda S.LoadBinA.hFilename + jsr S.MLIGetFileInfoA Get File Info for AUXTYPE + bcs .98 + + >STYA ZPQuickPtr2 + ldy #2 get AUXTYPE + lda (ZPQuickPtr2),y + sta R.BL Make BX=Range Start=AUXTYPE + sta S.LoadBinA.AuxType + clc + adc S.LoadBinA.FileLen + sta R.CL Make CX=Range End=AUXTYPE+FILELEN + iny + lda (ZPQuickPtr2),y + sta R.BH + sta S.LoadBinA.AuxType+1 + adc S.LoadBinA.FileLen+1 + sta R.CH + + lda ZPQuickPtr1 Compute relocation offset in DX sec - sbc R.CL ...AX-CX... - sta R.CL - lda R.AH - sbc R.CH - sta R.CH ...to CX - jsr S.BinRelocate + sbc S.LoadBinA.AuxType + sta R.DL DX=Offset=ZPQuickPtr1-AUXTYPE + lda ZPQuickPtr1+1 + sbc S.LoadBinA.AuxType+1 + sta R.DH + + >LDYA ZPQuickPtr1 + jsr S.BinRelocateYA + bcs .98 relocation error, dicard Code segment - lda R.DH get back bin path + + lda S.LoadBinA.hFilename get back bin path jsr S.PStrCpyA bcs .98 + pha save copy of bin path - lda R.DL + lda S.LoadBinA.hMem jsr S.GetMemByIDA >STYA ZPQuickPtr1 + lda (ZPQuickPtr1) ora #S.MEM.F.CODE This is a code segment sta (ZPQuickPtr1) + ldy #S.MEM.BIN pla get back copy of bin path sta (ZPQuickPtr1),y - >LDYA R.AX return CS PTR ... not modified by S.LoadCodeReloc - ldx R.DL ...and hMEM to Caller - clc + + lda S.LoadBinA.hMem + tax return hMEM to Caller... + jsr S.GetMemPtrA + clc ...and Y,A=PTR to CS rts + .98 pha - lda R.DL + lda S.LoadBinA.hMem jsr S.FreeMemA Discard Loaded Code pla -.99 sec - rts -*-------------------------------------- -* S.LoadDrvA -* in : -* A = hMem To Full Cmd Line -* out : -* none -*-------------------------------------- -S.LoadDrvA >PUSHA push Cmd Line for S.PStrGetTkn - >LDYAI MSG.DRVLOAD - jsr S.SysScrPPSTR - jsr S.CreateDevice - bcc .1 - pha save error code - >PULLA discard Cmd Line - pla + sec rts - -.1 >PUSHBI $20 Push SEP=' ' - >PUSHBI 0 Push 0 for getting CMD And ARGS - jsr S.PStrGetTkn - bcs .98 - ldy #S.DEV.hCMD - sta (DEVMGR.DEVPTR),y - - >PUSHA push CMD for S.FileSearch - txa - ldy #S.DEV.hARGS - sta (DEVMGR.DEVPTR),y - >PUSHWI ENV.DRV push ENVNAME=DRV - ldy #S.PS.hENV - lda TSKMGR.TABLE,y Get PS #0 Env - >PUSHA - jsr S.GetEnvVarP get value for ENV=%DRV% - bcs .98 - - sta LoadDrv.ENV - >PUSHA A=PStr to Value - jsr S.FileSearch find File in %DRV% - bcs .98 not Found - - sta LoadDrv.BIN - jsr S.SysScrPPSTRA - - lda LoadDrv.BIN - jsr S.LoadBinA X = BinPath hMem - bcs .97 - >STYA Kernel.JMP save PTR to Code Segment - txa - ldy #S.DEV.hCS - sta (DEVMGR.DEVPTR),y save CS hMem in DEVSLOT - - lda LoadDrv.BIN - jsr S.FreeMemA - lda LoadDrv.ENV - jsr S.FreeMemA - - ldx #DEVMGR.OPEN - >LDYA DEVMGR.DEVPTR - jsr Kernel.DRVCALL Call DRV Open function - bcs .99 - - lda (DEVMGR.DEVPTR) - ora #S.DEV.F.INUSE Get Device Flags in A - sta (DEVMGR.DEVPTR) +*-------------------------------------- +S.LoadBinA.hFilename .BS 1 +S.LoadBinA.hMem .BS 1 +S.LoadBinA.AuxType .BS 2 +S.LoadBinA.FileLen .BS 2 +*-------------------------------------- +* S.BinRelocateYA : +* YA = 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.BinRelocateYA >STYA ZPQuickPtr1 + ldy #H.BIN.JMP relocate Main JMP + lda (ZPQuickPtr1),y clc - rts - -.97 pha save error code - lda LoadDrv.BIN - jsr S.FreeMemA discard BIN in case of failed load - pla - -.98 pha - lda LoadDrv.ENV - jsr S.FreeMemA - pla - -.99 pha - jsr S.DestroyDevice - pla - sec - rts -*-------------------------------------- -* S.LoadLib -* in : -* PULLW = PTR To Lib Name -* out : -* A = hMem To loaded LIB -*-------------------------------------- -S.LoadLib jsr S.NewPStr - bcs .99 - pha save LibName hMem for discard - jsr S.LoadLibA - bcs .98 - plx get back STR hMem - pha save error code/hMem - txa - jsr S.FreeMemA discard STR hMem - pla get back error code/hMem - clc - rts -.98 plx get back STR hMem - pha save error code/hMem - txa - jsr S.FreeMemA discard STR hMem - pla get back error code/hMem - sec -.99 rts -*-------------------------------------- -* S.LoadLibA -* in : -* A = hMem To Lib Name -* out : -* A = hMem of Loaded Lib -*-------------------------------------- -S.LoadLibA >PUSHA push libname for S.FileSearch - >LDYAI MSG.LOADLIB - jsr S.SysScrPPSTR - >PUSHWI ENV.LIB push ENVNAME=LIB - ldy #S.PS.hENV - lda (TSKMGR.TSKPTR),y - >PUSHA - jsr S.GetEnvVarP get value for ENV=LIB - bcs .99 - pha save hMem to LIB VALUE - >PUSHA Push %LIB% VALUE - jsr S.FileSearch find libname in %LIB% - bcs .98 - pha save hMem to LIB full path - jsr S.SysScrPPSTRA - pla - pha - jsr S.LoadBinA A = hMem of filename full path - bcs .97 - phx - >STYA Kernel.JMP - - ldx #LIBMGR.LOAD - jsr Kernel.LIBCALL Call LIB.LOAD function - - bcs .97 - - plx - pla discard LIB PATH - jsr S.FreeMemA - pla discard LIB VALUE - jsr S.FreeMemA - txa - clc - rts -.97 pla discard LIB PATH - jsr S.FreeMemA -.98 pla discard LIB VALUE - jsr S.FreeMemA - sec -.99 rts -*-------------------------------------- -* S.UnloadLibA -* in : -* A = hMem To Lib -* out : -*-------------------------------------- -S.UnloadLibA pha - jsr S.GetMemByIDA - >STYA ZPQuickPtr1 - ldy #S.MEM.REFCNT - lda (ZPQuickPtr1),y Get count of those referencing this lib - dec only one left ? - beq .1 + adc R.DL sta (ZPQuickPtr1),y - pla - clc - rts - -.1 ldy #S.MEM.PTR - lda (ZPQuickPtr1),y - pha + iny lda (ZPQuickPtr1),y - ply - >STYA Kernel.JMP + adc R.DH + sta (ZPQuickPtr1),y + + ldy #H.BIN.RELOC.TABLE skip Header, CS.SIZE & DS.SIZE... (16 bytes) + bra S.JmpRelocate - ldx #LIBMGR.UNLOAD - jsr Kernel.BINCALL Call LIB.UNLOAD function - pla - jmp S.FreeMemA -*-------------------------------------- -* S.BinRelocate : -* R.AX = base address to start relocate -* R.BX = segment length (including data) -* R.CX = offset to apply to all abs addresses within segment -* R.DX unmodified -*-------------------------------------- -S.BinRelocate lda (R.AX) - cmp #K.BIN.MAGICHEADER - bne .99 - ldy #1 - lda (R.AX),y - cmp /K.BIN.MAGICHEADER - beq .1 -.99 sec Not a Valid Relocatable BIN File, exiting - rts -.1 >PUSHW R.DX - lda R.AL - clc - adc R.BL Make BX end of Segment Range (BX=AX+BX) - sta R.BL - lda R.AH - adc R.BH - sta R.BH +S.DrvRelocateYA >STYA ZPQuickPtr1 + ldy #0 + +S.JmpRelocate lda (ZPQuickPtr1),y Start Relocate JMP table + tax iny -.2 lda (R.AX),y Start Relocate JMP table - clc - adc R.CL - tax save LO to X - iny - lda (R.AX),y if HI = 0,we are done - beq .3 - adc R.CH - sta (R.AX),y + ora (ZPQuickPtr1),y + beq S.CodeRelocate $0000 = end of table + dey - txa get back LO - sta (R.AX),y - iny - iny - bra .2 -.3 iny we already skipped the 2 "0" bytes indicating end of JMP table - lda R.AL + txa clc - adc (R.AX),y make DX = end of opcode range - sta R.DL + adc R.DL + sta (ZPQuickPtr1),y + iny - lda R.AH - adc (R.AX),y - sta R.DH + lda (ZPQuickPtr1),y + adc R.DH + sta (ZPQuickPtr1),y + iny -* Start relocating opcodes between R.AX and R.DX with abs addressing pointing between R.AX and R.BX -* Applying offset = R.CX - tya add current offset in Y to R.AX + + bra S.JmpRelocate + +S.CodeRelocate lda ZPQuickPtr1 clc - adc R.AL - sta ZPQuickPtr1 - lda #0 + adc R.AL Make ZPQuickPtr2=End of code + sta ZPQuickPtr2 =ZPQuickPtr1+AX (code len) + lda ZPQuickPtr1+1 adc R.AH - sta ZPQuickPtr1+1 -.4 lda (ZPQuickPtr1) get OPCODE + 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 - clc - adc R.CL add CX to abs address - sta ZPQuickPtr2 store relocated addr LO - iny - lda (ZPQuickPtr1),y Get HI - adc R.CH - sta ZPQuickPtr2+1 store relocated addr LO - dey - lda ZPQuickPtr2 Get new LO - sec - sbc R.AL - iny - lda ZPQuickPtr2+1 Get new HI - sbc R.AH - bcc .6 new addr < AX, out of range - dey - lda ZPQuickPtr2 Get new LO sec sbc R.BL iny - lda ZPQuickPtr2+1 Get new HI + lda (ZPQuickPtr1),y Get HI sbc R.BH - bcs .6 new addr > BX, out of range + bcc .6 addr < AX, out of range + dey - lda ZPQuickPtr2 Get new LO - sta (ZPQuickPtr1),y + lda (ZPQuickPtr1),y Get LO + sec + sbc R.CL iny - lda ZPQuickPtr2+1 Get new HI - sta (ZPQuickPtr1),y -.6 lda OPCODES,x -.7 and #$3 get OPCODE length + lda (ZPQuickPtr1),y Get HI + sbc R.CH + bcs .6 addr > CX, out of range + + dey + lda (ZPQuickPtr1),y Get LO clc + adc R.DL add DX to abs address + sta (ZPQuickPtr1),y store relocated addr LO + iny + lda (ZPQuickPtr1),y Get HI + adc R.DH + sta (ZPQuickPtr1),y store relocated addr HI + +.6 pla + +.7 clc A = OPCODE length adc ZPQuickPtr1 sta ZPQuickPtr1 bcc .8 inc ZPQuickPtr1+1 -.8 sec A already got Ptr LO - sbc R.DL - lda ZPQuickPtr1+1 is Ptr greater than DX ? - sbc R.DH - bcc .4 no, continue relocating - >PULLW R.DX + +.8 lda ZPQuickPtr1 is Current PTR < Code Limit ? + sec + sbc ZPQuickPtr2 + lda ZPQuickPtr1+1 + sbc ZPQuickPtr2+1 + bcc .5 yes, continue relocating + clc rts -*-------------------------------------- -MSG.DRVLOAD >PSTRING "\nLoadDrv:" -MSG.LOADLIB >PSTRING "\nLoadLib:" -LoadDrv.ENV .BS 1 -LoadDrv.BIN .BS 1 - *-------------------------------------- * 65C02 OPCODES * Bit 7 : 1 absolute addressing diff --git a/SYS/KERNEL.S.DEV.txt b/SYS/KERNEL.S.DEV.txt index 3df7e7c7..1860805c 100644 --- a/SYS/KERNEL.S.DEV.txt +++ b/SYS/KERNEL.S.DEV.txt @@ -1,35 +1,28 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 *-------------------------------------- +DevMgr.HiMem .EQ $FFFE Protect IRQ vector in Aux LC +*-------------------------------------- * S.DevMgrInit *-------------------------------------- -S.DevMgrInit ldx #S.DEV.SIZE*K.DEV.MAX -.1 stz DEVMGR.TABLE-1,x +S.DevMgrInit ldx #S.DEV.SIZE*2 +.1 lda DevMgr.NUL-1,x + sta DevMgr.Table-1,x dex bne .1 - - ldy #5 -.2 lda DEVMGR.TABLE.NUL,y - sta DEVMGR.TABLE,y - dey - bpl .2 - - ldy #5 - ldx #S.DEV.SIZE+5 -.3 lda DEVMGR.TABLE.KBD,y - sta DEVMGR.TABLE,x - dex - dey - bpl .3 + + stz DevMgr.Table+S.DEV.SIZE*2+1 lda #1 reserve #0=NUL, #1=KBD - sta DEVMGR.LASTID - + sta DevMgr.LastDevID + + >LDYAI DevMgr.End + >STYA DevMgr.Free clc rts *-------------------------------------- @@ -41,185 +34,185 @@ S.DevMgrInit ldx #S.DEV.SIZE*K.DEV.MAX * Y,A = devslot * X Unmodified *-------------------------------------- -S.GetDevByIDA sta ZPQuickPtr1 - lda #K.DEV.MAX - sta ZPQuickPtr1+1 - - >LDYAI DEVMGR.TABLE - >STYA ZPQuickPtr2 - -.1 lda (ZPQuickPtr2) get S.DEV.F - bpl .2 In use ? - ldy #S.DEV.ID - lda (ZPQuickPtr2),y - cmp ZPQuickPtr1 - beq .8 - -.2 lda ZPQuickPtr2 - clc - adc #S.DEV.SIZE - sta ZPQuickPtr2 - bcc .3 - inc ZPQuickPtr2+1 - -.3 dec ZPQuickPtr1+1 - bne .1 - sec - rts - -.8 >LDYA ZPQuickPtr2 - clc - rts +S.GetDevByIDA cmp DevMgr.LastDevID + beq .1 + bcs .9 + +.1 stz S.GetDevByIDA.T + + asl + ror S.GetDevByIDA.T + asl + ror S.GetDevByIDA.T + asl + ror S.GetDevByIDA.T + asl + ror S.GetDevByIDA.T + + adc #DevMgr.Table + tay + lda S.GetDevByIDA.T + adc /DevMgr.Table + rts CC + +.9 lda #DEVMGR.ERRDNF + rts CS +S.GetDevByIDA.T .BS 1 *-------------------------------------- * GetDevIDByNameA * IN: * A = hPStr * OUT: * CC = OK, CS = ERROR -* A = DEVID -* set DEVMGR.DEVPTR to devslot +* X = DEVID +* Y,A = pDev *-------------------------------------- S.GetDevByNameA jsr S.GetMemPtrA S.GetDevByNameYA >STYA ZPQuickPtr1 - >LDYAI DEVMGR.TABLE - >STYA DEVMGR.DEVPTR + >LDYAI DevMgr.Table+S.DEV.NAME + >STYA ZPQuickPtr2 - ldx #K.DEV.MAX -.1 lda (DEVMGR.DEVPTR) get S.DEV.F - bpl .3 empty ? - lda DEVMGR.DEVPTR - clc - adc #S.DEV.NAME - sta ZPQuickPtr2 - lda DEVMGR.DEVPTR+1 - adc /S.DEV.NAME - sta ZPQuickPtr2+1 - lda (ZPQuickPtr1) + ldx #0 + +.1 lda (ZPQuickPtr1) cmp (ZPQuickPtr2) bne .3 + tay .2 lda (ZPQuickPtr1),y cmp (ZPQuickPtr2),y bne .3 + dey bne .2 - ldy #S.DEV.ID - lda (DEVMGR.DEVPTR),y - clc - rts -.3 lda DEVMGR.DEVPTR - clc - adc #S.DEV.SIZE - sta DEVMGR.DEVPTR - bcc .5 - inc DEVMGR.DEVPTR+1 -.5 dex - bne .1 - lda #DEVMGR.ERRDNF - sec - rts -*-------------------------------------- -* S.GetDevTable -* IN : -* OUT CC = OK, CS = ERROR -* Y,A = PTR to dev table -* X = LASTID -*-------------------------------------- -S.GetDevTable >LDYAI DEVMGR.TABLE - ldx DEVMGR.LASTID - rts -*-------------------------------------- -* S.DevOutA -* IN : -* A = hDev -*-------------------------------------- -S.DevOutA ldx #DEVMGR.OUT - jmp S.DevCallFunc -*-------------------------------------- -* S.GetDevInfoA -*-------------------------------------- -S.GetDevInfoA ldx #DEVMGR.GETINFO - jmp S.DevCallFunc -*-------------------------------------- -* PRIVATE -*-------------------------------------- -S.DevCallFunc jsr S.GetDevByIDA - bcs .9 - >STYA pDevContext - ldy #S.DEV.hCS - lda (pDevContext),y - jsr S.GetMemPtrA X = unmodified - >STYA Kernel.JMP - >LDYA pDevContext - jsr Kernel.DRVCALL Call DRV function -.9 rts -*-------------------------------------- -* S.CreateDevSlot -* IN : none -* OUT : A = DevID -* set DEVMGR.DEVPTR to freeslot -*-------------------------------------- -S.CreateDevice >LDYAI DEVMGR.TABLE - >STYA DEVMGR.DEVPTR - ldx #K.DEV.MAX -.1 lda (DEVMGR.DEVPTR) - bpl .3 - lda DEVMGR.DEVPTR - clc - adc #S.DEV.SIZE - sta DEVMGR.DEVPTR - bcc .2 - inc DEVMGR.DEVPTR+1 -.2 dex - bne .1 - lda #DEVMGR.ERROOS + lda ZPQuickPtr2 sec - rts - -.3 lda #0 + sbc #S.DEV.NAME tay -.4 sta (DEVMGR.DEVPTR),y - iny - cpy #S.DEV.SIZE - bne .4 - inc DEVMGR.LASTID - lda DEVMGR.LASTID - ldy #S.DEV.ID - sta (DEVMGR.DEVPTR),y + lda ZPQuickPtr2+1 + sbc /S.DEV.NAME clc rts + +.3 lda ZPQuickPtr2 + clc + adc #S.DEV.SIZE + sta ZPQuickPtr2 + bcc .4 + + inc ZPQuickPtr2+1 + +.4 cpx DevMgr.LastDevID + inx + bcc .1 + +.9 lda #DEVMGR.ERRDNF + rts *-------------------------------------- -* S.DestroyDevSlot -* selected by (DEVMGR.DEVPTR) +S.GetDevEvent >LDYAI DevMgr.Table + >STYA pDev + + stz DevMgr.DevID + +.1 ldy #S.DEV.F + lda (pDev),y get S.DEV.F + and #S.DEV.F.EVENT + beq .2 EVENT enabled ? + + ldx #DEVMGR.GETEVENT + jsr pDevJmp Call DRV GetEvent function + bcc .8 Got An Event + +.2 lda pDev + clc + adc #S.DEV.SIZE + sta pDev + bcc .3 + inc pDev+1 + +.3 lda DevMgr.DevID + inc DevMgr.DevID + cmp DevMgr.LastDevID + bne .1 + + lda #0 error code=0,CS=no event + sec + rts + +.8 lda DevMgr.DevID Carry is alredy clear + ldy #S.EVT.hDEV + sta (pEvent),y + rts *-------------------------------------- -S.DestroyDevice ldy #S.DEV.hCS - lda (DEVMGR.DEVPTR),y - beq .1 - jsr S.FreeMemA -.1 ldy #S.DEV.hDS - lda (DEVMGR.DEVPTR),y - beq .2 - jsr S.FreeMemA -.2 ldy #S.DEV.hCMD - lda (DEVMGR.DEVPTR),y - beq .3 - jsr S.FreeMemA -.3 ldy #S.DEV.hARGS - lda (DEVMGR.DEVPTR),y - beq .4 - jsr S.FreeMemA -.4 rts +DevMgr.Free .BS 2 +DevMgr.DevID .BS 1 +DevMgr.LastDevID .BS 1 *-------------------------------------- -DEVMGR.TABLE.NUL .DA #S.DEV.F.INUSE+S.DEV.F.CHAR+S.DEV.F.BLOCK - .HS 00 ID - >PSTRING "NUL" NAME -DEVMGR.TABLE.KBD .DA #S.DEV.F.INUSE+S.DEV.F.CHAR - .HS 01 ID - >PSTRING "KBD" NAME -DEVMGR.LASTID .BS 1 +DevMgr.NUL cld + jmp (DevMgr.NUL.Code,x) + .DA #S.DEV.F.INUSE+S.DEV.F.SHARE+S.DEV.F.COUT+S.DEV.F.CHAR + >PSTRING "NUL" NAME + .HS 00 NAME must Be 5 bytes long + .HS 00.00 + .HS 00.00.00.00 *-------------------------------------- +DevMgr.KBD cld + jmp (DevMgr.KBD.Code,x) + .DA #S.DEV.F.INUSE+S.DEV.F.EVENT+S.DEV.F.CHAR + >PSTRING "KBD" NAME + .HS 00 NAME must Be 5 bytes long + .HS 00.00 + .HS 00.00.00.00 +*-------------------------------------- +DevMgr.NUL.Code .DA .8 OPEN + .DA .8 GETEVENT + .DA .8 COUT + .DA .8 CLOSE + .DA .8 GETINFO + .DA .8 IRQ +.8 clc + rts +*-------------------------------------- +DevMgr.KBD.Code .DA .8 OPEN + .DA DevMgr.KBD.GETEVENT + .DA .8 COUT + .DA .8 CLOSE + .DA .8 GETINFO + .DA .8 IRQ +.8 clc + rts +*-------------------------------------- +DevMgr.KBD.GETEVENT + lda KBD + bpl .9 + + sta KBDSTROBE + and #$7F + ldy #S.EVT.DATA + sta (pEvent),y + iny + lda OPENAPPLE + asl + lda SOLIDAPPLE + ror + and #$C0 + sta (pEvent),y + lda #S.EVT.F.KEY + + sta (pEvent) + clc + rts + +.9 inc A2osX.RANDOM16 + bne .99 + inc A2osX.RANDOM16+1 +.99 lda #0 error code=0 + sec no event + rts +*-------------------------------------- +DevMgr.End .EQ * MAN SAVE SYS/KERNEL.S.DEV LOAD SYS/KERNEL.S diff --git a/SYS/KERNEL.S.DRV.txt b/SYS/KERNEL.S.DRV.txt new file mode 100644 index 00000000..5e211f63 --- /dev/null +++ b/SYS/KERNEL.S.DRV.txt @@ -0,0 +1,285 @@ +PR#3 +PREFIX /A2OSX.SRC +NEW +INC 1 +AUTO 6 + .LIST OFF + .OP 65C02 +*-------------------------------------- +* S.LoadDrvA +* in : +* A = hMem To Full Cmd Line +* out : +* none +*-------------------------------------- +S.LoadDrvA >PUSHA push Cmd Line for S.PStrGetTkn + >LDYAI MSG.DRVLOAD + jsr S.SysScrPPSTRYA + + >PUSHBI $20 Push SEP=' ' + >PUSHBI 0 Push 0 for getting CMD And ARGS + jsr S.PStrGetTkn + bcc .1 + rts + +.1 sta LoadDrv.Cmd + stx LoadDrv.Args + >PUSHA push CMD for S.FileSearch + + >PUSHWI ENV.DRV push ENVNAME=DRV + ldy #S.PS.hENV + lda TskMgr.Table,y Get PS #0 Env + >PUSHA + jsr S.GetEnvVarP get value for ENV=%DRV% + bcs .98 + + sta LoadDrv.Path + >PUSHA A=PStr to Value + jsr S.FileSearch find File in %DRV% + bcs .97 not Found + + sta LoadDrv.FullName + jsr S.SysScrPPSTRA + + lda LoadDrv.FullName + jsr S.LoadBinA + bcs .96 + + >STYA pCode + stx LoadDrv.hMem + + lda LoadDrv.Args + jsr pCodeJmp call Dev.Detect + + bcs .95 + + jsr S.InsDrv + bcs .95 + + jsr .95 + + ldy #S.DEV.F + lda (pDev),y + ora #S.DEV.F.INUSE + sta (pDev),y + clc + rts + +.95 pha + lda LoadDrv.hMem + jsr S.FreeMemA + pla + +.96 pha + lda LoadDrv.FullName + jsr S.FreeMemA + pla + +.97 pha + lda LoadDrv.Path + jsr S.FreeMemA + pla + +.98 pha + lda LoadDrv.Args + jsr S.FreeMemA + lda LoadDrv.Cmd + jsr S.FreeMemA + pla + +.99 sec + rts +*-------------------------------------- +MSG.DRVLOAD >PSTRING "\nLoadDrv:" +LoadDrv.Cmd .BS 1 +LoadDrv.Args .BS 1 +LoadDrv.Path .BS 1 +LoadDrv.FullName .BS 1 +LoadDrv.hMem .BS 1 +*-------------------------------------- +* pCode = .DRV File Loaded Address +*-------------------------------------- +S.InsDrv ldy #H.BIN.DRV.CODE.LEN + lda (pCode),y + sta R.AL + iny + lda (pCode),y + sta R.AH + + ldy #H.BIN.DRV.CODE.O + lda (pCode),y + clc + adc S.LoadBinA.AuxType + sta R.BL + iny + lda (pCode),y + adc S.LoadBinA.AuxType+1 + sta R.BH set BX=End Of Code + + lda S.LoadBinA.AuxType + clc + adc S.LoadBinA.FileLen + sta R.CL + lda S.LoadBinA.AuxType+1 + adc S.LoadBinA.FileLen+1 + sta R.CH set CX=End Of Range + + ldy #H.BIN.DRV.CODE.O + lda S.LoadBinA.FileLen + sec + sbc (pCode),y + sta S.InsDrv.DRVLen + iny + lda S.LoadBinA.FileLen+1 + sbc (pCode),y + sta S.InsDrv.DRVLen+1 Compute DRV Len + + lda DevMgr.Free + clc + adc S.InsDrv.DRVLen + sta S.InsDrv.DRVEnd + lda DevMgr.Free+1 + adc S.InsDrv.DRVLen+1 + sta S.InsDrv.DRVEnd+1 + + bcs .98 we crossed $FFFF, out of mem + + lda S.InsDrv.DRVEnd + sec + sbc #DevMgr.HiMem + lda S.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 (pCode),y + clc + adc pCode + sta ZPQuickPtr1 + iny + lda (pCode),y + adc pCode+1 + sta ZPQuickPtr1+1 + + ldy #S.DEV.JMP + + lda DevMgr.Free + sec + sbc (ZPQuickPtr1),y + sta R.DL + lda DevMgr.Free+1 + iny + sbc (ZPQuickPtr1),y + sta R.DH set DX=Offset + + ldy #H.BIN.DRV.CODE.O + lda (pCode),y + clc + adc pCode + pha + iny + lda (pCode),y + adc pCode+1 + ply + + jsr S.DrvRelocateYA + + jsr S.InsDrv.Move + + >LDYA S.InsDrv.DrvEnd + >STYA DevMgr.Free + clc + rts + +.98 lda #DEVMGR.ERROOM + sec + rts + +.99 lda #DEVMGR.ERROOH + sec + rts +*-------------------------------------- +S.InsDrv.Move ldy #H.BIN.DEV.HEADER.O + lda (pCode),y + clc + adc pCode + sta ZPQuickPtr1 + iny + lda (pCode),y + adc pCode+1 + sta ZPQuickPtr1+1 + + ldy #S.DEV.JMP Relocate Main JMP + lda (ZPQuickPtr1),y + clc + adc R.DL + sta (ZPQuickPtr1),y + iny + lda (ZPQuickPtr1),y + adc R.DH + sta (ZPQuickPtr1),y + + lda DevMgr.LastDevID + jsr S.GetDevByIDA + >STYA pDev + + ldy #S.DEV.SIZE-1 Copy DRV.Header + +.1 lda (ZPQuickPtr1),y + sta (pDev),y + dey + bpl .1 + + ldy #H.BIN.DRV.CODE.O + lda (pCode),y + clc + adc pCode + sta ZPQuickPtr1 + iny + lda (pCode),y + adc pCode+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 S.InsDrv.DrvLen + ldx S.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 +*-------------------------------------- +S.InsDrv.DrvLen .BS 2 +S.InsDrv.DrvEnd .BS 2 +*-------------------------------------- +MAN +SAVE SYS/KERNEL.S.DRV +LOAD SYS/KERNEL.S +ASM diff --git a/SYS/KERNEL.S.ENV.txt b/SYS/KERNEL.S.ENV.txt index 69df3806..2bb12b23 100644 --- a/SYS/KERNEL.S.ENV.txt +++ b/SYS/KERNEL.S.ENV.txt @@ -1,28 +1,20 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 *-------------------------------------- -* S.ExpandPStr -* In: -* PULLW = PSTR to String to Expand (PSTRING) -* Out: -* A = hMem to Expanded String (PSTRING) -*-------------------------------------- * S.ExpandPStrA * In: * A = hMem of String to Expand (PSTRING) * Out: * A = hMem to Expanded String (PSTRING) *-------------------------------------- -S.ExpandPStr >PULLW R.AX - bra S.ExpandPStr2 S.ExpandPStrA jsr S.GetMemPtrA - >STYA R.AX -S.ExpandPStr2 stz TmpBuffer256 init Expanded String len=0 +S.ExpandPStrYA >STYA R.AX + stz TmpBuffer256 init Expanded String len=0 stz R.BL reset "in var" ldy #0 .1 iny @@ -65,7 +57,7 @@ S.ExpandPStr2 stz TmpBuffer256 init Expanded String len=0 pha Get back ENVNAME hMem >PUSHA ldy #S.PS.hENV - lda (TSKMGR.TSKPTR),y + lda (pPs),y >PUSHA jsr S.GetEnvVarH bcs .5 @@ -98,8 +90,8 @@ S.ExpandPStr2 stz TmpBuffer256 init Expanded String len=0 cmp (R.AX) last char? beq .81 jmp .1 -.81 >PUSHWI TmpBuffer256 - jsr S.NewPStr +.81 >LDYAI TmpBuffer256 + jsr S.NewPStrYA rts *-------------------------------------- * S.CreateEnv @@ -118,7 +110,7 @@ S.CreateEnv >PUSHWI K.ENV.SIZE get a buffer for ENV clc .9 rts *-------------------------------------- -* S.DupEnvA2 +* S.DupEnvA * In: * A = ENV hMem To Duplicate * Out: @@ -128,8 +120,7 @@ S.DupEnvA pha jsr S.GetMemPtrA >STYA ZPQuickPtr1 pla - jsr S.GetMemLenA - >PUSHYA + >PUSHWI K.ENV.SIZE >PUSHBI 0 jsr S.GetMem bcs .9 @@ -401,6 +392,24 @@ S.SelectEnv .9 sec rts *-------------------------------------- +S.PrintSysEnv ldy #S.PS.hENV + lda TskMgr.Table,y Get PS #0 ENV + jsr S.GetMemPtrA + >STYA R.AX +.1 lda (R.AX) + beq .8 Ending 0 ? + >LDYA R.AX + jsr S.SysScrPPSTRYA + jsr S.SysScrCROUT + lda R.AL + sec + adc (R.AX) Add len+1 to PTR + sta R.AL + bcc .1 + inc R.AH + bra .1 +.8 rts +*-------------------------------------- MAN SAVE SYS/KERNEL.S.ENV LOAD SYS/KERNEL.S diff --git a/SYS/KERNEL.S.EVT.txt b/SYS/KERNEL.S.EVT.txt index abde36ad..d8bdfd3a 100644 --- a/SYS/KERNEL.S.EVT.txt +++ b/SYS/KERNEL.S.EVT.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -17,17 +17,18 @@ S.EvtMgrInit stz EVTMGR.PENDING * OUT : * CS = no event, A = ERROR * CC * event in YA -* (EVTMGR.EVTPTR) +* (pEvent) *-------------------------------------- S.GetEvent lda EVTMGR.PENDING Get Pending EVENT hMem if any beq .1 jsr S.GetMemPtrA - >STYA EVTMGR.EVTPTR + >STYA pEvent clc rts + .1 jsr S.CreateEvent bcs .9 - stx EVTMGR.PENDING + jsr S.GetSysEvent bcc .9 got SYS event jsr S.GetDevEvent @@ -39,12 +40,12 @@ S.GetEvent lda EVTMGR.PENDING Get Pending EVENT hMem if any *-------------------------------------- S.GetSysEvent lda VBL get VLINE status eor EVTMGR.VBLSTATE - bpl .2 no change + bpl .9 no change sta EVTMGR.VBLSTATE save new dec EVTMGR.FRAMECNT - bne .2 + bne .9 lda #K.TIMER16RESOLUTION sta EVTMGR.FRAMECNT @@ -53,97 +54,26 @@ S.GetSysEvent lda VBL get VLINE status inc A2osX.TIMER16+1 .1 lda #S.EVT.F.TIMER - sta (EVTMGR.EVTPTR) - clc - rts -.2 lda KBD - bpl .9 - and #$7F - sta KBDSTROBE - ldy #S.EVT.DATA - sta (EVTMGR.EVTPTR),y - iny - lda OPENAPPLE - asl - lda SOLIDAPPLE - ror - and #$C0 - sta (EVTMGR.EVTPTR),y - lda #S.EVT.F.KEY - sta (EVTMGR.EVTPTR) - ldy #S.EVT.hDEV - lda #1 Source dev = KBD - sta (EVTMGR.EVTPTR),y - clc +.8 sta (pEvent) + clc rts -.9 inc A2osX.RANDOM16 - bne .99 - inc A2osX.RANDOM16+1 -.99 lda #0 error code=0 +.9 lda #0 error code=0 sec no event rts *-------------------------------------- -S.GetDevEvent >LDYAI DEVMGR.TABLE - >STYA DEVMGR.DEVPTR - ldx #K.DEV.MAX -.1 lda (DEVMGR.DEVPTR) get S.DEV.F - bpl .3 empty ? - and #S.DEV.F.EVENT - beq .3 EVENT enabled ? - ldy #S.DEV.ID - lda (DEVMGR.DEVPTR),y - ldy #S.EVT.hDEV - sta (EVTMGR.EVTPTR),y - ldy #S.DEV.hCS - lda (DEVMGR.DEVPTR),y - jsr S.GetMemPtrA - >STYA Kernel.JMP - - phx - >PUSHW EVTMGR.EVTPTR - ldx #DEVMGR.GETEVENT - - jsr Kernel.DRVCALL Call DRV GetEvent function - - plx - bcc .9 Got An Event - -.3 lda DEVMGR.DEVPTR - clc - adc #S.DEV.SIZE - sta DEVMGR.DEVPTR - bcc .4 - inc DEVMGR.DEVPTR+1 -.4 dex - bne .1 - lda #0 error code=0 - sec no event -.9 rts -*-------------------------------------- * S.CreateEvent * OUT : * X = hMem * Y,A = PTR to EVENT *-------------------------------------- S.CreateEvent >PUSHWI S.EVT.SIZE - >PUSHBI 0 + >PUSHBI S.MEM.F.INIT0 jsr S.GetMem bcs .9 - >STYA EVTMGR.EVTPTR - lda #0 - ldy #S.EVT.SIZE-1 -.1 sta (EVTMGR.EVTPTR),y - dey - bpl .1 - clc -.9 rts -*-------------------------------------- -S.DestroyEvent lda EVTMGR.PENDING - beq .9 - jsr S.DestroyEventA - stz EVTMGR.PENDING + >STYA pEvent + stx EVTMGR.PENDING .9 rts *-------------------------------------- * S.DestroyEvent @@ -151,24 +81,29 @@ S.DestroyEvent lda EVTMGR.PENDING * A = Event hMem * OUT : *-------------------------------------- -S.DestroyEventA pha - jsr S.GetMemPtrA - >STYA EVTMGR.EVTPTR - lda (EVTMGR.EVTPTR) +S.DestroyEvent lda EVTMGR.PENDING + beq .9 + + lda (pEvent) and #S.EVT.F.hMEM1 beq .1 + ldy #S.EVT.DATALO - lda (EVTMGR.EVTPTR),y + lda (pEvent),y jsr S.FreeMemA -.1 lda (EVTMGR.EVTPTR) + +.1 lda (pEvent) and #S.EVT.F.hMEM2 beq .2 + ldy #S.EVT.DATAHI - lda (EVTMGR.EVTPTR),y + lda (pEvent),y jsr S.FreeMemA -.2 pla + +.2 lda EVTMGR.PENDING jsr S.FreeMemA - rts + stz EVTMGR.PENDING +.9 rts *-------------------------------------- EVTMGR.VBLSTATE .BS 1 EVTMGR.FRAMECNT .BS 1 diff --git a/SYS/KERNEL.S.FS.txt b/SYS/KERNEL.S.FS.txt index 95a9a989..fefa0e65 100644 --- a/SYS/KERNEL.S.FS.txt +++ b/SYS/KERNEL.S.FS.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -9,7 +9,7 @@ AUTO 6 * PUBLIC *-------------------------------------- S.CheckPrefixA jsr S.GetMemPtrA -S.CheckPrefix >STYA MLICALL.PARAMS+1 +S.CheckPrefixYA >STYA MLICALL.PARAMS+1 >STYA ZPQuickPtr1 lda (ZPQuickPtr1) beq .98 @@ -20,7 +20,7 @@ S.CheckPrefix >STYA MLICALL.PARAMS+1 bne .98 cpx #1 "/" allowed for listing online volumes beq .8 - >KMLICALL MLIGETFILEINFO + >MLICALL MLIGETFILEINFO bcs .98 No, invalid path... lda MLICALL.PARAMS+4 Check file type cmp #$0F Directory? @@ -46,37 +46,46 @@ S.FileSearch >PULLA Get Search path pla sec rts + .10 sta R.BL Store Expanded path list to search >PULLB R.AH Store Filename lda #1 sta R.BH Start At Token 1 + .1 >PUSHB R.BL push expanded path list >PUSHBI $3B Push SEP=';' >PUSHB R.BH Push Token IDX jsr S.PStrGetTkn Get R.BL token in A bcs .98 + sta R.CL Store Token path >PUSHB R.AH push filename >PUSHB R.CL Push Token path jsr S.PStrCat bcs .97 + sta R.CH Store Full path (Token Path+filename) jsr S.MLIGetFileInfoA bcc .8 + lda R.CH Discard this Full Path jsr S.FreeMemA lda R.CL Discard Token path jsr S.FreeMemA inc R.BH Try next Token bne .1 + beq .98 go to discard Expanded path list + .97 lda R.CL Discard Token path jsr S.FreeMemA + .98 lda R.BL Discard Expanded Path list jsr S.FreeMemA lda #SYSMGR.ERRFNF sec rts + .8 jsr .97 Dicard all except Full Path lda R.CH clc @@ -91,20 +100,24 @@ S.FileSearch >PULLA Get Search path *-------------------------------------- S.LoadFileA jsr S.MLIOpenA bcs .99 + sta R.AL save ref_num stx R.AH save Prodos Buffer for freemem jsr S.MLIGetEOFA bcs .98 + phx Larger than 64k? plx beq .1 File too big!!!! lda #SYSMGR.ERRFTB bra .98 + .1 >STYA R.BX save Length >PUSHYA Push Length for S.GetMem >PUSHBI 0 jsr S.GetMem bcs .98 + >STYA R.CX stx R.DL save Segment hMem >PUSHW R.BX Push Length for S.ReadFile @@ -112,24 +125,29 @@ S.LoadFileA jsr S.MLIOpenA >PUSHB R.AL Push ref_num jsr S.MLIRead bcs .97 + lda R.AL jsr S.MLICloseA + lda R.AH jsr S.FreeMemA Discard ProDOS IO Buffer >LDYA R.BX Return File Length... ldx R.DL ...and hMem to Caller clc rts + .97 pha lda R.DL jsr S.FreeMemA freemem because of failed load pla + .98 pha lda R.AL jsr S.MLICloseA lda R.AH jsr S.FreeMemA ProDOS IO Buffer pla + .99 sec rts *-------------------------------------- @@ -143,7 +161,7 @@ S.ListDirInitA sta R.AL stz TmpFileName Reset File.Pattern jsr S.GetMemPtrA >STYA R.BX Store path - jsr S.CheckPrefix is it a existing directory? + jsr S.CheckPrefixYA is it a existing directory? bcc .4 yes, continue with empty pattern lda (R.BX) no, get pattern at end of full path @@ -174,13 +192,11 @@ S.ListDirInitA sta R.AL sta (R.BX) remove pattern from path .4 >PUSHWI S.LISTDIR.SIZE get LISTDIR Struct - >PUSHBI 0 + >PUSHBI S.MEM.F.INIT0 reset all bytes jsr S.GetMem bcs .99 stx R.AH >STYA R.CX Store LISTDIR Struct - txa - jsr S.ClrMemA reset all bytes ldy TmpFileName beq .5 @@ -233,8 +249,10 @@ S.ListDirInitAV >PUSHWI 256 jsr S.MLIOnline bcs .98 ldy #S.LISTDIR.ONLINEPTR - lda #0 make index point first Entry - sta (R.CX),y + +* lda #0 make index point first Entry +* sta (R.CX),y + clc rts .98 lda (R.CX) @@ -242,10 +260,12 @@ S.ListDirInitAV >PUSHWI 256 .99 sec rts *-------------------------------------- -S.ListDirInitAD lda #0 - sta (R.CX) reset hONLINE +S.ListDirInitAD +* lda #0 +* sta (R.CX) reset hONLINE + >LDYA R.BX Open DIR - jsr S.MLIOpen + jsr S.MLIOpenYA bcs .99 ldy #S.LISTDIR.REFNUM sta (R.CX),y save ref_num @@ -284,10 +304,11 @@ S.ListDirInitAD lda #0 ldy #S.LISTDIR.FC+1 sta (R.CX),y - ldy #S.LISTDIR.FI - sta (R.CX),y - iny - sta (R.CX),y set FI to $0000 +* ldy #S.LISTDIR.FI +* lda #0 +* sta (R.CX),y +* iny +* sta (R.CX),y set FI to $0000 clc .99 rts *-------------------------------------- @@ -393,7 +414,7 @@ S.ListDirNextAD stz R.DL Reset Return Record hMem lda (R.AX) Is is a deleted file ? (storage_type=0) and #$F0 - beq .40 + beq .5 cmp #$F0 Volume header ? beq .30 yes, do not filter @@ -403,8 +424,9 @@ S.ListDirNextAD stz R.DL Reset Return Record hMem ldy #S.LISTDIR.hPATTERN any filter ? lda (R.CX),y beq .30 + jsr S.GetMemPtrA - >PUSHYA push Filter hMem + >PUSHYA push Filter PTR lda (R.AX) and #$0F @@ -415,9 +437,9 @@ S.ListDirNextAD stz R.DL Reset Return Record hMem dey bne .31 - >PUSHWI TmpFileName push Filename + >PUSHWI TmpFileName push Filename PTR jsr S.PStrMatchP - bcs .40 no match + bcs .5 no match .30 ldy #S.LISTDIR.EL Get Entry length lda (R.CX),y @@ -439,23 +461,23 @@ S.ListDirNextAD stz R.DL Reset Return Record hMem dey bpl .4 -.40 ldy #S.LISTDIR.EIB Set ENTRY INDEX IN BLOCK +=1 +.5 ldy #S.LISTDIR.EIB Set ENTRY INDEX IN BLOCK +=1 lda (R.CX),y inc sta (R.CX),y + ldy #S.LISTDIR.EL Set BLOCK PTR +=entry_length lda (R.CX),y ldy #S.LISTDIR.BLKPTR clc adc (R.CX),y sta (R.CX),y - bcc .5 iny lda (R.CX),y - inc + adc #0 sta (R.CX),y -.5 lda (R.AX) + lda (R.AX) and #$E0 is storage_type = $F or $E ? cmp #$E0 yes, do NOT increase FI bne .6 @@ -503,7 +525,8 @@ S.ListDirCloseA pha beq .3 jsr S.FreeMemA -.3 lda (ZPQuickPtr1) Online buffer +.3 ldy #S.LISTDIR.hONLINE + lda (ZPQuickPtr1),y beq .4 jsr S.FreeMemA @@ -535,7 +558,7 @@ S.ListDirReadBlock >STYA MLICALL.PARAMS+2 >LDYAI 512 >STYA MLICALL.PARAMS+4 - >KMLICALL MLIREAD + >MLICALL MLIREAD bcs .9 ldy #S.LISTDIR.BLKPTR set BLKPTR to $0004 lda #4 diff --git a/SYS/KERNEL.S.LIB.txt b/SYS/KERNEL.S.LIB.txt new file mode 100644 index 00000000..0af123d5 --- /dev/null +++ b/SYS/KERNEL.S.LIB.txt @@ -0,0 +1,115 @@ +PR#3 +PREFIX /A2OSX.SRC +NEW +INC 1 +AUTO 6 + .LIST OFF + .OP 65C02 +*-------------------------------------- +* S.LoadLibYA +* in : +* Y,A = PTR To Lib Name +* out : +* A = hMem To loaded LIB +*-------------------------------------- +S.LoadLibYA jsr S.NewPStrYA + bcs .99 + + sta S.LoadLibYA.hLibName save LibName hMem for discard + jsr S.LoadLibA + + php save error status + + pha save error code/hMem + lda S.LoadLibYA.hLibName + jsr S.FreeMemA discard STR hMem + pla get back error code/hMem + plp ..and error status +.99 rts +S.LoadLibYA.hLibName .BS 1 +*-------------------------------------- +* S.LoadLibA +* in : +* A = hMem To Lib Name +* out : +* A = hMem of Loaded Lib +*-------------------------------------- +S.LoadLibA >PUSHA push libname for S.FileSearch + >LDYAI MSG.LOADLIB + jsr S.SysScrPPSTRYA + >PUSHWI ENV.LIB push ENVNAME=LIB + ldy #S.PS.hENV + lda (pPs),y + >PUSHA + jsr S.GetEnvVarP get value for ENV=LIB + bcs .99 + pha save hMem to LIB VALUE + >PUSHA Push %LIB% VALUE + jsr S.FileSearch find libname in %LIB% + bcs .98 + pha save hMem to LIB full path + jsr S.SysScrPPSTRA + pla + pha + jsr S.LoadBinA A = hMem of filename full path + bcs .97 + phx + >STYA pLib + + ldx #LIBMGR.LOAD + jsr pLibJmp Call LIB.LOAD function + + bcs .97 + + plx + pla discard LIB PATH + jsr S.FreeMemA + pla discard LIB VALUE + jsr S.FreeMemA + txa + clc + rts + +.97 pla discard LIB PATH + jsr S.FreeMemA +.98 pla discard LIB VALUE + jsr S.FreeMemA + sec +.99 rts +*-------------------------------------- +* S.UnloadLibA +* in : +* A = hMem To Lib +* out : +*-------------------------------------- +S.UnloadLibA pha + jsr S.GetMemByIDA + >STYA ZPQuickPtr1 + ldy #S.MEM.REFCNT + lda (ZPQuickPtr1),y Get count of those referencing this lib + dec only one left ? + beq .1 + sta (ZPQuickPtr1),y + pla + clc + rts + +.1 ldy #S.MEM.PTR + lda (ZPQuickPtr1),y + pha + iny + lda (ZPQuickPtr1),y + ply + >STYA pLib + + ldx #LIBMGR.UNLOAD + jsr pLibJmp Call LIB.UNLOAD function + pla + jmp S.FreeMemA +*-------------------------------------- +MSG.LOADLIB >PSTRING "\nLoadLib:" +*-------------------------------------- +MAN +SAVE SYS/KERNEL.S.LIB +LOAD SYS/KERNEL.S +ASM diff --git a/SYS/KERNEL.S.MEM.txt b/SYS/KERNEL.S.MEM.txt index a00abda0..b3d7201d 100644 --- a/SYS/KERNEL.S.MEM.txt +++ b/SYS/KERNEL.S.MEM.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -9,48 +9,46 @@ AUTO 6 * !!!!!!!! DO NOT USE VCPU16 !!!!!!!! * !!!!!! DO NOT USE ZPQuickPTRs !!!!! *-------------------------------------- -ZPMemMgrReqS .EQ ZPMemMgr store requested Size -ZPMemMgrReqF .EQ ZPMemMgr+2 store requested Flags -ZPMemMgrSPtr .EQ ZPMemMgr+6 Pointer To Slot selected -ZPMemMgrTmp1 .EQ ZPMemMgr+8 -ZPMemMgrTmp2 .EQ ZPMemMgr+10 -ZPMemMgrTmp3 .EQ ZPMemMgr+12 +ZPMemMgrSPtr .EQ ZPMemMgr Pointer To Slot selected +ZPMemMgrTmp1 .EQ ZPMemMgr+2 +ZPMemMgrTmp2 .EQ ZPMemMgr+4 +ZPMemMgrTmp3 .EQ ZPMemMgr+6 *-------------------------------------- * TODO : -* - Create a 256 bytes table in SLOT #0 -* (eh, mem.ID=0 always used! useful to test if hMem=0) +* - Create a 256 bytes table * mapping hMem's to real memory blocks to help * Garbage collector move blocks +* - mem.ID=0 always used! useful to test if hMem=0 *-------------------------------------- -S.MemMgrInit stz MEMMGR.MHLIMIT - stz MEMMGR.HIMEM +S.MemMgrInit >LDYAI MemMgr.MHiMem + >STYA MemMgr.HiMem + >STYA MemMgr.Free - ldx /MLI - dex Reserve $BE00 For Global Page - stx MEMMGR.MHLIMIT+1 - stx MEMMGR.HIMEM+1 + >LDYAI MemMgr.MLoMem + >STYA MemMgr.LoMem - >LDYAI A2osX.LOMEM - >STYA MEMMGR.MLLIMIT - >STYA MEMMGR.LOMEM - stz MEMMGR.TABLESIZE Init Table Size to 0 -* jsr S.UpdateMemStats Not needed, will be called by S.GetMem - >PUSHWI 256 get a 256 bytes buffer for Map Table, hMem=0 - >PUSHBI 0 - jsr S.GetMem create it... + stz MemMgr.LastSlot Reserve Slot #0 + + sta SETREADAUX + sta SETWRITEAUX + + >LDYAI MemMgr.XHiMem + >STYA MemMgr.HiMem + >STYA MemMgr.Free + + >LDYAI MemMgr.XLoMem + >STYA MemMgr.LoMem + + stz MemMgr.LastSlot Reserve Slot #0 + + sta CLRREADAUX + sta CLRWRITEAUX + clc rts *-------------------------------------- * PUBLIC *-------------------------------------- -S.SetLowMemLimit - clc - rts -*-------------------------------------- -S.GarbageCollector - clc - rts -*-------------------------------------- * S.GetMem * In: * PULLB = FLAGS @@ -60,58 +58,99 @@ S.GarbageCollector * X = S.MEM.ID * CS on err *-------------------------------------- -S.GetMem >PULLB ZPMemMgrReqF store requested flags - >PULLW ZPMemMgrReqS store requested size - lda ZPMemMgrReqS align REQS to 16 bytes +S.GetMem >PULLB MemMgr.ReqFlags store requested flags + and #S.MEM.F.AUX + beq .11 + + sta SETREADAUX Aux Mem requested,switch to AUX + sta SETWRITEAUX + +.11 >PULLW MemMgr.ReqSize Store requested size + lda MemMgr.ReqSize align REQS to 16 bytes and #$0F beq .10 - lda ZPMemMgrReqS + + lda MemMgr.ReqSize and #$F0 clc adc #$10 - sta ZPMemMgrReqS + sta MemMgr.ReqSize bcc .10 - inc ZPMemMgrReqS+1 -.10 ldx #0 init to SLOT #0 of MEMSLOT list + inc MemMgr.ReqSize+1 + +.10 >LDYAI MemMgr.Table + >STYA ZPMemMgrSPtr + + ldx #0 Current slot=0 - lda MEMMGR.TABLESIZE Check if some free slot to reuse first - beq .6 -.1 txa - jsr S.GetMemByIDA + lda MemMgr.LastSlot Check if some free slot to reuse first + beq .41 + + sta MemMgr.SlotCnt + +.1 inx move to next slot + jsr MemMgr.NextSlot lda (ZPMemMgrSPtr) Get Flags bmi .4 in use ? -.2 lda ZPMemMgrReqF Found an empty slot + +.2 lda MemMgr.ReqFlags Found an empty slot and #S.MEM.F.ALIGN is request needs a page align ? beq .3 + ldy #S.MEM.PTR lda (ZPMemMgrSPtr),y get LO of PTR bne .4 not page-aligned + .3 ldy #S.MEM.LEN lda (ZPMemMgrSPtr),y get LEN of this block - cmp ZPMemMgrReqS compare with requested size + cmp MemMgr.ReqSize compare with requested size bne .4 + iny lda (ZPMemMgrSPtr),y - cmp ZPMemMgrReqS+1 - beq .5 requested size matches slot size !!! -.4 inx move to next slot - cpx MEMMGR.TABLESIZE last slot ? - bne .1 check for another slot - beq .6 last one, create a new slot + cmp MemMgr.ReqSize+1 + beq .7 requested size matches slot size !!! + +.4 dec MemMgr.SlotCnt any other slot to check? + bne .1 last one, create a new slot +*-------------- Create a New SLOT +.41 lda MemMgr.ReqFlags + and #S.MEM.F.ALIGN is request needs a page align ? + beq .6 + + lda MemMgr.Free target PTR will be page aligned ? + sec + sbc MemMgr.ReqSize + beq .6 yes, allocate + + tay no, reserve a free slot to fill gap + lda #0 + jsr MemMgr.AddSlot X = new slot + bcs .9 + +.6 >LDYA MemMgr.ReqSize + jsr MemMgr.AddSlot X = new slot + bcs .9 *-------------- Reuse this SLOT -.5 lda ZPMemMgrReqF get requested flags +.7 lda MemMgr.ReqFlags get requested flags ora #S.MEM.F.INUSE mark as in use sta (ZPMemMgrSPtr) - lda #0 + and #S.MEM.F.INIT0 + beq .8 + + jsr MemMgr.Init0 + +.8 lda #0 ldy #S.MEM.BIN sta (ZPMemMgrSPtr),y - inc Mark this slot used by one task + + inc Mark this slot used by one process ldy #S.MEM.REFCNT sta (ZPMemMgrSPtr),y ldy #S.PS.ID - lda (TSKMGR.TSKPTR),y + lda (pPs),y ldy #S.MEM.OWNERPID sta (ZPMemMgrSPtr),y @@ -122,45 +161,112 @@ S.GetMem >PULLB ZPMemMgrReqF store requested flags lda (ZPMemMgrSPtr),y A = HI PTR ply Y = LO PTR clc X = Current hMem - rts -*-------------- Create a New SLOT -.6 lda ZPMemMgrReqF - and #S.MEM.F.ALIGN is request needs a page align ? - beq .7 - lda MEMMGR.MHLIMIT target PTR will be page aligned ? +.9 bit MemMgr.ReqFlags + bpl .99 + + sta CLRREADAUX + sta CLRWRITEAUX + +.99 rts +*-------------------------------------- +* MemMgr.AddSlot +* In: +* Y,A = Requested size +* Out: +*-------------------------------------- +MemMgr.AddSlot >STYA ZPMemMgrTmp1 save req size + ldx MemMgr.LastSlot + inx + beq .99 > 255 ERR:OUT OF SLOT + + lda MemMgr.Free Compute base PTR=FREE-REQ size sec - sbc ZPMemMgrReqS - beq .7 yes, allocate + sbc ZPMemMgrTmp1 + sta ZPMemMgrTmp2 store new MemMgr.Free in ZPMemMgrTmp2 + lda MemMgr.Free+1 + sbc ZPMemMgrTmp1+1 + sta ZPMemMgrTmp2+1 + + lda ZPMemMgrTmp2 ensure new MemMgr.Free is not lower + sec than LoMem + sbc MemMgr.LoMem + lda ZPMemMgrTmp2+1 + sbc MemMgr.LoMem+1 + bcc .98 ERR out of mem + + jsr MemMgr.NextSlot - tay no, reserve a free slot to fill gap - lda #0 - jsr S.AddSlot - bcs .99 - -.7 >LDYA ZPMemMgrReqS - jsr S.AddSlot - bcs .99 - phx Save hMem - >STYA ZPMemMgrTmp1 - lda ZPMemMgrReqF - ora #S.MEM.F.INUSE - sta (ZPMemMgrSPtr) set Flags - - lda #1 - ldy #S.MEM.REFCNT Mark this slot referenced + ldy #S.MEM.PTR + lda ZPMemMgrTmp2 get new MemMgr.Free + sta MemMgr.Free set as system MemMgr.Free value + sta (ZPMemMgrSPtr),y store is as base address of new slot + iny + lda ZPMemMgrTmp2+1 + sta MemMgr.Free+1 sta (ZPMemMgrSPtr),y - ldy #S.PS.ID - lda (TSKMGR.TSKPTR),y - ldy #S.MEM.OWNERPID + + iny + lda ZPMemMgrTmp1 get requested size + sta (ZPMemMgrSPtr),y setup slot LEN + iny + lda ZPMemMgrTmp1+1 sta (ZPMemMgrSPtr),y - jsr S.UpdateMemStats - >LDYA ZPMemMgrTmp1 Y,A = PTR - plx X = hMem + + stx MemMgr.LastSlot mark this slot allocated clc rts -.99 sec + +.98 lda #MemMgr.ERROOM + sec rts + +.99 lda #MemMgr.ERROOH + sec + rts +*-------------------------------------- +MemMgr.NextSlot lda ZPMemMgrSPtr + clc + adc #S.MEM.SIZE + sta ZPMemMgrSPtr + bcc .8 + inc ZPMemMgrSPtr+1 +.8 rts +*-------------------------------------- +MemMgr.Init0 ldy #S.MEM.PTR + lda (ZPMemMgrSPtr),y ZPMemMgrSPtr already set + sta ZPMemMgrTmp1 set ZPMemMgrTmp1 to Mem Ptr + iny + lda (ZPMemMgrSPtr),y + sta ZPMemMgrTmp1+1 + + ldy #S.MEM.LEN + lda (ZPMemMgrSPtr),y + sta ZPMemMgrTmp2 set ZPMemMgrTmp2 to mem size + iny + lda (ZPMemMgrSPtr),y + sta ZPMemMgrTmp2+1 + + lda #0 + +.1 ldy ZPMemMgrTmp2 + bne .2 + ldy ZPMemMgrTmp2+1 + beq .3 + dec ZPMemMgrTmp2+1 +.2 dec ZPMemMgrTmp2 + + sta (ZPMemMgrTmp1) + inc ZPMemMgrTmp1 + bne .1 + inc ZPMemMgrTmp1+1 + bra .1 + +.3 rts +*-------------------------------------- +MemMgr.SlotCnt .BS 1 +MemMgr.ReqFlags .BS 1 store requested Flags +MemMgr.ReqSize .BS 2 store requested Size *-------------------------------------- * S.FreeMemA * In: @@ -168,12 +274,11 @@ S.GetMem >PULLB ZPMemMgrReqF store requested flags * Out: * X,Y unmodified *-------------------------------------- -S.FreeMemA and #$FF - bne S.FreeMemA0 Slot=0, reserved by Kernel - rts - -S.FreeMemA0 phy +S.FreeMemA phy phx + tax + beq .8 Slot=0, reserved by Kernel + jsr S.GetMemByIDA lda (ZPMemMgrSPtr) bpl * In use ? @@ -182,156 +287,51 @@ S.FreeMemA0 phy lda (ZPMemMgrSPtr),y Get count of those referencing this hMem dec only one left ? sta (ZPMemMgrSPtr),y - bne .82 no, must be a code segment loaded several times + bne .8 no, must be a code segment loaded several times ldy #S.MEM.BIN lda (ZPMemMgrSPtr),y Any BINPATH to discard ? - beq .11 + beq .1 pha save hMem >PUSHW ZPMemMgrSPtr pla jsr S.GetMemByIDA lda (ZPMemMgrSPtr) - bmi .12 In use ? - bra * + bpl * ***MUST BE ALLOCATED*** -.12 lda (ZPMemMgrSPtr) mark record as free - and #$7F + lda #0 mark BINPATH slot as free sta (ZPMemMgrSPtr) >PULLW ZPMemMgrSPtr -.11 lda (ZPMemMgrSPtr) mark record as free - and #$7F +.1 lda #0 mark this slot as free sta (ZPMemMgrSPtr) -.20 lda MEMMGR.TABLESIZE - beq .82 -.21 dec +.2 lda MemMgr.LastSlot + beq .8 + jsr S.GetMemByIDA lda (ZPMemMgrSPtr) - bmi .81 - dec MEMMGR.TABLESIZE discard last record + bmi .8 + ldy #S.MEM.LEN lda (ZPMemMgrSPtr),y give back LEN bytes clc - adc MEMMGR.MHLIMIT to HLIMIT - sta MEMMGR.MHLIMIT + adc MemMgr.Free to MemMgr.Free + sta MemMgr.Free iny lda (ZPMemMgrSPtr),y - adc MEMMGR.MHLIMIT+1 - sta MEMMGR.MHLIMIT+1 - lda MEMMGR.MLLIMIT And give back S.MEM.SIZE - sec - sbc #S.MEM.SIZE - sta MEMMGR.MLLIMIT to LLIMIT - bcs .2 - dec MEMMGR.MLLIMIT+1 -.2 lda MEMMGR.TABLESIZE - bne .21 no slot left, exit -.81 jsr S.UpdateMemStats -.82 plx + adc MemMgr.Free+1 + sta MemMgr.Free+1 + + dec MemMgr.LastSlot discard last slot + bne .2 no slot left, exit + +.8 plx ply clc rts *-------------------------------------- -* IN/OUT -* A = hMem -*-------------------------------------- -S.ClrMemA pha - jsr S.GetMemByIDA - ldy #S.MEM.LEN ZPMemMgrSPtr already set by S.GetMemByIDA - lda (ZPMemMgrSPtr),y - sta ZPMemMgrReqS set ZPMemMgrReqS to mem size - iny - lda (ZPMemMgrSPtr),y - sta ZPMemMgrReqS+1 - ldy #S.MEM.PTR - lda (ZPMemMgrSPtr),y - tax - iny - lda (ZPMemMgrSPtr),y - stx ZPMemMgrSPtr - sta ZPMemMgrSPtr+1 set ZPMemMgrSPtr to Mem - lda #0 -.1 ldx ZPMemMgrReqS - bne .2 - ldx ZPMemMgrReqS+1 - beq .3 - dec ZPMemMgrReqS+1 -.2 dec ZPMemMgrReqS - sta (ZPMemMgrSPtr) - inc ZPMemMgrSPtr - bne .1 - inc ZPMemMgrSPtr+1 - bra .1 -.3 pla - rts -*-------------------------------------- -* S.GetMemByIDA -* In: -* A = hMem -* Out: -* Y,A = ZPMemMgrSPtr = PTR to S.MEM -* X unmodified -*-------------------------------------- -S.GetMemByIDA stz ZPMemMgrSPtr+1 - asl - rol ZPMemMgrSPtr+1 - asl - rol ZPMemMgrSPtr+1 - asl - rol ZPMemMgrSPtr+1 - clc - adc MEMMGR.LOMEM - sta ZPMemMgrSPtr - tay - lda ZPMemMgrSPtr+1 - adc MEMMGR.LOMEM+1 - sta ZPMemMgrSPtr+1 - rts -*-------------------------------------- -* In: -* A = hMem to BINPATH (PSTR) -* Out: -* Y,A = ZPMemMgrSPtr = PTR to S.MEM -* X = hMem -*-------------------------------------- -S.GetMemByNameA jsr S.GetMemPtrA - >STYA ZPMemMgrTmp1 save BINPATH - >LDYA MEMMGR.LOMEM - >STYA ZPMemMgrTmp2 - ldx #0 -.1 lda (ZPMemMgrTmp2) - bpl .6 In Use? - ldy #S.MEM.BIN any BIN PATH in this slot? - lda (ZPMemMgrTmp2),y - beq .6 - jsr S.GetMemPtrA get pathname - >STYA ZPMemMgrTmp3 - ldy #0 -.2 lda (ZPMemMgrTmp1),y - cmp (ZPMemMgrTmp3),y - bne .6 - tya - iny - cmp (ZPMemMgrTmp1) - bne .2 - >LDYA ZPMemMgrTmp2 - clc - rts -.6 lda ZPMemMgrTmp2 - clc - adc #S.MEM.SIZE - sta ZPMemMgrTmp2 - bcc .7 - inc ZPMemMgrTmp2+1 -.7 inx - cpx MEMMGR.TABLESIZE - bne .1 - sec - rts -*-------------------------------------- * S.GetMemPtrA * In: * A = hMem @@ -348,110 +348,90 @@ S.GetMemPtrA jsr S.GetMemByIDA ply rts *-------------------------------------- -* S.GetMemLenA +* S.GetMemByIDA * In: * A = hMem * Out: -* Y,A = PTR to MemLength +* Y,A = ZPMemMgrSPtr = PTR to S.MEM * X unmodified *-------------------------------------- -S.GetMemLenA jsr S.GetMemByIDA - ldy #S.MEM.LEN - lda (ZPMemMgrSPtr),y - pha - iny - lda (ZPMemMgrSPtr),y - ply +S.GetMemByIDA stz ZPMemMgrSPtr+1 + + asl + rol ZPMemMgrSPtr+1 + asl + rol ZPMemMgrSPtr+1 + asl + rol ZPMemMgrSPtr+1 + + clc + adc #MemMgr.Table + sta ZPMemMgrSPtr + tay + lda ZPMemMgrSPtr+1 + adc /MemMgr.Table + sta ZPMemMgrSPtr+1 rts *-------------------------------------- -* PRIVATE +* In: +* A = hMem to BINPATH (PSTR) +* Out: +* Y,A = ZPMemMgrSPtr = PTR to S.MEM +* X = hMem *-------------------------------------- -* S.AddSlot -* In: -* Y,A = Requested size -* Out: -* Y,A = PTR to MemSlot -* X = SLOT.ID -*-------------------------------------- -S.AddSlot >STYA ZPMemMgrTmp1 save req size - lda MEMMGR.TABLESIZE - inc - beq .99 > 255 ERR:OUT OF SLOT - dec - jsr S.GetMemByIDA yes, get PTR to slot - - lda MEMMGR.MHLIMIT Compute base PTR=HLIMIT-REQ size - sec - sbc ZPMemMgrTmp1 - sta ZPMemMgrTmp2 store new HLIMIT in ZPMemMgrTmp2 - lda MEMMGR.MHLIMIT+1 - sbc ZPMemMgrTmp1+1 - sta ZPMemMgrTmp2+1 - - lda MEMMGR.MLLIMIT compute new LLIMIT +S.GetMemByNameA jsr S.GetMemPtrA +S.GetMemByNameYA + >STYA ZPMemMgrTmp1 save BINPATH + >LDYAI MemMgr.Table+S.MEM.SIZE + >STYA ZPMemMgrSPtr + ldx #0 + +.1 cpx MemMgr.LastSlot + beq .9 + inx + lda (ZPMemMgrSPtr) + bpl .6 In Use? + + ldy #S.MEM.BIN any BIN PATH in this slot? + lda (ZPMemMgrSPtr),y + beq .6 + + jsr S.GetMemPtrA get pathname + >STYA ZPMemMgrTmp2 + + ldy #0 + +.2 lda (ZPMemMgrTmp1),y + cmp (ZPMemMgrTmp2),y + bne .6 + + tya + iny + cmp (ZPMemMgrTmp1) + bne .2 + + >LDYA ZPMemMgrSPtr + clc + rts + +.6 lda ZPMemMgrSPtr clc adc #S.MEM.SIZE - sta ZPMemMgrTmp3 store new LLIMIT in ZPMemMgrTmp3 - lda MEMMGR.MLLIMIT+1 - adc #0 - sta ZPMemMgrTmp3+1 - - lda ZPMemMgrTmp2 ensure new LLIMIT is not higher - sec than new HLIMIT - sbc ZPMemMgrTmp3 - lda ZPMemMgrTmp2+1 - sbc ZPMemMgrTmp3+1 - bcc .98 ERR out of mem - - >LDYA ZPMemMgrTmp3 get new LLIMIT - >STYA MEMMGR.MLLIMIT And set it allocated - - lda #0 - sta (ZPMemMgrSPtr) - ldy #S.MEM.BIN - sta (ZPMemMgrSPtr),y - ldy #S.MEM.REFCNT - sta (ZPMemMgrSPtr),y - ldy #S.MEM.OWNERPID - sta (ZPMemMgrSPtr),y - - ldy #S.MEM.PTR - lda ZPMemMgrTmp2 get new HLIMIT - sta MEMMGR.MHLIMIT set as system HLIMIT value - sta (ZPMemMgrSPtr),y store is as base address of new slot - iny - lda ZPMemMgrTmp2+1 - sta MEMMGR.MHLIMIT+1 - sta (ZPMemMgrSPtr),y - - ldy #S.MEM.LEN - lda ZPMemMgrTmp1 get requested size - sta (ZPMemMgrSPtr),y setup slot LEN - iny - lda ZPMemMgrTmp1+1 - sta (ZPMemMgrSPtr),y - - >LDYA ZPMemMgrTmp2 Y,A = PTR - ldx MEMMGR.TABLESIZE X = SLOT.ID - inc MEMMGR.TABLESIZE mark this slot allocated + sta ZPMemMgrSPtr + bcc .1 + inc ZPMemMgrSPtr+1 + bra .1 + +.9 sec + rts +*-------------------------------------- +S.SetLoMem clc rts -.98 lda #MEMMGR.ERROOM - sec - rts -.99 lda #MEMMGR.ERROOS - sec - rts *-------------------------------------- -S.UpdateMemStats - lda MEMMGR.MHLIMIT - sec - sbc MEMMGR.MLLIMIT - sta MEMMGR.MFREE - lda MEMMGR.MHLIMIT+1 - sbc MEMMGR.MLLIMIT+1 - sta MEMMGR.MFREE+1 - rts +S.GarbageCollector + clc + rts *-------------------------------------- MAN SAVE SYS/KERNEL.S.MEM diff --git a/SYS/KERNEL.S.MLI.txt b/SYS/KERNEL.S.MLI.txt index 08654481..11986cb5 100644 --- a/SYS/KERNEL.S.MLI.txt +++ b/SYS/KERNEL.S.MLI.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -8,9 +8,33 @@ AUTO 6 *-------------------------------------- * PUBLIC *-------------------------------------- -S.MLICreate -S.MLIDestroy -S.MLIRename +S.MLICreateFile + clc + rts +*-------------------------------------- +S.MLICreateDirA jsr S.GetMemPtrA +S.MLICreateDirYA + >STYA MLICALL.PARAMS+1 + lda #$C3 + sta MLICALL.PARAMS+3 Access + lda #$0F + sta MLICALL.PARAMS+4 type=Directory + lda #$0D + sta MLICALL.PARAMS+7 Storage=Linked List + + >MLICALL MLICREATE + rts +*-------------------------------------- +S.MLIDestroyA jsr S.GetMemPtrA +S.MLIDestroyYA >STYA MLICALL.PARAMS+1 + >MLICALL MLIDESTROY + rts +*-------------------------------------- +S.MLIRename >PULLW MLICALL.PARAMS+3 + >PULLW MLICALL.PARAMS+1 + >MLICALL MLIRENAME + rts +*-------------------------------------- S.MLISetFileInfo *-------------------------------------- * S.MLIGetFileInfoA @@ -21,9 +45,9 @@ S.MLISetFileInfo *-------------------------------------- S.MLIGetFileInfoA jsr S.GetMemPtrA -S.MLIGetFileInfo +S.MLIGetFileInfoYA >STYA MLICALL.PARAMS+1 - >KMLICALL MLIGETFILEINFO + >MLICALL MLIGETFILEINFO bcs .9 >LDYAI MLICALL.PARAMS+3 .9 rts @@ -35,14 +59,19 @@ S.MLIGetFileInfo *-------------------------------------- S.MLIOnline >PULLB MLICALL.PARAMS+1 >PULLW MLICALL.PARAMS+2 - >KMLICALL MLIONLINE + >MLICALL MLIONLINE rts *-------------------------------------- -S.MLISetPrefix +S.MLISetPrefixA jsr S.GetMemPtrA +S.MLISetPrefixYA + >STYA MLICALL.PARAMS+1 + >MLICALL MLISETPREFIX + rts *-------------------------------------- S.MLIGetPrefixA jsr S.GetMemPtrA -S.MLIGetPrefix >STYA MLICALL.PARAMS+1 - >KMLICALL MLIGETPREFIX +S.MLIGetPrefixYA + >STYA MLICALL.PARAMS+1 + >MLICALL MLIGETPREFIX rts *-------------------------------------- * S.MLIOpenA @@ -53,18 +82,20 @@ S.MLIGetPrefix >STYA MLICALL.PARAMS+1 * X = buf hMem *-------------------------------------- S.MLIOpenA jsr S.GetMemPtrA -S.MLIOpen >STYA MLICALL.PARAMS+1 +S.MLIOpenYA >STYA MLICALL.PARAMS+1 >PUSHWI 1024 get a ProDOS IO buffer - >PUSHBI S.MEM.F.ALIGN+S.MEM.F.NOMOV + >PUSHBI S.MEM.F.ALIGN+S.MEM.F.NOMOVE jsr S.GetMem bcs .99 + phx save Prodos Buffer hMem >STYA MLICALL.PARAMS+3 - >KMLICALL MLIOPEN + >MLICALL MLIOPEN bcs .98 lda MLICALL.PARAMS+5 get ref_num plx get back Prodos Buffer hMem rts CC + .98 plx get back Prodos Buffer hMem pha save MLI error txa @@ -82,7 +113,7 @@ S.MLIOpen >STYA MLICALL.PARAMS+1 S.MLINewLine >PULLB MLICALL.PARAMS+1 >PULLB MLICALL.PARAMS+2 >PULLB MLICALL.PARAMS+3 - >KMLICALL MLINEWLINE + >MLICALL MLINEWLINE rts *-------------------------------------- * S.MLIRead @@ -96,7 +127,7 @@ S.MLINewLine >PULLB MLICALL.PARAMS+1 S.MLIRead >PULLB MLICALL.PARAMS+1 >PULLW MLICALL.PARAMS+2 >PULLW MLICALL.PARAMS+4 - >KMLICALL MLIREAD + >MLICALL MLIREAD bcs .9 >LDYA MLICALL.PARAMS+6 .9 rts @@ -112,23 +143,40 @@ S.MLIRead >PULLB MLICALL.PARAMS+1 S.MLIWrite >PULLB MLICALL.PARAMS+1 >PULLW MLICALL.PARAMS+2 >PULLW MLICALL.PARAMS+4 - >KMLICALL MLIWRITE + >MLICALL MLIWRITE bcs .9 >LDYA MLICALL.PARAMS+6 .9 rts *-------------------------------------- -* S.MLIClose +* S.MLICloseA * in : * A = ref_num * out : *-------------------------------------- S.MLICloseA sta MLICALL.PARAMS+1 - >KMLICALL MLICLOSE + >MLICALL MLICLOSE + rts +*-------------------------------------- +S.MLIFlushA sta MLICALL.PARAMS+1 + >MLICALL MLIFLUSH rts *-------------------------------------- -S.MLIFlushA S.MLISetMark -S.MLIGetMark +*-------------------------------------- +* S.MLIGetMarkA +* in : +* A = ref_num +* out : +* Y,A,X = EOF +*-------------------------------------- +S.MLIGetMarkA sta MLICALL.PARAMS+1 + >MLICALL MLIGETMARK + bcs .9 + >LDYA MLICALL.PARAMS+2 + ldx MLICALL.PARAMS+4 + clc +.9 rts +*-------------------------------------- S.MLISetEOF *-------------------------------------- * S.MLIGetEOF @@ -138,13 +186,38 @@ S.MLISetEOF * Y,A,X = EOF *-------------------------------------- S.MLIGetEOFA sta MLICALL.PARAMS+1 - >KMLICALL MLIGETEOF + >MLICALL MLIGETEOF bcs .9 >LDYA MLICALL.PARAMS+2 ldx MLICALL.PARAMS+4 clc .9 rts *-------------------------------------- +S.MLISetBuf clc + rts +*-------------------------------------- +S.MLIGetBuf clc + rts +*-------------------------------------- +S.MLIGetTime >MLICALL MLIGETTIME + rts +*-------------------------------------- +S.MLIAllocIRQ >PULLB MLICALL.PARAMS+1 + >PULLW MLICALL.PARAMS+2 + >MLICALL MLIALLOCIRQ + rts +*-------------------------------------- +S.MLIDeallocIRQA + sta MLICALL.PARAMS+1 + >MLICALL MLIDEALLOCIRQ + rts +*-------------------------------------- +S.MLIReadBlock clc + rts +*-------------------------------------- +S.MLIWriteBlock clc + rts +*-------------------------------------- MAN SAVE SYS/KERNEL.S.MLI LOAD SYS/KERNEL.S diff --git a/SYS/KERNEL.S.NET.txt b/SYS/KERNEL.S.NET.txt index 1b86fc69..9aa893b0 100644 --- a/SYS/KERNEL.S.NET.txt +++ b/SYS/KERNEL.S.NET.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/SYS/KERNEL.S.RDR.txt b/SYS/KERNEL.S.RDR.txt index 6718f3f8..8a5307e0 100644 --- a/SYS/KERNEL.S.RDR.txt +++ b/SYS/KERNEL.S.RDR.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 diff --git a/SYS/KERNEL.S.SCR.txt b/SYS/KERNEL.S.SCR.txt index 19593730..a0b9aa6d 100644 --- a/SYS/KERNEL.S.SCR.txt +++ b/SYS/KERNEL.S.SCR.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -68,8 +68,8 @@ S.ScreenSelectA and A2osX.SCREENS Screen is available ? bne .2 sta SETTEXT sta SET80DISP + sta CLR80STORE sta CLRPAGE2 - sta SET80STORE sta SETALTCHAR lda #A2osX.SCREENS.C bra .8 @@ -80,19 +80,22 @@ S.ScreenSelectA and A2osX.SCREENS Screen is available ? sta CLRTEXT sta CLRMIXED sta SETHIRES + sta CLR80STORE sta CLRPAGE2 - - sta SET80DISP sta SETIOUDIS sta SETDHIRES - sta CLRDHIRES - sta SETDHIRES - sta CLRDHIRES - sta SETDHIRES + +* sta CLR80DISP +* sta SETDHIRES +* sta CLRDHIRES +* sta SET80DISP +* sta SETDHIRES +* sta CLRDHIRES +* sta SETDHIRES lda #A2osX.SCREENS.G -.8 sta A2osX.ACTIVESCRN +.8 sta A2osX.ASCREEN .9 rts *-------------------------------------- S.SysScrCPULoad ldx SYSSCR.CPULOADI @@ -134,8 +137,38 @@ S.SysScrPRCode php save P to keep carry plp rts *-------------------------------------- +S.DumpEvent lda (pEvent) + jsr S.SysScrPRBYTEA + ldy #S.EVT.hDEV + lda (pEvent),y + jsr S.SysScrPRBYTEA + ldy #S.EVT.DATALO + lda (pEvent),y + jsr S.SysScrPRBYTEA + ldy #S.EVT.DATAHI + lda (pEvent),y + jsr S.SysScrPRBYTEA + + lda #'.' + jsr S.SysScrCOUTA + ldy #S.EVT.DATAW1 + lda (pEvent),y + jsr S.SysScrPRBYTEA + iny + lda (pEvent),y + jsr S.SysScrPRBYTEA + + lda #'.' + jsr S.SysScrCOUTA + ldy #S.EVT.DATAW2 + lda (pEvent),y + jsr S.SysScrPRBYTEA + iny + lda (pEvent),y + jmp S.SysScrPRBYTEA +*-------------------------------------- S.SysScrPPSTRA jsr S.GetMemPtrA -S.SysScrPPSTR >STYA SYSSCR.STRPTR +S.SysScrPPSTRYA >STYA SYSSCR.STRPTR lda (SYSSCR.STRPTR) beq .9 ldy #0 @@ -319,7 +352,7 @@ S.SysScrSetCharAtYX SYSSCR.CH .BS 1 SYSSCR.CV .BS 1 SYSSCR.CPULOADI .BS 1 -SYSSCR.CPULOADC .AS -"|\-/" +SYSSCR.CPULOADC .AS -"|/-\" *-------------------------------------- SYSSCR.TITLE >CSTRING "A2osX System Screen" SYSSCR.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0 diff --git a/SYS/KERNEL.S.STR.txt b/SYS/KERNEL.S.STR.txt index 3f5cddd1..075b300d 100644 --- a/SYS/KERNEL.S.STR.txt +++ b/SYS/KERNEL.S.STR.txt @@ -1,29 +1,26 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 *-------------------------------------- -* S.NewPStr -* IN: -* PULLW = PTR to buffer -* OUT: -* A = hMem to S (PSTRING) -*-------------------------------------- -S.NewPStr >PULLW ZPQuickPtr1 - bra S.PStrCpy2 -*-------------------------------------- * S.PStrCpyA * In: * A = hMem of Src String * Out: * A = hMem of Dest String *-------------------------------------- +* S.NewPStrYA +* IN: +* PULLW = PTR to buffer +* OUT: +* A = hMem to S (PSTRING) +*-------------------------------------- S.PStrCpyA jsr S.GetMemPtrA - >STYA ZPQuickPtr1 -S.PStrCpy2 lda (ZPQuickPtr1) +S.NewPStrYA >STYA ZPQuickPtr1 + lda (ZPQuickPtr1) inc tay lda #0 Y,A = len of new string diff --git a/SYS/KERNEL.S.TSK.txt b/SYS/KERNEL.S.TSK.txt index 7c15db60..c74f5349 100644 --- a/SYS/KERNEL.S.TSK.txt +++ b/SYS/KERNEL.S.TSK.txt @@ -1,5 +1,5 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 @@ -9,177 +9,189 @@ AUTO 6 * S.TskMgrInit *-------------------------------------- S.TskMgrInit stz TSKMGR.LASTID + lda #1 + sta TSKMGR.SIZE One Slot Busy (Kernel PS=0) - >LDYAI TSKMGR.TABLE - >STYA TSKMGR.TSKPTR - + >LDYAI TskMgr.Table Make PS #0 as current process + >STYA pPs + ldx #K.PS.MAX .1 lda #0 ldy #S.PS.SIZE-1 -.2 sta (TSKMGR.TSKPTR),y +.2 sta (pPs),y dey bpl .2 - lda TSKMGR.TSKPTR + lda pPs clc adc #S.PS.SIZE - sta TSKMGR.TSKPTR + sta pPs bcc .3 - inc TSKMGR.TSKPTR+1 -.3 dex + + inc pPs+1 +.3 dex bne .1 - >LDYAI TSKMGR.TABLE Make PS #0 as current process - >STYA TSKMGR.TSKPTR + >LDYAI TskMgr.Table Make PS #0 as current process + >STYA pPs jsr S.CreateEnv - bcs .9 + bcs * + ldy #S.PS.hENV - sta TSKMGR.TABLE,y + sta TskMgr.Table,y >LDYAI TmpBuffer256 - jsr S.MLIGetPrefix - bcs .9 - >PUSHWI TmpBuffer256 - jsr S.NewPStr - bcs .9 + jsr S.MLIGetPrefixYA + bcs * + + >LDYAI TmpBuffer256 + jsr S.NewPStrYA + bcs * + ldy #S.PS.hPREFIX - sta TSKMGR.TABLE,y + sta TskMgr.Table,y >PUSHWI TmpBuffer256 push ENV value >PUSHWI ENV.A2osX push ENV name ldy #S.PS.hENV - lda TSKMGR.TABLE,y + lda TskMgr.Table,y >PUSHA jsr S.SetEnvVarP rts + .9 sec rts *-------------------------------------- * S.TskMgrRun *-------------------------------------- -S.TskMgrRun >LDYAI TSKMGR.TABLE+S.PS.SIZE - >STYA TSKMGR.TSKPTR +S.TskMgrRun >LDYAI TskMgr.Table+S.PS.SIZE + >STYA pPs - lda #K.PS.MAX-1 Skip PS #0 + lda #1 Skip PS #0 sta TSKMGR.COUNT -.1 lda (TSKMGR.TSKPTR) get S.PS.F +.1 lda (pPs) get S.PS.F and #S.PS.F.INUSE In use ? beq .5 - lda (TSKMGR.TSKPTR) get S.PS.F + lda (pPs) get S.PS.F and #S.PS.F.HOLD Waiting for Another Task to Terminate? - beq .3 + beq .2 ldy #S.PS.CID - lda (TSKMGR.TSKPTR),y - jsr S.IsPSRunningA + lda (pPs),y + jsr S.GetPSByIDA bcc .5 yes, running.... - lda (TSKMGR.TSKPTR) get S.PS.F - and #$FF^S.PS.F.HOLD unmark as HOLD - sta (TSKMGR.TSKPTR) -.3 ldy #S.PS.hCS - lda (TSKMGR.TSKPTR),y - jsr S.GetMemPtrA Y,A = CS - pha - tya get CS LO - ldy #S.PS.PC + lda (pPs) get S.PS.F + and #$FF^S.PS.F.HOLD unmark as HOLD + sta (pPs) + +.2 jsr S.SelectProcess + + ldy #S.PS.PC+1 Is this PS sleeping? + lda (pPs),y + tax + dey + ora (pPs),y + beq .3 no, call TSKMGR.RUN + + lda (pPs),y clc - adc (TSKMGR.TSKPTR),y - sta Kernel.JMP - iny - pla - adc (TSKMGR.TSKPTR),y - sta Kernel.JMP+1 + adc pCode + sta S.TskMgrRunJmp+1 + txa + adc pCode+1 + sta S.TskMgrRunJmp+2 lda #0 Don't forget to reset S.PC - sta (TSKMGR.TSKPTR),y - dey - sta (TSKMGR.TSKPTR),y + ldy #S.PS.PC + sta (pPs),y + iny + sta (pPs),y - >LDYA TSKMGR.TSKPTR - ldx #TSKMGR.RUN - jsr Kernel.BINCALL Call RUN function - bcc .5 RUN said CS=QUIT? + jsr S.TskMgrRunJmp + bra .4 + +.3 ldx #TSKMGR.RUN + jsr pCodeJmp Call RUN function +.4 bcc .5 RUN said CS=QUIT? - ldy #S.PS.hCS - lda (TSKMGR.TSKPTR),y - jsr S.GetMemPtrA Y,A = CS - >STYA Kernel.JMP - - >LDYA TSKMGR.TSKPTR ldx #TSKMGR.QUIT yes, quit this process - - jsr Kernel.BINCALL Call QUIT function + jsr pCodeJmp Call QUIT function ldy #S.PS.ID - lda (TSKMGR.TSKPTR),y + lda (pPs),y jsr S.FreeProcessA bcs .99 -.5 lda TSKMGR.TSKPTR +.5 lda pPs clc adc #S.PS.SIZE - sta TSKMGR.TSKPTR + sta pPs bcc .6 - inc TSKMGR.TSKPTR+1 + inc pPs+1 -.6 dec TSKMGR.COUNT +.6 lda TSKMGR.COUNT + inc TSKMGR.COUNT + cmp TSKMGR.SIZE bne .1 clc rts + .99 bra * *-------------------------------------- +S.TskMgrRunJmp jmp $FFFF +*-------------------------------------- * S.DispatchEvent * IN: -* PULLW = Event * OUT: * CS: Not Dispatched * CC: Event Cleared *-------------------------------------- -S.DispatchEvent >LDYAI TSKMGR.TABLE+S.PS.SIZE - >STYA TSKMGR.TSKPTR +S.DispatchEvent >LDYAI TskMgr.Table+S.PS.SIZE + >STYA pPs - lda #K.PS.MAX-1 + lda #1 sta TSKMGR.COUNT -.1 lda (TSKMGR.TSKPTR) get S.PS.F +.1 lda (pPs) get S.PS.F and #S.PS.F.INUSE In use ? beq .3 - lda (TSKMGR.TSKPTR) get S.PS.F + lda (pPs) get S.PS.F and #S.PS.F.HOLD Waiting for Another Task to Terminate? bne .3 - lda (TSKMGR.TSKPTR) get S.PS.F + lda (pPs) get S.PS.F and #S.PS.F.EVENT Accept Events ? beq .3 + + jsr S.SelectProcess - ldy #S.PS.hCS - lda (TSKMGR.TSKPTR),y - jsr S.GetMemPtrA - >STYA Kernel.JMP - - >PUSHW EVTMGR.EVTPTR - >LDYA TSKMGR.TSKPTR ldx #TSKMGR.DOEVENT - jsr Kernel.BINCALL Call DOEVENT function + jsr pCodeJmp Call DOEVENT function bcc .8 -.3 lda TSKMGR.TSKPTR +.3 lda pPs clc adc #S.PS.SIZE - sta TSKMGR.TSKPTR + sta pPs bcc .4 - inc TSKMGR.TSKPTR+1 + inc pPs+1 -.4 dec TSKMGR.COUNT +.4 lda TSKMGR.COUNT + inc TSKMGR.COUNT + cmp TSKMGR.SIZE bne .1 sec -.8 rts + rts + +.8 jsr S.DestroyEvent + clc + rts *-------------------------------------- * S.TskMgrQuit *-------------------------------------- @@ -190,18 +202,20 @@ S.TskMgrQuit clc *-------------------------------------- * S.ExecProcessA (Blocking Parent PID) * in : -* A = hMem To Full Cmd Line +* A = hMem To Cmd Line * out : * A = Child PSID *-------------------------------------- S.ExecProcessA jsr S.CreateProcessA bcs .9 terminated, do not set PID as HOLD + ldy #S.PS.CID - sta (TSKMGR.TSKPTR),y + sta (pPs),y + pha Save Child PID - lda (TSKMGR.TSKPTR) + lda (pPs) ora #S.PS.F.HOLD - sta (TSKMGR.TSKPTR) + sta (pPs) pla Get Back PID clc .9 rts @@ -213,174 +227,188 @@ S.ExecProcessA jsr S.CreateProcessA * A = Child PSID *-------------------------------------- S.CreateProcessA - pha save CMD line + sta S.CreateProcessA.Cmd >LDYAI MSG.NEWPS - jsr S.SysScrPPSTR - - ldy #S.PS.ID - lda (TSKMGR.TSKPTR),y - - jsr S.CreateChildProcessA + jsr S.SysScrPPSTRYA + jsr S.CreateChildProcess bcs .99 - >STYA TSKMGR.pNewPS + + sta S.CreateProcessA.CPSID + + jsr S.SelectProcessA - pla Get Back CMD Line + lda S.CreateProcessA.Cmd jsr S.InitProcessA - bcs .97 Init Failed or exit? - ldy #S.PS.ID - lda (TSKMGR.pNewPS),y + bcs .98 Init Failed or exit? + + ldy #S.PS.PID switch back to Parent Process + lda (pPs),y + + jsr S.SelectProcessA + + lda S.CreateProcessA.CPSID clc rts -.97 pha save error code - tay error code =0 ? - bne .98 no, init failed - >LDYA TSKMGR.pNewPS - ldx #TSKMGR.QUIT yes, simply call QUIT function - jsr Kernel.BINCALL Call QUIT function - -.98 ldy #S.PS.ID - lda (TSKMGR.pNewPS),y +.98 pha save error code + + ldy #S.PS.PID switch back to Parent Process + lda (pPs),y + jsr S.SelectProcessA + + lda S.CreateProcessA.CPSID jsr S.FreeProcessA - bra .90 -.99 plx Discard CMD Line - pha save error code + pla get back error code -.90 pla get back error code - sec +.99 sec rts *-------------------------------------- +S.CreateProcessA.Cmd .BS 1 +S.CreateProcessA.CPSID .BS 1 +*-------------------------------------- * S.GetPSByIDA * In : -* A = PID +* A = PID * Out : * Y,A = PTR to TSKSLOT *-------------------------------------- -S.GetPSByIDA tax - bne .10 - >LDYAI TSKMGR.TABLE - clc - rts +S.GetPSByIDA sta S.GetPSByIDA.PS -.10 sta ZPQuickPtr1 Store requested PID - lda #K.PS.MAX - sta ZPQuickPtr1+1 + >LDYAI TskMgr.Table + >STYA ZPQuickPtr1 - >LDYAI TSKMGR.TABLE+S.PS.SIZE - >STYA ZPQuickPtr2 - -.1 lda (ZPQuickPtr2) - bpl .2 - ldy #S.PS.ID - lda (ZPQuickPtr2),y - cmp ZPQuickPtr1 + lda S.GetPSByIDA.PS beq .8 -.2 dec ZPQuickPtr1+1 - beq .9 - lda ZPQuickPtr2 + + ldx #0 + +.1 inx + lda ZPQuickPtr1 clc adc #S.PS.SIZE - sta ZPQuickPtr2 - bcc .1 - inc ZPQuickPtr2+1 - bra .1 -.8 >LDYA ZPQuickPtr2 - clc - rts -.9 sec - rts -*-------------------------------------- -* PRIVATE -*-------------------------------------- -* S.CreateChildProcessA -* in : -* A = Parent PSID -* out : -* X = PSID -* Y,A = PTR to S.PS -* we cannot use ZPQuickPtrs -* because of calling S.PStrCpyA & S.DupEnvA -*-------------------------------------- -S.CreateChildProcessA - jsr S.GetPSByIDA - bcs .9 - - >STYA R.AX - >LDYAI TSKMGR.TABLE+S.PS.SIZE - >STYA R.BX - - ldx #K.PS.MAX -.1 lda (R.BX) - bpl .3 - lda R.BL - clc - adc #S.PS.SIZE - sta R.BL + sta ZPQuickPtr1 bcc .2 - inc R.BH -.2 dex + inc ZPQuickPtr1+1 + +.2 lda (ZPQuickPtr1) + bpl .3 + + ldy #S.PS.ID + lda (ZPQuickPtr1),y + cmp S.GetPSByIDA.PS + beq .8 + +.3 cpx TSKMGR.SIZE bne .1 - lda #TSKMGR.ERROOS - sec - rts .9 lda #TSKMGR.ERRNSP + sec + rts + +.8 >LDYA ZPQuickPtr1 + clc + rts +*-------------------------------------- +S.GetPSByIDA.PS .BS 1 +*-------------------------------------- +* PRIVATE +*-------------------------------------- +* S.CreateChildProcess +* in : +* out : +* A = PSID +* we cannot use ZPQuickPtrs +* because of calling S.PStrCpyA & S.DupEnvA +*-------------------------------------- +S.CreateChildProcess + >LDYAI TskMgr.Table+S.PS.SIZE + >STYA R.AX + + ldx #0 + +.1 inx + cpx TSKMGR.SIZE + beq .2 + + lda (R.AX) Found an empty slot + bpl .3 + lda R.AL + clc + adc #S.PS.SIZE + sta R.AL + bcc .1 + inc R.AH + + bra .1 + +.2 cpx #K.PS.MAX + bne .30 + + lda #TSKMGR.ERROOH sec rts +.30 inc TSKMGR.SIZE + .3 lda #S.PS.F.INUSE - sta (R.BX) - ldy #S.PS.ID - lda (R.AX),y - ldy #S.PS.PID - sta (R.BX),y + sta (R.AX) - inc TSKMGR.LASTID - bne .4 - inc TSKMGR.LASTID Ensure PSID not 0 -.4 lda TSKMGR.LASTID +.4 inc TSKMGR.LASTID Get a PSID not alredy running + beq .4 not = 0 + lda TSKMGR.LASTID + jsr S.GetPSByIDA + bcc .4 ldy #S.PS.ID - sta (R.BX),y + lda TSKMGR.LASTID + sta (R.AX),y + lda #0 ldy #S.PS.hCS -.5 sta (R.BX),y Blank Everything in this S.PS +.5 sta (R.AX),y Blank Everything in this S.PS iny cpy #S.PS.SIZE bne .5 ldy #S.PS.hPREFIX copy hPREFIX... - lda (R.AX),y + lda (pPs),y jsr S.PStrCpyA bcs .99 ldy #S.PS.hPREFIX - sta (R.BX),y + sta (R.AX),y + ldy #S.PS.hENV ...and hENV from parent PS - lda (R.AX),y + lda (pPs),y jsr S.DupEnvA bcs .99 + ldy #S.PS.hENV - sta (R.BX),y + sta (R.AX),y ldy #S.PS.hINDEV - lda (R.AX),y - sta (R.BX),y + lda (pPs),y + sta (R.AX),y ldy #S.PS.hOUTDEV - lda (R.AX),y - sta (R.BX),y + lda (pPs),y + sta (R.AX),y ldy #S.PS.hERRDEV - lda (R.AX),y - sta (R.BX),y + lda (pPs),y + sta (R.AX),y ldy #S.PS.ID - lda (R.BX),y - tax Exit with X=PSID - >LDYA R.BX And Y,A=S.PS - clc + lda (pPs),y + + ldy #S.PS.PID + sta (R.AX),y + + ldy #S.PS.ID + lda (R.AX),y + clc Exit with A=PSID rts + .99 sec rts *-------------------------------------- @@ -388,77 +416,116 @@ S.CreateChildProcessA * In : * A = hMem To Full Cmd Line *-------------------------------------- -* LS(2) -* 0 : hMem to ENVPATH value -* 1 : hMem to FULLPATH value -*-------------------------------------- -S.InitProcessA >ADDLOCAL 2 - >PUSHA Push Cmd Line +S.InitProcessA >PUSHA Push Cmd Line >PUSHBI $20 Push SEP=' ' >PUSHBI 0 Push 0 for getting CMD And ARGS jsr S.PStrGetTkn - bcs .99 OOM error - ldy #S.PS.hCMD - sta (TSKMGR.pNewPS),y + bcc .10 + rts OOM error + +.10 ldy #S.PS.hCMD + sta (pPs),y >PUSHA push CMD for S.FileSearch txa ldy #S.PS.hARGS - sta (TSKMGR.pNewPS),y set ARGS hMem (0 if none) + sta (pPs),y set ARGS hMem (0 if none) + >PUSHWI ENV.PATH push ENVNAME=PATH ldy #S.PS.hENV - lda (TSKMGR.pNewPS),y + lda (pPs),y >PUSHA jsr S.GetEnvVarP get value for ENV=PATH bcs .99 - >STAL 0 save VALUE hMem for discard + + sta S.InitProcessA.PATH save VALUE hMem for discard >PUSHA A=PStr to ENV Value jsr S.FileSearch find File in %PATH% bcs .98 - >STAL 1 save FULLPATH hMem for discard + + sta S.InitProcessA.FULLPATH save FULLPATH hMem for discard pha jsr S.SysScrPPSTRA pla + jsr S.LoadBinA A = BinPath hMem + bcs .97 - >STYA Kernel.JMP save PTR to Code Segment + + >STYA pCode save PTR to Code Segment txa ldy #S.PS.hCS - sta (TSKMGR.pNewPS),y save CS hMem in TSKSLOT - >LDYA TSKMGR.pNewPS - ldx #TSKMGR.INIT - jsr Kernel.BINCALL Call INIT function + sta (pPs),y save CS hMem in TSKSLOT + + ldy #H.BIN.BIN.DS.SIZE+1 + lda (pCode),y Load DS.SIZE HI + tax + dey + ora (pCode),y + + beq .1 DS.SIZE=0... + + lda (pCode),y + >PUSHAX Push DS.SIZE + >PUSHBI 0 no option + jsr S.GetMem + bcs .97 + + >STYA pData + txa + ldy #S.PS.hDS + sta (pPs),y save DS hMem in TSKSLOT + +.1 ldx #TSKMGR.INIT + jsr pCodeJmp Call INIT function bcs .97 jsr .97 clc rts + .97 pha save ERR - >LDAL 1 + lda S.InitProcessA.FULLPATH jsr S.FreeMemA pla + .98 pha save ERR - >LDAL 0 + lda S.InitProcessA.PATH jsr S.FreeMemA pla -.99 >REMLOCAL 2 - sec + +.99 sec rts +S.InitProcessA.PATH .BS 1 +S.InitProcessA.FULLPATH .BS 1 *-------------------------------------- -* S.QuitProcessA -* In : A = PID to Quit (call TSKMGR.QUIT) +* S.SelectProcessA +* In : A=PSID *-------------------------------------- -S.QuitProcessA jsr S.GetPSByIDA - bcs .9 - >STYA ZPQuickPtr1 - ldy #S.PS.hCS - lda (ZPQuickPtr1),y +S.SelectProcessA + jsr S.GetPSByIDA + bcs * + >STYA pPS + +S.SelectProcess ldy #S.PS.hCS + lda (pPs),y jsr S.GetMemPtrA - >STYA Kernel.JMP - >LDYA ZPQuickPtr1 - ldx #TSKMGR.QUIT - jsr Kernel.BINCALL Call QUIT function - clc + >STYA pCode + + ldy #S.PS.hDS + lda (pPs),y + beq .1 + + jsr S.GetMemPtrA + >STYA pData + +.1 ldy #S.PS.hOUTDEV + lda (pPs),y + beq .8 + + jsr S.GetDevByIDA + >STYA pDev + +.8 clc rts -.9 bra * *-------------------------------------- * S.FreeProcessA * In : A = PID to free @@ -469,71 +536,46 @@ S.FreeProcessA jsr S.GetPSByIDA ldy #S.PS.hARGS lda (ZPQuickPtr1),y beq .1 + jsr S.FreeMemA + .1 ldy #S.PS.hCMD lda (ZPQuickPtr1),y beq .2 + jsr S.FreeMemA + .2 ldy #S.PS.hENV lda (ZPQuickPtr1),y beq .3 + jsr S.FreeMemA + .3 ldy #S.PS.hPREFIX lda (ZPQuickPtr1),y beq .4 + jsr S.FreeMemA + .4 ldy #S.PS.hDS lda (ZPQuickPtr1),y beq .5 + jsr S.FreeMemA + .5 ldy #S.PS.hCS lda (ZPQuickPtr1),y beq .8 + jsr S.FreeMemA + .8 lda #0 sta (ZPQuickPtr1) Mark TSKSLOT as free clc rts .9 bra * *-------------------------------------- -* S.IsPSRunningA -* In : -* A = PID -* Out : -* CC = Running -* CS = no PS -*-------------------------------------- -S.IsPSRunningA pha save PID - ldx #K.PS.MAX - >LDYAI TSKMGR.TABLE+S.PS.SIZE - >STYA ZPQuickPtr1 - -.1 lda (ZPQuickPtr1) - bpl .2 - ldy #S.PS.ID - pla - pha - cmp (ZPQuickPtr1),y - beq .8 - - lda ZPQuickPtr1 - clc - adc #S.PS.SIZE - sta ZPQuickPtr1 - bcc .2 - - inc ZPQuickPtr2+1 -.2 dex - bne .1 - - pla - sec - rts - -.8 pla - clc - rts -*-------------------------------------- +TSKMGR.SIZE .BS 1 TSKMGR.COUNT .BS 1 TSKMGR.LASTID .BS 1 *-------------------------------------- diff --git a/SYS/KERNEL.S.txt b/SYS/KERNEL.S.txt index 0827f794..90bd8056 100644 --- a/SYS/KERNEL.S.txt +++ b/SYS/KERNEL.S.txt @@ -1,34 +1,35 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 - .OR $E000 - .TF SYS/KERNEL + .OR $D000 + .TF /A2OSX.BOOT/SYS/KERNEL *-------------------------------------- .INB INC/MACROS.I .INB INC/KERNEL.I .INB INC/A2OSX.I + .INB INC/A2OSX.API.I .INB INC/IO.I .INB INC/PRODOS.I *-------------------------------------- -KERNEL.Start jmp S.Kernel +KERNEL jmp S.KernelInit KERNEL.COLDBOOT *-------------------------------------- -KERNEL.SYSCALL jmp (.1,x) + jmp (.1,x) KERNEL.SYSCALL *-------------------------------------- .1 .DA S.GetMem $00 .DA S.FreeMemA - .DA S.ClrMemA .DA S.GetMemPtrA - - .DA S.GetMemLenA .DA S.GetMemByIDA + .DA S.GetMemByNameA + .DA S.GetMemByNameYA + .DA 0 .DA 0 *-------------------------------------- - .DA S.NewPStr $10 + .DA S.NewPStrYA $10 .DA S.PStrCpyA .DA S.PStrCat .DA S.PStrCmp @@ -39,7 +40,7 @@ KERNEL.SYSCALL jmp (.1,x) .DA 0 *-------------------------------------- .DA S.LoadBinA $20 - .DA S.LoadLib + .DA S.LoadLibYA .DA S.UnloadLibA .DA S.LoadDrvA @@ -49,7 +50,7 @@ KERNEL.SYSCALL jmp (.1,x) .DA 0 *-------------------------------------- .DA S.ExpandPStrA $30 - .DA S.ExpandPStr + .DA S.ExpandPStrYA .DA S.GetEnvVarH .DA S.GetEnvVarP @@ -58,51 +59,51 @@ KERNEL.SYSCALL jmp (.1,x) .DA 0 .DA 0 *-------------------------------------- - .DA S.MLICreate $40 - .DA S.MLIDestroy + .DA S.MLICreateFile $40 + .DA S.MLICreateDirA + .DA S.MLICreateDirYA + .DA S.MLIDestroyA + + .DA S.MLIDestroyYA .DA S.MLIRename .DA S.MLISetFileInfo - .DA S.MLIGetFileInfoA + + .DA S.MLIGetFileInfoYA $50 .DA S.MLIOnline - .DA S.MLISetPrefix - .DA S.MLIGetPrefixA + .DA S.MLISetPrefixA + .DA S.MLISetPrefixYA - .DA S.MLIOpenA $50 - .DA S.MLINewLine + .DA S.MLIGetPrefixA + .DA S.MLIGetPrefixYA + .DA S.MLIOpenA + .DA S.MLIOpenYA + + .DA S.MLINewLine $60 .DA S.MLIRead .DA S.MLIWrite - .DA S.MLICloseA + .DA S.MLIFlushA .DA S.MLISetMark - .DA S.MLIGetMark + .DA S.MLIGetMarkA + .DA S.MLISetEOF - .DA S.MLISetEOF $60 - .DA S.MLIGetEOFA - .DA 0 - .DA 0 + .DA S.MLIGetEOFA $70 + .DA S.MLISetBuf + .DA S.MLIGetBuf + .DA S.MLIGetTime - .DA 0 - .DA 0 - .DA 0 - .DA 0 + .DA S.MLIAllocIRQ + .DA S.MLIDeallocIRQA + .DA S.MLIReadBlock + .DA S.MLIWriteBlock *-------------------------------------- - .DA S.GetDevByIDA $70 + .DA S.GetDevByIDA $80 .DA S.GetDevByNameA - .DA S.GetDevTable - .DA S.GetDevInfoA - - .DA S.DevOutA .DA S.GetDevByNameYA .DA 0 - .DA 0 -*-------------------------------------- - .DA S.GetEvent $80 - .DA S.DestroyEvent - .DA 0 - .DA 0 - + .DA 0 .DA 0 .DA 0 @@ -139,58 +140,66 @@ KERNEL.SYSCALL jmp (.1,x) .DA 0 *-------------------------------------- .DA S.ScreenSelectA $C0 + .DA 0 + .DA S.SysScrPPSTRA + .DA S.SysScrPPSTRYA *-------------------------------------- -S.Kernel jsr S.KernelInit - jsr S.KernelRun - jsr S.KernelQuit - - bra * -*-------------------------------------- -S.KernelInit >LDYAI D.STACKSEG - >STYA R.SP init Soft Stack - >STYA R.LS init LS - +S.KernelInit sei + ldx #$FF init 6502 stack to highest + txs + stx A2osX.SaveSM + stx A2osX.SaveSX + cli + + >LDYAI D.STACK.TOP + >STYA pStack init Soft Stack + stz A2osX.SCREENS - stz A2osX.ACTIVESCRN + stz A2osX.ASCREEN + + stz A2osX.CSCREEN.DEV + stz A2osX.GSCREEN.DEV + jsr S.SysScrInit >LDYAI MSG.Init - jsr S.SysScrPPSTR - + jsr S.SysScrPPSTRYA + >LDYAI MSG.Init.MemMgr - jsr S.SysScrPPSTR + jsr S.SysScrPPSTRYA jsr S.MemMgrInit jsr S.SysScrPRCode bcs .1 >LDYAI MSG.Init.TskMgr - jsr S.SysScrPPSTR + jsr S.SysScrPPSTRYA jsr S.TskMgrInit jsr S.SysScrPRCode .1 bcs .2 >LDYAI MSG.Init.DevMgr - jsr S.SysScrPPSTR + jsr S.SysScrPPSTRYA jsr S.DevMgrInit jsr S.SysScrPRCode .2 bcs .3 >LDYAI MSG.Init.EvtMgr - jsr S.SysScrPPSTR + jsr S.SysScrPPSTRYA jsr S.EvtMgrInit jsr S.SysScrPRCode .3 bcs .99 >LDYAI MSG.Init.Startup - jsr S.SysScrPPSTR + jsr S.SysScrPPSTRYA - >PUSHWI STARTUP.FILE Build A2osX.STARTUP full path... - jsr S.NewPStr + >LDYAI STARTUP.FILE Build A2osX.STARTUP full path... + jsr S.NewPStrYA pha save for discard + >PUSHA >PUSHWI ENV.A2osX get KRNL root path ldy #S.PS.hENV - lda TSKMGR.TABLE,y + lda TskMgr.Table,y >PUSHA jsr S.GetEnvVarP pha save for discard @@ -200,7 +209,8 @@ S.KernelInit >LDYAI D.STACKSEG jsr S.ExecFileA jsr S.SysScrPRCode - + bcs * + pla jsr S.FreeMemA pla @@ -209,11 +219,14 @@ S.KernelInit >LDYAI D.STACKSEG jsr S.FreeMemA >LDYAI MSG.Init.SysEnv - jsr S.SysScrPPSTR + jsr S.SysScrPPSTRYA jsr S.PrintSysEnv -.99 rts +.99 bcs * + + >LDYAI MSG.Init.OK + jsr S.SysScrPPSTRYA *-------------------------------------- S.KernelRun jsr S.TskMgrRun bcs .98 @@ -225,22 +238,22 @@ S.KernelRun jsr S.TskMgrRun jsr S.DispatchEvent bcc S.KernelRun CC=Event Dispatched - lda (EVTMGR.EVTPTR) + lda (pEvent) and #S.EVT.F.TIMER Discard any TIMER event beq .1 jsr S.DestroyEvent bra S.KernelRun -.1 lda (EVTMGR.EVTPTR) +.1 lda (pEvent) and #S.EVT.F.KEY any special key? beq .99 ldy #S.EVT.DATAHI Open-Apple? - lda (EVTMGR.EVTPTR),y + lda (pEvent),y bpl .99 ldy #S.EVT.DATALO - lda (EVTMGR.EVTPTR),y + lda (pEvent),y cmp #$31 bne .2 @@ -258,52 +271,24 @@ S.KernelRun jsr S.TskMgrRun bne .8 lda #A2osX.SCREENS.G jsr S.ScreenSelectA + .8 jsr S.DestroyEvent bra S.KernelRun .98 lda #A2osX.SCREENS.S jsr S.ScreenSelectA >LDYAI MSG.KRNLPANIC - jsr S.SysScrPPSTR + jsr S.SysScrPPSTRYA bra * .99 >LDYAI MSG.EVNTPANIC - jsr S.SysScrPPSTR - lda (EVTMGR.EVTPTR) - jsr S.SysScrPRBYTEA - ldy #S.EVT.hDEV - lda (EVTMGR.EVTPTR),y - jsr S.SysScrPRBYTEA - ldy #S.EVT.DATALO - lda (EVTMGR.EVTPTR),y - jsr S.SysScrPRBYTEA - ldy #S.EVT.DATAHI - lda (EVTMGR.EVTPTR),y - jsr S.SysScrPRBYTEA - - lda #'.' - jsr S.SysScrCOUTA - ldy #S.EVT.DATAW1 - lda (EVTMGR.EVTPTR),y - jsr S.SysScrPRBYTEA - iny - lda (EVTMGR.EVTPTR),y - jsr S.SysScrPRBYTEA - - lda #'.' - jsr S.SysScrCOUTA - ldy #S.EVT.DATAW2 - lda (EVTMGR.EVTPTR),y - jsr S.SysScrPRBYTEA - iny - lda (EVTMGR.EVTPTR),y - jsr S.SysScrPRBYTEA + jsr S.SysScrPPSTRYA + jsr S.DumpEvent jsr S.DestroyEvent jmp S.KernelRun *-------------------------------------- -S.KernelQuit clc - rts +S.KernelQuit bra * *-------------------------------------- * PUBLIC *-------------------------------------- @@ -311,38 +296,44 @@ S.KernelQuit clc * in : * A = hMem of FilePath (PSTRING) * out : -*-------------------------------------- -* LS : (8) -* 0 = hMem of Loaded File -* 2 = PTR to File data -* 4 = Data Len -* 6 = CMD hMem -* 7 = ARGS hMem +* *-------------------------------------- S.ExecFileA jsr S.LoadFileA bcc S.ExecFileAOK rts -S.ExecFileAOK >ADDLOCAL 8 - >STYAL 4 Store File Length + +S.ExecFileAOK >STYA S.ExecFileA.DataLen + stx S.ExecFileA.hData txa - >STAL 0 hMem of Loaded File jsr S.GetMemPtrA - >STYAL 2 + >STYA S.ExecFileA.DataPtr + .1 stz TmpBuffer256 -.2 >LDYAL 2 + +.2 >LDYA S.ExecFileA.DataPtr >STYA ZPQuickPtr1 - >INCLW 2 - >DECLW 4 + + inc S.ExecFileA.DataPtr + bne .21 + inc S.ExecFileA.DataPtr+1 + +.21 lda S.ExecFileA.DataLen + bne .22 + dec S.ExecFileA.DataLen+1 +.22 dec S.ExecFileA.DataLen + lda (ZPQuickPtr1) cmp #$0D beq .3 inc TmpBuffer256 ldx TmpBuffer256 sta TmpBuffer256,x - >LDAL 4 + + lda S.ExecFileA.DataLen bne .2 - >LDAL 5 + lda S.ExecFileA.DataLen+1 bne .2 + .3 lda TmpBuffer256 beq .4 lda TmpBuffer256+1 @@ -353,83 +344,78 @@ S.ExecFileAOK >ADDLOCAL 8 lda #'>' jsr S.SysScrCOUTA >LDYAI TmpBuffer256 - jsr S.SysScrPPSTR - >PUSHWI TmpBuffer256 - jsr S.NewPStr + jsr S.SysScrPPSTRYA + >LDYAI TmpBuffer256 + jsr S.NewPStrYA bcs .99 + pha jsr S.ExecCmdLineA jsr S.SysScrPRCode pla jsr S.FreeMemA -.4 >LDAL 4 -.5 bne .6 - >LDAL 5 - beq .8 -.6 jmp .1 -.8 jsr .99 + +.4 lda S.ExecFileA.DataLen + bne .1 + lda S.ExecFileA.DataLen+1 + bne .1 + + jsr .99 clc rts -.99 >LDAL 0 + +.99 lda S.ExecFileA.hData jsr S.FreeMemA - >REMLOCAL 8 sec rts *-------------------------------------- -S.ExecCmdLineA >PUSHA +S.ExecCmdLineA >PUSHA Push Cmd Line >PUSHBI $20 Push SEP=' ' >PUSHBI 0 Push Token IDX jsr S.PStrGetTkn bcs .99 - >STAL 6 - pha - txa - >STAL 7 - pla + + sta S.ExecFileA.hCMD + stx S.ExecFileA.hARGS jsr S.GetMemPtrA >PUSHYA >PUSHWI EXECCMDS jsr S.GetPStrIndex bcs .98 + asl tax - >LDAL 7 + lda S.ExecFileA.hARGS jsr S.ExecCmdLine bcs .98 + jsr .98 clc rts + .98 pha - >LDAL 7 + lda S.ExecFileA.hARGS jsr S.FreeMemA - >LDAL 6 + lda S.ExecFileA.hCMD jsr S.FreeMemA pla .99 sec rts *-------------------------------------- +S.ExecFileA.hData .BS 1 +S.ExecFileA.DataLen .BS 2 +S.ExecFileA.DataPtr .BS 2 +S.ExecFileA.hCMD .BS 1 +S.ExecFileA.hARGS .BS 1 +*-------------------------------------- S.ExecCmdLine jmp (.1,x) .1 .DA S.SetSysEnvA .DA S.LoadDrvA VCPU!!!! .DA S.CreateProcessA VCPU!!!! *-------------------------------------- -S.PrintSysEnv ldy #S.PS.hENV - lda TSKMGR.TABLE,y Get PS #0 ENV - jsr S.GetMemPtrA - >STYA R.AX -.1 lda (R.AX) - beq .8 Ending 0 ? - >LDYA R.AX - jsr S.SysScrPPSTR - jsr S.SysScrCROUT - lda R.AL - sec - adc (R.AX) Add len+1 to PTR - sta R.AL - bcc .1 - inc R.AH - bra .1 -.8 rts +pDevJmp jmp (pDev) +pCodeJmp jmp (pCode) +pLibJmp jmp (pLib) *-------------------------------------- EXECCMDS >PSTRING "SET" EXECCMDS1 >PSTRING "LOAD" @@ -443,6 +429,8 @@ MSG.Init.DevMgr >PSTRING "->DevMgr Init" MSG.Init.EvtMgr >PSTRING "->EvtMgr Init" MSG.Init.Startup >PSTRING "EXEC A2osX.Startup...\n" MSG.Init.SysEnv >PSTRING "SYS ENV:\n" +MSG.Init.OK >PSTRING "A2osX[Stage2]:Complete." + MSG.EVNTPANIC >PSTRING "\nEVT:F/hDev/DATA/W1/W2=" MSG.KRNLPANIC >PSTRING "\n\n!!!Kernel Panic!!!" *-------------------------------------- @@ -454,25 +442,21 @@ ENV.DRV >PSTRING "DRV" ENV.ETC >PSTRING "ETC" ENV.LIB >PSTRING "LIB" *-------------------------------------- - .INB SYS/KERNEL.S.BIN - .INB SYS/KERNEL.S.DEV - .INB SYS/KERNEL.S.ENV - .INB SYS/KERNEL.S.EVT - .INB SYS/KERNEL.S.FS .INB SYS/KERNEL.S.MEM - .INB SYS/KERNEL.S.MLI - .INB SYS/KERNEL.S.NET -* .INB SYS/KERNEL.S.RDR .INB SYS/KERNEL.S.SCR .INB SYS/KERNEL.S.STR + .INB SYS/KERNEL.S.FS + .INB SYS/KERNEL.S.MLI + .INB SYS/KERNEL.S.BIN + .INB SYS/KERNEL.S.DRV + .INB SYS/KERNEL.S.LIB + .INB SYS/KERNEL.S.NET + .INB SYS/KERNEL.S.RDR + .INB SYS/KERNEL.S.ENV .INB SYS/KERNEL.S.TSK + .INB SYS/KERNEL.S.EVT *-------------------------------------- -KERNEL.End .EQ * -Kernel.Size .EQ KERNEL.End-KERNEL.Start -*-------------------------------------- - .DO Kernel.Size>$1FFA - ERROR:KERNEL.SIZE too big - .FIN + .INB SYS/KERNEL.S.DEV *-------------------------------------- MAN SAVE SYS/KERNEL.S diff --git a/SYS/KM.NSC.S.txt b/SYS/KM.NSC.S.txt index ffe34e85..64198b22 100644 --- a/SYS/KM.NSC.S.txt +++ b/SYS/KM.NSC.S.txt @@ -1,12 +1,12 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF SYS/KM.NSC + .TF /A2OSX.BOOT/SYS/KM.NSC *-------------------------------------- .INB INC/MACROS.I .INB INC/IO.I diff --git a/SYS/KM.RAMWORKS.S.txt b/SYS/KM.RAMWORKS.S.txt index 7c183885..2886dd54 100644 --- a/SYS/KM.RAMWORKS.S.txt +++ b/SYS/KM.RAMWORKS.S.txt @@ -1,12 +1,12 @@ PR#3 -PREFIX /A2OSX.BUILD +PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF .OP 65C02 .OR $2000 - .TF SYS/KM.RAMWORKS + .TF /A2OSX.BOOT/SYS/KM.RAMWORKS *-------------------------------------- .INB INC/MACROS.I .INB INC/IO.I @@ -166,7 +166,7 @@ RW.Install lda RRAMWRAMBNK1 inc DEVCNT ldx DEVCNT - lda #$30 Slot 3,Drive 1 + lda #$30 Slot 3,Drive 1,0=Not Removable, 0=no int, 00=1 Volume sta DEVLST,x lda #RWDRV.START @@ -276,7 +276,8 @@ RW.Format jsr RW.BLOCK.SET00 cmp #4 Are we writing first volume bitmap ? bne .63 no, regular one - lda #$CF Mark Block 0 & 1 free, 2,3 used (vol hdr) +* lda #$CF Mark Block 0 & 1 free, 2,3 used (vol hdr) + lda #$0F sta RW.BLOCK ldy #0 @@ -371,9 +372,13 @@ RW.MSG.KO3 >CSTRING "RamWorks Drive Format Error." * Driver for Ramworks in main LC * $FF00 -> $FF9A (Inclusive) * $FF58 MUST BE $60 (RTS) -* DO NOT trash DRV.BLKNUM as ProDOS +* DO NOT trash DRV.COMMAND...DRV.BLKNUM as ProDOS * reuses it after Block operation +* A1,A2 are used by Disk II Driver, +* so we use it safely as Tmp Ptr *-------------------------------------- +DRV.A2L .EQ $3E +DRV.A2H .EQ $3F DRV.COMMAND .EQ $42 DRV.BUFF .EQ $44 DRV.BLKNUM .EQ $46 @@ -389,14 +394,13 @@ RWDRV.START cld ProDOS will check that byte!!! bcs RWDRV.IOERR > 3 = Invalid OP, IO error lda DRV.BLKNUM - sec - sbc RWDRV.MAXLO+1 + sbc RWDRV.MAXLO+1 Carry is Clear lda DRV.BLKNUM+1 sbc RWDRV.MAXHI+1 bcs RWDRV.IOERR DRV.BLKNUM >= RW.DRV.SIZE, IO error - lda DRV.BLKNUM compute PAGE = blocknumLO *2 - asl + lda DRV.BLKNUM Get Back DRV.BLKNUM + asl compute PAGE = blocknumLO *2 pha lda DRV.BLKNUM+1 compute BANK = blocknumHI *2 rol @@ -408,50 +412,54 @@ RWDRV.START cld ProDOS will check that byte!!! *-------------------------------------- * X=Page($02 -> $BF),A=Bank,Y=CMD *-------------------------------------- - php +* php sei Disable IRQ as no vector set in RW Banks sta RWBankSelect Select RAMWorks Bank sta CLR80STORE make sure SETREADAUX/SETWRITEAUX effective everywhere - stx DRV.COMMAND+1 Reuse DRV.COMMAND for RAM PTR - stz DRV.COMMAND + inx second 256 bytes first + stx DRV.A2H Use DRV.A1L/H for RAM PTR + stz DRV.A2L + + inc DRV.BUFF+1 dey Y=CMD, zero if read - bne RWDRV.W CC, go write - + bne RWDRV.W non zero, go write + sta SETREADAUX - ldx #DRV.COMMAND READ:copy from RAM to BUFF - ldy #DRV.BUFF + ldx #DRV.A2L READ:copy from RAM to BUFF + lda #DRV.BUFF bra RWDRV.RW RWDRV.W sta SETWRITEAUX ldx #DRV.BUFF - ldy #DRV.COMMAND WRITE:copy from BUFF to RAM + lda #DRV.A2L WRITE:copy from BUFF to RAM + dey Make sure Y=0 for main loop below RWDRV.RW stx RWDRV.RW.SRC+1 - sty RWDRV.RW.DST+1 + sta RWDRV.RW.DST+1 ldx #2 2 pages to copy - ldy #0 - RWDRV.RW.SRC lda ($FF),y RWDRV.RW.DST sta ($FF),y iny bne RWDRV.RW.SRC + .HS 24 BIT Zero Page to skip RTS RWDRV.RTS rts $FF58 Must Be RTS - inc DRV.BUFF+1 - inc DRV.COMMAND+1 + dec DRV.BUFF+1 + dec DRV.A2H dex bne RWDRV.RW.SRC stz RWBankSelect sta CLRREADAUX sta CLRWRITEAUX - plp +* plp + cli RMDRV.CMDSTATUS RWDRV.MAXLO ldx #$FF return device block count in X,Y... diff --git a/_Make_DIR.txt b/_Make_DIR.txt new file mode 100644 index 00000000..c4c4f193 --- /dev/null +++ b/_Make_DIR.txt @@ -0,0 +1,16 @@ +PREFIX /A2OSX.BOOT +CREATE BIN +CREATE DRV +CREATE ETC +CREATE INC +CREATE LIB +CREATE SBIN +CREATE SYS +PREFIX /A2OSX.SRC +CREATE BIN +CREATE DRV +CREATE ETC +CREATE INC +CREATE LIB +CREATE SBIN +CREATE SYS \ No newline at end of file diff --git a/_Make_SYS.txt b/_Make_SYS.txt index 07a59e85..a59c244d 100644 --- a/_Make_SYS.txt +++ b/_Make_SYS.txt @@ -1,5 +1,12 @@ -PREFIX /A2OSX.BUILD +PR#3 +PREFIX /A2OSX.SRC NEW -BLOAD A +INC 1 +AUTO 6 +PREFIX /A2OSX.BOOT DELETE A2OSX.SYSTEM +BLOAD A BSAVE A2OSX.SYSTEM,TSYS,A$2000,L$1300 +-A2OSX.SYSTEM +MAN +TEXT MSYS