Modified 800K SRC disk now bootable, some work in progress...

This commit is contained in:
Rémy GIBERT 2015-08-05 22:38:05 +02:00
parent bc595fee37
commit 3e60ff3064
15 changed files with 1247 additions and 226 deletions

Binary file not shown.

Binary file not shown.

View File

@ -9,14 +9,14 @@ SET ETC=%A2OSX%ETC/
SET LIB=%A2OSX%LIB/
LOAD CONSOLE.DRV
EXEC GETTY KBD CON LOGIN
*LOAD SSC.DRV 9600 N 8 1 X
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 /MNT/A2OSX
*MOUNT TFTP 192.168.1.5:/A2OSX /MNT/A2OSX
*MOUNT CIFS 192.168.1.5:/MSSHARE /MNT/MSSHARE
LOAD DHGR.DRV
LOAD MOUSE.DRV

View File

@ -6,10 +6,11 @@ AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/ASM
.TF /A2OSX.BOOT/BIN/ASM
*---------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/A2OSX.API.I
.INB INC/LIBSTR.I
*---------------------------------------
SYM.BLOCK.SIZE .EQ 4096
@ -19,9 +20,21 @@ ERR.INV.ARGS .EQ 1
ERR.SRC.INV.TYPE .EQ 2
ERR.SRC.TOO.LONG .EQ 3
ERR.SYM.TOO.LARGE .EQ 10
*---------------------------------------
*--------------------------------------
* 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
@ -32,19 +45,20 @@ L.MSG.HELP2 .DA MSG.HELP2
L.MSG.SRCLINE .DA MSG.SRCLINE
L.READ.BUFFER .DA READ.BUFFER
.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
ldx #VAR.INIT.END-VAR.INIT
.1 stz VAR.INIT-1,x
dex
ldy #VAR.INIT
lda #0
.1 sta (pData),y
iny
cpy #VAR.INIT.END
bne .1
ldy #S.PS.hARGS
lda (pPsContext),y
lda (pPs),y
bne CS.INIT.ARGS
>PUSHW L.MSG.HELP1
@ -58,67 +72,37 @@ CS.INIT >LIBLOADP L.LIBSTR
CS.INIT.ARGS >SYSCALL SYS.GetMemPtrA
>STYA ZPQuickPtr1
lda (ZPQuickPtr1)
bne .1
lda #ERR.INV.ARGS
sec
rts
beq .98
.1 ldy #1
lda (ZPQuickPtr1),y
cmp #'/'
bne .2
ldy #S.PS.hARGS
lda (pPsContext),y
lda (pPs),y
>SYSCALL SYS.PStrCpyA
bra CS.INIT.ARGS.OK
bra .3
.2 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
CS.INIT.ARGS.OK sta SRC.hFILENAMES
>SYSCALL SYS.MLIOpenA
bcc CS.INIT.OPEN
sec
rts
CS.INIT.OPEN sta SRC.hREFNUMS
stx SRC.hBUFFERS
inc SRC.COUNT
lda SRC.hFILENAMES
>SYSCALL SYS.MLIGetFileInfoA
.3 jsr SRC.OPEN
bcs .99
>STYA ZPQuickPtr1
ldy #1
lda (ZPQuickPtr1),y
sta SRC.hFILETYPES
cmp #$04 TXT?
bne .1
>PUSHBI $0D
>PUSHBI $FF
>PUSHB SRC.hREFNUMS
>SYSCALL SYS.MLINewLine
bcs .99
.1 cmp #$FA BAS?
bne .98
stz bSTOP
stz bCANCEL
lda (pPsContext)
lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPsContext)
sta (pPs)
clc
rts
.98 lda #ERR.SRC.INV.TYPE
.98 lda #ERR.INV.ARGS
sec
.99 rts
*--------------------------------------
@ -132,7 +116,7 @@ CS.RUN lda bCANCEL
clc
rts
.2 jsr CS.RUN.READLINE
.2 jsr SRC.ReadLine
bcs .9
>PUSHWI TmpBuffer256
@ -141,14 +125,142 @@ CS.RUN lda bCANCEL
>LIBCALL hLIBSTR,LIBSTR.PRINTF
clc
.9 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
sta bCANCEL
bra .8
.1 cmp #$13 Ctrl-S
bne .8
lda bSTOP
eor #$FF
sta bSTOP
.8 clc
rts
.9 sec
rts
*--------------------------------------
CS.QUIT ldy SRC.INDEX
lda (pData),y
bmi .8
.1 clc
adc #SRC.hREFNUMS
tay
lda (pData),y
>SYSCALL SYS.MLICloseA
ldy SRC.INDEX
lda (pData),y
clc
adc #SRC.hBUFFERS
tay
lda (pData),y
>SYSCALL SYS.FreeMemA
ldy SRC.INDEX
lda (pData),y
dec
sta (pData),y
bpl .1
.8 lda hLIBSTR
>SYSCALL SYS.UnloadLibA
clc
rts
*---------------------------------------
CS.RUN.READLINE ldx SRC.COUNT
lda SRC.hFILETYPES-1,x
bmi CS.RUN.READLINE.BIN
jmp CS.RUN.READLINE.TXT
LOAD.ASM.T
clc
rts
*---------------------------------------
CS.RUN.READLINE.BIN >LDYAI 3 LEN + LINENUM
jsr CS.RUN.READLINE.YA
SRC.OPEN sta hFileName
>SYSCALL SYS.MLIOpenA
bcs .99
pha
ldy #SRC.INDEX
lda (pData),y
clc
adc #SRC.hREFNUMS
tay
pla
sta (pData),y
ldy #SRC.INDEX
lda (pData),y
clc
adc #SRC.hBUFFERS
tay
txa
sta (pData),y
lda hFileName
>SYSCALL SYS.MLIGetFileInfoA
bcs .99
>STYA ZPQuickPtr1
ldy #1
lda (ZPQuickPtr1),y
pha
ldy #SRC.INDEX
lda (pData),y
clc
adc #SRC.hFILETYPES
tay
pla
sta (pData),y
cmp #$04 TXT?
bne .1
>PUSHBI $0D
>PUSHBI $FF
>PUSHB SRC.hREFNUMS
>SYSCALL SYS.MLINewLine
bcs .99
.1 cmp #$FA BAS?
bne .98
ldy #SRC.INDEX
lda (pData),y
inc
sta (pData),y
clc
rts
.98 lda #ERR.SRC.INV.TYPE
.99 sec
rts
*---------------------------------------
SRC.ReadLine ldy #SRC.INDEX
lda (pData),y
clc
adc #SRC.hFILETYPES
tay
lda (pData),y
bmi SRC.ReadLine.BIN
jmp SRC.ReadLine.TXT
*---------------------------------------
SRC.ReadLine.BIN >LDYAI 3 LEN + LINENUM
jsr SRC.ReadLine.YA
bcs .9
lda READ.BUFFER+1
@ -164,7 +276,7 @@ CS.RUN.READLINE.BIN >LDYAI 3 LEN + LINENUM
tay
lda #0
jsr CS.RUN.READLINE.YA
jsr SRC.ReadLine.YA
bcs .9
ldy #0
@ -213,79 +325,26 @@ CS.RUN.READLINE.BIN >LDYAI 3 LEN + LINENUM
.8 clc
.9 rts
.99 lda #ERR.SRC.TOO.LONG
sec
rts
*--------------------------------------
CS.RUN.READLINE.TXT >LDYAI 256 newline = $0D
jsr CS.RUN.READLINE.YA
bcs .9
SRC.ReadLine.TXT
clc
.9 rts
rts
*--------------------------------------
CS.RUN.READLINE.YA >PUSHYA
SRC.ReadLine.YA >PUSHYA
>PUSHW L.READ.BUFFER
ldx SRC.COUNT
lda SRC.hREFNUMS-1,x
ldy #SRC.INDEX
lda (pData),y
clc
adc #SRC.hREFNUMS
tay
lda (pData),y
>PUSHA
>SYSCALL SYS.MLIRead
rts
*--------------------------------------
CS.DOEVENT 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 .8
lda bSTOP
eor #$FF
sta bSTOP
.8 >SYSCALL SYS.DestroyEvent
clc
rts
.9 sec
rts
*--------------------------------------
CS.QUIT ldx SRC.COUNT
beq .1
lda SRC.hREFNUMS-1,x
>SYSCALL SYS.MLICloseA
ldx SRC.COUNT
lda SRC.hFILENAMES-1,x
>SYSCALL SYS.FreeMemA
ldx SRC.COUNT
lda SRC.hBUFFERS-1,x
>SYSCALL SYS.FreeMemA
dec SRC.COUNT
bne CS.QUIT
.1 lda hLIBSTR
>SYSCALL SYS.UnloadLibA
clc
rts
*---------------------------------------
LOAD.ASM.T
clc
rts
*---------------------------------------
SYM.ADD
clc
@ -305,6 +364,7 @@ SYM.BLOCK.ALLOC ldx #0
lda #ERR.SYM.TOO.LARGE
sec Out of block error
rts
.2 phx Save next free block
>LDYA SYM.BLOCK.SIZE
>SYSCALL SYS.GetMem
@ -341,41 +401,44 @@ T.DIRECTIVES .AS "AS"
.AS "TF"
.AS "TI"
.AS "US"
T.DIRECTIVES.END .EQ *
*---------------------------------------
LIBSTR >PSTRING "libstr.o"
MSG.HELP1 >CSTRING "A2OS-Macro Assembler (S-C MASM 2.0 Based)\n"
MSG.HELP1 >CSTRING "A2osX-Macro Assembler (S-C MASM 2.0 Based)\n"
MSG.HELP2 >CSTRING "Usage : ASM <src file> [type TXT ($04) or S-C/BAS ($FA)]\n"
MSG.SRCLINE >CSTRING "%05D-%s\n"
*---------------------------------------
hLIBSTR .BS 1
hFileName .BS 1
READ.BUFFER .BS 256
*--------------------------------------
.DUMMY
.OR 0
DS.START
*---------------------------------------
hLIBSTR .BS 1
VAR.INIT
bSTOP .BS 1
bCANCEL .BS 1
*---------------------------------------
VAR.INIT
SRC.COUNT .BS 1
SRC.hFILENAMES .BS 8 Store full path to opened SRC files
SRC.hFILETYPES .BS 8 Store file type of opened SRC files
SRC.INDEX .BS 1
SRC.hREFNUMS .BS 8 Store ref_num of opened files (Main, .INs & .INBs)
SRC.hBUFFERS .BS 8 Store hMem to allocated buffers
SRC.hFILETYPES .BS 8 Store file type of opened SRC files
SRC.LINENUM .BS 2
ASM.T.hFILENAME .BS 1
ASM.T.hFILE .BS 1 handle to loaded ASM.T.xxxxx
DST.hFILENAME .BS 1
DST.hFILE .BS 1
DST.hREFNUM .BS 1
DST.hBUFFER .BS 1
VAR.INIT.END
*---------------------------------------
ASM.T.FILENAME .BS 65 PStr ProDOS Max Path Len +1
TARGET.FILENAME .BS 65 PStr ProDOS Max Path Len +1
TARGET.FILETYPE .BS 1
READ.BUFFER .BS 256
*---------------------------------------
PASS .BS 1
ORIGIN .BS 4 32Bits Origin
ASM.PASS .BS 1
ASM.ORG .BS 4 32Bits Origin
SYM.BLOCKS .BS SYM.BLOCK.MAX
DS.END
DS.END .ED
*---------------------------------------
MAN
SAVE BIN/ASM.S

