A2osX/SYS/KERNEL.S.INIT.txt

1358 lines
25 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
2019-04-30 16:08:47 +00:00
AUTO 3,1
*--------------------------------------
2018-07-10 15:33:13 +00:00
Kernel.Init2 sei
ldx #$FF
txs
sta SETALTZP
2021-05-04 17:31:21 +00:00
stx SaveSM
stx SaveSX
2018-07-11 15:13:29 +00:00
ldx #Kernel.ZP.S-1
2019-10-21 14:25:37 +00:00
2019-10-28 06:32:12 +00:00
.1 lda Kernel.ZP,x
2018-07-11 15:13:29 +00:00
sta CHARGET,x
dex
bpl .1
sta CLRALTZP
2018-07-12 15:20:39 +00:00
>LDYAI MSG.Init2
jsr PrintFYA
2019-10-21 14:25:37 +00:00
2019-10-30 16:29:46 +00:00
>LDYA PAKME.MAIN
2019-10-28 06:32:12 +00:00
>STYA ZPInBufPtr
2020-09-24 15:31:48 +00:00
>LDYAI A2osX.EndTables
2020-04-13 17:04:02 +00:00
jsr A2osX.Unpak
2019-10-30 16:29:46 +00:00
>LDYA PAKME.AUX
2019-10-28 06:32:12 +00:00
>STYA ZPInBufPtr
2020-04-13 17:04:02 +00:00
>LDYAI $9F00
jsr A2osX.Unpak
>LDYAI $9F00
>STYA ZPPtr1
2020-01-11 17:13:27 +00:00
>LDYAI Mem.XHiMem
2020-04-13 17:04:02 +00:00
>STYA ZPPtr2
2020-01-10 15:58:47 +00:00
2021-05-04 17:31:21 +00:00
lda #AUX.S
2020-04-13 17:04:02 +00:00
eor #$ff
tax
2021-05-04 17:31:21 +00:00
lda /AUX.S
2020-04-13 17:04:02 +00:00
eor #$ff
pha
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
ldy #0
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
sta SETWRITEAUX
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
.2 inx
bne .3
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
pla
inc
beq .4
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
pha
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
.3 lda (ZPPtr1),y
sta (ZPPtr2),y
iny
bne .2
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
inc ZPPtr1+1
inc ZPPtr2+1
bra .2
2020-07-28 15:16:14 +00:00
.4 sta CLRWRITEAUX
2019-10-30 16:29:46 +00:00
>LDYA PAKME.GP
2019-10-28 06:32:12 +00:00
>STYA ZPInBufPtr
2019-07-29 15:38:55 +00:00
>LDYAI A2osX.SYSCALL
2020-04-13 17:04:02 +00:00
jsr A2osX.Unpak
2019-10-28 06:32:12 +00:00
sta SETALTZP
bit RRAMWRAMBNK2
bit RRAMWRAMBNK2
2019-10-30 16:29:46 +00:00
>LDYA PAKME.D2
2019-10-28 06:32:12 +00:00
>STYA ZPInBufPtr
>LDYAI $D000
2020-04-13 17:04:02 +00:00
jsr A2osX.Unpak
2020-07-28 15:16:14 +00:00
bit RRAMWRAMBNK1
bit RRAMWRAMBNK1
2019-10-30 16:29:46 +00:00
>LDYA PAKME.D1
2019-10-28 06:32:12 +00:00
>STYA ZPInBufPtr
>LDYAI $D000
2020-04-13 17:04:02 +00:00
jsr A2osX.Unpak
2019-10-28 06:32:12 +00:00
2019-10-30 16:29:46 +00:00
>LDYA PAKME.E0
2019-10-28 06:32:12 +00:00
>STYA ZPInBufPtr
>LDYAI $E000
2020-04-13 17:04:02 +00:00
jsr A2osX.Unpak
2019-10-28 06:32:12 +00:00
2018-07-12 15:20:39 +00:00
bit RROMBNK1
sta CLRALTZP
cli
2019-10-21 14:25:37 +00:00
jsr KConfigLoad
lda A2osX.HZ
2018-07-12 15:20:39 +00:00
pha
>LDYAI MSG.HZ
jsr PrintFYA
>LDYAI MSG.Init2.OK
jsr PrintFYA
*--------------------------------------
>DEBUGOA
*--------------------------------------
Kernel.Init3 sta SETALTZP
bit RRAMWRAMBNK1
bit RRAMWRAMBNK1
2020-11-19 15:34:02 +00:00
lda #$ff Make sure we are in Kernel Mode during setup
sta IRQ.InKernel
2019-03-27 17:01:01 +00:00
stz IRQ.InLib
2020-11-19 15:34:02 +00:00
lda /K.VER
sta A2osX.KVER
lda #K.VER
sta A2osX.KVER+1
2019-04-09 15:47:33 +00:00
sta SETALTCHAR
2020-12-15 13:23:22 +00:00
sta SETMIXED
2018-12-14 07:32:20 +00:00
sta CLRHIRES
2020-06-26 21:20:15 +00:00
sta SET80DISP
2018-12-14 07:32:20 +00:00
sta SET80STORE
sta CLRPAGE2
2020-07-28 15:16:14 +00:00
2020-06-27 18:30:09 +00:00
bit RDIOUDIS
2020-06-26 21:20:15 +00:00
sta SETIOUDIS
2019-04-09 15:47:33 +00:00
sta SETDHIRES
2020-06-27 18:30:09 +00:00
bmi .10
2020-06-26 21:20:15 +00:00
sta CLRIOUDIS
2018-12-14 07:32:20 +00:00
2020-06-27 18:30:09 +00:00
.10 jsr MemMgrInit
2018-12-10 16:45:37 +00:00
2019-01-13 13:10:14 +00:00
>LDYAI S.PS Select Process 0 (Kernel)
jsr K.GetMem0
2018-12-18 14:37:07 +00:00
>STYA pPs
2019-01-24 13:53:29 +00:00
stx PS.Table.hPS
2018-12-18 14:37:07 +00:00
2019-08-02 20:55:43 +00:00
jsr Mem.SetOwner
2019-01-24 13:53:29 +00:00
lda #1
sta CORE.PSCount
2018-12-18 14:37:07 +00:00
>LDYAI K.STACKTOP
>STYA pStack
2020-02-23 20:01:48 +00:00
sta pBase+1
2018-12-18 14:37:07 +00:00
2020-02-16 20:45:16 +00:00
>PUSHWI FD.NULL
2018-12-11 16:41:25 +00:00
>PUSHWI FD.NULL.NAME
2019-06-10 13:52:20 +00:00
>SYSCALL2 MKDev
2020-03-12 07:46:43 +00:00
2018-12-10 16:45:37 +00:00
jsr SysScrInit
2018-12-13 16:39:24 +00:00
bcs *
2021-03-11 21:40:55 +00:00
2021-07-24 20:42:23 +00:00
* sta CLRMIXED
2021-03-11 21:40:55 +00:00
2020-02-14 07:21:56 +00:00
>PUSHWI DEV.CONSOLE
2019-01-13 13:10:14 +00:00
>PUSHBI O.RDWR
2020-02-14 07:21:56 +00:00
>PUSHBI S.FI.T.TXT
2020-02-16 20:45:16 +00:00
>PUSHWZ Aux type
2019-06-10 13:52:20 +00:00
>SYSCALL2 fopen
2018-12-03 13:56:52 +00:00
bcs *
2020-07-28 15:16:14 +00:00
2019-01-13 13:10:14 +00:00
ldy #S.PS.hStdIn
2020-02-28 07:21:46 +00:00
sta (pPS),y
2019-01-13 13:10:14 +00:00
iny #S.PS.hStdOut
2020-02-28 07:21:46 +00:00
sta (pPS),y
2019-01-13 13:10:14 +00:00
iny #S.PS.hStdErr
2020-02-28 07:21:46 +00:00
sta (pPS),y
2019-01-06 09:58:49 +00:00
*--------------------------------------
2020-02-14 07:21:56 +00:00
Kernel.Init3C >PUSHWI MSG.Init3
>PUSHBI 0
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
2018-12-03 13:56:52 +00:00
2019-10-21 14:25:37 +00:00
jsr HW.Detect
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
jsr CPU.Init
2018-12-03 13:56:52 +00:00
2018-07-13 14:38:24 +00:00
jsr CPU.Init.Z80
2020-03-10 16:42:07 +00:00
jsr DevMgrInit
2018-12-03 13:56:52 +00:00
jsr IrqMgrInit
bcs *
2018-12-03 13:56:52 +00:00
jsr EvtMgrInit
2018-12-03 13:56:52 +00:00
jsr TskMgrInit
bcs *
2018-12-03 13:56:52 +00:00
2019-04-09 15:47:33 +00:00
jsr PwdMgrInit
2020-02-27 16:46:40 +00:00
>PUSHWI MSG.EXEC
>PUSHWI SBININITD
2018-08-22 15:23:27 +00:00
>PUSHBI 2
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2020-07-28 15:16:14 +00:00
2020-02-27 07:27:42 +00:00
>PUSHWI SBININITD
>PUSHBI 0 PS Flags
2020-08-07 19:49:24 +00:00
>SYSCALL2 ExecV
2018-12-03 06:59:30 +00:00
bcs Kernel.Init3.Err
2020-07-28 15:16:14 +00:00
2020-02-14 07:21:56 +00:00
>PUSHWI MSG.Init3.OK
2018-10-25 15:31:41 +00:00
>PUSHBI 0
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
>DEBUGOA
jmp CORE.Run
2018-12-03 06:59:30 +00:00
Kernel.Init3.Err
2020-02-14 07:21:56 +00:00
pha
>PUSHWI MSG.StartupErr
pla
2018-12-03 06:59:30 +00:00
>PUSHA
2020-08-19 19:39:43 +00:00
>PUSHBI 1
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
2020-07-28 15:16:14 +00:00
bra * No need to discard Expanded CMDLINE
*--------------------------------------
2018-07-12 15:20:39 +00:00
* INIT2 Subs
*--------------------------------------
KConfigLoad >LDYAI MSG.KCREAD
jsr PrintFYA
2018-07-10 15:33:13 +00:00
2020-08-18 15:00:56 +00:00
jsr MLIENTRY Bypass ATALK
2019-11-27 22:04:55 +00:00
.DA #MLIGETFILEINFOEX
2021-05-04 17:31:21 +00:00
.DA pMLIGFIEX
2019-11-28 22:06:22 +00:00
bcc .1
2019-12-03 15:42:17 +00:00
eor #MLI.E.BADCALL
2019-12-09 15:53:14 +00:00
beq .2 regular ProDOS
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
ror A2osX.FSID Bad file, but ProDOS.FX detected
2019-11-28 22:06:22 +00:00
bra .9
2019-11-27 22:04:55 +00:00
2019-12-17 12:28:49 +00:00
.1 sec
2020-11-19 15:34:02 +00:00
ror A2osX.FSID File Present & ProDOS.FX detected
2019-12-09 15:53:14 +00:00
2019-11-28 22:06:22 +00:00
.2 jsr MLI
2018-07-10 15:33:13 +00:00
.DA #MLIOPEN
2021-05-04 17:31:21 +00:00
.DA pMLIOPEN
2018-07-10 15:33:13 +00:00
bcs .9
2021-05-04 17:31:21 +00:00
lda pMLIOPEN+5
sta pMLIREAD+1
sta pMLICLOSE+1
2018-07-10 15:33:13 +00:00
jsr MLI
.DA #MLIREAD
2021-05-04 17:31:21 +00:00
.DA pMLIREAD
2018-07-10 15:33:13 +00:00
php
pha
jsr MLI
.DA #MLICLOSE
2021-05-04 17:31:21 +00:00
.DA pMLICLOSE
2018-07-10 15:33:13 +00:00
pla
plp
bcs .9
2019-11-28 22:06:22 +00:00
2018-07-12 15:20:39 +00:00
>LDYAI MSG.KCREAD.OK
2019-11-28 22:06:22 +00:00
bra .8
2018-07-12 15:20:39 +00:00
.9 >LDYAI MSG.KCREAD.KO
2020-07-28 15:16:14 +00:00
2019-12-09 15:53:14 +00:00
.8 jsr PrintFYA
2020-11-19 15:34:02 +00:00
lda A2osX.FSID
2019-11-28 22:06:22 +00:00
beq .99
2020-07-28 15:16:14 +00:00
2019-11-28 22:06:22 +00:00
>LDYAI MSG.PRODOSFX
jsr PrintFYA
.99 rts
2018-07-10 15:33:13 +00:00
*--------------------------------------
2018-07-12 15:20:39 +00:00
* INIT3 Subs
*--------------------------------------
2018-12-10 16:45:37 +00:00
MemMgrInit >LDYAI Mem.MHiMem
>STYA Mem.HiMem
>STYA Mem.Free
>LDYAI Mem.MLoMem
>STYA Mem.LoMem
stz Mem.LastSlot Reserve Slot #0
sta SETWRITEAUX
2018-12-17 14:24:39 +00:00
2018-12-10 16:45:37 +00:00
>LDYAI Mem.XLoMem
>STYA Mem.LoMem
2018-12-17 14:24:39 +00:00
2018-12-10 16:45:37 +00:00
stz Mem.LastSlot Reserve Slot #0
sta CLRWRITEAUX
2021-07-24 20:42:23 +00:00
ldx #K.hFD.MAX-1
2020-07-28 15:16:14 +00:00
2021-07-24 20:42:23 +00:00
.1 stz hFDs,x
stz hFDs.hName,x
stz hFDs.oCnt,x
2018-12-10 16:45:37 +00:00
dex
bpl .1
2020-07-28 15:16:14 +00:00
2018-12-10 16:45:37 +00:00
ldx #K.PS.MAX*4-1
2019-10-18 15:07:14 +00:00
2018-12-10 16:45:37 +00:00
.3 stz PS.Table.PID,x
dex
bpl .3
2019-10-18 15:07:14 +00:00
2018-12-10 16:45:37 +00:00
ldx #K.EVT.MAX*S.EVT-1
2019-10-18 15:07:14 +00:00
2018-12-10 16:45:37 +00:00
.5 stz Evt.Table,x
dex
bpl .5
2019-10-18 15:07:14 +00:00
2019-04-15 05:40:13 +00:00
ldx #K.USR.MAX*2-1
2019-10-18 15:07:14 +00:00
2020-03-12 16:44:11 +00:00
.6 stz S.Table.hSID,x
2019-04-15 05:40:13 +00:00
dex
bpl .6
2019-10-18 15:07:14 +00:00
2021-01-12 21:14:13 +00:00
ldx #K.FLT.MAX*4-1
.7 stz Flt.Table.pftLO,x
dex
bpl .7
2018-12-10 16:45:37 +00:00
rts
*--------------------------------------
2019-04-30 16:08:47 +00:00
SysScrInit >LDYAI Mem.XHiMem
2020-05-04 20:46:21 +00:00
>STYA FD.TTY+S.FD.DEV.DCBPTR
2018-12-17 14:24:39 +00:00
jsr SysScrInit.TTYPtrs
2018-12-10 16:45:37 +00:00
2020-02-16 20:45:16 +00:00
>PUSHWI FD.TTY
2018-12-13 16:39:24 +00:00
>PUSHWI FD.CONSOLE.NAME
2020-03-12 07:46:43 +00:00
2019-06-10 13:52:20 +00:00
>SYSCALL2 MKDev
2018-12-13 16:39:24 +00:00
bcs .9
2020-07-28 15:16:14 +00:00
2018-12-17 14:24:39 +00:00
ldx A2osX.TTYDEVS
2020-01-11 17:13:27 +00:00
2018-12-17 14:24:39 +00:00
.1 phx
2018-12-10 16:45:37 +00:00
inc FD.TTY+S.FD.DEV.DEVID
2018-12-11 16:41:25 +00:00
inc FD.TTY.NAME+3
2018-12-17 14:24:39 +00:00
jsr SysScrInit.TTYPtrs
2020-07-28 15:16:14 +00:00
2020-02-16 20:45:16 +00:00
>PUSHWI FD.TTY
2018-12-11 16:41:25 +00:00
>PUSHWI FD.TTY.NAME
2020-03-12 07:46:43 +00:00
2019-06-10 13:52:20 +00:00
>SYSCALL2 MKDev
2018-12-17 14:24:39 +00:00
plx
bcs .9
2020-01-11 17:13:27 +00:00
2018-12-17 14:24:39 +00:00
dex
2018-12-10 16:45:37 +00:00
bne .1
2020-01-11 17:13:27 +00:00
2020-04-13 17:04:02 +00:00
* clc
2018-12-13 16:39:24 +00:00
.9 rts
2018-07-12 15:20:39 +00:00
*--------------------------------------
2018-12-17 14:24:39 +00:00
SysScrInit.TTYPtrs
2020-05-04 20:46:21 +00:00
lda FD.TTY+S.FD.DEV.DCBPTR
sec
2021-05-04 17:31:21 +00:00
sbc #80*24+S.DCB.TTY
2018-12-13 16:39:24 +00:00
sta FD.TTY+S.FD.DEV.DCBPTR
2021-07-24 20:42:23 +00:00
sta ZPPtr1
2020-05-04 20:46:21 +00:00
tay
2020-07-28 15:16:14 +00:00
2020-05-04 20:46:21 +00:00
lda FD.TTY+S.FD.DEV.DCBPTR+1
2021-05-04 17:31:21 +00:00
sbc /80*24+S.DCB.TTY
2018-12-13 16:39:24 +00:00
sta FD.TTY+S.FD.DEV.DCBPTR+1
2021-07-24 20:42:23 +00:00
sta ZPPtr1+1
2020-01-11 17:13:27 +00:00
2020-05-04 20:46:21 +00:00
sta SETWRITEAUX
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
>STYA Mem.HiMem
>STYA Mem.Free
2021-07-24 20:42:23 +00:00
ldy #S.DCB.TTY-1
lda #0
.1 sta (ZPPtr1),y
dey
bne .1
lda FD.TTY+S.FD.DEV.DEVID
sta (ZPPtr1)
2020-04-13 17:04:02 +00:00
sta CLRWRITEAUX
2020-07-28 15:16:14 +00:00
2018-12-13 16:39:24 +00:00
rts
*--------------------------------------
2019-10-21 14:25:37 +00:00
* http://www.1000bit.it/support/manuali/apple/technotes/misc/tn.misc.02.html
* https://mirrors.apple2.org.za/apple.cabi.net/FAQs.and.INFO/A2.TECH.NOTES.ETC/A2.CLASSIC.TNTS/a2misc007(1).htm
*--------------------------------------
2020-02-14 07:21:56 +00:00
HW.Detect >PUSHWI MSG.HW
>PUSHBI 0
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
2019-10-21 14:25:37 +00:00
bit RROMBNK1
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
stz A2osX.HWType
stz A2osX.HWSubT
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
sec
jsr $FE1F IIgs ?
bcs .2
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
lda #A2osX.HWType.IIgs
sta A2osX.HWType
cpy #2
2019-10-21 15:24:11 +00:00
bne .1
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
iny
2019-10-21 15:24:11 +00:00
2019-10-21 14:25:37 +00:00
.1 sty A2osX.HWSubT
bra .8
.2 lda $FBC0
beq .4 //c
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
ldx #A2osX.HWType.IIe
stx A2osX.HWType
cmp #$EA
beq .8 //e OLD ROMs
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
inc A2osX.HWSubT //e Enh ROMs
lda $FBDD
cmp #2
bne .8
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
inc A2osX.HWSubT //e LC card
bra .8
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
.4 lda #A2osX.HWType.IIc
sta A2osX.HWType
lda $FBBF
sta A2osX.HWSubT
2020-07-28 15:16:14 +00:00
2019-10-21 14:25:37 +00:00
.8 bit RRAMWRAMBNK1
bit RRAMWRAMBNK1
2020-07-28 15:16:14 +00:00
2020-02-14 07:21:56 +00:00
>PUSHWI MSG.HW.TypeSubT
2019-10-21 14:25:37 +00:00
>PUSHB A2osX.HWType
2020-02-14 07:21:56 +00:00
>PUSHB A2osX.HWSubT
2019-10-21 14:25:37 +00:00
>PUSHBI 2
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
2019-10-21 14:25:37 +00:00
rts
*--------------------------------------
2020-11-19 15:34:02 +00:00
CPU.Init >PUSHWI MSG.CPU
2020-02-14 07:21:56 +00:00
>PUSHBI 0
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
jsr Detect6502 A = CPU type
sta A2osX.CPUTYPE
2018-07-13 14:38:24 +00:00
and #$F
asl
tax
ldy MSG.CPUTYPE,x
lda MSG.CPUTYPE+1,x
2019-06-10 13:52:20 +00:00
>SYSCALL2 puts
2020-02-14 07:21:56 +00:00
>PUSHWI MSG.CPU.SPEED
2020-07-28 15:16:14 +00:00
>PUSHB A2osX.HZ
>PUSHBI 1
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
2020-07-28 15:16:14 +00:00
ldy #0
2020-11-19 15:34:02 +00:00
stz A2osX.CPUSPEED+1
2019-10-21 14:25:37 +00:00
php
sei
2020-04-23 15:36:51 +00:00
2019-10-21 14:25:37 +00:00
lda MACHID
and #MACHID.T
2019-10-21 19:40:50 +00:00
eor #MACHID.T.IIc
2020-11-19 15:34:02 +00:00
beq CPU.Init2c
2019-10-21 14:25:37 +00:00
2020-11-19 15:34:02 +00:00
lda A2osX.HZ
asl
2020-07-28 15:16:14 +00:00
tax
2021-03-11 21:40:55 +00:00
2020-11-19 15:34:02 +00:00
.1 bit VBL //e : Wait VBL high....
2020-07-28 15:16:14 +00:00
bpl .1
.2 lda VBL //e : wait VBL low
bmi .2
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
.3 pha (3)
pla (4)
pha (3)
pla (4)
pha (3)
pla (4)
pha (3)
pla (4)
pha (3)
pla (4)
pha (3)
pla (4)
2021-03-11 21:40:55 +00:00
2020-11-19 15:34:02 +00:00
iny
cpy #100
bne .5
2021-03-11 21:40:55 +00:00
2020-11-19 15:34:02 +00:00
ldy #0
inc A2osX.CPUSPEED+1
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
.5 eor VBL (4)
bpl .3 (2*)
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
dex
bne .3
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
bra CPU.InitOK
*--------------------------------------
CPU.Init2c sta CLRIOUDIS
lda IO.IIC.RDVBLMSK
pha Save VBLIRQ enable
2019-10-22 14:28:54 +00:00
2020-11-19 15:34:02 +00:00
sta IO.IIC.ENVBL
lda IO.IIC.CLRVBLIRQ
2019-10-22 14:28:54 +00:00
2020-11-19 15:34:02 +00:00
ldx A2osX.HZ
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
.1 bit VBL Wait VBL high....
bpl .1
2019-10-22 14:28:54 +00:00
2020-11-19 15:34:02 +00:00
bit IO.IIC.CLRVBLIRQ clear //c IRQ
2021-03-11 21:40:55 +00:00
.3 lda #40
2020-11-23 22:05:27 +00:00
.4 pha (3)
2020-11-19 15:34:02 +00:00
pla (4)
pha (3)
pla (4)
2020-07-28 15:16:14 +00:00
2020-11-23 22:05:27 +00:00
dec
bne .4
2021-03-11 21:40:55 +00:00
2020-11-19 15:34:02 +00:00
iny
cpy #100
bne .5
2021-03-11 21:40:55 +00:00
2020-11-19 15:34:02 +00:00
inc A2osX.CPUSPEED+1
ldy #0
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
.5 bit VBL Wait VBL high....
bpl .3
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
bit IO.IIC.CLRVBLIRQ clear //c IRQ
2020-07-28 15:16:14 +00:00
2020-11-19 15:34:02 +00:00
dex
2020-07-28 15:16:14 +00:00
bne .3
2020-11-19 15:34:02 +00:00
pla Disable VBLIRQ ?
bpl CPU.InitOk
2020-07-28 15:16:14 +00:00
2019-10-21 19:40:50 +00:00
sta IO.IIC.DISVBL
2020-07-28 04:49:45 +00:00
*--------------------------------------
2020-11-19 15:34:02 +00:00
CPU.InitOk plp
2020-11-19 15:34:02 +00:00
sty A2osX.CPUSPEED
2019-10-22 14:28:54 +00:00
2020-02-14 07:21:56 +00:00
>PUSHWI MSG.CPU.SPEEDOK
lda A2osX.CPUSPEED+1
2020-11-19 15:34:02 +00:00
>PUSHA push CPU speed HI
lda A2osX.CPUSPEED
2020-02-14 07:21:56 +00:00
>PUSHA push CPU speed LO
2018-08-22 15:23:27 +00:00
>PUSHBI 2
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
2018-07-13 14:38:24 +00:00
rts
*--------------------------------------
2020-02-14 07:21:56 +00:00
CPU.Init.Z80 >PUSHWI MSG.Z80
>PUSHBI 0
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
jsr DetectZ80
bcs .9
sta A2osX.Z80SLOT
tax
lda #A2osX.S.Z80
sta A2osX.S,x
2020-07-28 15:16:14 +00:00
2020-02-14 07:21:56 +00:00
>PUSHWI MSG.Z80.OK
lda A2osX.Z80SLOT
>PUSHA
2018-08-22 15:23:27 +00:00
>PUSHBI 1
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
rts
2020-09-24 15:31:48 +00:00
2018-07-12 15:20:39 +00:00
.9 >LDYAI MSG.Z80.KO
2019-06-10 13:52:20 +00:00
>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
2021-02-11 22:08:22 +00:00
.1 lda Z80Code.Start-1,x
2018-07-04 14:59:12 +00:00
sta Z80CODE-1,x 00000H for Z80
dex
bne .1
2021-02-11 22:08:22 +00:00
stz ZPPtr1
lda #$C1
2021-02-11 22:08:22 +00:00
sta ZPPtr1+1
2021-02-11 22:08:22 +00:00
.2 sta (ZPPtr1)
lda $100D
bmi .8
2021-02-11 22:08:22 +00:00
inc ZPPtr1+1
lda ZPPtr1+1
cmp #$C8
beq .9 CS
2021-02-11 22:08:22 +00:00
clc
adc #$20
sta $100A
bra .2
2021-02-11 22:08:22 +00:00
.8 lda ZPPtr1+1
and #$0F
clc
.9 rts
*--------------------------------------
2019-07-23 06:13:03 +00:00
DevMgrInit >LDYAI MSG.DEV
>SYSCALL2 puts
2019-10-17 13:30:09 +00:00
2021-02-20 10:18:02 +00:00
jsr DevMgrInit.VSD
2019-07-23 06:13:03 +00:00
lda DEVCNT
sta .1+1
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
.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
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
ora #$30
sta FD.BDEV.NAME+1 SnDy
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
lda DEVPTRS,x
sta FD.BDEV+S.FD.DEV.BUSPTR
lda DEVPTRS+1,x
sta FD.BDEV+S.FD.DEV.BUSPTR+1
2019-10-17 13:30:09 +00:00
2020-07-28 15:16:14 +00:00
sta ZPPtr1+1
2019-07-23 06:13:03 +00:00
stz ZPPtr1 Cn00
2020-12-15 13:23:22 +00:00
2019-07-23 06:13:03 +00:00
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
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
.2 cmp #$D0 Disk II Driver is $D000
bne .3
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
jsr DevMgrInit.DII
lda #A2osX.S.DII
bra .7 Go mark slot as USED
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
.3 bcs .53 > $D0, Some BLK remapped DRV
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
cmp #$C0
2020-07-28 15:16:14 +00:00
bcs .4 $C0 .. $CF, in slot ROM
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
jsr DevMgrInit.USR Outside ROM/LC space, User loaded BLK dev
bra .8 keep slot free
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
.4 ldx #SmartPort.SIG-SmartPort.OFS-1
2020-01-28 16:42:51 +00:00
.5 ldy SmartPort.OFS,x Check if there is a smartport firmware
2019-07-23 06:13:03 +00:00
lda (ZPPtr1),y
cmp SmartPort.SIG,x
2020-01-28 16:42:51 +00:00
bne .8 not a Disk Controller...
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
dex
bpl .5
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
ldy #7
lda (ZPPtr1),y
2020-01-28 16:42:51 +00:00
bne .6 $Cn07=00 : SmartPort
2019-07-23 06:13:03 +00:00
2019-10-18 19:57:38 +00:00
jsr DevMgrInit.SP
2019-07-23 06:13:03 +00:00
lda #A2osX.S.SP
bra .7
2020-07-28 15:16:14 +00:00
2020-01-28 16:42:51 +00:00
.53 jsr DevMgrInit.RSP Remapped SP devices....
bra .8 don't mark slot as busy
2020-07-28 15:16:14 +00:00
2019-07-23 06:13:03 +00:00
.6 jsr DevMgrInit.BLK
lda #A2osX.S.BLK
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
.7 ldx FD.BDEV+S.FD.DEV.BUSID
sta A2osX.S,x
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
.8 dec .1+1
bmi .80
2019-10-17 13:30:09 +00:00
2019-07-23 06:13:03 +00:00
jmp .1
.80 clc
rts
*--------------------------------------
DevMgrInit.RAM ldx #0
2020-01-28 16:42:51 +00:00
.HS 2C BIT ABS
2019-07-23 06:13:03 +00:00
*--------------------------------------
DevMgrInit.DII ldx #2
2020-01-28 16:42:51 +00:00
.HS 2C BIT ABS
2019-07-23 06:13:03 +00:00
*--------------------------------------
DevMgrInit.USR ldx #4
2019-11-09 13:27:05 +00:00
.HS 2C BIT ABS
2019-07-23 06:13:03 +00:00
*--------------------------------------
2019-11-09 13:27:05 +00:00
DevMgrInit.BLK ldx #6
2019-07-23 06:13:03 +00:00
bra DevMgrInit.AddBDev
*--------------------------------------
DevMgrInit.SP ldy #$ff
lda (ZPPtr1),y
clc
adc #3 Compute smartport entry point
sta FD.BDEV+S.FD.DEV.BUSPTR
2020-01-28 16:42:51 +00:00
2020-01-13 11:05:11 +00:00
ldx #8
2020-01-28 16:42:51 +00:00
.HS 2C BIT ABS
DevMgrInit.RSP ldx #10
2019-07-23 06:13:03 +00:00
*--------------------------------------
DevMgrInit.AddBDev
2021-04-29 11:56:34 +00:00
>LDYA DRV.BLKDEVX,x
2019-07-23 06:13:03 +00:00
>STYA FD.BDEV+S.FD.DEV.DRVPTR
2020-07-28 15:16:14 +00:00
2020-02-14 07:21:56 +00:00
>PUSHWI MSG.BLKDEV
2019-07-23 06:13:03 +00:00
>PUSHWI FD.BDEV.NAME
2020-02-14 07:21:56 +00:00
>PUSHW FD.BDEV+S.FD.DEV.BUSPTR
>PUSHW MSG.BLKDEV.TBL,x
2020-01-28 16:42:51 +00:00
>PUSHBI 6
2020-02-14 16:32:52 +00:00
>SYSCALL2 printf
2020-01-28 16:42:51 +00:00
2020-02-16 20:45:16 +00:00
>PUSHWI FD.BDEV
2019-07-23 06:13:03 +00:00
>PUSHWI FD.BDEV.NAME
>SYSCALL2 MKDev
2020-09-24 15:31:48 +00:00
2019-07-23 06:13:03 +00:00
rts
*--------------------------------------
2021-02-20 10:18:02 +00:00
DevMgrInit.VSD ldy #VSD.PATCH.SIZE-1
.1 lda $BF41,y
cmp VSD.PATCH,y
bne .9
2021-03-11 21:40:55 +00:00
2021-02-20 10:18:02 +00:00
dey
bpl .1
2021-03-11 21:40:55 +00:00
2021-02-20 10:18:02 +00:00
php
sei
bit RRAMWRAMBNK2
bit RRAMWRAMBNK2
sta CLRALTZP
2021-03-11 21:40:55 +00:00
ldx $d001
2021-02-20 10:18:02 +00:00
sta SETALTZP
bit RRAMWRAMBNK1
bit RRAMWRAMBNK1
lda #A2osX.S.VSDRIVE
sta A2osX.S,x
plp
2021-03-11 21:40:55 +00:00
.9 rts
2021-02-20 10:18:02 +00:00
*--------------------------------------
2021-02-26 20:13:48 +00:00
VSD.PATCH bit RRAMWRAMBNK2
2021-03-11 21:40:55 +00:00
jsr $D002
2021-02-26 20:13:48 +00:00
bit RRAMWRAMBNK1
2021-02-20 10:18:02 +00:00
rts
VSD.PATCH.SIZE .EQ *-VSD.PATCH
*--------------------------------------
* Setup AuxLC $FFFE->Kernel IRQ Handler
* if irq not handled, jmp (S.IrqMgrOldFFFE)
*--------------------------------------
IrqMgrInit >LDYAI MSG.IRQ
2019-06-10 13:52:20 +00:00
>SYSCALL2 puts
2020-07-28 15:16:14 +00:00
php
sei
>LDYA $FFFE
2020-09-24 15:31:48 +00:00
>STYA IRQ.JMP+1
>LDYAI IRQ.Handler
>STYA $FFFE
2020-09-24 15:31:48 +00:00
>LDYAI GP.IRQ
>STYA K.MLI.PARAMS+2
>MLICALL MLIALLOCIRQ
2019-10-22 07:52:34 +00:00
bcs .9
lda K.MLI.PARAMS+1
sta IRQ.INTNUM
plp
2019-10-22 07:52:34 +00:00
*--------------------------------------
2019-10-21 14:25:37 +00:00
lda A2osX.HWType
cmp #A2osX.HWType.IIgs
2019-10-22 07:52:34 +00:00
bne .1
2020-07-28 15:16:14 +00:00
2019-10-22 07:52:34 +00:00
lda #"G"
sta IRQ.Mode
2020-07-28 15:16:14 +00:00
2019-10-22 07:52:34 +00:00
lda #$08
tsb IO.IIGS.INTEN
2020-07-28 15:16:14 +00:00
2019-10-22 07:52:34 +00:00
jsr IrqMgrInit.HZ2Tick
2020-07-28 15:16:14 +00:00
2020-09-24 15:31:48 +00:00
>LDYAI CORE.IRQ.IIGS
2019-10-22 07:52:34 +00:00
jsr IrqMgrInit.SetV
2020-07-28 15:16:14 +00:00
2020-09-24 15:31:48 +00:00
>LDYAI CORE.IRQ.IIGS.Off
2021-04-10 17:17:40 +00:00
>STYA CORE.Quit+3
2020-09-24 15:31:48 +00:00
2019-10-22 07:52:34 +00:00
>LDYAI MSG.IRQ.IIGS
bra .8
2020-07-28 15:16:14 +00:00
2020-09-24 15:31:48 +00:00
.9 plp
sec
rts
2021-03-11 21:40:55 +00:00
2019-10-22 07:52:34 +00:00
.1 cmp #A2osX.HWType.IIc
beq .2
2020-07-28 15:16:14 +00:00
jsr IrqMgrInit.TClock
2021-02-26 20:13:48 +00:00
bcs .3
2019-10-21 14:37:10 +00:00
lda #"C"
2018-12-17 07:02:03 +00:00
sta IRQ.Mode
2020-11-25 16:29:06 +00:00
2020-09-24 15:31:48 +00:00
>LDYAI CORE.IRQ.TCLOCK
2019-10-22 07:52:34 +00:00
jsr IrqMgrInit.SetV
2021-03-11 21:40:55 +00:00
2020-09-24 15:31:48 +00:00
>LDYAI CORE.IRQ.TCLOCK.Off
2021-04-10 17:17:40 +00:00
>STYA CORE.Quit+3
2021-03-11 21:40:55 +00:00
>LDYAI MSG.IRQ.CLOCK
2019-10-22 07:52:34 +00:00
bra .8
2021-02-26 20:13:48 +00:00
.2 php
sei
sta CLRPAGE2
lda #$60
2021-07-28 16:50:59 +00:00
sta $5fa //c EXTINT COM1:Dont buffer but get IRQ
sta $5fb //c EXTINT COM2:Dont buffer but get IRQ
2021-03-11 21:40:55 +00:00
2021-07-28 16:50:59 +00:00
stz $5FA //c TYPHED no keyboard buffering
stz $4FF //c ROM FF: no ACIABUF
stz $4FC //c ROM 0X: no ACIABUF
2021-02-26 20:13:48 +00:00
plp
.3 jsr IrqMgrInit.Mouse
bcs .7
2019-10-21 14:37:10 +00:00
lda #"V"
2018-12-17 07:02:03 +00:00
sta IRQ.Mode
2020-11-25 16:29:06 +00:00
2020-09-24 15:31:48 +00:00
>LDYAI CORE.IRQ.MOUSE
2019-10-22 07:52:34 +00:00
jsr IrqMgrInit.SetV
2020-07-28 15:16:14 +00:00
2020-09-24 15:31:48 +00:00
>LDYAI CORE.IRQ.MOUSE.Off
2021-04-10 17:17:40 +00:00
>STYA CORE.Quit+3
2020-09-24 15:31:48 +00:00
>LDYAI MSG.IRQ.MOUSE
2019-10-22 07:52:34 +00:00
bra .8
2019-10-21 14:37:10 +00:00
2021-02-26 20:13:48 +00:00
.7 jsr IrqMgrInit.HZ2Tick
lda #"P"
2019-10-21 14:37:10 +00:00
sta IRQ.Mode
>LDYAI MSG.IRQ.POLL
2020-07-28 15:16:14 +00:00
2019-10-22 07:52:34 +00:00
.8 >SYSCALL2 puts
2020-11-23 22:05:27 +00:00
clc
rts
2019-10-22 07:52:34 +00:00
*--------------------------------------
2020-09-24 15:31:48 +00:00
IrqMgrInit.SetV >STYA IRQ.JSR+1
>STYA GP.IRQ.JSR+1
2019-10-03 06:25:27 +00:00
rts
*--------------------------------------
IrqMgrInit.TClock
2019-01-04 13:17:31 +00:00
stz ZPPtr1 Try finding a TClock Card...
lda #$C1
sta ZPPtr1+1
2020-07-28 15:16:14 +00:00
2020-04-13 17:04:02 +00:00
.1 ldx #TClock.SIG-TClock.OFS-1
2020-04-13 17:04:02 +00:00
.2 ldy TClock.OFS,x
lda (ZPPtr1),y
cmp TClock.SIG,x
bne .3
2020-04-13 17:04:02 +00:00
2020-11-23 22:05:27 +00:00
dex
bpl .2
2020-04-13 17:04:02 +00:00
bra .4
2020-04-13 17:04:02 +00:00
.3 inc ZPPtr1+1 no match, try next slot....
lda ZPPtr1+1
cmp #$C8
2020-07-28 15:16:14 +00:00
bne .1
2020-11-23 22:05:27 +00:00
2020-11-25 16:29:06 +00:00
* sec
rts
.4 lda ZPPtr1+1 get $Cn
and #$f
tax get $0n
asl
asl
asl
asl
tay get $n0
2020-09-25 12:05:23 +00:00
sty IRQ.n0
2018-12-01 19:39:44 +00:00
lda #A2osX.S.CLK
sta A2osX.S,x
2020-09-24 15:31:48 +00:00
php
sei
2020-11-23 22:05:27 +00:00
2018-12-01 19:39:44 +00:00
lda #$40+$20 Enable interrupt + 64Hz
sta $c080,y
2020-09-24 15:31:48 +00:00
lda #$40
2020-11-25 16:29:06 +00:00
2021-07-28 16:50:59 +00:00
* sta SETPAGE2
* sta $478,x
* sta $7f8,x
2021-03-11 21:40:55 +00:00
2021-07-28 16:50:59 +00:00
* sta CLRPAGE2
sta $478,x
sta $7f8,x
lda #64
sta CORE.TickPerSec
sta CORE.TickSec
2020-11-25 16:29:06 +00:00
lda #11
sta CORE.TickPer10t
sta CORE.Tick10t
2020-11-19 15:34:02 +00:00
dec A2osX.IRQMode
2020-11-23 22:05:27 +00:00
plp
clc
rts
*--------------------------------------
IrqMgrInit.Mouse
stz ZPPtr1 Try finding a Mouse Card...
lda #$C1
sta ZPPtr1+1
2020-07-28 15:16:14 +00:00
.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
2020-07-28 15:16:14 +00:00
bne .1
sec
rts
2021-05-15 14:35:24 +00:00
.4 lda ZPPtr1+1
sta .11+2
2020-09-24 15:31:48 +00:00
sta CORE.IRQ.MOUSE.Off.1+2
sta CORE.IRQ.MOUSE+2
sta CORE.IRQ.MOUSE.2+2
and #$0f
2020-09-25 12:05:23 +00:00
sta IRQ.0n
asl
asl
asl
asl
2020-09-25 12:05:23 +00:00
sta IRQ.n0
php
sei
bit RROMBNK2 Renable ROM to allow MOUSE II firmware works properly
ldy #INITMOUSE
jsr .10
2020-09-24 15:31:48 +00:00
ldy #SETMOUSE
2020-09-24 15:31:48 +00:00
lda (ZPPtr1),y
sta CORE.IRQ.MOUSE.Off.1+1
lda #MOUSEMODx.INTVBL+MOUSEMODx.ACTIVE
jsr .10
bit RRAMWRAMBNK1 Back To LC Ram
bit RRAMWRAMBNK1
ldy #SERVEMOUSE
lda (ZPPtr1),y
2020-09-24 15:31:48 +00:00
sta CORE.IRQ.MOUSE+1
ldy #READMOUSE
lda (ZPPtr1),y
2020-09-24 15:31:48 +00:00
sta CORE.IRQ.MOUSE.2+1
jsr IrqMgrInit.HZ2Tick
2020-11-19 15:34:02 +00:00
dec A2osX.IRQMode
2020-09-24 15:31:48 +00:00
plp
2019-10-03 06:25:27 +00:00
clc
rts
2020-09-24 15:31:48 +00:00
.9 plp
sec
rts
.10 pha
lda (ZPPtr1),y
sta .11+1
pla
ldx .11+2 Cn
2020-09-25 12:05:23 +00:00
ldy IRQ.n0
.11 jmp $ffff SELF MODIFIED
*--------------------------------------
IrqMgrInit.HZ2Tick
lda A2osX.HZ
sta CORE.TickPer10t
sta CORE.Tick10t
2019-10-22 07:52:34 +00:00
asl
asl
clc
adc A2osX.HZ
2020-07-28 15:16:14 +00:00
2019-10-22 07:52:34 +00:00
asl
sta CORE.TickPerSec
sta CORE.TickSec
rts
*--------------------------------------
EvtMgrInit >LDYAI MSG.EVT
2019-06-10 13:52:20 +00:00
>SYSCALL2 puts
2020-04-13 17:04:02 +00:00
2019-01-24 13:53:29 +00:00
stz CORE.EvtCount
lda /Evt.Table
sta pEvent+1
clc
2021-05-04 17:31:21 +00:00
rts
*--------------------------------------
TskMgrInit >LDYAI MSG.TSK
2019-06-10 13:52:20 +00:00
>SYSCALL2 puts
>LDYAI K.ENV.SIZE get a buffer for ENV
2020-02-17 16:55:02 +00:00
>SYSCALL NewStkObj Buffer in AUX mem
2021-05-04 17:31:21 +00:00
bcs .99
2020-02-17 16:55:02 +00:00
2019-01-22 16:35:42 +00:00
>STYA ZPPtr1
txa
2020-01-14 07:40:01 +00:00
2020-02-03 16:31:18 +00:00
ldy #S.PS.hENV
2020-02-28 07:21:46 +00:00
sta (pPS),y
2020-07-28 15:16:14 +00:00
2020-01-17 16:12:24 +00:00
sta SETWRITEAUX
2019-01-22 16:35:42 +00:00
lda #0
sta (ZPPtr1) make sure blank!!
2020-01-17 16:12:24 +00:00
sta CLRWRITEAUX
2020-07-28 15:16:14 +00:00
2021-07-24 20:42:23 +00:00
>PUSHWZ
>PUSHWZ
2020-03-13 16:10:36 +00:00
>SYSCALL OpenSession
bcs .99
2020-07-28 15:16:14 +00:00
2020-03-13 16:10:36 +00:00
sta S.Table.hSID
2020-07-28 15:16:14 +00:00
2020-03-13 16:10:36 +00:00
ldy #S.PS.hStdIn
lda (pPS),y
sta S.Table.hFile
lda #1
ldy #S.PS.hSession
sta (pPS),y
2020-07-28 15:16:14 +00:00
2019-04-30 16:08:47 +00:00
>LDYAI $2E0 Get ROOT from QC
2019-06-10 13:52:20 +00:00
>SYSCALL2 strdup
2021-05-04 17:31:21 +00:00
.99 bcs .9
2020-01-17 16:12:24 +00:00
txa
2019-07-22 16:28:44 +00:00
ldy #S.PS.hCWD
2020-02-28 07:21:46 +00:00
sta (pPS),y
2020-01-17 16:12:24 +00:00
2020-01-17 07:31:00 +00:00
>PUSHWI I.ENV.BOOT
2019-04-30 16:08:47 +00:00
>PUSHWI $2C0 Get BOOT from QC
2019-06-10 13:52:20 +00:00
>SYSCALL2 SetEnv
2021-05-04 17:31:21 +00:00
bcs .9
2020-01-17 07:31:00 +00:00
>PUSHWI I.ENV.ROOT
2019-04-30 16:08:47 +00:00
>PUSHWI $2E0 Get ROOT from QC
2019-06-10 13:52:20 +00:00
>SYSCALL2 SetEnv
bcs .9
2020-01-17 11:23:11 +00:00
>PUSHWI I.ENV.PATH
2019-06-10 13:52:20 +00:00
>SYSCALL2 PutEnv
bcs .9
2020-01-17 11:23:11 +00:00
>PUSHWI I.ENV.LIB
2019-06-10 13:52:20 +00:00
>SYSCALL2 PutEnv
bcs .9
2020-01-17 11:23:11 +00:00
>PUSHWI I.ENV.DRV
2019-06-10 13:52:20 +00:00
>SYSCALL2 PutEnv
.9 rts
*--------------------------------------
2019-04-09 15:47:33 +00:00
PwdMgrInit >LDYAI MSG.PWD
2019-06-10 13:52:20 +00:00
>SYSCALL2 puts
2020-02-14 07:21:56 +00:00
2020-03-12 16:44:11 +00:00
>LDYAI PWD.ETCPASSWD
2020-12-15 13:23:22 +00:00
>SYSCALL2 LoadStkObj
2019-04-15 05:40:13 +00:00
bcs .1
2020-03-12 16:44:11 +00:00
stx PWD.hUsrDB
>STYA PWD.UsrDBSize
2020-07-28 15:16:14 +00:00
2020-03-12 16:44:11 +00:00
>LDYAI PWD.ETCGROUP
2020-12-15 13:23:22 +00:00
>SYSCALL2 LoadStkObj
2020-03-12 16:44:11 +00:00
bcs .1
stx PWD.hGrpDB
>STYA PWD.GrpDBSize
2020-07-28 15:16:14 +00:00
.1
* clc
2020-03-12 16:44:11 +00:00
.9 rts
*--------------------------------------
2018-07-11 15:13:29 +00:00
* 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
2019-07-28 20:39:30 +00:00
beq ZP.IsDigit.9
ZP.IsDigit cmp #'0'
bcc ZP.IsDigit.9
2018-07-11 15:13:29 +00:00
cmp #'9'+1
rts
2019-07-28 20:39:30 +00:00
ZP.IsDigit.9 sec
2019-10-03 06:25:27 +00:00
rts
2018-07-11 15:13:29 +00:00
.EP
2019-10-03 06:25:27 +00:00
Kernel.ZP.S .EQ *-Kernel.ZP
2018-07-11 15:13:29 +00:00
*--------------------------------------
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
2019-10-03 06:25:27 +00:00
*--------------------------------------
2018-07-11 15:13:29 +00:00
Mouse.OFS .HS 05070B0CFB
Mouse.SIG .HS 38180120D6
2020-07-28 15:16:14 +00:00
*--------------------------------------
2020-11-23 22:05:27 +00:00
TClock.OFS .HS 00020406
2020-04-13 17:04:02 +00:00
TClock.SIG .HS 08285870
2018-07-11 15:13:29 +00:00
*--------------------------------------
2020-07-28 15:16:14 +00:00
SmartPort.OFS .HS 010305
SmartPort.SIG .HS 200003
*--------------------------------------
2018-07-12 15:20:39 +00:00
MSG.Init2 .AZ "A2osX[Stage2]:Init\nRelocating Kernel...\n"
MSG.HZ .AZ "Kernel SYS Timer Set For %d0 hz Machine.\n"
2018-07-13 14:38:24 +00:00
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"
2019-11-28 22:06:22 +00:00
MSG.PRODOSFX .AZ "!!!Running under ProDOS.FX!!! Enabling lowercase mode.\n"
2020-06-26 19:34:12 +00:00
MSG.Init2.OK .AZ "A2osX[Stage2]:Complete."
*--------------------------------------
2020-03-13 16:10:36 +00:00
MSG.Init3 .AZ "A2osX[Stage3]:Init *** Press Ctrl-R for entering ROOT Mode ***\r\n"
2018-08-22 15:23:27 +00:00
MSG.DEV .AZ "Device Manager..."
2020-01-28 16:42:51 +00:00
*--------------------------------------
MSG.BLKDEV .AZ " Adding Device: /dev/%s, Addr:%H, Type: %s\r\n"
2019-05-07 08:26:14 +00:00
MSG.BLKDEV.TBL .DA MSG.BLKDEV.RAM
.DA MSG.BLKDEV.DII
2019-05-06 12:58:15 +00:00
.DA MSG.BLKDEV.USR
.DA MSG.BLKDEV.BLK
.DA MSG.BLKDEV.SP
2020-01-13 11:05:11 +00:00
.DA MSG.BLKDEV.RSP
2019-05-06 12:58:15 +00:00
MSG.BLKDEV.RAM .AZ "/RAM Disk"
2019-05-07 08:26:14 +00:00
MSG.BLKDEV.DII .AZ "Disk ]["
2019-05-06 12:58:15 +00:00
MSG.BLKDEV.USR .AZ "User"
2020-01-28 16:42:51 +00:00
MSG.BLKDEV.BLK .AZ "Generic Block"
MSG.BLKDEV.SP .AZ "Smart Port"
MSG.BLKDEV.RSP .AZ "Remapped SP"
2021-04-29 11:56:34 +00:00
DRV.BLKDEVX .DA DRV.RamDrive
2020-01-28 16:42:51 +00:00
.DA DRV.DiskII
2021-04-29 11:56:34 +00:00
.DA DRV.BlkDev
.DA DRV.BlkDev
2020-01-28 16:42:51 +00:00
.DA DRV.SmartPort
2021-04-29 11:56:34 +00:00
.DA DRV.BlkDev
2020-01-28 16:42:51 +00:00
*--------------------------------------
2018-08-22 15:23:27 +00:00
MSG.IRQ .AZ "Interrupt Manager..."
2019-10-22 07:52:34 +00:00
MSG.IRQ.IIGS .AZ " Apple IIgs VBL IRQ Activated."
2020-09-24 15:31:48 +00:00
MSG.IRQ.MOUSE .AZ " Mouse Card VBL IRQ Activated."
2018-08-22 15:23:27 +00:00
MSG.IRQ.CLOCK .AZ " Clock Card IRQ Activated."
MSG.IRQ.POLL .AZ " Polling Mode."
MSG.EVT .AZ "Event Manager..."
MSG.TSK .AZ "Task Manager..."
2019-04-09 15:47:33 +00:00
MSG.PWD .AZ "Password Manager..."
2020-02-27 16:46:40 +00:00
MSG.EXEC .AZ "Executing %s..."
2020-08-19 19:39:43 +00:00
MSG.StartupErr .AZ "Failed : [$%h]\r\n"
2018-10-05 14:58:38 +00:00
MSG.Init3.OK .AZ "OK\r\nA2osX[Stage3]:Complete.\r\n"
*--------------------------------------
2019-10-21 14:25:37 +00:00
MSG.HW .AZ "Checking Hardware..."
MSG.HW.TypeSubT .AZ "Type=%h,SubT=%h\r\n"
MSG.CPU .AZ "Checking CPU..."
2018-07-13 14:38:24 +00:00
MSG.CPUTYPE .DA MSG.6502
.DA MSG.65C02
.DA MSG.65R02
.DA MSG.65816
2018-08-22 15:23:27 +00:00
MSG.6502 .AZ "6502."
MSG.65C02 .AZ "65C02."
MSG.65R02 .AZ "65R02."
MSG.65816 .AZ "65816."
2020-07-28 15:16:14 +00:00
MSG.CPU.SPEED .AZ "Checking CPU Speed (%d0Hz)..."
2018-07-13 14:38:24 +00:00
MSG.CPU.SPEEDOK .AZ "%d.%02d Mhz.\r\n"
2018-10-03 15:25:03 +00:00
MSG.Z80 .AZ "Checking Z80 CPU..."
2018-07-13 14:38:24 +00:00
MSG.Z80.OK .AZ "Detected In Slot %d.\r\n"
2018-08-22 15:23:27 +00:00
MSG.Z80.KO .AZ "Not Detected."
*--------------------------------------
2019-11-26 06:46:02 +00:00
DEV.CONSOLE .AZ "/dev/console"
2019-04-30 16:08:47 +00:00
RAMx .AZ "/RAMx"
I.ENV.BOOT .AZ "BOOT"
2018-11-17 17:17:13 +00:00
I.ENV.ROOT .AZ "ROOT"
2019-12-05 15:09:38 +00:00
I.ENV.PATH .AZ "PATH=${BOOT}sbin/:${BOOT}bin/"
2019-12-03 15:42:17 +00:00
I.ENV.LIB .AZ "LIB=${BOOT}lib/"
2019-12-05 15:09:38 +00:00
I.ENV.DRV .AZ "DRV=${BOOT}drv/"
2020-02-27 07:27:42 +00:00
SBININITD .AZ "${ROOT}sbin/initd"
2020-08-07 19:49:24 +00:00
.DA #0 end of ARGV for ExecV
*--------------------------------------
2021-05-04 17:31:21 +00:00
pMLIGFIEX .DA #2
.DA FNKConfig
2020-06-29 05:49:24 +00:00
.BS S.FIEX
2019-11-27 22:04:55 +00:00
*--------------------------------------
2021-05-04 17:31:21 +00:00
pMLIOPEN .DA #3
.DA FNKConfig
2020-07-28 15:16:14 +00:00
.DA $B000
.BS 1
2021-05-04 17:31:21 +00:00
FNKConfig >PSTR "A2osX.kconfig"
*--------------------------------------
2021-05-04 17:31:21 +00:00
pMLIREAD .DA #4
.BS 1
2018-10-08 05:55:28 +00:00
.DA A2osX.KCONFIG
.DA 16
.BS 2
*--------------------------------------
2021-05-04 17:31:21 +00:00
pMLICLOSE .DA #1
.BS 1
*--------------------------------------
2018-07-11 15:13:29 +00:00
FD.NULL .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
2018-12-11 16:41:25 +00:00
.DA #0 DEVID
2018-07-12 15:20:39 +00:00
.DA 0 BUSPTR
2018-07-11 15:13:29 +00:00
.DA DRV.NULL
2018-12-13 16:39:24 +00:00
.DA 0 DCBPTR
2018-12-11 16:41:25 +00:00
.DA 0 BUFPTR
2021-07-24 20:42:23 +00:00
*--------------------------------------
2019-11-26 06:46:02 +00:00
FD.NULL.NAME .AZ "null" NAME
2018-07-11 15:13:29 +00:00
*--------------------------------------
2018-12-10 16:45:37 +00:00
FD.TTY .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
2021-07-24 20:42:23 +00:00
.DA #0 DEVID
2018-12-11 16:41:25 +00:00
.DA 0 BUSPTR
2018-12-13 16:39:24 +00:00
.DA DRV.TERM
.BS 2 DCBPTR
2018-12-17 14:24:39 +00:00
.BS 2 BUFPTR
2018-12-13 16:39:24 +00:00
*--------------------------------------
2019-11-26 06:46:02 +00:00
FD.CONSOLE.NAME .AZ "console"
FD.TTY.NAME .AZ "tty0"
2018-12-10 16:45:37 +00:00
*--------------------------------------
2018-07-11 15:13:29 +00:00
FD.BDEV .DA #S.FD.T.BDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #0 DEVID
2018-07-12 15:20:39 +00:00
.BS 2 BUSPTR
2018-07-11 15:13:29 +00:00
.BS 2 DRVPTR
2018-12-13 16:39:24 +00:00
.DA 0 DCBPTR
2018-12-11 16:41:25 +00:00
.DA 0 BUFPTR
2021-07-24 20:42:23 +00:00
*--------------------------------------
2019-11-26 06:46:02 +00:00
FD.BDEV.NAME .AZ "s1d1"
2018-07-11 15:13:29 +00:00
*--------------------------------------
MAN
2020-07-08 15:26:23 +00:00
SAVE usr/src/sys/kernel.s.init
LOAD usr/src/sys/kernel.s
ASM