mirror of
https://github.com/A2osX/A2osX.git
synced 2024-07-13 13:29:04 +00:00
Kernel 0.93+
This commit is contained in:
parent
933e1fae53
commit
52dccc3298
@ -132,7 +132,7 @@ In maintenance mode, you still have access to all A2osX utilities and scripts, s
|
|||||||
|
|
||||||
### A2osX Preemptive Mode
|
### A2osX Preemptive Mode
|
||||||
|
|
||||||
A2osX is a multiuser multitasking operating system. As with any such operating system running on a single core single CPU system such as an Apple II with the 6502, A2osX switches between all of the running processes automatically ensuring that each gets serviced in a reasonable time. It is the A2osX Kernel that performs this task in 1 of 2 manners: Cooperative or Preemptive mode. In Cooperative mode, the default, switching between processes occurs whenever an application makes a "blocking" API call such as a file services request or cooperatively relinquishes control (see the A2osX Developers Guide). In Preemptive Mode, set by option in KCONFIG utility (see A2osX Command Guide), the kernel switches between "sleeping" processes automatically at 1/10th-second intervals. In order to use Preemptive Mode, your system must have supported hardware that generates an interrupt used by A2osX such as an Apple II Mouse or Uthernet interface.
|
A2osX is a multiuser multitasking operating system. As with any such operating system running on a single core single CPU system such as an Apple II with the 6502, A2osX switches between all of the running processes automatically ensuring that each gets serviced in a reasonable time. It is the A2osX Kernel that performs this task in 1 of 2 manners: Cooperative or Preemptive mode. In Cooperative mode, the default, switching between processes occurs whenever an application makes a "blocking" API call such as waiting for a key pressed, a network frame... or cooperatively relinquishes control (explicitly calling >SLEEP, see the A2osX Developers Guide). In Preemptive Mode, set by option in KCONFIG utility (see A2osX Command Guide), the kernel switches between "sleeping" processes automatically at 1/10th-second intervals. In order to use Preemptive Mode, your system must have supported hardware that generates an interrupt used by A2osX such as an Apple II Mouse or ThunderClock interface.
|
||||||
|
|
||||||
## Devices
|
## Devices
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ Any ProDOS Block Device (5.25 & 3.5 Floppy Drives, SmartPort Hard Drive and Ram
|
|||||||
NoSlot Clock or ThunderClock
|
NoSlot Clock or ThunderClock
|
||||||
Super Serial Card
|
Super Serial Card
|
||||||
Mouse Card
|
Mouse Card
|
||||||
Network Card (Uthernet I or II, LanCes)
|
Network Card (Uthernet I or II, LanCEgs)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
Binary file not shown.
267
BIN/PAK.S.txt
267
BIN/PAK.S.txt
@ -8,21 +8,10 @@ NEW
|
|||||||
.INB INC/MACROS.I
|
.INB INC/MACROS.I
|
||||||
.INB INC/A2OSX.I
|
.INB INC/A2OSX.I
|
||||||
.INB INC/KERNEL.I
|
.INB INC/KERNEL.I
|
||||||
.INB INC/MLI.I
|
.INB INC/LIBPAK.I
|
||||||
.INB INC/MLI.E.I
|
.INB INC/MLI.E.I
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CHNK.T .EQ 0
|
CHNK.SIZE .EQ 4096
|
||||||
CHNK.T.DATA .EQ 0
|
|
||||||
CHNK.T.DIR .EQ 1
|
|
||||||
CHNK.T.FILE .EQ 2
|
|
||||||
*
|
|
||||||
CHNK.TYPE .EQ 1
|
|
||||||
CHNK.AUXTYPE .EQ 2
|
|
||||||
CHNK.FNLEN .EQ 4
|
|
||||||
*
|
|
||||||
CHNK.COMPALG .EQ 1
|
|
||||||
CHNK.ULEN .EQ 2
|
|
||||||
CHNK.CLEN .EQ 4
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
X.ENTER.SUBDIR .EQ 0
|
X.ENTER.SUBDIR .EQ 0
|
||||||
X.COPY.TO.DEST .EQ 0
|
X.COPY.TO.DEST .EQ 0
|
||||||
@ -39,6 +28,7 @@ ZPFileStat .BS 2
|
|||||||
ZPFullPath .BS 2
|
ZPFullPath .BS 2
|
||||||
ZPRelPath .BS 2
|
ZPRelPath .BS 2
|
||||||
|
|
||||||
|
ZPBufPtr .BS 2
|
||||||
bAppend .BS 1
|
bAppend .BS 1
|
||||||
bRecurse .BS 1
|
bRecurse .BS 1
|
||||||
bPause .BS 1
|
bPause .BS 1
|
||||||
@ -69,6 +59,7 @@ L.MSG.DIR .DA MSG.DIR
|
|||||||
L.MSG.FILE .DA MSG.FILE
|
L.MSG.FILE .DA MSG.FILE
|
||||||
L.MSG.OK .DA MSG.OK
|
L.MSG.OK .DA MSG.OK
|
||||||
L.MSG.ERR .DA MSG.ERR
|
L.MSG.ERR .DA MSG.ERR
|
||||||
|
L.MSG.E.IARC .DA MSG.E.IARC
|
||||||
L.ARC.Header .DA ARC.Header
|
L.ARC.Header .DA ARC.Header
|
||||||
.DA 0
|
.DA 0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -143,9 +134,11 @@ CS.RUN >INC.G ArgIndex
|
|||||||
jsr CS.RUN.OpenArc
|
jsr CS.RUN.OpenArc
|
||||||
bcs .99
|
bcs .99
|
||||||
|
|
||||||
>LDYAI 4096
|
>LDYAI CHNK.SIZE
|
||||||
>SYSCALL getmem
|
>SYSCALL getmem
|
||||||
bcs .99
|
bcs .99
|
||||||
|
>STYA ZPBufPtr
|
||||||
|
>STYA.G Shunk
|
||||||
txa
|
txa
|
||||||
>STA.G hMem
|
>STA.G hMem
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -173,7 +166,7 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
|
|||||||
|
|
||||||
.1 lda bPause
|
.1 lda bPause
|
||||||
bne CS.RUN.LOOP Pause...
|
bne CS.RUN.LOOP Pause...
|
||||||
|
*--------------------------------------
|
||||||
jsr GetEntry
|
jsr GetEntry
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
@ -230,8 +223,7 @@ CS.RUN.DIR lda bRecurse
|
|||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
lda #CHNK.T.DIR
|
jsr CS.RUN.WriteArcHdrDir
|
||||||
jsr CS.RUN.WriteHeader
|
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
>LDYA ZPFileName
|
>LDYA ZPFileName
|
||||||
@ -244,18 +236,17 @@ CS.RUN.DIR lda bRecurse
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN.FILE jsr FilterMatch
|
CS.RUN.FILE jsr FilterMatch
|
||||||
bcs .8 no match, skip....
|
bcs .8 no match, skip....
|
||||||
|
|
||||||
|
jsr CS.RUN.GetFilePath
|
||||||
|
|
||||||
>PUSHW ZPFullPath
|
>PUSHW ZPFullPath
|
||||||
|
|
||||||
>LDA.G hArcFile
|
>LDA.G hArcFile
|
||||||
tay
|
tay
|
||||||
lda OF.Table.hPath-1,x
|
lda OF.Table.hPath-1,y
|
||||||
>SYSCALL getmemptr
|
>SYSCALL getmemptr
|
||||||
>SYSCALL strcmp
|
>SYSCALL strcmp
|
||||||
bcc .8
|
bcc .8
|
||||||
|
|
||||||
jsr CS.RUN.GetFilePath
|
|
||||||
|
|
||||||
>PUSHW ZPRelPath
|
>PUSHW ZPRelPath
|
||||||
|
|
||||||
>PUSHBI 2
|
>PUSHBI 2
|
||||||
@ -263,15 +254,33 @@ CS.RUN.FILE jsr FilterMatch
|
|||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
lda #CHNK.T.FILE
|
jsr CS.RUN.WriteArcHdrFile
|
||||||
jsr CS.RUN.WriteHeader
|
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
jsr CS.RUN.OpenFile
|
jsr CS.RUN.OpenFile
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
|
.1 lda #'.'
|
||||||
|
>SYSCALL putchar
|
||||||
|
|
||||||
|
jsr CS.RUN.ReadFile
|
||||||
|
bcc .2
|
||||||
|
|
||||||
|
cmp #MLI.E.EOF
|
||||||
|
bne .4
|
||||||
|
|
||||||
jsr CS.RUN.CloseFile
|
jsr CS.RUN.CloseFile
|
||||||
|
|
||||||
|
bra .9
|
||||||
|
|
||||||
|
.2 jsr CS.RUN.WriteArcData
|
||||||
|
bcc .1
|
||||||
|
|
||||||
|
.4 pha
|
||||||
|
jsr CS.RUN.CloseFile
|
||||||
|
pla
|
||||||
|
sec
|
||||||
|
|
||||||
.9 jmp CS.RUN.CheckErr
|
.9 jmp CS.RUN.CheckErr
|
||||||
|
|
||||||
.8 clc
|
.8 clc
|
||||||
@ -307,60 +316,6 @@ CS.RUN.GetFilePath
|
|||||||
>SYSCALL StrCat
|
>SYSCALL StrCat
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN.OpenArc >PUSHWZ Aux type
|
|
||||||
>PUSHBI $CF PAK
|
|
||||||
>PUSHBI O.CREATE+O.WRONLY
|
|
||||||
>LDA.G ArcName
|
|
||||||
>SYSCALL Argv
|
|
||||||
|
|
||||||
>SYSCALL FOpen
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
>STA.G hArcFile
|
|
||||||
|
|
||||||
>PUSHW L.ARC.Header
|
|
||||||
>LDA.G hArcFile
|
|
||||||
>SYSCALL fputs
|
|
||||||
.9 rts
|
|
||||||
*--------------------------------------
|
|
||||||
CS.RUN.WriteHeader
|
|
||||||
>PUSHA
|
|
||||||
jsr .8
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
ldy #S.STAT.P.TYPE
|
|
||||||
jsr .6
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
ldy #S.STAT.P.AUXTYPE
|
|
||||||
jsr .6
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
ldy #S.STAT.P.AUXTYPE+1
|
|
||||||
jsr .6
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
ldy #$ff
|
|
||||||
|
|
||||||
.1 iny
|
|
||||||
lda (ZPRelPath),y
|
|
||||||
bne .1
|
|
||||||
|
|
||||||
tya
|
|
||||||
jsr .7
|
|
||||||
bcs .9
|
|
||||||
|
|
||||||
>PUSHW ZPRelPath
|
|
||||||
>LDA.G hArcFile
|
|
||||||
>SYSCALL fputs
|
|
||||||
rts
|
|
||||||
|
|
||||||
.6 lda (ZPFileStat),y
|
|
||||||
.7 >PUSHA
|
|
||||||
.8 >LDA.G hArcFile
|
|
||||||
>SYSCALL fputc
|
|
||||||
.9 rts
|
|
||||||
*--------------------------------------
|
|
||||||
CS.RUN.OpenFile >PUSHWZ Aux type
|
CS.RUN.OpenFile >PUSHWZ Aux type
|
||||||
>PUSHBI 0 Type
|
>PUSHBI 0 Type
|
||||||
>PUSHBI O.RDONLY
|
>PUSHBI O.RDONLY
|
||||||
@ -373,6 +328,16 @@ CS.RUN.OpenFile >PUSHWZ Aux type
|
|||||||
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
CS.RUN.ReadFile >PUSHWI CHNK.SIZE
|
||||||
|
>PUSHW ZPBufPtr
|
||||||
|
>LDA.G hFile
|
||||||
|
>SYSCALL fread
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
>STYA.G Shunk+2
|
||||||
|
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
CS.RUN.CloseFile
|
CS.RUN.CloseFile
|
||||||
>LDA.G hFile
|
>LDA.G hFile
|
||||||
>SYSCALL fclose
|
>SYSCALL fclose
|
||||||
@ -381,6 +346,142 @@ CS.RUN.CloseFile
|
|||||||
>STZ.G hFile
|
>STZ.G hFile
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
CS.RUN.OpenArc >PUSHWZ Aux type
|
||||||
|
>PUSHBI $CF PAK
|
||||||
|
|
||||||
|
bit bAppend
|
||||||
|
bmi .1
|
||||||
|
|
||||||
|
>PUSHBI O.CREATE+O.WRONLY
|
||||||
|
>LDA.G ArcName
|
||||||
|
>SYSCALL Argv
|
||||||
|
|
||||||
|
>SYSCALL FOpen
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
>STA.G hArcFile
|
||||||
|
|
||||||
|
>PUSHW L.ARC.Header
|
||||||
|
>LDA.G hArcFile
|
||||||
|
>SYSCALL fputs
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
|
.1 >PUSHBI O.RDWR
|
||||||
|
>LDA.G ArcName
|
||||||
|
>SYSCALL Argv
|
||||||
|
|
||||||
|
>SYSCALL FOpen
|
||||||
|
bcs .9
|
||||||
|
>STA.G hArcFile
|
||||||
|
|
||||||
|
pha
|
||||||
|
>PUSHWI 3
|
||||||
|
>PUSHW ZPBufPtr
|
||||||
|
pla
|
||||||
|
>SYSCALL fread
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
cpy #3
|
||||||
|
bne .99
|
||||||
|
|
||||||
|
dey
|
||||||
|
|
||||||
|
.2 lda ARC.Header,y
|
||||||
|
cmp (ZPBufPtr),y
|
||||||
|
bne .99
|
||||||
|
dey
|
||||||
|
bpl .2
|
||||||
|
|
||||||
|
>PUSHBI SEEK.END
|
||||||
|
>PUSHWI 0
|
||||||
|
>PUSHWI 0
|
||||||
|
>LDA.G hArcFile
|
||||||
|
>SYSCALL fseek
|
||||||
|
bcc .8
|
||||||
|
cmp #MLI.E.EOF
|
||||||
|
bne .99
|
||||||
|
clc
|
||||||
|
.8 rts
|
||||||
|
|
||||||
|
.99 >LDYA L.MSG.E.IARC
|
||||||
|
>SYSCALL puts
|
||||||
|
lda #E.SYN
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.WriteArcHdrDir
|
||||||
|
lda #CHNK.T.DIR
|
||||||
|
jsr CS.RUN.WriteArcByteA
|
||||||
|
bcc CS.RUN.WriteArcHdr
|
||||||
|
rts
|
||||||
|
|
||||||
|
CS.RUN.WriteArcHdrFile
|
||||||
|
lda #CHNK.T.FILE
|
||||||
|
jsr CS.RUN.WriteArcByteA
|
||||||
|
bcs CS.RUN.WriteArcHdr.9
|
||||||
|
|
||||||
|
ldy #S.STAT.P.TYPE
|
||||||
|
jsr CS.RUN.WriteArcByteY
|
||||||
|
bcs CS.RUN.WriteArcHdr.9
|
||||||
|
|
||||||
|
ldy #S.STAT.P.AUXTYPE
|
||||||
|
jsr CS.RUN.WriteArcByteY
|
||||||
|
bcs CS.RUN.WriteArcHdr.9
|
||||||
|
|
||||||
|
ldy #S.STAT.P.AUXTYPE+1
|
||||||
|
jsr CS.RUN.WriteArcByteY
|
||||||
|
bcs CS.RUN.WriteArcHdr.9
|
||||||
|
|
||||||
|
CS.RUN.WriteArcHdr
|
||||||
|
ldy #$ff
|
||||||
|
|
||||||
|
.1 iny
|
||||||
|
lda (ZPRelPath),y
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
tya
|
||||||
|
jsr CS.RUN.WriteArcByteA
|
||||||
|
bcs CS.RUN.WriteArcHdr.9
|
||||||
|
|
||||||
|
>PUSHW ZPRelPath
|
||||||
|
>LDA.G hArcFile
|
||||||
|
>SYSCALL fputs
|
||||||
|
|
||||||
|
CS.RUN.WriteArcHdr.9
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.WriteArcData
|
||||||
|
lda #CHNK.T.DATA
|
||||||
|
jsr CS.RUN.WriteArcByteA
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
lda #CHNK.ALG.STORE
|
||||||
|
jsr CS.RUN.WriteArcByteA
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
>LDA.G Shunk+2 Len LO
|
||||||
|
jsr CS.RUN.WriteArcByteA
|
||||||
|
bcs .9 Len HI
|
||||||
|
|
||||||
|
>LDA.G Shunk+3
|
||||||
|
jsr CS.RUN.WriteArcByteA
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
>PUSHW.G Shunk+2
|
||||||
|
>PUSHW ZPBufPtr
|
||||||
|
>LDA.G hArcFile
|
||||||
|
>SYSCALL fwrite
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.WriteArcByteY
|
||||||
|
lda (ZPFileStat),y
|
||||||
|
|
||||||
|
CS.RUN.WriteArcByteA
|
||||||
|
>PUSHA
|
||||||
|
>LDA.G hArcFile
|
||||||
|
>SYSCALL fputc
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
CS.DOEVENT sec
|
CS.DOEVENT sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -397,14 +498,12 @@ CS.QUIT jsr LeaveSubDir
|
|||||||
|
|
||||||
.2 >LDA.G hArcFile
|
.2 >LDA.G hArcFile
|
||||||
beq .3
|
beq .3
|
||||||
|
|
||||||
>SYSCALL fclose
|
>SYSCALL fclose
|
||||||
|
|
||||||
.3 >LDA.G hMem
|
.3 >LDA.G hMem
|
||||||
beq .8
|
beq .8
|
||||||
>SYSCALL FreeMem
|
>SYSCALL FreeMem
|
||||||
|
|
||||||
|
|
||||||
.8 clc
|
.8 clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -439,6 +538,7 @@ MSG.USAGE .AS "Usage : PAK Archive [File *,? wildcards allowed]\r\n"
|
|||||||
.AZ " -R : Recurse subdirectories\r\n"
|
.AZ " -R : Recurse subdirectories\r\n"
|
||||||
MSG.OK .AZ "[OK]"
|
MSG.OK .AZ "[OK]"
|
||||||
MSG.ERR .AZ "[%h]\r\n"
|
MSG.ERR .AZ "[%h]\r\n"
|
||||||
|
MSG.E.IARC .AZ "Invalid/corrupt archive"
|
||||||
MSG.DIR .AZ "Reading Dir:%s..."
|
MSG.DIR .AZ "Reading Dir:%s..."
|
||||||
MSG.FILE .AZ "Adding File:%s..."
|
MSG.FILE .AZ "Adding File:%s..."
|
||||||
ARC.Header .AZ "PAK"
|
ARC.Header .AZ "PAK"
|
||||||
@ -453,6 +553,11 @@ hArcFile .BS 1
|
|||||||
hFile .BS 1
|
hFile .BS 1
|
||||||
hMem .BS 1
|
hMem .BS 1
|
||||||
|
|
||||||
|
Shunk .BS 2 SrcPtr
|
||||||
|
.BS 2 SrcSize
|
||||||
|
.BS 2 DstPtr
|
||||||
|
.BS 2 DstSize
|
||||||
|
|
||||||
.INB USR/SRC/BIN/X.FILEENUM.G
|
.INB USR/SRC/BIN/X.FILEENUM.G
|
||||||
DS.END
|
DS.END
|
||||||
.ED
|
.ED
|
||||||
|
405
BIN/UNPAK.S.txt
405
BIN/UNPAK.S.txt
@ -3,22 +3,34 @@ NEW
|
|||||||
.LIST OFF
|
.LIST OFF
|
||||||
.OP 65C02
|
.OP 65C02
|
||||||
.OR $2000
|
.OR $2000
|
||||||
.TF ROOT/UNPAK
|
.TF BIN/UNPAK
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.INB INC/MACROS.I
|
.INB INC/MACROS.I
|
||||||
.INB INC/A2OSX.I
|
.INB INC/A2OSX.I
|
||||||
|
.INB INC/MLI.E.I
|
||||||
.INB INC/LIBPAK.I
|
.INB INC/LIBPAK.I
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
ZPPakHdrPtr .EQ ZPBIN
|
CHNK.SIZE .EQ 4096
|
||||||
ZPPakDataPtr .EQ ZPBIN+2
|
|
||||||
ZPPakSrcPtr .EQ ZPBIN+4
|
|
||||||
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
UNPAK.Mask .EQ ZPBIN+8
|
.DUMMY
|
||||||
UNPAK.LastByte .EQ ZPBIN+9
|
.OR ZPBIN
|
||||||
UNPAK.Cnt .EQ ZPBIN+10
|
ZS.START
|
||||||
UNPAK.Ofs .EQ ZPBIN+12
|
ZPPtr1 .BS 2
|
||||||
UNPAK.BLOfs .EQ ZPBIN+14
|
ZPInBufPtr .BS 2
|
||||||
|
ZPULen .BS 2
|
||||||
|
|
||||||
|
ZPPakHdrPtr .BS 2
|
||||||
|
ZPPakDataPtr .BS 2
|
||||||
|
ZPPakSrcPtr .BS 2
|
||||||
|
ZPFullPathPtr .BS 2
|
||||||
|
ZPRelPathPtr .BS 2
|
||||||
|
|
||||||
|
UNPAK.Mask .BS 2
|
||||||
|
UNPAK.LastByte .BS 2
|
||||||
|
UNPAK.Cnt .BS 2
|
||||||
|
UNPAK.Ofs .BS 2
|
||||||
|
UNPAK.BLOfs .BS 2
|
||||||
|
ZS.END .ED
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* File Header (16 Bytes)
|
* File Header (16 Bytes)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -30,7 +42,7 @@ CS.START cld
|
|||||||
.DA CS.END-CS.START CS
|
.DA CS.END-CS.START CS
|
||||||
.DA DS.END-DS.START DS
|
.DA DS.END-DS.START DS
|
||||||
.DA #64 SS
|
.DA #64 SS
|
||||||
.DA #16 ZP
|
.DA #ZS.END-ZS.START Zero Page Size
|
||||||
.DA 0
|
.DA 0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Relocation Table
|
* Relocation Table
|
||||||
@ -39,47 +51,304 @@ CS.START cld
|
|||||||
.DA CS.RUN
|
.DA CS.RUN
|
||||||
.DA CS.DOEVENT
|
.DA CS.DOEVENT
|
||||||
.DA CS.QUIT
|
.DA CS.QUIT
|
||||||
L.MSG.USAGE .DA MSG.USAGE
|
L.MSG.USAGE .DA MSG.USAGE
|
||||||
|
L.MSG.DIR .DA MSG.DIR
|
||||||
|
L.MSG.FILE .DA MSG.FILE
|
||||||
|
L.MSG.OK .DA MSG.OK
|
||||||
|
L.MSG.ERR .DA MSG.ERR
|
||||||
|
L.MSG.E.IARC .DA MSG.E.IARC
|
||||||
|
L.MSG.E.OFS .DA MSG.E.OFS
|
||||||
L.MSG.DEBUG .DA MSG.DEBUG
|
L.MSG.DEBUG .DA MSG.DEBUG
|
||||||
L.MSG.UnpakErr .DA MSG.UnpakErr
|
|
||||||
L.MSG.DEBUG.S3 .DA MSG.DEBUG.S3
|
|
||||||
.DA 0
|
.DA 0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.INIT clc
|
CS.INIT clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN ldy #S.PS.ARGC
|
CS.RUN >LDYAI CHNK.SIZE
|
||||||
lda (pPs),y
|
>SYSCALL getmem
|
||||||
bne CS.RUN.Pak
|
bcs .9
|
||||||
|
>STYA ZPInBufPtr
|
||||||
|
txa
|
||||||
|
>STA.G hInBuf
|
||||||
|
|
||||||
>PUSHBI 0
|
lda #1
|
||||||
|
>SYSCALL Argv
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
jsr CS.RUN.OpenArc
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
>LDYAI 256
|
||||||
|
>SYSCALL getmem
|
||||||
|
bcs .9
|
||||||
|
>STYA ZPFullPathPtr
|
||||||
|
txa
|
||||||
|
>STA.G hFullPath
|
||||||
|
|
||||||
|
lda #2
|
||||||
|
>SYSCALL Argv
|
||||||
|
bcc .1
|
||||||
|
|
||||||
|
ldy #S.PS.hCWD
|
||||||
|
lda (pPS),y
|
||||||
|
>SYSCALL getmemptr
|
||||||
|
|
||||||
|
.1 jsr CS.RUN.SetupPath
|
||||||
|
|
||||||
|
>LDYAI CHNK.SIZE
|
||||||
|
>SYSCALL getmem
|
||||||
|
bcs .9
|
||||||
|
txa
|
||||||
|
>STA.G hOutBuf
|
||||||
|
|
||||||
|
jsr CS.RUN.LOOP
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sec
|
||||||
|
.9 rts
|
||||||
|
|
||||||
|
.99 >PUSHBI 0
|
||||||
>LDYA L.MSG.USAGE
|
>LDYA L.MSG.USAGE
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
lda #E.SYN
|
lda #E.SYN
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.8 sec
|
CS.RUN.SetupPath
|
||||||
.9 rts
|
>STYA ZPPtr1
|
||||||
|
|
||||||
|
ldy #$ff
|
||||||
|
|
||||||
|
.2 iny
|
||||||
|
lda (ZPPtr1),y
|
||||||
|
sta (ZPFullPathPtr),y
|
||||||
|
bne .2
|
||||||
|
|
||||||
.1 >PUSHW.G PAK.Stat+S.PAKSTAT.STORE
|
dey
|
||||||
>PUSHW.G PAK.Stat+S.PAKSTAT.S4
|
lda #'/'
|
||||||
>PUSHW.G PAK.Stat+S.PAKSTAT.S3
|
cmp (ZPFullPathPtr),y
|
||||||
>PUSHW.G PAK.Stat+S.PAKSTAT.REP
|
beq .3
|
||||||
>PUSHW.G PAK.Stat+S.PAKSTAT.BL
|
|
||||||
>PUSHW.G PAK.Stat+S.PAKSTAT.PASS2
|
iny
|
||||||
>PUSHW.G PAK.Stat+S.PAKSTAT.PASS1
|
sta (ZPFullPathPtr),y
|
||||||
>PUSHW.G PAK.FileSize
|
|
||||||
>PUSHBI 16
|
.3 tya
|
||||||
>LDYA L.MSG.DEBUG
|
sec
|
||||||
|
adc ZPFullPathPtr
|
||||||
|
sta ZPRelPathPtr
|
||||||
|
lda #0
|
||||||
|
adc ZPFullPathPtr+1
|
||||||
|
sta ZPRelPathPtr+1
|
||||||
|
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.LOOP jsr CS.RUN.GetByte
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
.10 cmp #CHNK.T.DIR
|
||||||
|
bne .1
|
||||||
|
|
||||||
|
jsr CS.RUN.GetFileName
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
jsr CS.RUN.PrintFN
|
||||||
|
|
||||||
|
jsr CS.RUN.CheckDir
|
||||||
|
bcs .99
|
||||||
|
|
||||||
|
>LDYA L.MSG.OK
|
||||||
|
>SYSCALL puts
|
||||||
|
|
||||||
|
bra CS.RUN.LOOP
|
||||||
|
clc
|
||||||
|
.99 rts
|
||||||
|
|
||||||
|
.9 jmp CS.RUN.E.IARC
|
||||||
|
|
||||||
|
.1 cmp #CHNK.T.FILE
|
||||||
|
bne .9
|
||||||
|
|
||||||
|
jsr CS.RUN.GetFileType
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
jsr CS.RUN.GetFileName
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
ldx #2
|
||||||
|
jsr CS.RUN.PrintFN
|
||||||
|
|
||||||
|
jsr CS.RUN.OpenFile
|
||||||
|
bcs .9
|
||||||
|
*--------------------------------------
|
||||||
|
jsr CS.RUN.GetByte DATA
|
||||||
|
bcs .8 eof
|
||||||
|
|
||||||
|
.2 cmp #CHNK.T.DATA
|
||||||
|
bne .3 Could be a 0 byte file
|
||||||
|
|
||||||
|
.20 jsr CS.RUN.GetByte ALG
|
||||||
|
bcs .9
|
||||||
|
cmp #0 STORE
|
||||||
|
bne .9
|
||||||
|
|
||||||
|
jsr CS.RUN.GetByte ULEN LO
|
||||||
|
bcs .9
|
||||||
|
sta ZPULen
|
||||||
|
|
||||||
|
jsr CS.RUN.GetByte ULEN HI
|
||||||
|
bcs .9
|
||||||
|
sta ZPULen+1
|
||||||
|
|
||||||
|
jsr CS.RUN.ReadData
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
jsr CS.RUN.WriteFile
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
jsr CS.RUN.GetByte
|
||||||
|
bcs .8
|
||||||
|
|
||||||
|
cmp #CHNK.T.DATA
|
||||||
|
beq .20
|
||||||
|
|
||||||
|
.3 pha
|
||||||
|
jsr .8
|
||||||
|
pla
|
||||||
|
|
||||||
|
jmp .10
|
||||||
|
|
||||||
|
.8 >LDA.G hFile
|
||||||
|
>SYSCALL fclose
|
||||||
|
>LDYA L.MSG.OK
|
||||||
|
>SYSCALL puts
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.PrintFN >PUSHW ZPFullPathPtr
|
||||||
|
>PUSHBI 2
|
||||||
|
>LDYA L.MSG.DIR,x
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.OpenArc pha
|
||||||
|
>PUSHWZ Aux type
|
||||||
|
>PUSHBI $CF PAK
|
||||||
|
>PUSHBI O.RDONLY
|
||||||
|
pla
|
||||||
|
>SYSCALL FOpen
|
||||||
|
bcs .9
|
||||||
|
>STA.G hArcFile
|
||||||
|
|
||||||
|
pha
|
||||||
|
>PUSHWI 3
|
||||||
|
>PUSHW ZPInBufPtr
|
||||||
|
pla
|
||||||
|
>SYSCALL fread
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
cpy #3
|
||||||
|
bne .99
|
||||||
|
|
||||||
|
dey
|
||||||
|
|
||||||
|
.1 lda MSG.PAK,y
|
||||||
|
cmp (ZPInBufPtr),y
|
||||||
|
bne .99
|
||||||
|
dey
|
||||||
|
bpl .1
|
||||||
|
|
||||||
|
clc
|
||||||
|
.9 rts
|
||||||
|
|
||||||
|
.99
|
||||||
|
CS.RUN.E.IARC >LDYA L.MSG.E.IARC
|
||||||
|
>SYSCALL puts
|
||||||
|
lda #E.SYN
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.GetFileType
|
||||||
|
>PUSHWI 3
|
||||||
|
>PUSHEA.G FileType
|
||||||
|
>LDA.G hArcFile
|
||||||
|
>SYSCALL fread
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.GetFileName
|
||||||
|
jsr CS.RUN.GetByte
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
tay
|
||||||
|
lda #0
|
||||||
|
|
||||||
|
>PUSHYA
|
||||||
|
>PUSHW ZPRelPathPtr
|
||||||
|
>LDA.G hArcFile
|
||||||
|
>SYSCALL fread
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta (ZPRelPathPtr),y
|
||||||
|
|
||||||
|
* clc
|
||||||
|
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.ReadData >PUSHW ZPULen
|
||||||
|
>PUSHW ZPInBufPtr
|
||||||
|
>LDA.G hArcFile
|
||||||
|
>SYSCALL fread
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.GetByte >LDA.G hArcFile
|
||||||
|
>SYSCALL getc
|
||||||
|
rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.CheckDir >PUSHEA.G STAT
|
||||||
|
>LDYA ZPFullPathPtr
|
||||||
|
>SYSCALL stat
|
||||||
|
bcc .1
|
||||||
|
|
||||||
|
>LDYA ZPFullPathPtr
|
||||||
|
>SYSCALL mkdir
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.1 ldy #STAT+S.STAT.P.TYPE
|
||||||
|
lda (pData),y
|
||||||
|
cmp #$F
|
||||||
|
bne .99
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
.99 lda #MLI.E.INVPATH
|
||||||
|
sec
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.OpenFile >PUSHW.G FileAuxType
|
||||||
|
>PUSHB.G FileType
|
||||||
|
>PUSHBI O.CREATE+O.WRONLY+O.TRUNC
|
||||||
|
>LDYA ZPFullPathPtr
|
||||||
|
>SYSCALL FOpen
|
||||||
|
bcs .9
|
||||||
|
>STA.G hFile
|
||||||
|
.9 rts
|
||||||
|
*--------------------------------------
|
||||||
|
CS.RUN.WriteFile
|
||||||
|
>PUSHW ZPULen
|
||||||
|
>PUSHW ZPInBufPtr
|
||||||
|
>LDA.G hFile
|
||||||
|
>SYSCALL fwrite
|
||||||
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Y,A = Ptr to Shunk Header:
|
* Y,A = Ptr to Shunk Header:
|
||||||
* +0 : Flags
|
* +0 : Flags
|
||||||
* 10000000 : LZ8 encoded, 1 byte (ESC) follow
|
* 10000000 : LZ8 encoded, 1 byte (ESC) follow
|
||||||
* 01000000 : BS
|
* 01000000 : BS
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN.Unpak lda ZPPakHdrPtr
|
CS.RUN.UnpakChnk
|
||||||
|
lda ZPPakHdrPtr
|
||||||
clc
|
clc
|
||||||
adc #S.PAKSTAT
|
adc #S.PAKSTAT
|
||||||
sta ZPPakDataPtr
|
sta ZPPakDataPtr
|
||||||
@ -100,10 +369,7 @@ CS.RUN.Unpak lda ZPPakHdrPtr
|
|||||||
lda #$80
|
lda #$80
|
||||||
sta UNPAK.Mask
|
sta UNPAK.Mask
|
||||||
|
|
||||||
>LDA.G PAK.hFileBuf
|
|
||||||
>SYSCALL GetMemPtr
|
|
||||||
>STYA ZPPakSrcPtr
|
|
||||||
|
|
||||||
stz UNPAK.Ofs
|
stz UNPAK.Ofs
|
||||||
stz UNPAK.Ofs+1
|
stz UNPAK.Ofs+1
|
||||||
|
|
||||||
@ -126,11 +392,11 @@ CS.RUN.Unpak lda ZPPakHdrPtr
|
|||||||
ldx #3
|
ldx #3
|
||||||
jsr CS.RUN.UnpakGetXBitInA
|
jsr CS.RUN.UnpakGetXBitInA
|
||||||
clc
|
clc
|
||||||
adc #S.PAKHDR.SHORT3
|
* adc #S.PAKHDR.SHORT3
|
||||||
tay
|
tay
|
||||||
lda (ZPPakHdrPtr),y
|
lda (ZPPakHdrPtr),y
|
||||||
sta UNPAK.LastByte
|
sta UNPAK.LastByte
|
||||||
jsr DEBUG.S3
|
|
||||||
jsr CS.RUN.UnpakCmpA
|
jsr CS.RUN.UnpakCmpA
|
||||||
bcs .9
|
bcs .9
|
||||||
bra .1
|
bra .1
|
||||||
@ -142,7 +408,7 @@ CS.RUN.Unpak lda ZPPakHdrPtr
|
|||||||
ldx #4
|
ldx #4
|
||||||
jsr CS.RUN.UnpakGetXBitInA
|
jsr CS.RUN.UnpakGetXBitInA
|
||||||
clc
|
clc
|
||||||
adc #S.PAKHDR.SHORT4
|
* adc #S.PAKHDR.SHORT4
|
||||||
tay
|
tay
|
||||||
lda (ZPPakHdrPtr),y
|
lda (ZPPakHdrPtr),y
|
||||||
sta UNPAK.LastByte
|
sta UNPAK.LastByte
|
||||||
@ -205,7 +471,7 @@ CS.RUN.Unpak lda ZPPakHdrPtr
|
|||||||
|
|
||||||
.9 >PUSHW UNPAK.Ofs
|
.9 >PUSHW UNPAK.Ofs
|
||||||
>PUSHBI 2
|
>PUSHBI 2
|
||||||
>LDYA L.MSG.UnpakErr
|
>LDYA L.MSG.ERR
|
||||||
>SYSCALL printf
|
>SYSCALL printf
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
@ -266,44 +532,46 @@ CS.RUN.UnpakCmpA
|
|||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
DEBUG.S3 pha
|
|
||||||
phx
|
|
||||||
phy
|
|
||||||
>PUSHA
|
|
||||||
>PUSHBI 1
|
|
||||||
>LDYA L.MSG.DEBUG.S3
|
|
||||||
>SYSCALL printf
|
|
||||||
ply
|
|
||||||
plx
|
|
||||||
pla
|
|
||||||
rts
|
|
||||||
lda #0
|
|
||||||
sec
|
|
||||||
rts
|
|
||||||
*--------------------------------------
|
|
||||||
CS.DOEVENT sec
|
CS.DOEVENT sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.QUIT >LDA.G PAK.hFileName
|
CS.QUIT >LDA.G hFile
|
||||||
beq .1
|
beq .1
|
||||||
|
|
||||||
>SYSCALL FreeMem
|
>SYSCALL fclose
|
||||||
|
|
||||||
.1 >LDA.G PAK.hFileBuf
|
.1 >LDA.G hFullPath
|
||||||
beq .2
|
beq .2
|
||||||
|
|
||||||
>SYSCALL FreeMem
|
>SYSCALL FreeMem
|
||||||
|
|
||||||
.2 >LDA.G PAK.hOutBuf
|
.2 >LDA.G hOutBuf
|
||||||
beq .8
|
beq .3
|
||||||
|
|
||||||
>SYSCALL FreeMem
|
>SYSCALL FreeMem
|
||||||
|
|
||||||
|
.3 >LDA.G hInBuf
|
||||||
|
beq .4
|
||||||
|
|
||||||
|
>SYSCALL FreeMem
|
||||||
|
|
||||||
|
.4 >LDA.G hArcFile
|
||||||
|
beq .8
|
||||||
|
|
||||||
|
>SYSCALL fclose
|
||||||
|
|
||||||
.8 clc
|
.8 clc
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.END
|
CS.END
|
||||||
MSG.USAGE .AS "Usage : UNPAK Archive [DstDir]\r\n"
|
MSG.USAGE .AZ "Usage : UNPAK Archive [DstDir]\r\n"
|
||||||
|
MSG.DIR .AZ "Creating Dir:%s..."
|
||||||
|
MSG.FILE .AZ "Extracting File:%s..."
|
||||||
|
MSG.OK .AZ "[OK]"
|
||||||
|
MSG.ERR .AZ "[%h]\r\n"
|
||||||
|
MSG.E.IARC .AZ "Invalid/corrupt archive"
|
||||||
|
MSG.E.OFS .AZ "UnPak Error at Offset : %L\r\n"
|
||||||
|
MSG.PAK .AS "PAK"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MSG.DEBUG .AS "Src Length : %D\r\n"
|
MSG.DEBUG .AS "Src Length : %D\r\n"
|
||||||
.AS "Pass #1 : %D\r\n"
|
.AS "Pass #1 : %D\r\n"
|
||||||
@ -313,20 +581,21 @@ MSG.DEBUG .AS "Src Length : %D\r\n"
|
|||||||
.AS "S3 Count : %D\r\n"
|
.AS "S3 Count : %D\r\n"
|
||||||
.AS "S4 Count : %D\r\n"
|
.AS "S4 Count : %D\r\n"
|
||||||
.AZ "STO Count : %D\r\n"
|
.AZ "STO Count : %D\r\n"
|
||||||
MSG.UnpakErr .AZ "UnPak Error at Offset : %H\r\n"
|
|
||||||
MSG.DEBUG.S3 .AZ "S3:%h\r\n"
|
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
.DUMMY
|
.DUMMY
|
||||||
.OR 0
|
.OR 0
|
||||||
DS.START
|
DS.START
|
||||||
PAK.hFileName .BS 1
|
hArcFile .BS 1
|
||||||
PAK.FileSize .BS 2
|
hFullPath .BS 1
|
||||||
PAK.hFileBuf .BS 1
|
hInBuf .BS 1
|
||||||
PAK.hOutBuf .BS 1
|
hOutBuf .BS 1
|
||||||
PAK.Stat .BS S.PAKSTAT
|
hFile .BS 1
|
||||||
|
FileType .BS 1
|
||||||
|
FileAuxType .BS 2
|
||||||
|
STAT .BS S.STAT
|
||||||
DS.END
|
DS.END
|
||||||
.ED
|
.ED
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
MAN
|
MAN
|
||||||
SAVE BIN/UNPAK.S
|
SAVE USR/SRC/BIN/UNPAK.S
|
||||||
ASM
|
ASM
|
||||||
|
@ -2,6 +2,21 @@ NEW
|
|||||||
AUTO 3,1
|
AUTO 3,1
|
||||||
.LIST OFF
|
.LIST OFF
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
|
CHNK.T .EQ 0
|
||||||
|
CHNK.T.DIR .EQ 1
|
||||||
|
CHNK.T.FILE .EQ 2
|
||||||
|
CHNK.T.DATA .EQ 128
|
||||||
|
*
|
||||||
|
CHNK.TYPE .EQ 1 FILE/DIR
|
||||||
|
CHNK.AUXTYPE .EQ 2
|
||||||
|
CHNK.FNLEN .EQ 4
|
||||||
|
*
|
||||||
|
CHNK.ALG .EQ 1 DATA
|
||||||
|
CHNK.ALG.STORE .EQ 0
|
||||||
|
CHNK.ULEN .EQ 2
|
||||||
|
*
|
||||||
|
CHNK.CLEN .EQ 4
|
||||||
|
*--------------------------------------
|
||||||
STOREMAX .EQ 64
|
STOREMAX .EQ 64
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* File Header :
|
* File Header :
|
||||||
|
Loading…
Reference in New Issue
Block a user