View File

@ -0,0 +1,198 @@
PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/BIN/EDIT
*--------------------------------------
.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 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
.DA 0
*--------------------------------------
CS.INIT lda #0
ldy #DS.END-DS.START-1
.1 sta (pData),y
dey
bpl .1
lda #12
jsr COUT
ldy #S.PS.hARGS
lda (pPs),y
beq .7
>SYSCALL SYS.GetMemPtrA
>STYA ZPQuickPtr1
lda (ZPQuickPtr1),y
cmp #'/'
bne .10
ldy #S.PS.hARGS
lda (pPs),y
bra .3
.10 ldy #S.PS.hARGS
lda (pPs),y
>PUSHA
ldy #S.PS.hPREFIX
lda (pPs),y
>PUSHA
>SYSCALL SYS.PStrCat
.3 ldy #hFileName
sta (pData),y
>SYSCALL SYS.LoadFileA
bcs .9
bra .8
.7 >PUSHWI 16
>PUSHBI 0
>SYSCALL SYS.GetMem
bcs .9
>LDYAI 0
.8 pha
tya
ldy #FileLen
sta (pData),y
iny
pla
sta (pData),y
txa
ldy #hBuffer
txa
sta (pData),y
lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc
.9 rts
*--------------------------------------
CS.RUN ldy #bCANCEL
lda (pData),y
bne .9
clc
rts
.9 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
.8 clc
rts
.9 sec
rts
*--------------------------------------
CS.QUIT lda #12
jsr COUT
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
*--------------------------------------
.DUMMY
.OR 0
DS.START
bCANCEL .BS 1
hFileName .BS 1
hBuffer .BS 1
FileLen .BS 2
xPos .BS 2
yPos .BS 2
DS.END
.ED
*--------------------------------------
MAN
SAVE BIN/EDIT.S
ASM

