mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
1081 lines
22 KiB
Plaintext
1081 lines
22 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
Kernel.Init2 sei
|
||
ldx #$FF
|
||
txs
|
||
sta SETALTZP
|
||
|
||
stx A2osX.SaveSM
|
||
stx A2osX.SaveSX
|
||
|
||
ldx #Kernel.ZP.S-1
|
||
.1 lda Kernel.ZP,x
|
||
sta CHARGET,x
|
||
dex
|
||
bpl .1
|
||
|
||
sta CLRALTZP
|
||
>LDYAI MSG.Init2
|
||
jsr PrintFYA
|
||
>LDYAI A2osX.MAIN
|
||
>STYA ZPPtr1
|
||
>LDYAI CORE.Run
|
||
>STYA ZPPtr2
|
||
>LDYAI A2osX.MAIN.S^$FFFF
|
||
|
||
jsr Kernel.Move
|
||
|
||
>LDYAI A2osX.AUX
|
||
>STYA A1L Src Start Address (MAIN)
|
||
>LDYAI A2osX.GP
|
||
>STYA A2L Src End Address (MAIN)
|
||
>LDYAI X.OSD
|
||
>STYA A4L Dst Address (AUX)
|
||
sec Main To Aux
|
||
jsr AuxMove
|
||
>LDYAI A2osX.GP
|
||
>STYA ZPPtr1
|
||
>LDYAI A2osX.SYSCALL
|
||
>STYA ZPPtr2
|
||
>LDYAI A2osX.GP.S^$FFFF
|
||
|
||
jsr Kernel.Move
|
||
>LDYAI A2osX.GPX
|
||
>STYA A1L Src Start Address (MAIN)
|
||
>LDYAI A2osX.D1
|
||
>STYA A2L Src End Address (MAIN)
|
||
>LDYAI A2osX.SYSCALL
|
||
>STYA A4L Dst Address (AUX)
|
||
sec Main To Aux
|
||
jsr AuxMove
|
||
|
||
sta SETALTZP
|
||
bit RRAMWRAMBNK2
|
||
bit RRAMWRAMBNK2
|
||
|
||
>LDYAI A2osX.D2
|
||
>STYA ZPPtr1
|
||
>LDYAI $D000
|
||
>STYA ZPPtr2
|
||
>LDYAI A2osX.D2.S^$FFFF
|
||
|
||
jsr Kernel.Move
|
||
bit RRAMWRAMBNK1
|
||
bit RRAMWRAMBNK1
|
||
|
||
>LDYAI A2osX.D1
|
||
>STYA ZPPtr1
|
||
>LDYAI $D000
|
||
>STYA ZPPtr2
|
||
>LDYAI A2osX.D1.S^$FFFF
|
||
|
||
jsr Kernel.Move
|
||
>LDYAI A2osX.E0
|
||
>STYA ZPPtr1
|
||
>LDYAI $E000
|
||
>STYA ZPPtr2
|
||
>LDYAI A2osX.E0.S^$FFFF
|
||
|
||
jsr Kernel.Move
|
||
bit RROMBNK1
|
||
sta CLRALTZP
|
||
cli
|
||
jsr KConfigLoad
|
||
lda A2osX.HZ
|
||
pha
|
||
>LDYAI MSG.HZ
|
||
jsr PrintFYA
|
||
>LDYAI MSG.Init2.OK
|
||
jsr PrintFYA
|
||
*--------------------------------------
|
||
>DEBUGOA
|
||
*--------------------------------------
|
||
Kernel.Init3 sta SETALTZP
|
||
bit RRAMWRAMBNK1
|
||
bit RRAMWRAMBNK1
|
||
lda #$ff Make sure we are in Kernel Mode during setup
|
||
sta IRQ.InKernel
|
||
stz IRQ.InLib
|
||
|
||
sta SETALTCHAR
|
||
sta CLRMIXED
|
||
sta CLRHIRES
|
||
sta SET80STORE
|
||
sta CLRPAGE2
|
||
sta SETDHIRES
|
||
|
||
jsr MemMgrInit
|
||
|
||
>LDYAI S.PS Select Process 0 (Kernel)
|
||
jsr K.GetMem0
|
||
>STYA pPs
|
||
stx PS.Table.hPS
|
||
|
||
jsr Mem.SetOwner
|
||
lda #1
|
||
sta CORE.PSCount
|
||
>LDYAI K.STACKTOP
|
||
>STYA pStack
|
||
sta pLocal+1
|
||
|
||
>PUSHWI FD.NULL.NAME
|
||
>LDYAI FD.NULL
|
||
>SYSCALL2 MKDev
|
||
|
||
jsr SysScrInit
|
||
bcs *
|
||
>PUSHWZ Aux type
|
||
>PUSHBI S.FI.T.TXT
|
||
>PUSHBI O.RDWR
|
||
>LDYAI DEV.CONSOLE
|
||
>SYSCALL2 fopen
|
||
bcs *
|
||
|
||
ldy #S.PS.hStdIn
|
||
sta (pPs),y
|
||
iny #S.PS.hStdOut
|
||
sta (pPs),y
|
||
iny #S.PS.hStdErr
|
||
sta (pPs),y
|
||
*--------------------------------------
|
||
Kernel.Init3C >LDYAI MSG.Init3
|
||
>SYSCALL2 puts
|
||
|
||
jsr CPU.Init.6502
|
||
|
||
jsr CPU.Init.Z80
|
||
|
||
jsr DevMgrInit
|
||
|
||
jsr IrqMgrInit
|
||
bcs *
|
||
|
||
jsr EvtMgrInit
|
||
|
||
jsr TskMgrInit
|
||
bcs *
|
||
|
||
jsr PwdMgrInit
|
||
|
||
lda KBD
|
||
bpl .7
|
||
sta KBDSTROBE
|
||
cmp #146 CTRL-R for ROOT mode
|
||
bne .7
|
||
>PUSHBI 0
|
||
>LDYAI MSG.CTRLR
|
||
>SYSCALL2 printf
|
||
>PUSHBI 0 PS Flags
|
||
>LDYAI CTRLR.SHELL
|
||
bra .8
|
||
.7 >PUSHWI ETCINIT.CMDLINE
|
||
>PUSHBI 2
|
||
>LDYAI MSG.EtcInit
|
||
>SYSCALL2 printf
|
||
|
||
>PUSHBI 0 PS Flags
|
||
>LDYAI ETCINIT.CMDLINE
|
||
.8 >SYSCALL2 ExecL
|
||
bcs Kernel.Init3.Err
|
||
>PUSHBI 0
|
||
>LDYAI MSG.Init3.OK
|
||
>SYSCALL2 printf
|
||
>DEBUGOA
|
||
|
||
jmp CORE.Run
|
||
Kernel.Init3.Err
|
||
>PUSHA
|
||
>PUSHBI 1
|
||
>LDYAI MSG.StartupErr
|
||
>SYSCALL2 printf
|
||
bra * No need to discard Expanded CMDLINE
|
||
*--------------------------------------
|
||
* INIT2 Subs
|
||
*--------------------------------------
|
||
Kernel.Move >STYA ZPPtr3
|
||
|
||
ldy #0
|
||
|
||
.1 inc ZPPtr3
|
||
bne .2
|
||
inc ZPPtr3+1
|
||
beq .9
|
||
|
||
.2 lda (ZPPtr1),y
|
||
sta (ZPPtr2),y
|
||
iny
|
||
bne .1
|
||
inc ZPPtr1+1
|
||
inc ZPPtr2+1
|
||
bne .1
|
||
.9 rts
|
||
*--------------------------------------
|
||
KConfigLoad >LDYAI MSG.KCREAD
|
||
jsr PrintFYA
|
||
|
||
jsr MLI
|
||
.DA #MLIOPEN
|
||
.DA MLIOPEN00
|
||
bcs .9
|
||
|
||
lda MLIOPEN00+5
|
||
sta MLIREAD00+1
|
||
sta MLICLOSE00+1
|
||
jsr MLI
|
||
.DA #MLIREAD
|
||
.DA MLIREAD00
|
||
php
|
||
pha
|
||
jsr MLI
|
||
.DA #MLICLOSE
|
||
.DA MLICLOSE00
|
||
pla
|
||
plp
|
||
bcs .9
|
||
>LDYAI MSG.KCREAD.OK
|
||
jsr PrintFYA
|
||
rts
|
||
.9 >LDYAI MSG.KCREAD.KO
|
||
jsr PrintFYA
|
||
rts
|
||
*--------------------------------------
|
||
* INIT3 Subs
|
||
*--------------------------------------
|
||
MemMgrInit >LDYAI Mem.MHiMem
|
||
>STYA Mem.HiMem
|
||
>STYA Mem.Free
|
||
>LDYAI Mem.MLoMem
|
||
>STYA Mem.LoMem
|
||
stz Mem.LastSlot Reserve Slot #0
|
||
|
||
sta SETWRITEAUX
|
||
|
||
>LDYAI Mem.XLoMem
|
||
>STYA Mem.LoMem
|
||
|
||
stz Mem.LastSlot Reserve Slot #0
|
||
sta CLRWRITEAUX
|
||
|
||
ldx #K.DEV.MAX*2-1
|
||
.1 stz Dev.Table,x
|
||
dex
|
||
bpl .1
|
||
ldx #K.FLT.MAX*2-1
|
||
.11 stz Flt.Table.hPath,x
|
||
dex
|
||
bpl .11
|
||
|
||
ldx #K.NOD.MAX*2-1
|
||
.2 stz Nod.Table.hPath,x
|
||
dex
|
||
bpl .2
|
||
ldx #K.PS.MAX*4-1
|
||
.3 stz PS.Table.PID,x
|
||
dex
|
||
bpl .3
|
||
ldx #K.OF.MAX*2-1
|
||
.4 stz OF.Table.hPath,x
|
||
dex
|
||
bpl .4
|
||
|
||
ldx #K.EVT.MAX*S.EVT-1
|
||
.5 stz Evt.Table,x
|
||
dex
|
||
bpl .5
|
||
ldx #K.USR.MAX*2-1
|
||
.6 stz S.Table.hSession,x
|
||
dex
|
||
bpl .6
|
||
rts
|
||
*--------------------------------------
|
||
SysScrInit >LDYAI Mem.XHiMem
|
||
>STYA FD.TTY+S.FD.DEV.BUFPTR
|
||
|
||
jsr SysScrInit.TTYPtrs
|
||
|
||
>PUSHWI FD.CONSOLE.NAME
|
||
>LDYAI FD.TTY
|
||
>SYSCALL2 MKDev
|
||
bcs .9
|
||
ldx A2osX.TTYDEVS
|
||
.1 phx
|
||
inc FD.TTY+S.FD.DEV.DEVID
|
||
inc FD.TTY.NAME+3
|
||
jsr SysScrInit.TTYPtrs
|
||
>PUSHWI FD.TTY.NAME
|
||
>LDYAI FD.TTY
|
||
>SYSCALL2 MKDev
|
||
plx
|
||
bcs .9
|
||
dex
|
||
bne .1
|
||
>LDYA FD.TTY+S.FD.DEV.BUFPTR
|
||
sta SETWRITEAUX
|
||
>STYA Mem.HiMem
|
||
>STYA Mem.Free
|
||
sta CLRWRITEAUX
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
SysScrInit.TTYPtrs
|
||
lda DevMgr.Free
|
||
sta FD.TTY+S.FD.DEV.DCBPTR
|
||
sta .1+1
|
||
clc
|
||
adc #S.DCB.TTY
|
||
sta DevMgr.Free
|
||
|
||
lda DevMgr.Free+1
|
||
sta FD.TTY+S.FD.DEV.DCBPTR+1
|
||
sta .1+2
|
||
|
||
adc /S.DCB.TTY
|
||
sta DevMgr.Free+1
|
||
ldx #S.DCB.TTY-1
|
||
.1 stz $ffff,x SELF MODIFIED
|
||
dex
|
||
bpl .1
|
||
lda FD.TTY+S.FD.DEV.BUFPTR
|
||
sec
|
||
sbc #TTY.BUF.SIZE
|
||
sta FD.TTY+S.FD.DEV.BUFPTR
|
||
|
||
lda FD.TTY+S.FD.DEV.BUFPTR+1
|
||
sbc /TTY.BUF.SIZE
|
||
sta FD.TTY+S.FD.DEV.BUFPTR+1
|
||
rts
|
||
*--------------------------------------
|
||
CPU.Init.6502 >PUSHBI 0
|
||
>LDYAI MSG.CPU
|
||
>SYSCALL2 printf
|
||
jsr Detect6502 A = CPU type
|
||
sta A2osX.CPUTYPE
|
||
and #$F
|
||
asl
|
||
tax
|
||
ldy MSG.CPUTYPE,x
|
||
lda MSG.CPUTYPE+1,x
|
||
>SYSCALL2 puts
|
||
|
||
lda MACHID
|
||
and #MACHID.T
|
||
cmp #MACHID.T.IIc
|
||
bne .10
|
||
|
||
jmp CPU.Init.Z80
|
||
.10 >PUSHBI 0
|
||
>LDYAI MSG.CPU.SPEED
|
||
>SYSCALL2 printf
|
||
|
||
stz A2osX.RANDOM16
|
||
stz A2osX.RANDOM16+1
|
||
php
|
||
sei
|
||
.1 bit VBL
|
||
bpl .2
|
||
|
||
.2 bit VBL
|
||
bmi .2
|
||
|
||
ldx #0 Count LO
|
||
lda #0 Count HI
|
||
.3 ldy #3 (2)
|
||
.4 nop (2)
|
||
dey (2)
|
||
bne .4 (2*)
|
||
inc A2osX.RANDOM16 (6)
|
||
bne .5 (2*)
|
||
inc A2osX.RANDOM16+1 (6)
|
||
bit VBL (4)
|
||
bpl .3 (2*)
|
||
bmi .6
|
||
.5 nop (2)
|
||
nop (2)
|
||
nop (2)
|
||
bit VBL (4)
|
||
bpl .3 (2*)
|
||
.6 plp
|
||
|
||
stz A2osX.CPUSPEED
|
||
.7 sec
|
||
lda A2osX.RANDOM16
|
||
sbc #100
|
||
tax
|
||
lda A2osX.RANDOM16+1
|
||
sbc /100
|
||
bcc .8
|
||
stx A2osX.RANDOM16
|
||
sta A2osX.RANDOM16+1
|
||
inc A2osX.CPUSPEED
|
||
bra .7
|
||
|
||
.8 lda A2osX.RANDOM16
|
||
sta A2osX.CPUSPEED+1
|
||
>PUSHA push CPU speed LO
|
||
lda A2osX.CPUSPEED
|
||
>PUSHA push CPU speed HI
|
||
>PUSHBI 2
|
||
>LDYAI MSG.CPU.SPEEDOK
|
||
>SYSCALL2 printf
|
||
rts
|
||
*--------------------------------------
|
||
CPU.Init.Z80 >PUSHBI 0
|
||
>LDYAI MSG.Z80
|
||
>SYSCALL2 printf
|
||
jsr DetectZ80
|
||
bcs .9
|
||
sta A2osX.Z80SLOT
|
||
>PUSHA
|
||
tax
|
||
lda #A2osX.S.Z80
|
||
sta A2osX.S,x
|
||
>PUSHBI 1
|
||
>LDYAI MSG.Z80.OK
|
||
>SYSCALL2 printf
|
||
rts
|
||
.9 >LDYAI MSG.Z80.KO
|
||
>SYSCALL2 puts
|
||
rts
|
||
*--------------------------------------
|
||
* Out:
|
||
* A = $60, 6502
|
||
* A = $61, 65C02
|
||
* A = $62, 65R02
|
||
* A = $63, 65816
|
||
*--------------------------------------
|
||
Detect6502 ldy #0 Test 6502 BCD bug
|
||
sed
|
||
lda #$99
|
||
clc
|
||
adc #$01
|
||
cld
|
||
bmi .9 BUG!, we have 6502
|
||
|
||
ldy #3 test 65C816 TYX Instruction
|
||
ldx #0
|
||
.OP 65816
|
||
tyx TYX: if 65C816, x becomes non-zero
|
||
.OP 65C02
|
||
bne .9 worked! 65C816
|
||
|
||
dey y=2 -> R65C02
|
||
ldx $EA save zp $EA
|
||
stz $EA store 0 in $EA
|
||
* .OP 65R02
|
||
.HS F7EA For compatibility with A2osX.ASM
|
||
* smb 7,$EA if not Rockwell, assemble as nop nop
|
||
* .OP 65C02
|
||
asl $EA cs if Rockwell
|
||
stx $EA restore zp $EA
|
||
bcs .9
|
||
dey y=1 -> 65C02
|
||
.9 tya
|
||
ora #$60
|
||
rts
|
||
*--------------------------------------
|
||
* Out:
|
||
* A = Z80 Slot
|
||
*--------------------------------------
|
||
DetectZ80 ldx #Z80Code.Size
|
||
.1 lda Z80Code.Start-1,x
|
||
sta Z80CODE-1,x 00000H for Z80
|
||
dex
|
||
bne .1
|
||
stz ZPPtr1
|
||
lda #$C1
|
||
sta ZPPtr1+1
|
||
.2 sta (ZPPtr1)
|
||
lda $100D
|
||
bmi .8
|
||
inc ZPPtr1+1
|
||
lda ZPPtr1+1
|
||
cmp #$C8
|
||
beq .9 CS
|
||
clc
|
||
adc #$20
|
||
sta $100A
|
||
bra .2
|
||
.8 lda ZPPtr1+1
|
||
and #$0F
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
DevMgrInit >LDYAI MSG.DEV
|
||
>SYSCALL2 puts
|
||
lda DEVCNT
|
||
sta .1+1
|
||
.1 ldx #$ff SELF MODIFIED
|
||
lda DEVLST,x
|
||
and #$F0
|
||
asl
|
||
php Save Drive 1/2 in C
|
||
ror DSSS0000
|
||
lsr
|
||
lsr
|
||
lsr
|
||
|
||
tax 000DSSS0
|
||
lsr 0000DSSS
|
||
and #$7
|
||
sta FD.BDEV+S.FD.DEV.BUSID
|
||
ora #$30
|
||
sta FD.BDEV.NAME+1 SnDy
|
||
lda DEVPTRS,x
|
||
sta FD.BDEV+S.FD.DEV.BUSPTR
|
||
lda DEVPTRS+1,x
|
||
sta FD.BDEV+S.FD.DEV.BUSPTR+1
|
||
sta ZPPtr1+1
|
||
stz ZPPtr1 Cn00
|
||
plp
|
||
lda #0
|
||
adc #1 Make DevID 1 or 2
|
||
sta FD.BDEV+S.FD.DEV.DEVID
|
||
ora #$30
|
||
sta FD.BDEV.NAME+3 SxDn
|
||
lda ZPPtr1+1
|
||
|
||
cmp #$FF /RAM is always $FF00
|
||
bne .2
|
||
|
||
jsr DevMgrInit.RAM
|
||
bra .8 keep slot free
|
||
.2 cmp #$D0 Disk II Driver is $D000
|
||
bne .3
|
||
jsr DevMgrInit.DII
|
||
lda #A2osX.S.DII
|
||
bra .7 Go mark slot as USED
|
||
.3 bcs .53 > $D0, Some BLK remapped DRV
|
||
cmp #$C0
|
||
bcs .4 $C0 .. $CF, in slot ROM
|
||
jsr DevMgrInit.USR Outside ROM/LC space, User loaded BLK dev
|
||
bra .8 keep slot free
|
||
.4 ldx #SmartPort.SIG-SmartPort.OFS-1
|
||
|
||
.5 ldy SmartPort.OFS,x Check if there is a smartport firmware
|
||
lda (ZPPtr1),y
|
||
cmp SmartPort.SIG,x
|
||
bne .8 not a Disk Controller...
|
||
dex
|
||
bpl .5
|
||
ldy #7
|
||
lda (ZPPtr1),y
|
||
beq .51 $Cn07=00 : SmartPort
|
||
ldx #AWSmartPort.SIG-AWSmartPort.OFS-1
|
||
.50 ldy AWSmartPort.OFS,x Check if there is AWsmartport firmware
|
||
lda (ZPPtr1),y
|
||
cmp AWSmartPort.SIG,x
|
||
bne .6 not on AW
|
||
dex
|
||
bpl .50
|
||
|
||
.51 lda ZPPtr1+1 get $Cn
|
||
and #$f get $0n
|
||
cmp FD.BDEV+S.FD.DEV.BUSID same as SSS ?
|
||
beq .52
|
||
inc FD.BDEV+S.FD.DEV.DEVID Remapped SP devices....
|
||
inc FD.BDEV+S.FD.DEV.DEVID Add 2 to DEVID (2 & 3)
|
||
jsr DevMgrInit.SP
|
||
bra .8 Phantom slot...
|
||
.52 jsr DevMgrInit.SP
|
||
lda #A2osX.S.SP
|
||
bra .7
|
||
|
||
.53 inc FD.BDEV+S.FD.DEV.DEVID Remapped BLK devices....
|
||
inc FD.BDEV+S.FD.DEV.DEVID Add 2 to DEVID (2 & 3)
|
||
|
||
.6 jsr DevMgrInit.BLK
|
||
lda #A2osX.S.BLK
|
||
.7 ldx FD.BDEV+S.FD.DEV.BUSID
|
||
sta A2osX.S,x
|
||
.8 dec .1+1
|
||
bmi .80
|
||
jmp .1
|
||
.80 clc
|
||
rts
|
||
*--------------------------------------
|
||
DevMgrInit.RAM ldx #0
|
||
>LDYAI DRV.RamDrive
|
||
bra DevMgrInit.AddBDev
|
||
*--------------------------------------
|
||
DevMgrInit.DII ldx #2
|
||
>LDYAI DRV.DiskII
|
||
bra DevMgrInit.AddBDev
|
||
*--------------------------------------
|
||
DevMgrInit.USR ldx #4
|
||
>LDYAI DRV.BlkDevice
|
||
bra DevMgrInit.AddBDev
|
||
*--------------------------------------
|
||
DevMgrInit.BLK ldy #$ff
|
||
lda (ZPPtr1),y
|
||
sta FD.BDEV+S.FD.DEV.BUSPTR
|
||
ldx #6
|
||
>LDYAI DRV.BlkDevice
|
||
bra DevMgrInit.AddBDev
|
||
*--------------------------------------
|
||
DevMgrInit.SP ldy #$ff
|
||
lda (ZPPtr1),y
|
||
clc
|
||
adc #3 Compute smartport entry point
|
||
sta FD.BDEV+S.FD.DEV.BUSPTR
|
||
ldx #8
|
||
>LDYAI DRV.SmartPort
|
||
*--------------------------------------
|
||
DevMgrInit.AddBDev
|
||
>STYA FD.BDEV+S.FD.DEV.DRVPTR
|
||
>PUSHW MSG.BLKDEV.TBL,x
|
||
>PUSHWI FD.BDEV.NAME
|
||
>PUSHBI 4
|
||
>LDYAI MSG.BLKDEV
|
||
>SYSCALL2 printf
|
||
>PUSHWI FD.BDEV.NAME
|
||
>LDYAI FD.BDEV
|
||
>SYSCALL2 MKDev
|
||
|
||
DevMgrInit.AddBDev.RTS
|
||
rts
|
||
*--------------------------------------
|
||
* Setup AuxLC $FFFE->Kernel IRQ Handler
|
||
* if irq not handled, jmp (S.IrqMgrOldFFFE)
|
||
*--------------------------------------
|
||
IrqMgrInit >LDYAI MSG.IRQ
|
||
>SYSCALL2 puts
|
||
php
|
||
sei
|
||
>LDYA $FFFE
|
||
>STYA K.IrqHAuxLC.JMP+1
|
||
>LDYAI K.IrqHAuxLC
|
||
>STYA $FFFE
|
||
|
||
>LDYAI GP.IrqH
|
||
>STYA K.MLI.PARAMS+2
|
||
|
||
>MLICALL MLIALLOCIRQ
|
||
bcs .90
|
||
lda K.MLI.PARAMS+1
|
||
sta IRQ.INTNUM
|
||
|
||
plp
|
||
jsr IrqMgrInit.TClock
|
||
bcs .1
|
||
lda #"C"
|
||
sta IRQ.Mode
|
||
>LDYAI K.IrqH.TCLOCK
|
||
>STYA K.IrqHAuxLC.JSR+1
|
||
>STYA GP.IrqH.JSR+1
|
||
>LDYAI MSG.IRQ.CLOCK
|
||
>SYSCALL2 puts
|
||
clc
|
||
rts
|
||
|
||
.1 jsr IrqMgrInit.Mouse
|
||
bcs .8
|
||
lda #"V"
|
||
sta IRQ.Mode
|
||
>LDYAI K.IrqH.VBL
|
||
>STYA K.IrqHAuxLC.JSR+1
|
||
>STYA GP.IrqH.JSR+1
|
||
>LDYAI MSG.IRQ.VBL
|
||
>SYSCALL2 puts
|
||
clc
|
||
rts
|
||
.8 jsr IrqMgrInit.HZ2Tick
|
||
|
||
lda #"P"
|
||
sta IRQ.Mode
|
||
>LDYAI MSG.IRQ.POLL
|
||
>SYSCALL2 puts
|
||
clc
|
||
rts
|
||
|
||
.90 plp
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
IrqMgrInit.TClock
|
||
stz ZPPtr1 Try finding a TClock Card...
|
||
lda #$C1
|
||
sta ZPPtr1+1
|
||
.1 ldy #TClock.SIG.Cnt-1
|
||
|
||
.2 lda (ZPPtr1),y
|
||
cmp TClock.SIG,y
|
||
bne .3
|
||
dey
|
||
bpl .2
|
||
bra .4
|
||
.3 inc ZPPtr1+1 no match, try next slot....
|
||
lda ZPPtr1+1
|
||
cmp #$C8
|
||
bne .1
|
||
sec
|
||
rts
|
||
|
||
.4 lda ZPPtr1+1 get $Cn
|
||
and #$f
|
||
tax get $0n
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
tay get $n0
|
||
sty IRQ.VBL.n0
|
||
lda #A2osX.S.CLK
|
||
sta A2osX.S,x
|
||
php
|
||
sei
|
||
lda #$40+$20 Enable interrupt + 64Hz
|
||
sta $c080,y
|
||
lda #$40
|
||
sta CLRPAGE2
|
||
sta $478,x
|
||
sta $7f8,x
|
||
|
||
lda #64
|
||
sta CORE.TickPerSec
|
||
sta CORE.TickSec
|
||
lda #11
|
||
sta CORE.TickPer10t
|
||
sta CORE.Tick10t
|
||
dec CORE.IRQMode
|
||
plp
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
IrqMgrInit.Mouse
|
||
stz ZPPtr1 Try finding a Mouse Card...
|
||
lda #$C1
|
||
sta ZPPtr1+1
|
||
.1 ldx #Mouse.SIG-Mouse.OFS-1
|
||
|
||
.2 ldy Mouse.OFS,x
|
||
lda (ZPPtr1),y
|
||
cmp Mouse.SIG,x
|
||
bne .3
|
||
dex
|
||
bpl .2
|
||
bra .4
|
||
.3 inc ZPPtr1+1 no match, try next slot....
|
||
lda ZPPtr1+1
|
||
cmp #$C8
|
||
bne .1
|
||
|
||
sec
|
||
rts
|
||
.4 lda ZPPtr1+1
|
||
|
||
sta .11+2
|
||
sta K.IrqH.VBL.MSM+2
|
||
sta K.IrqH.VBL.MRM+2
|
||
and #$0f
|
||
sta IRQ.VBL.0n
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
|
||
sta IRQ.VBL.n0
|
||
|
||
php
|
||
sei
|
||
bit RROMBNK2 Renable ROM to allow MOUSE II firmware works properly
|
||
ldy #INITMOUSE
|
||
jsr .10
|
||
ldy #SETMOUSE
|
||
lda #MOUSEMODx.INTVBL+MOUSEMODx.ACTIVE
|
||
jsr .10
|
||
|
||
bit RRAMWRAMBNK1 Back To LC Ram
|
||
bit RRAMWRAMBNK1
|
||
ldy #SERVEMOUSE
|
||
lda (ZPPtr1),y
|
||
sta K.IrqH.VBL.MSM+1
|
||
|
||
ldy #READMOUSE
|
||
lda (ZPPtr1),y
|
||
sta K.IrqH.VBL.MRM+1
|
||
|
||
jsr IrqMgrInit.HZ2Tick
|
||
dec CORE.IRQMode
|
||
plp
|
||
clc
|
||
rts
|
||
.9 plp
|
||
sec
|
||
rts
|
||
|
||
.10 pha
|
||
lda (ZPPtr1),y
|
||
sta .11+1
|
||
pla
|
||
ldx .11+2 Cn
|
||
ldy IRQ.VBL.n0
|
||
|
||
.11 jmp $ffff SELF MODIFIED
|
||
*--------------------------------------
|
||
IrqMgrInit.HZ2Tick
|
||
ldx #50
|
||
lda A2osX.HZ
|
||
sta CORE.TickPer10t
|
||
sta CORE.Tick10t
|
||
cmp #5
|
||
beq .1
|
||
ldx #60
|
||
.1 stx CORE.TickPerSec
|
||
stx CORE.TickSec
|
||
|
||
rts
|
||
*--------------------------------------
|
||
EvtMgrInit >LDYAI MSG.EVT
|
||
>SYSCALL2 puts
|
||
stz CORE.EvtCount
|
||
lda #$A5
|
||
sta A2osX.TIMER16
|
||
lda #$9B
|
||
sta A2osX.TIMER16+1
|
||
|
||
lda /Evt.Table
|
||
sta pEvent+1
|
||
clc
|
||
EvtMgrInit.RTS rts
|
||
*--------------------------------------
|
||
TskMgrInit >LDYAI MSG.TSK
|
||
>SYSCALL2 puts
|
||
|
||
>LDYAI K.ENV.SIZE get a buffer for ENV
|
||
jsr K.GetMem
|
||
bcs EvtMgrInit.RTS
|
||
>STYA ZPPtr1
|
||
ldy #S.PS.ENVPAGECNT
|
||
lda /K.ENV.SIZE
|
||
sta (pPs),y
|
||
|
||
txa
|
||
* ldy #S.PS.hENV
|
||
iny
|
||
sta (pPs),y
|
||
lda #0
|
||
sta (ZPPtr1) make sure blank!!
|
||
|
||
>LDYAI $2E0 Get ROOT from QC
|
||
>SYSCALL2 strdup
|
||
bcs .9
|
||
txa
|
||
ldy #S.PS.hCWD
|
||
sta (pPs),y
|
||
>PUSHWI $2C0 Get BOOT from QC
|
||
>LDYAI I.ENV.BOOT
|
||
>SYSCALL2 SetEnv
|
||
bcs .9
|
||
|
||
>PUSHWI $2E0 Get ROOT from QC
|
||
>LDYAI I.ENV.ROOT
|
||
>SYSCALL2 SetEnv
|
||
bcs .9
|
||
|
||
>LDYAI I.ENV.PATH
|
||
>SYSCALL2 PutEnv
|
||
bcs .9
|
||
|
||
>LDYAI I.ENV.LIB
|
||
>SYSCALL2 PutEnv
|
||
bcs .9
|
||
|
||
>LDYAI I.ENV.DRV
|
||
>SYSCALL2 PutEnv
|
||
.9 rts
|
||
*--------------------------------------
|
||
PwdMgrInit >LDYAI MSG.PWD
|
||
>SYSCALL2 puts
|
||
>PUSHWZ Aux type
|
||
>PUSHBI S.FI.T.TXT
|
||
>PUSHBI O.RDONLY
|
||
>LDYAI ETCPASSWD
|
||
>SYSCALL2 LoadStkObj
|
||
bcs .1
|
||
stx PWD.hDB
|
||
>STYA PWD.DBSize
|
||
*--------------------------------------
|
||
.1 >LDYAI PwdMgr.ROOT.Size
|
||
jsr K.Getmem
|
||
>STYA pSession
|
||
stx S.Table.hSession
|
||
phy
|
||
ldy #S.PS.ZP.SESSION+1
|
||
sta (pPS),y
|
||
dey
|
||
pla
|
||
sta (pPS),y
|
||
lda #1
|
||
ldy #S.PS.hSID
|
||
sta (pPS),y
|
||
ldy #PwdMgr.ROOT.Size-1
|
||
.2 lda PwdMgr.ROOT,y
|
||
sta (pSession),y
|
||
dey
|
||
bpl .2
|
||
ldy #S.PS.hStdIn
|
||
lda (pPS),y
|
||
sta S.Table.hFile
|
||
rts
|
||
*--------------------------------------
|
||
PwdMgr.ROOT .DA #S.SESSION.P.ROOT
|
||
.DA #0 UID
|
||
.DA #0 GID
|
||
.AZ "ROOT" NAME
|
||
.AZ "Root User" GECOS
|
||
.AZ "${ROOT}ROOT/" DIR
|
||
.AZ "${ROOT}BIN/SH" SHELL
|
||
PwdMgr.ROOT.Size .EQ *-PwdMgr.ROOT
|
||
*--------------------------------------
|
||
* Modified CHARGET/CHARGOT for ROM CALL
|
||
* CHRGET .EQ $B1 - C8
|
||
*--------------------------------------
|
||
Kernel.ZP .PH $B1
|
||
CHARGET inc TXTPTR
|
||
bne CHARGOT
|
||
inc TXTPTR+1
|
||
CHARGOT lda $ffff
|
||
beq ZP.IsDigit.9
|
||
ZP.IsDigit cmp #'0'
|
||
bcc ZP.IsDigit.9
|
||
cmp #'9'+1
|
||
rts
|
||
ZP.IsDigit.9 sec
|
||
rts
|
||
.EP
|
||
Kernel.ZP.S .EQ *-Kernel.ZP
|
||
*--------------------------------------
|
||
Z80Code.Start .HS 31FF00 START: LD SP,000FFH Init Stack
|
||
.HS 3EFF LD A,0FFH Set Flag
|
||
.HS 320D00 LD (FLAG),A
|
||
.HS 3200E1 LD (0E100H),A Back to 6502
|
||
.HS 18F3 JR START Loop
|
||
.HS 00 FLAG: .DB 0
|
||
Z80Code.Size .EQ *-Z80Code.Start
|
||
*--------------------------------------
|
||
Mouse.OFS .HS 05070B0CFB
|
||
Mouse.SIG .HS 38180120D6
|
||
*--------------------------------------
|
||
TClock.SIG .HS 0878282c58ff700538b00118b8087848
|
||
.HS 8a489848adffcf201ac86868ba8df807
|
||
TClock.SIG.Cnt .EQ *-TClock.SIG
|
||
*--------------------------------------
|
||
MSG.Init2 .AZ "A2osX[Stage2]:Init\nRelocating Kernel...\n"
|
||
MSG.HZ .AZ "Kernel SYS Timer Set For %d0 hz Machine.\n"
|
||
MSG.KCREAD .AZ "Reading Kernel Config File..."
|
||
MSG.KCREAD.OK .AZ "OK\n"
|
||
MSG.KCREAD.KO .AZ "\nError While Reading Kernel Config File, Using Default.\n"
|
||
MSG.Init2.OK .AZ "A2osX[Stage2]:Complete.\n"
|
||
*--------------------------------------
|
||
SYSSCREEN.TOP .AZ "A2osX 0.93 Console"
|
||
MSG.Init3 .AZ "A2osX[Stage3]:Init *** Press Ctrl-R for ROOT Mode ***"
|
||
MSG.DEV .AZ "Device Manager..."
|
||
MSG.BLKDEV .AZ " Adding Device: /DEV/%s, Type: %s\r\n"
|
||
MSG.BLKDEV.TBL .DA MSG.BLKDEV.RAM
|
||
.DA MSG.BLKDEV.DII
|
||
.DA MSG.BLKDEV.USR
|
||
.DA MSG.BLKDEV.BLK
|
||
.DA MSG.BLKDEV.SP
|
||
MSG.BLKDEV.RAM .AZ "/RAM Disk"
|
||
MSG.BLKDEV.DII .AZ "Disk ]["
|
||
MSG.BLKDEV.USR .AZ "User"
|
||
MSG.BLKDEV.BLK .AZ "Generic Block"
|
||
MSG.BLKDEV.SP .AZ "Smartport"
|
||
MSG.IRQ .AZ "Interrupt Manager..."
|
||
MSG.IRQ.VBL .AZ " Mouse VBL IRQ Activated."
|
||
MSG.IRQ.CLOCK .AZ " Clock Card IRQ Activated."
|
||
MSG.IRQ.POLL .AZ " Polling Mode."
|
||
MSG.EVT .AZ "Event Manager..."
|
||
MSG.TSK .AZ "Task Manager..."
|
||
MSG.PWD .AZ "Password Manager..."
|
||
MSG.BOOTROOT .AZ "Boot Path:%S\r\nRoot Path:%S\r\n"
|
||
MSG.CTRLR .AZ "Ctrl-R Pressed, entering ROOT mode..."
|
||
MSG.PWDINIT .AZ "Loading ETC/PASSWD file..."
|
||
MSG.ETCINIT .AZ "Executing %s..."
|
||
MSG.StartupErr .AZ "Failed : [$%h]\r\n"
|
||
MSG.Init3.OK .AZ "OK\r\nA2osX[Stage3]:Complete.\r\n"
|
||
*--------------------------------------
|
||
MSG.CPU .AZ "Checking CPU..."
|
||
MSG.CPUTYPE .DA MSG.6502
|
||
.DA MSG.65C02
|
||
.DA MSG.65R02
|
||
.DA MSG.65816
|
||
MSG.6502 .AZ "6502."
|
||
MSG.65C02 .AZ "65C02."
|
||
MSG.65R02 .AZ "65R02."
|
||
MSG.65816 .AZ "65816."
|
||
MSG.CPU.SPEED .AZ "Checking CPU Speed..."
|
||
MSG.CPU.SPEEDOK .AZ "%d.%02d Mhz.\r\n"
|
||
MSG.Z80 .AZ "Checking Z80 CPU..."
|
||
MSG.Z80.OK .AZ "Detected In Slot %d.\r\n"
|
||
MSG.Z80.KO .AZ "Not Detected."
|
||
*--------------------------------------
|
||
DEV.CONSOLE .AZ "/DEV/CONSOLE"
|
||
RAMx .AZ "/RAMx"
|
||
I.ENV.BOOT .AZ "BOOT"
|
||
I.ENV.ROOT .AZ "ROOT"
|
||
I.ENV.PATH .AZ "PATH=${BOOT}SBIN/:${BOOT}BIN/"
|
||
I.ENV.LIB .AZ "LIB=${BOOT}LIB/"
|
||
I.ENV.DRV .AZ "DRV=${BOOT}DRV/"
|
||
CTRLR.SHELL .AZ "${BOOT}BIN/SH"
|
||
ETCPASSWD .AZ "${ROOT}ETC/PASSWD"
|
||
ETCINIT.CMDLINE .AZ "${ROOT}ETC/INIT"
|
||
*--------------------------------------
|
||
MLIOPEN00 .DA #3
|
||
.DA .1
|
||
.DA $B000
|
||
.BS 1
|
||
.1 >PSTR "A2osX.KCONFIG"
|
||
*--------------------------------------
|
||
MLIREAD00 .DA #4
|
||
.BS 1
|
||
.DA A2osX.KCONFIG
|
||
.DA 16
|
||
.BS 2
|
||
*--------------------------------------
|
||
MLICLOSE00 .DA #1
|
||
.BS 1
|
||
*--------------------------------------
|
||
FD.NULL .DA #S.FD.T.CDEV
|
||
.DA #0 HANDLER
|
||
.DA #0 BUSID
|
||
.DA #0 DEVID
|
||
.DA 0 BUSPTR
|
||
.DA DRV.NULL
|
||
.DA 0 DCBPTR
|
||
.DA 0 BUFPTR
|
||
FD.NULL.NAME .AZ "NULL" NAME
|
||
*--------------------------------------
|
||
FD.TTY .DA #S.FD.T.CDEV
|
||
.DA #0 HANDLER
|
||
.DA #0 BUSID
|
||
.DA #1 DEVID
|
||
.DA 0 BUSPTR
|
||
.DA DRV.TERM
|
||
.BS 2 DCBPTR
|
||
.BS 2 BUFPTR
|
||
*--------------------------------------
|
||
FD.CONSOLE.NAME .AZ "CONSOLE"
|
||
FD.TTY.NAME .AZ "TTY0"
|
||
*--------------------------------------
|
||
FD.BDEV .DA #S.FD.T.BDEV
|
||
.DA #0 HANDLER
|
||
.DA #0 BUSID
|
||
.DA #0 DEVID
|
||
.BS 2 BUSPTR
|
||
.BS 2 DRVPTR
|
||
.DA 0 DCBPTR
|
||
.DA 0 BUFPTR
|
||
FD.BDEV.NAME .AZ "S1D1"
|
||
*--------------------------------------
|
||
SmartPort.OFS .HS 010305
|
||
SmartPort.SIG .HS 200003
|
||
AWSmartPort.OFS .HS 12131415161718191A1B
|
||
AWSmartPort.SIG .HS A9008DF2C0A9708DF3C0
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/SYS/KERNEL.S.INIT
|
||
LOAD USR/SRC/SYS/KERNEL.S
|
||
ASM
|