View File

@ -54,7 +54,7 @@ CS.INIT >LDYA L.LIBSTR
ldy #S.PS.hARGS
lda (pPs),y
beq .1
beq .1 no arg, go get current prefix
>SYSCALL SYS.GetMemPtrA
>STYA ZPQuickPtr1
@ -62,10 +62,10 @@ CS.INIT >LDYA L.LIBSTR
beq .1
ldy #1
lda (ZPQuickPtr1),y
cmp #'/'
bne .10
cmp #'/' full path starting with '/'?
bne .10 no, append to current prefix
ldy #S.PS.hARGS
ldy #S.PS.hARGS yes, get back arg...
lda (pPs),y
bra .3
@ -82,7 +82,28 @@ CS.INIT >LDYA L.LIBSTR
.1 ldy #S.PS.hPREFIX
lda (pPs),y
.3 >SYSCALL SYS.ListDirInitA
.3 pha
>SYSCALL SYS.CheckPrefixA is it a existing directory?
bcs .4 no, let ListDirInitA extract pattern
pla
pha
>SYSCALL SYS.GetMemPtrA
>STYA ZPQuickPtr1
lda (ZPQuickPtr1)
tay
lda #'/'
cmp (ZPQuickPtr1),y
beq .31
iny
sta (ZPQuickPtr1),y
.31 iny
lda #'*'
sta (ZPQuickPtr1),y
.4 pla
>SYSCALL SYS.ListDirInitA
bcs .9
ldy #hS.LISTDIR
sta (pData),y

0
BIN/NSCSET.S.txt Normal file
View File

View File

@ -0,0 +1,270 @@
PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/BIN/RM
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/A2OSX.API.I
.INB INC/LIBSTR.I
*--------------------------------------
ZPListDirPTR .EQ ZPBIN
*--------------------------------------
* 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.FullPath .DA FullPath
.DA 0
*--------------------------------------
CS.INIT lda #0
ldy #DS.END-DS.START-1
.11 sta (pData),y
dey
bpl .11
ldy #S.PS.hARGS
lda (pPs),y
beq .98
>SYSCALL SYS.GetMemPtrA
>STYA ZPQuickPtr1
lda (ZPQuickPtr1)
beq .98
ldy #1
lda (ZPQuickPtr1),y
cmp #'/'
bne .10
ldy #S.PS.hARGS
lda (pPs),y
bra .3
.10 ldy #S.PS.hARGS
lda (pPs),y
>PUSHA
ldy #S.PS.hPREFIX
lda (pPs),y
>PUSHA
>SYSCALL SYS.PStrCat
sta hDIRPATH
.3 >SYSCALL SYS.ListDirInitA
bcs .99
ldy #hS.LISTDIR
sta (pData),y
lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc
rts
.98 lda #SYSMGR.ERRSYN
.99 sec
rts
*--------------------------------------
CS.RUN ldy #bCANCEL
lda (pData),y
beq .10
sec
rts
.10 ldy #bSTOP
lda (pData),y
beq .1
clc
.99 rts
.1 ldy #hS.LISTDIR
lda (pData),y
>SYSCALL SYS.ListDirNextA
bcs .99
pha
>SYSCALL SYS.GetMemPtrA
>STYA ZPQuickPtr1
lda (ZPQuickPtr1)
pha
and #$0F
sta (ZPQuickPtr1) Adjust Filename len
pla
and #$F0
cmp #$F0 Volume ($F) HEADER ?
beq .8
cmp #$E0 Dir ($E) HEADER ?
beq .8
ldy #hS.LISTDIR
lda (pData),y
>SYSCALL SYS.GetMemPtrA
>STYA ZPQuickPtr2
ldy #S.LISTDIR.hPATH
lda (ZPQuickPtr2),y
>SYSCALL SYS.GetMemPtrA
>STYA ZPQuickPtr2
lda (ZPQuickPtr2)
tax
tay
.2 lda (ZPQuickPtr2),y
sta FullPath,y
dey
bne .2
ldy #0
.3 inx
iny
lda (ZPQuickPtr1),y
sta FullPath,x
tya
cmp (ZPQuickPtr1)
bne .3
stx FullPath
ldy #0
.4 iny
lda FullPath,y
jsr COUT
cpy FullPath
bne .4
>LDYA L.FullPath
>SYSCALL SYS.MLIDestroyYA
bcc .5
pha
lda #"["
jsr COUT
pla
jsr PRBYTE
lda #"]"
jsr COUT
.5 jsr CROUT
.8 pla
>SYSCALL SYS.FreeMemA
clc
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 .8
ldy #bSTOP
lda (pData),y
eor #$FF
sta (pData),y
.8 clc
rts
.9 sec
rts
*--------------------------------------
CS.QUIT ldy #hS.LISTDIR
lda (pData),y
>SYSCALL SYS.ListDirCloseA
ldy #hDIRPATH
lda (pData),y
beq .3
>SYSCALL SYS.FreeMemA
.3 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
FullPath .BS 64
*--------------------------------------
.DUMMY
.OR 0
DS.START
hDIRPATH .BS 1
hS.LISTDIR .BS 1
bSTOP .BS 1
bCANCEL .BS 1
DS.END
.ED
*--------------------------------------
MAN
SAVE BIN/RM.S
ASM

View File

@ -105,7 +105,13 @@ IRQ clc
*--------------------------------------
* PRIVATE
*--------------------------------------
COUT1 cmp #8
COUT1 pha
jsr CUROFF
pla
cmp #32
bcs .80 regular char
cmp #8
bne .2
ldx CH
beq .10
@ -127,9 +133,16 @@ COUT1 cmp #8
jsr SetCharAtXY
rts
.2 cmp #13
.2 cmp #12
bne .3
jmp HOME
.3 cmp #13
beq CROUT
ora INVFLG
rts
.80 ora INVFLG
ldx CH
ldy CV
jsr SetCharAtXY

View File

@ -106,7 +106,6 @@ OPEN sta SETHIRES
txa
bne .81
>DEBUG
clc
rts
*--------------------------------------

View File

@ -6,10 +6,11 @@ AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF DRV/SSC.DRV
.TF /A2OSX.BOOT/DRV/SSC.DRV
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/A2OSX.API.I
*--------------------------------------
BUF.SIZE .EQ $20
BUF.MASK .EQ $1F
@ -52,35 +53,28 @@ SSC.REG.CMD.RIRQDIS .EQ %00000010
SSC.REG.CMD.DTR .EQ %00000001
SSC.REG.CTL .EQ $C08B W
*--------------------------------------
* Main DRV entry point
* input :
* X = CMD
* 0 : OPEN
* 2 : GETEVENT
* 4 : OUT
* 6 : CLOSE
* 8 : GETINFO
* 10 : IRQ
*--------------------------------------
* CLD $D8
* JMP (*,x) $7C
* #JMPTABLE
* /JMPTABLE
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.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
.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 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
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect sta hArgs
>LDYA L.MSG.DETECT
>SYSCALL SYS.SysScrPPSTRYA
stz ZPTmpPtr1
lda #$C1
sta ZPTmpPtr1+1
@ -108,13 +102,43 @@ OPEN stz ZPTmpPtr1
and #$0F
sta DEVSLOT0n
ora #$30
sta DEVNAME+4
sta DEV.HEADER.NAME+4
asl
asl
asl
asl
sta DEVSLOTn0
clc
rts
*--------------------------------------
CS.END
DEVSIG.Offset .HS 05070B0C
DEVSIG.Value .HS 38180131
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
MSG.DETECT >PSTRING "\nApple Super Serial Card Driver."
hArgs .BS 1
*--------------------------------------
* Device Header (16 Bytes)
*--------------------------------------
DEV.HEADER cld
jmp (DRV.CS.START,x)
.DA #S.DEV.F.IRQ+S.DEV.F.EVENT+S.DEV.F.COUT+S.DEV.F.CHAR
DEV.HEADER.NAME >PSTRING "COM1" 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
* ldy #SSC.INIT
* jsr GoCard
ldx DEVSLOTn0
@ -128,11 +152,6 @@ OPEN stz ZPTmpPtr1
stz OUTBUF.PTR
stz OUTBUF.CNT
>PUSHW L.IRQ
>PUSHBI 4
>SYSCALL SYS.MLIAllocIRQ
bcs *
php
sei
ldx DEVSLOTn0
@ -142,25 +161,10 @@ OPEN stz ZPTmpPtr1
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
beq .8
inx
iny
bne .7
lda #S.DEV.F.CHAR+S.DEV.F.OUT+S.DEV.F.EVENT
sta (pDevContext)
.8 clc
rts
*--------------------------------------
GETEVENT >PULLW pEvent
php
GETEVENT php
sei
lda INBUF.CNT
beq .9
@ -195,7 +199,7 @@ GETEVENT >PULLW pEvent
sec
rts
*--------------------------------------
OUT php
COUT php
sei
ldx DEVSLOTn0
@ -295,11 +299,7 @@ GOCARD sta $CFFF Prevent SSC firmware bug
pla
jmp (ZPGoCard)
*--------------------------------------
CS.END
DEVSIG.Offset .HS 05070B0C
DEVSIG.Value .HS 38180131
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
DEVNAME >PSTRING "COM0"
DRV.CS.END
DEVSLOT0n .BS 1
DEVSLOTCn .BS 1
DEVSLOTn0 .BS 1
@ -309,7 +309,7 @@ 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
DEVINFO .DA #S.DEVINFO.TYPE.CHAR
.DA #0
*--------------------------------------
MAN

454
DRV/UTHERNET2.DRV.S.txt Normal file
View File

@ -0,0 +1,454 @@
PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF /A2OSX.BOOT/DRV/UTHERNET2.DRV
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/A2OSX.API.I
.INB INC/KERNEL.I
*--------------------------------------
ZPTmpPTR .EQ ZPDRV
*--------------------------------------
DEVID .EQ $630E
*--------------------------------------
* CS8900A IO Registers
*--------------------------------------
RTDATA .EQ $C080 Receive/Transmit Data (DWORD)
TxCMD .EQ $C084 Transmit Command
TxLength .EQ $C086 Transmission Length
IntStatusQueue .EQ $C088 Interrupt Status Queue
PacketPagePTR .EQ $C08A PacketPage Pointer
PacketPageDATA .EQ $C08C PacketPage Data (DWORD)
*--------------------------------------
TxCMD.LID .EQ %00000000.00001001
TxCMD.TxStart5 .EQ %00000000.00000000 00 = start after 5 Bytes
TxCMD.TxStart381 .EQ %00000000.01000000 01 = start after 381 Bytes
TxCMD.TxStart1021 .EQ %00000000.10000000 10 = start after 1021 Bytes
TxCMD.TxStartFULL .EQ %00000000.11000000 11 = start after ENTIRE Frame
TxCMD.Force .EQ %00000001.00000000
TxCMD.OneColl .EQ %00000010.00000000
TxCMD.InhibitCRC .EQ %00010000.00000000
TxCMD.TxPadDis .EQ %00100000.00000000
*--------------------------------------
* PacketPage Offsets & Masks
*--------------------------------------
PP.ID .EQ $0000 Product ID code (RO)
PP.RFBCNT .EQ $0050 Received Frame Byte Counter (RO)
PP.RxCFG .EQ $0102 Receiver Configuration (RW)
PP.RxCFG.LID .EQ %00000000.00000011
PP.RxCTL .EQ $0104 Receiver Control (RW)
PP.RxCTL.LID .EQ %00000000.00000101
PP.RxCTL.IAHashA .EQ %00000000.01000000
PP.RxCTL.PromisA .EQ %00000000.10000000
PP.RxCTL.RxOKA .EQ %00000001.00000000
PP.RxCTL.MulticastA .EQ %00000010.00000000
PP.RxCTL.IA .EQ %00000100.00000000
PP.RxCTL.BroadcastA .EQ %00001000.00000000
PP.RxCTL.CRCerrorA .EQ %00010000.00000000
PP.RxCTL.RuntA .EQ %00100000.00000000
PP.RxCTL.ExtradataA .EQ %01000000.00000000
PP.TxCFG .EQ $0106 Transmit Configuration (RW)
PP.TxCMD .EQ $0108 Receiver Control (RW)
PP.BufCFG .EQ $010A
PP.LineCTL .EQ $0112 Line Control (RW)
PP.LineCTL.LID .EQ %00000000.00010011
PP.LineCTL.SerRxOn .EQ %00000000.01000000
PP.LineCTL.SerTxOn .EQ %00000000.10000000
PP.LineCTL.AUIonly .EQ %00000001.00000000
PP.LineCTL.Auto .EQ %00000010.00000000
PP.SelfCTL .EQ $0114 Self Control (RW)
PP.SelfCTL.LID .EQ %00000000.00010101
PP.SelfCTL.RESET .EQ %00000000.01000000
PP.SelfCTL.SWSuspnd .EQ %00000000.10000000
PP.SelfCTL.HWSleepE .EQ %00000001.00000000
PP.SelfCTL.HWStndby .EQ %00000010.00000000
PP.BufCTL .EQ $0116
PP.TestCTL .EQ $0118
PP.TestCTL.LID .EQ %00000000.00011001
PP.TestCTL.DisLT .EQ %00000000.10000000
PP.TestCTL.FDX .EQ %01000000.00000000
PP.ISQ .EQ $0120
PP.RxEvent .EQ $0124 Receiver Event (RO)
PP.RxEvent.LID .EQ %00000000.00000100
PP.RxEvent.RxOK .EQ %00000001.00000000
PP.RxEvent.IA .EQ %00000100.00000000
PP.RxEvent.Brdcast .EQ %00001000.00000000
PP.RxEvent.CRCerror .EQ %00010000.00000000
PP.RxEvent.Runt .EQ %00100000.00000000
PP.RxEvent.Xtradata .EQ %01000000.00000000
PP.TxEvent .EQ $0128 Transmitter Event (RO)
PP.TxEvent.LID .EQ %00000000.00001000
PP.BufEvent .EQ $012C
PP.RxMISS .EQ $0130
PP.TxCOL .EQ $0132
PP.LineST .EQ $0134 Line Status (RO)
PP.LineST.LID .EQ %00000000.00010100
PP.LineST.LinkOK .EQ %00000000.10000000
PP.LineST.AUI .EQ %00000001.00000000
PP.LineST.10BT .EQ %00000010.00000000
PP.LineST.PolOK .EQ %00010000.00000000
PP.LineST.CRS .EQ %01000000.00000000
PP.SelfST .EQ $0136 Self Status (RO)
PP.SelfST.INITD .EQ %00000000.10000000
PP.BusST .EQ $0138 Bus Status (RO)
PP.BusST.LID .EQ %00000000.00011000
PP.BusST.TxBidErr .EQ %00000000.10000000
PP.BusST.Rdy4TxNOW .EQ %00000001.00000000
PP.TDR .EQ $013C
PP.MAC .EQ $0158 MAC Address (RW)
PP.RxStatus .EQ $0400
PP.RxLength .EQ $0402
PP.RxFrame .EQ $0404
PP.TxFrame .EQ $0A00
*--------------------------------------
ERRTNOFRAME .EQ 0
ERRNOBUFFER .EQ 1
ERRTIMEOUT .EQ 2
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
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 sta hArgs
>LDYA L.MSG.DETECT
>SYSCALL SYS.SysScrPPSTRYA
ldx #$10
.1 stx DEVSLOTx0
>LDYAI PP.ID
>STYA PacketPagePTR,x
>LDYA PacketPageDATA,x
cpy #DEVID
bne .2
cmp /DEVID
beq .3
.2 inc DEV.HEADER.NAME+4
txa
clc
adc #$10
tax
cpx #$80
bne .1
lda #DEVMGR.ERRNOHW
sec
rts
.3 lda hARGS
beq .4
>SYSCALL SYS.GetMemPtrA
>STYA ZPTmpPTR
jsr DecodeMac
bcc .4
lda #DEVMGR.ERRNICL
sec
rts
.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 II/W5100 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
>STYA PacketPageDATA,x
>LDYAI PP.MAC
>STYA PacketPagePTR,x
>LDYA MAC
>STYA PacketPageDATA,x
>LDYAI PP.MAC+2
>STYA PacketPagePTR,x
>LDYA MAC+2
>STYA PacketPageDATA,x
>LDYAI PP.MAC+4
>STYA PacketPagePTR,x
>LDYA MAC+4
>STYA PacketPageDATA,x
>LDYAI PP.LineCTL
>STYA PacketPagePTR,x
>LDYAI PP.LineCTL.LID+PP.LineCTL.SerRxOn+PP.LineCTL.SerTxOn+PP.LineCTL.Auto
>STYA PacketPageDATA,x
clc
rts
*--------------------------------------
* input :
* pEvent
* output :
* CC no event
* CS event
*--------------------------------------
GETEVENT ldx DEVSLOTx0
>LDYAI PP.RxEvent
>STYA PacketPagePTR,x
>LDYA PacketPageDATA,x
and /PP.RxEvent.RxOK+PP.RxEvent.Brdcast+PP.RxEvent.IA
bne GETEVENT.RxOK
lda #ERRTNOFRAME
sec
rts
GETEVENT.RxOK
and /PP.RxEvent.Brdcast
beq .10
lda #$80
.10 ldy #S.EVT.DATAHI
sta (pEvent),y
>LDYA RTDATA,x discard RxStatus
>LDYA RTDATA,x get RxLength
>STYA FRAMELEN
>PUSHYA
>PUSHBI 0
>SYSCALL SYS.GetMem
bcs .99
>STYA ZPTmpPTR
txa
ldy #S.EVT.DATALO
sta (pEvent),y
ldy #S.EVT.DATAW1
lda FRAMELEN
sta (pEvent),y
iny
lda FRAMELEN+1
sta (pEvent),y
lda #S.EVT.F.NET+S.EVT.F.hMEM1
sta (pEvent)
ldy #0
ldx DEVSLOTx0
.1 lda RTDATA,x
sta (ZPTmpPTR),y
iny
bne .2
inc ZPTmpPTR+1
.2 jsr DecFrameLen
beq .8
lda RTDATA+1,x
sta (ZPTmpPTR),y
iny
bne .3
inc ZPTmpPTR+1
.3 jsr DecFrameLen
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
* PULLW = FRAME LEN
* out:
* CC on success
* CS on error
*--------------------------------------
SEND >PULLW ZPTmpPTR
>PULLW FRAMELEN
ldy #11 Add Src MAC Address
ldx #5
.10 lda MAC,x
sta (ZPTmpPTR),y
dey
dex
bpl .10
ldx DEVSLOTx0
>LDYAI TxCMD.LID+TxCMD.TxStartFULL
>STYA TxCMD,x
>LDYA FRAMELEN
>STYA TxLength,x
>LDYAI PP.BusST
>STYA PacketPagePTR,x
ldy #16
.1 lda PacketPageDATA,x
and #PP.BusST.TxBidErr
bne .9
lda PacketPageDATA+1,x
and /PP.BusST.Rdy4TxNOW
bne SENDPREADY
bra *
lda #0
.2 dec
bne .2
dey
bne .1
bra *
lda #ERRTIMEOUT
sec
rts
.9 bra *
lda #ERRNOBUFFER
sec
rts
SENDPREADY ldy #0
.1 lda (ZPTmpPTR),y
sta RTDATA,x
iny
bne .2
inc ZPTmpPTR+1
.2 jsr DecFrameLen
beq .8
.3 lda (ZPTmpPTR),y
sta RTDATA+1,x
iny
bne .5
inc ZPTmpPTR+1
.5 jsr DecFrameLen
bne .1
.8 clc
rts
*--------------------------------------
* PRIVATE
*--------------------------------------
Reset ldx DEVSLOTx0
>LDYAI PP.SelfCTL
>STYA PacketPagePTR,x
>LDYAI PP.SelfCTL.LID+PP.SelfCTL.RESET
>STYA PacketPageDATA,x
rts
*--------------------------------------
DecFrameLen lda FRAMELEN
bne .1
lda FRAMELEN+1
beq .8
dec FRAMELEN+1
.1 dec FRAMELEN
lda #1 Make something NZ
.8 rts
*--------------------------------------
DRV.CS.END
*--------------------------------------
DEVSLOTx0 .BS 1
FRAMELEN .BS 2
*--------------------------------------
DEVINFO .DA #S.DEVINFO.TYPE.NET
MAC .BS 6
LINK.STATUS .BS 1
LINK.SPEED .BS 1 SPEED/DUPLEX
*--------------------------------------
MAN
SAVE DRV/UTHERNET2.DRV.S
ASM

View File

@ -12,30 +12,28 @@ AUTO 6
.INB INC/A2OSX.I
.INB INC/LIBGFX.I
*--------------------------------------
* 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)
.1 .DA LIB.LOAD
.DA LIB.UNLOAD
*--------------------------------------
.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
*--------------------------------------
LIB.LOAD
LIB.UNLOAD clc
rts
*--------------------------------------
CS.END
MAN
SAVE LIB/LIBGFX.S
ASM

View File

@ -157,12 +157,13 @@ S.LoadFileA jsr S.MLIOpenA
* out :
* A = hMem of Dir Listing
*--------------------------------------
S.ListDirInitA sta R.AL
S.ListDirInitA
* sta R.AL
stz TmpFileName Reset File.Pattern
jsr S.GetMemPtrA
>STYA R.BX Store path
jsr S.CheckPrefixYA is it a existing directory?
bcc .4 yes, continue with empty pattern
* 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
tay
@ -191,19 +192,19 @@ S.ListDirInitA sta R.AL
tya
sta (R.BX) remove pattern from path
.4 >LDYA R.BX
jsr S.NewPStrYA
bcs .99
ldy #S.LISTDIR.hPATH
sta (R.CX),y
>PUSHWI S.LISTDIR.SIZE get LISTDIR Struct
.4 >PUSHWI S.LISTDIR.SIZE get LISTDIR Struct
>PUSHBI S.MEM.F.INIT0 reset all bytes
jsr S.GetMem
bcs .99
stx R.AH
>STYA R.CX Store LISTDIR Struct
>LDYA R.BX
jsr S.NewPStrYA
bcs .99
ldy #S.LISTDIR.hPATH
sta (R.CX),y
ldy TmpFileName
beq .5

View File

@ -380,6 +380,7 @@ S.GetMemByIDA stz ZPMemMgrSPtr+1
* X = hMem
*--------------------------------------
S.GetMemByNameA jsr S.GetMemPtrA
bcs *
S.GetMemByNameYA
>STYA ZPMemMgrTmp1 save BINPATH
>LDYAI MemMgr.Table+S.MEM.SIZE
@ -411,6 +412,9 @@ S.GetMemByNameYA
bne .2
>LDYA ZPMemMgrSPtr
bra *
clc
rts