2017-12-22 22:24:30 +01:00
|
|
|
|
NEW
|
2019-05-08 21:41:46 +02:00
|
|
|
|
AUTO 3,1
|
2017-08-29 17:19:09 +02:00
|
|
|
|
*--------------------------------------
|
2020-09-24 17:31:48 +02:00
|
|
|
|
CORE.Run ldx #1
|
2018-10-15 17:39:21 +02:00
|
|
|
|
|
2020-09-24 17:31:48 +02:00
|
|
|
|
bra .80 Skip PS0
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2020-09-24 08:24:47 +02:00
|
|
|
|
.1 stx CORE.PSIndex
|
|
|
|
|
|
|
|
|
|
lda PS.Table.hPS,x
|
2018-04-26 17:38:02 +02:00
|
|
|
|
beq .8
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2018-06-21 17:12:10 +02:00
|
|
|
|
jsr K.GetMemPtr
|
2018-04-12 16:45:31 +01:00
|
|
|
|
>STYA pPs
|
2020-12-15 14:23:22 +01:00
|
|
|
|
lda (pPS) get S.PS.F
|
2019-07-22 18:28:44 +02:00
|
|
|
|
* bit #S.PS.F.HOLD Waiting for Another Task to Terminate?
|
|
|
|
|
* beq .2
|
|
|
|
|
|
|
|
|
|
bpl .2
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2017-08-29 17:19:09 +02:00
|
|
|
|
ldy #S.PS.CPID
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2018-06-22 08:24:35 +02:00
|
|
|
|
jsr CORE.GetPS
|
2017-09-20 17:09:55 +02:00
|
|
|
|
bcc .8 yes, still running....
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS) get S.PS.F again
|
2018-04-20 16:06:41 +01:00
|
|
|
|
eor #S.PS.F.HOLD unmark as HOLD
|
2020-02-28 08:21:46 +01:00
|
|
|
|
sta (pPS)
|
2020-09-24 08:24:47 +02:00
|
|
|
|
|
2019-01-21 14:51:10 +00:00
|
|
|
|
.2 jsr CORE.PSSelect Restore ZP & Ptrs
|
|
|
|
|
|
|
|
|
|
.3 jsr CORE.PSExec INIT/RUN/QUIT/RESUME
|
2018-04-26 17:38:02 +02:00
|
|
|
|
dec IRQ.InKernel
|
2019-01-24 13:53:29 +00:00
|
|
|
|
bcc .4 INIT/RUN Exit ?
|
2017-08-29 17:19:09 +02:00
|
|
|
|
|
2021-04-29 13:56:34 +02:00
|
|
|
|
jsr CORE.UpdPPS Yes, go Update Parent PS
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2019-07-22 18:28:44 +02:00
|
|
|
|
ldy #S.PS.S
|
2019-10-03 08:25:27 +02:00
|
|
|
|
lda #S.PS.S.QUIT
|
2020-02-28 08:21:46 +01:00
|
|
|
|
sta (pPS),y
|
2019-01-21 14:51:10 +00:00
|
|
|
|
bra .3 try executing QUIT now...
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2020-02-28 08:21:46 +01:00
|
|
|
|
.4 lda (pPS)
|
2018-04-26 17:38:02 +02:00
|
|
|
|
bit #S.PS.F.SLEEP
|
|
|
|
|
bne .7
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2019-07-22 18:28:44 +02:00
|
|
|
|
ldy #S.PS.S
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2019-07-22 18:28:44 +02:00
|
|
|
|
bne .5
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2019-10-03 08:25:27 +02:00
|
|
|
|
lda #S.PS.S.RUN go from INIT to RUN
|
2020-02-28 08:21:46 +01:00
|
|
|
|
sta (pPS),y
|
2018-04-26 17:38:02 +02:00
|
|
|
|
bra .7
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2019-10-03 08:25:27 +02:00
|
|
|
|
.5 cmp #S.PS.S.QUIT
|
2020-12-15 14:23:22 +01:00
|
|
|
|
bne .7
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2017-08-29 17:19:09 +02:00
|
|
|
|
ldy #S.PS.PID
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2020-09-24 17:31:48 +02:00
|
|
|
|
cmp #1 INITD ?
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
jmp CORE.Quit
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2021-04-10 19:17:40 +02:00
|
|
|
|
.6 >PUSHA PID
|
|
|
|
|
>PUSHBI 2 SIG
|
|
|
|
|
>SYSCALL2 Kill
|
2017-09-20 17:09:55 +02:00
|
|
|
|
bra .8
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2017-09-20 17:09:55 +02:00
|
|
|
|
.7 jsr CORE.PSLeave Save ZP & Ptrs
|
2020-09-22 17:34:51 +02:00
|
|
|
|
|
2020-09-24 08:24:47 +02:00
|
|
|
|
.8 ldx CORE.PSIndex
|
|
|
|
|
inx
|
2020-09-24 17:31:48 +02:00
|
|
|
|
.80 cpx CORE.PSCount
|
2019-10-03 08:25:27 +02:00
|
|
|
|
bne .1
|
2017-09-06 17:00:10 +02:00
|
|
|
|
*--------------------------------------
|
2017-09-20 17:09:55 +02:00
|
|
|
|
CORE.Events jsr CORE.GetEvents
|
2017-09-19 17:34:01 +02:00
|
|
|
|
bcs .4 CS=no event
|
|
|
|
|
|
2017-10-27 16:56:46 +02:00
|
|
|
|
jsr CORE.Dispatch
|
2017-09-19 17:34:01 +02:00
|
|
|
|
bcc .4 CC=All Events Dispatched
|
|
|
|
|
|
2019-01-24 13:53:29 +00:00
|
|
|
|
lda PS.Table.PID Select PS0
|
|
|
|
|
jsr K.GetMemPtr
|
|
|
|
|
>STYA pPs
|
|
|
|
|
>LDYAI K.STACKTOP
|
|
|
|
|
>STYA pStack
|
2017-10-27 08:36:46 +02:00
|
|
|
|
lda #Evt.Table
|
2017-09-19 17:34:01 +02:00
|
|
|
|
sta pEvent
|
2021-05-14 22:58:20 +02:00
|
|
|
|
|
2017-09-19 17:34:01 +02:00
|
|
|
|
.1 lda (pEvent)
|
|
|
|
|
beq .3
|
2020-09-24 08:24:47 +02:00
|
|
|
|
|
2021-05-14 22:58:20 +02:00
|
|
|
|
bpl .3
|
2020-09-24 08:24:47 +02:00
|
|
|
|
|
2021-05-14 22:58:20 +02:00
|
|
|
|
jsr CORE.DestroyEvent Discard any timer event
|
2017-09-06 17:00:10 +02:00
|
|
|
|
|
2017-09-19 17:34:01 +02:00
|
|
|
|
.3 lda pEvent
|
|
|
|
|
clc
|
|
|
|
|
adc #S.EVT
|
|
|
|
|
sta pEvent
|
2017-10-11 17:37:41 +02:00
|
|
|
|
lda CORE.EvtCount
|
2017-09-19 17:34:01 +02:00
|
|
|
|
bne .1
|
2020-12-15 14:23:22 +01:00
|
|
|
|
*--------------------------------------
|
2017-11-17 17:16:05 +01:00
|
|
|
|
.4 bit OPENAPPLE
|
2017-09-19 17:34:01 +02:00
|
|
|
|
bpl .8
|
2020-03-11 17:41:45 +01:00
|
|
|
|
|
2017-09-19 17:34:01 +02:00
|
|
|
|
lda KBD
|
|
|
|
|
bpl .8
|
2020-03-11 17:41:45 +01:00
|
|
|
|
|
2018-12-10 17:45:37 +01:00
|
|
|
|
cmp #"0"
|
2017-09-19 17:34:01 +02:00
|
|
|
|
bcc .8
|
2020-03-11 17:41:45 +01:00
|
|
|
|
|
|
|
|
|
cmp #"9"+1
|
2017-09-19 17:34:01 +02:00
|
|
|
|
bcs .8
|
2020-03-11 17:41:45 +01:00
|
|
|
|
|
2017-09-20 17:09:55 +02:00
|
|
|
|
sta KBDSTROBE
|
2021-07-24 22:42:23 +02:00
|
|
|
|
|
2019-04-25 17:33:56 +02:00
|
|
|
|
and #$0F
|
|
|
|
|
|
2020-03-12 08:46:43 +01:00
|
|
|
|
cmp A2osX.ASCREEN Same as active screen...nothing to do
|
2019-04-25 17:33:56 +02:00
|
|
|
|
beq .8
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2021-07-24 22:42:23 +02:00
|
|
|
|
tax
|
|
|
|
|
lda A2osX.SCRNDEVS,x Get DevID
|
|
|
|
|
beq .8 No device claimed this screen
|
|
|
|
|
|
2020-02-16 21:45:16 +01:00
|
|
|
|
>PUSHA
|
2019-04-25 17:33:56 +02:00
|
|
|
|
>PUSHBI IOCTL.CONTROL request
|
2020-02-16 21:45:16 +01:00
|
|
|
|
>PUSHWZ Param
|
|
|
|
|
>SYSCALL2 IOCTL
|
2017-09-19 17:34:01 +02:00
|
|
|
|
.8 jmp CORE.Run
|
2017-09-08 16:49:23 +02:00
|
|
|
|
*--------------------------------------
|
2020-11-25 17:29:06 +01:00
|
|
|
|
CORE.Quit php
|
|
|
|
|
sei
|
2023-01-11 19:34:34 +01:00
|
|
|
|
jsr CORE.IRQOff
|
2020-11-25 17:29:06 +01:00
|
|
|
|
|
|
|
|
|
plp
|
2020-09-24 17:31:48 +02:00
|
|
|
|
|
|
|
|
|
lda IRQ.INTNUM
|
|
|
|
|
sta K.MLI.PARAMS+1
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-09-24 17:31:48 +02:00
|
|
|
|
>MLICALL MLIDEALLOCIRQ
|
|
|
|
|
|
2022-03-06 23:28:52 +01:00
|
|
|
|
bit RDIOUDIS
|
|
|
|
|
sta SETIOUDIS
|
|
|
|
|
sta CLRDHIRES
|
|
|
|
|
bmi .1
|
2020-09-24 17:31:48 +02:00
|
|
|
|
|
2022-03-06 23:28:52 +01:00
|
|
|
|
sta CLRIOUDIS
|
|
|
|
|
|
|
|
|
|
.1 ldx #5
|
|
|
|
|
|
|
|
|
|
.2 stz K.MLI.PARAMS+1,x
|
2020-09-24 17:31:48 +02:00
|
|
|
|
dex
|
2022-03-06 23:28:52 +01:00
|
|
|
|
bpl .2
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-09-24 17:31:48 +02:00
|
|
|
|
lda #4
|
|
|
|
|
ldx #MLIQUIT
|
|
|
|
|
jmp GP.MLICall
|
|
|
|
|
*--------------------------------------
|
2021-04-29 13:56:34 +02:00
|
|
|
|
CORE.UpdPPS tax save RC From INIT or RUN
|
2019-01-24 13:53:29 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.PPID Notify Parent Process for exit code...
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2019-01-24 13:53:29 +00:00
|
|
|
|
beq .8 no parent process
|
2020-09-24 08:24:47 +02:00
|
|
|
|
|
2019-01-24 13:53:29 +00:00
|
|
|
|
jsr CORE.GetPSByID X unmodified
|
|
|
|
|
bcs .8 parent is dead.....skipping...
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1
|
2020-12-15 14:23:22 +01:00
|
|
|
|
lda (ZPPtr1) Parent PS is HOLD?
|
2021-09-07 14:32:31 +02:00
|
|
|
|
|
|
|
|
|
* bit #S.PS.F.HOLD
|
|
|
|
|
* beq .8 no...
|
|
|
|
|
|
|
|
|
|
bpl .8
|
2019-01-24 13:53:29 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.CPID
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
dey #S.PS.PID
|
2020-02-28 08:21:46 +01:00
|
|
|
|
cmp (pPS),y
|
2019-01-24 13:53:29 +00:00
|
|
|
|
bne .8 Hold, but not waiting this PS
|
2020-09-24 08:24:47 +02:00
|
|
|
|
|
2019-01-24 13:53:29 +00:00
|
|
|
|
txa waiting for this PS to terminate....
|
|
|
|
|
ldy #S.PS.RC give it RC
|
|
|
|
|
sta (ZPPtr1),y
|
2021-09-07 14:32:31 +02:00
|
|
|
|
|
2019-01-24 13:53:29 +00:00
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
eor #S.PS.F.HOLD release Parent PS HOLD...
|
|
|
|
|
sta (ZPPtr1)
|
2020-09-24 08:24:47 +02:00
|
|
|
|
|
2019-10-03 08:25:27 +02:00
|
|
|
|
* clc
|
2020-09-24 08:24:47 +02:00
|
|
|
|
|
2019-01-24 13:53:29 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2017-08-31 17:35:15 +02:00
|
|
|
|
* CORE.GetEvents :
|
|
|
|
|
* IN :
|
2020-12-15 14:23:22 +01:00
|
|
|
|
* OUT :
|
2017-08-31 17:35:15 +02:00
|
|
|
|
* CS = no event, A = ERROR
|
|
|
|
|
* CC * event in YA
|
|
|
|
|
* (pEvent)
|
|
|
|
|
*--------------------------------------
|
2017-10-27 08:36:46 +02:00
|
|
|
|
CORE.GetEvents lda #Evt.Table
|
2017-08-31 17:35:15 +02:00
|
|
|
|
sta pEvent point to start of event list
|
2017-10-11 17:37:41 +02:00
|
|
|
|
stz CORE.EvtCount reset Size
|
2020-11-19 16:34:02 +01:00
|
|
|
|
bit A2osX.IRQMode do we have IRQ enabled for Ticks ?
|
2017-10-11 17:37:41 +02:00
|
|
|
|
bpl .1 no, regular poll
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2018-04-10 16:03:29 +01:00
|
|
|
|
lda IRQ.Tick a Tick ?
|
2017-10-11 17:37:41 +02:00
|
|
|
|
beq .8 no, no event
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2018-04-10 16:03:29 +01:00
|
|
|
|
dec IRQ.Tick
|
2017-10-11 17:37:41 +02:00
|
|
|
|
bra .2
|
2019-10-03 08:25:27 +02:00
|
|
|
|
|
2017-10-11 17:37:41 +02:00
|
|
|
|
.1 lda VBL get VLINE status
|
2017-08-31 17:35:15 +02:00
|
|
|
|
tax
|
2020-12-15 14:23:22 +01:00
|
|
|
|
eor CORE.VBLState
|
2017-10-11 17:37:41 +02:00
|
|
|
|
bpl .8 no change,no tick
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2017-08-31 17:35:15 +02:00
|
|
|
|
txa
|
2017-10-11 17:37:41 +02:00
|
|
|
|
sta CORE.VBLState save new
|
|
|
|
|
bpl .8 Up2down transition,no tick
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2017-12-18 17:36:21 +01:00
|
|
|
|
.2 lda #0
|
2017-10-11 17:37:41 +02:00
|
|
|
|
dec CORE.TickSec
|
2017-12-18 17:36:21 +01:00
|
|
|
|
bne .3 not yet One Sec
|
2017-08-31 17:35:15 +02:00
|
|
|
|
|
2018-12-17 08:02:03 +01:00
|
|
|
|
lda IRQ.Mode
|
2017-12-18 17:36:21 +01:00
|
|
|
|
eor #$C0
|
2018-12-17 08:02:03 +01:00
|
|
|
|
sta IRQ.Mode
|
2021-07-24 22:42:23 +02:00
|
|
|
|
|
|
|
|
|
ldx A2osX.ASCREEN /DEV/CONSOLE
|
2018-12-17 08:02:03 +01:00
|
|
|
|
bne .22
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2017-12-18 17:36:21 +01:00
|
|
|
|
sta SYS.BASL0+38
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2018-12-17 08:02:03 +01:00
|
|
|
|
.22 ldx CORE.TickPerSec
|
2017-10-11 17:37:41 +02:00
|
|
|
|
stx CORE.TickSec
|
2017-08-31 17:35:15 +02:00
|
|
|
|
|
2017-12-18 17:36:21 +01:00
|
|
|
|
lda #S.EVT.F.T1SEC
|
|
|
|
|
bra .4 Force Resync T1 & T10...
|
2017-08-31 17:35:15 +02:00
|
|
|
|
|
2017-12-18 17:36:21 +01:00
|
|
|
|
.3 dec CORE.Tick10t
|
|
|
|
|
bne .6
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-01-11 18:13:27 +01:00
|
|
|
|
.4 inc DevMgr.Timer
|
|
|
|
|
inc A2osX.TIMER16
|
2017-12-18 17:36:21 +01:00
|
|
|
|
bne .5
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2017-12-18 17:36:21 +01:00
|
|
|
|
inc A2osX.TIMER16+1
|
|
|
|
|
|
|
|
|
|
.5 ldx CORE.TickPer10t
|
2017-10-11 17:37:41 +02:00
|
|
|
|
stx CORE.Tick10t
|
2017-08-31 17:35:15 +02:00
|
|
|
|
|
2017-10-11 17:37:41 +02:00
|
|
|
|
ora #S.EVT.F.T10TH
|
2017-12-18 17:36:21 +01:00
|
|
|
|
.6 tax Finally, do we have an event ?
|
2017-10-11 17:37:41 +02:00
|
|
|
|
beq .8 no....
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2017-10-11 17:37:41 +02:00
|
|
|
|
sta (pEvent)
|
|
|
|
|
inc CORE.EvtCount Add one event to Queue
|
2017-08-31 17:35:15 +02:00
|
|
|
|
|
2017-10-11 17:37:41 +02:00
|
|
|
|
* lda pEvent
|
|
|
|
|
* clc
|
|
|
|
|
* adc #S.EVT
|
|
|
|
|
* sta pEvent if CS, EVT queue full!!! ($100)
|
|
|
|
|
|
|
|
|
|
* MORE EVENT PROCESSING HERE
|
2017-08-31 17:35:15 +02:00
|
|
|
|
|
2017-10-11 17:37:41 +02:00
|
|
|
|
.8 lda CORE.EvtCount if 0, exit with CS (from cmp), and A=0 "no event"
|
2017-08-31 17:35:15 +02:00
|
|
|
|
beq .9
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2017-10-11 17:37:41 +02:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-11-19 16:34:02 +01:00
|
|
|
|
|
2017-10-11 17:37:41 +02:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2017-08-31 17:35:15 +02:00
|
|
|
|
*--------------------------------------
|
2017-10-27 16:56:46 +02:00
|
|
|
|
* CORE.Dispatch
|
2020-12-15 14:23:22 +01:00
|
|
|
|
* IN:
|
2017-08-29 17:19:09 +02:00
|
|
|
|
* OUT:
|
|
|
|
|
* CS: Not Dispatched
|
2020-12-15 14:23:22 +01:00
|
|
|
|
* CC: Event Cleared
|
2017-08-29 17:19:09 +02:00
|
|
|
|
*--------------------------------------
|
2020-09-24 08:24:47 +02:00
|
|
|
|
CORE.Dispatch ldx #1 skip PS0
|
2020-09-24 17:31:48 +02:00
|
|
|
|
bra .80
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-09-24 08:24:47 +02:00
|
|
|
|
.1 stx CORE.PSIndex
|
|
|
|
|
|
|
|
|
|
lda PS.Table.hPS,x
|
2017-09-20 17:09:55 +02:00
|
|
|
|
beq .5
|
2020-09-24 08:24:47 +02:00
|
|
|
|
|
2018-06-21 17:12:10 +02:00
|
|
|
|
jsr K.GetMemPtr
|
2017-09-19 17:34:01 +02:00
|
|
|
|
>STYA pPS
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS)
|
2017-08-29 17:19:09 +02:00
|
|
|
|
bit #S.PS.F.EVENT Accept Events ?
|
2017-09-20 17:09:55 +02:00
|
|
|
|
beq .5
|
2017-08-29 17:19:09 +02:00
|
|
|
|
|
2019-07-22 18:28:44 +02:00
|
|
|
|
ldy #S.PS.S
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2019-10-03 08:25:27 +02:00
|
|
|
|
cmp #S.PS.S.RUN
|
2019-07-22 18:28:44 +02:00
|
|
|
|
bne .5
|
|
|
|
|
|
2019-10-03 08:25:27 +02:00
|
|
|
|
lda #S.PS.S.DOEVENT Flag this PS for IRQ Mgr
|
2020-02-28 08:21:46 +01:00
|
|
|
|
sta (pPS),y
|
2018-04-13 16:18:48 +01:00
|
|
|
|
jsr CORE.PSSelect
|
2017-08-29 17:19:09 +02:00
|
|
|
|
|
2017-10-27 08:36:46 +02:00
|
|
|
|
lda #Evt.Table
|
2017-08-29 17:19:09 +02:00
|
|
|
|
sta pEvent Select first event in list
|
2017-10-11 17:37:41 +02:00
|
|
|
|
lda CORE.EvtCount
|
2018-04-26 17:38:02 +02:00
|
|
|
|
sta CORE.EvtIndex
|
2017-08-29 17:19:09 +02:00
|
|
|
|
|
|
|
|
|
.2 lda (pEvent) Empty event, select next
|
|
|
|
|
beq .3
|
2021-02-17 17:15:43 +01:00
|
|
|
|
|
|
|
|
|
ldx #S.PS.S.DOEVENT
|
|
|
|
|
jsr CORE.PSExecX
|
2018-04-12 16:45:31 +01:00
|
|
|
|
dec IRQ.InKernel
|
2018-04-26 17:38:02 +02:00
|
|
|
|
|
2017-08-29 17:19:09 +02:00
|
|
|
|
bcs .3 not for this PS, try next event in list
|
|
|
|
|
jsr CORE.DestroyEvent this PS handled the EVT, destroy it...
|
2018-04-26 17:38:02 +02:00
|
|
|
|
|
2017-10-11 17:37:41 +02:00
|
|
|
|
lda CORE.EvtCount
|
2018-04-26 17:38:02 +02:00
|
|
|
|
beq .4 no more event, exit
|
2017-08-29 17:19:09 +02:00
|
|
|
|
|
2018-04-26 17:38:02 +02:00
|
|
|
|
.3 dec CORE.EvtIndex
|
2017-08-29 17:19:09 +02:00
|
|
|
|
beq .4 all EVT submitted to this PS, try other PS
|
2021-02-17 17:15:43 +01:00
|
|
|
|
|
2017-08-29 17:19:09 +02:00
|
|
|
|
lda pEvent try next EVT to this PS
|
|
|
|
|
clc
|
|
|
|
|
adc #S.EVT
|
|
|
|
|
sta pEvent
|
|
|
|
|
bra .2
|
2017-09-20 17:09:55 +02:00
|
|
|
|
|
2019-07-22 18:28:44 +02:00
|
|
|
|
.4 ldy #S.PS.S
|
2019-10-03 08:25:27 +02:00
|
|
|
|
lda #S.PS.S.RUN
|
2020-02-28 08:21:46 +01:00
|
|
|
|
sta (pPS),y
|
2019-07-22 18:28:44 +02:00
|
|
|
|
jsr CORE.PSLeave
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-09-24 08:24:47 +02:00
|
|
|
|
.5 ldx CORE.PSIndex
|
|
|
|
|
inx
|
2020-09-24 17:31:48 +02:00
|
|
|
|
.80 cpx CORE.PSCount
|
2017-09-19 17:34:01 +02:00
|
|
|
|
bne .1
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2019-04-15 16:29:07 +01:00
|
|
|
|
* sec
|
2020-09-24 17:31:48 +02:00
|
|
|
|
|
2017-08-29 17:19:09 +02:00
|
|
|
|
rts
|
2017-09-19 17:34:01 +02:00
|
|
|
|
*--------------------------------------
|
2018-10-15 17:39:21 +02:00
|
|
|
|
* X unmodified
|
2017-09-20 17:09:55 +02:00
|
|
|
|
*--------------------------------------
|
2019-01-24 13:53:29 +00:00
|
|
|
|
CORE.GetPSByID jsr CORE.GetPS
|
2021-05-04 19:31:21 +02:00
|
|
|
|
bcs .9
|
2021-04-29 13:56:34 +02:00
|
|
|
|
|
2018-10-17 17:31:29 +02:00
|
|
|
|
lda PS.TABLE.hPS,y
|
2018-06-21 17:12:10 +02:00
|
|
|
|
jmp K.GetMemPtr
|
2021-05-04 19:31:21 +02:00
|
|
|
|
|
|
|
|
|
.9 rts
|
2018-10-17 17:31:29 +02:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* X,A unmodified
|
2017-11-22 17:27:50 +01:00
|
|
|
|
*--------------------------------------
|
2019-01-24 13:53:29 +00:00
|
|
|
|
CORE.GetPS tay
|
2021-04-29 13:56:34 +02:00
|
|
|
|
beq .8 PS0 requested
|
2019-01-24 13:53:29 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
bra .2 Skip PS0
|
2021-04-29 13:56:34 +02:00
|
|
|
|
|
2018-10-15 17:39:21 +02:00
|
|
|
|
.1 cmp PS.Table.PID,y
|
2021-04-29 13:56:34 +02:00
|
|
|
|
beq .8
|
|
|
|
|
|
2019-01-24 13:53:29 +00:00
|
|
|
|
.2 iny
|
2018-10-23 17:36:57 +02:00
|
|
|
|
cpy CORE.PSCount
|
2017-09-20 17:09:55 +02:00
|
|
|
|
bne .1
|
2021-04-29 13:56:34 +02:00
|
|
|
|
|
2018-10-21 22:54:07 +02:00
|
|
|
|
.9 lda #E.NSP
|
2018-10-15 17:39:21 +02:00
|
|
|
|
* sec
|
2019-01-26 14:01:05 +00:00
|
|
|
|
rts
|
2021-04-29 13:56:34 +02:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2021-05-04 19:31:21 +02:00
|
|
|
|
rts
|
2017-09-20 17:09:55 +02:00
|
|
|
|
*--------------------------------------
|
2017-08-29 17:19:09 +02:00
|
|
|
|
CORE.DestroyEvent
|
|
|
|
|
lda (pEvent)
|
|
|
|
|
beq .9
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2017-08-29 17:19:09 +02:00
|
|
|
|
bit #S.EVT.F.hMEM1
|
|
|
|
|
beq .1
|
|
|
|
|
pha
|
2017-10-27 08:36:46 +02:00
|
|
|
|
ldy #S.EVT.B1
|
2017-08-29 17:19:09 +02:00
|
|
|
|
lda (pEvent),y
|
2018-06-21 17:12:10 +02:00
|
|
|
|
jsr K.FreeMem
|
2017-08-29 17:19:09 +02:00
|
|
|
|
pla
|
|
|
|
|
.1 bit #S.EVT.F.hMEM2
|
|
|
|
|
beq .2
|
2017-10-27 08:36:46 +02:00
|
|
|
|
ldy #S.EVT.B2
|
2017-08-29 17:19:09 +02:00
|
|
|
|
lda (pEvent),y
|
2018-06-21 17:12:10 +02:00
|
|
|
|
jsr K.FreeMem
|
2017-08-29 17:19:09 +02:00
|
|
|
|
.2 lda #0
|
|
|
|
|
sta (pEvent)
|
2017-10-11 17:37:41 +02:00
|
|
|
|
dec CORE.EvtCount
|
2017-08-29 17:19:09 +02:00
|
|
|
|
.9 rts
|
2017-09-19 17:34:01 +02:00
|
|
|
|
*--------------------------------------
|
2020-02-04 15:35:48 +01:00
|
|
|
|
CORE.PSSelect ldy #S.PS.ZP.CODE+PSCTX.SIZE-1
|
2019-07-18 17:55:43 +02:00
|
|
|
|
ldx #PSCTX.SIZE-1
|
2018-04-26 17:38:02 +02:00
|
|
|
|
|
2020-02-28 08:21:46 +01:00
|
|
|
|
.1 lda (pPS),y
|
2020-02-04 15:35:48 +01:00
|
|
|
|
sta pCode,x
|
2018-04-10 16:03:29 +01:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2017-09-19 17:34:01 +02:00
|
|
|
|
rts
|
2018-04-26 17:38:02 +02:00
|
|
|
|
*--------------------------------------
|
2020-02-04 15:35:48 +01:00
|
|
|
|
CORE.PSLeave ldx #PSCTX.SIZE-1
|
|
|
|
|
ldy #S.PS.ZP.CODE+PSCTX.SIZE-1
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-02-04 15:35:48 +01:00
|
|
|
|
.1 lda pCode,x
|
2020-02-28 08:21:46 +01:00
|
|
|
|
sta (pPS),y
|
2017-09-19 17:34:01 +02:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2021-01-17 22:48:54 +01:00
|
|
|
|
|
2018-04-10 16:03:29 +01:00
|
|
|
|
rts
|
2017-08-29 17:19:09 +02:00
|
|
|
|
*--------------------------------------
|
2019-01-21 14:51:10 +00:00
|
|
|
|
CORE.PSExec lda (pPS)
|
2018-04-26 17:38:02 +02:00
|
|
|
|
bit #S.PS.F.SLEEP
|
|
|
|
|
bne CORE.PSResume
|
2019-10-03 08:25:27 +02:00
|
|
|
|
|
2021-02-17 17:15:43 +01:00
|
|
|
|
ldy #S.PS.S
|
2019-07-22 18:28:44 +02:00
|
|
|
|
lda (pPS),y
|
|
|
|
|
tax
|
2021-02-17 17:15:43 +01:00
|
|
|
|
|
|
|
|
|
CORE.PSExecX lda pCode+1
|
2018-04-26 17:38:02 +02:00
|
|
|
|
pha
|
|
|
|
|
lda pCode
|
|
|
|
|
pha
|
|
|
|
|
php
|
2018-04-20 16:06:41 +01:00
|
|
|
|
sei
|
2018-04-26 17:38:02 +02:00
|
|
|
|
inc IRQ.InKernel
|
|
|
|
|
rti
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.PSResume sei
|
|
|
|
|
|
|
|
|
|
eor #S.PS.F.SLEEP unmark as SLEEP
|
|
|
|
|
sta (pPS)
|
|
|
|
|
|
2020-12-15 14:23:22 +01:00
|
|
|
|
>PULLA Get !BC
|
2018-04-26 17:38:02 +02:00
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
.1 >PULLA
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
bne .1
|
2021-01-17 22:48:54 +01:00
|
|
|
|
|
2018-04-26 17:38:02 +02:00
|
|
|
|
.2 ldy #S.PS.PC+1
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2018-04-26 17:38:02 +02:00
|
|
|
|
pha
|
|
|
|
|
dey #S.PS.PC
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2018-04-26 17:38:02 +02:00
|
|
|
|
pha
|
|
|
|
|
dey #S.PS.P
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2018-04-26 17:38:02 +02:00
|
|
|
|
pha
|
|
|
|
|
dey #S.PS.Y
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2018-04-26 17:38:02 +02:00
|
|
|
|
pha
|
|
|
|
|
dey #S.PS.X
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2018-04-26 17:38:02 +02:00
|
|
|
|
tax
|
|
|
|
|
dey #S.PS.A
|
2020-02-28 08:21:46 +01:00
|
|
|
|
lda (pPS),y
|
2018-04-26 17:38:02 +02:00
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
inc IRQ.InKernel
|
|
|
|
|
rti
|
|
|
|
|
*--------------------------------------
|
2020-02-16 21:45:16 +01:00
|
|
|
|
CORE.VBLState .BS 1
|
|
|
|
|
CORE.TickPerSec .BS 1
|
|
|
|
|
CORE.TickPer10t .BS 1
|
|
|
|
|
CORE.TickSec .BS 1
|
|
|
|
|
CORE.Tick10t .BS 1
|
|
|
|
|
CORE.CPUStatCnt .DA #100
|
|
|
|
|
CORE.LastPSID .DA #0
|
|
|
|
|
*--------------------------------------
|
2019-04-15 06:40:13 +01:00
|
|
|
|
CORE.EvtIndex .BS 1
|
|
|
|
|
CORE.EvtCount .BS 1
|
|
|
|
|
*--------------------------------------
|
2023-01-11 19:34:34 +01:00
|
|
|
|
* Called by IIgs formware, Native Mode, 8bits
|
2020-09-04 17:21:15 +02:00
|
|
|
|
*--------------------------------------
|
2023-01-11 19:34:34 +01:00
|
|
|
|
CORE.IRQGS .OP 65816
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
phb
|
|
|
|
|
phx
|
|
|
|
|
phy
|
|
|
|
|
|
|
|
|
|
phk
|
|
|
|
|
plb
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
stz IO.IIGS.CLRVBLINT
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2023-01-11 19:34:34 +01:00
|
|
|
|
jsr CORE.IRQ.Switch
|
|
|
|
|
|
|
|
|
|
ply
|
|
|
|
|
plx
|
|
|
|
|
plb
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
* clc
|
|
|
|
|
rtl
|
|
|
|
|
|
|
|
|
|
* bra CORE.IRQ.Switch
|
|
|
|
|
.OP 65C02
|
2020-09-04 17:21:15 +02:00
|
|
|
|
*--------------------------------------
|
2023-01-11 19:34:34 +01:00
|
|
|
|
* Called by :
|
|
|
|
|
* - Kernel IRQ Manager (AuxLC)
|
|
|
|
|
* - ProDOS IRQ Manager (GP)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.IRQTK ldy IRQ.n0
|
2020-09-04 17:21:15 +02:00
|
|
|
|
|
|
|
|
|
lda $c080,y
|
|
|
|
|
and #$20
|
2020-09-24 17:31:48 +02:00
|
|
|
|
beq CORE.IRQ.DEV
|
2020-09-04 17:21:15 +02:00
|
|
|
|
|
|
|
|
|
lda $c088,y
|
|
|
|
|
lda $c080,y
|
|
|
|
|
|
2020-09-24 17:31:48 +02:00
|
|
|
|
bra CORE.IRQ.Switch
|
2020-09-04 17:21:15 +02:00
|
|
|
|
*--------------------------------------
|
2023-01-11 19:34:34 +01:00
|
|
|
|
CORE.IRQM jsr $FFFF SELF MODIFIED,SERVEMOUSE
|
2020-09-24 17:31:48 +02:00
|
|
|
|
bcs CORE.IRQ.DEV Not From Mouse
|
|
|
|
|
|
2020-09-25 14:05:23 +02:00
|
|
|
|
ldx IRQ.0n
|
2020-09-04 17:21:15 +02:00
|
|
|
|
lda MOUSESTSx,x
|
|
|
|
|
and #MOUSESTSx.INTVBL IRQ was caused by VBL ?
|
2020-09-24 17:31:48 +02:00
|
|
|
|
beq CORE.IRQ.DEV
|
|
|
|
|
|
2023-01-11 19:34:34 +01:00
|
|
|
|
ldx CORE.IRQM.2+2 $Cn
|
2020-09-25 14:05:23 +02:00
|
|
|
|
ldy IRQ.n0
|
2020-09-24 17:31:48 +02:00
|
|
|
|
|
2023-01-11 19:34:34 +01:00
|
|
|
|
CORE.IRQM.2 jsr $FFFF SELF MODIFIED,READMOUSE
|
2020-09-04 17:21:15 +02:00
|
|
|
|
*--------------------------------------
|
2020-09-24 17:31:48 +02:00
|
|
|
|
CORE.IRQ.Switch inc IRQ.Tick
|
2020-09-04 17:21:15 +02:00
|
|
|
|
|
|
|
|
|
dec CORE.CPUStatCnt
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
lda #100
|
|
|
|
|
sta CORE.CPUStatCnt
|
|
|
|
|
ldx #K.PS.MAX-1
|
|
|
|
|
|
|
|
|
|
.1 lda PS.Table.Hits,x
|
|
|
|
|
stz PS.Table.Hits,x
|
|
|
|
|
sta PS.Table.Stats,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
.2 lda IRQ.InKernel
|
|
|
|
|
bpl .3
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
inc PS.Table.Hits
|
|
|
|
|
|
|
|
|
|
.9 clv
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 ldx CORE.PSIndex
|
|
|
|
|
inc PS.Table.Hits,x
|
|
|
|
|
|
|
|
|
|
bit A2osX.F A2osX.F.PMODE .EQ %01000000
|
|
|
|
|
bvc .8
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.S
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
eor #S.PS.S.RUN
|
|
|
|
|
bne .9
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
lda IRQ.InLib
|
|
|
|
|
bmi .9 we are in LIB, no switching
|
|
|
|
|
|
|
|
|
|
.8 clc exit with V flag set
|
|
|
|
|
rts
|
2020-12-15 14:23:22 +01:00
|
|
|
|
*--------------------------------------
|
2020-09-24 17:31:48 +02:00
|
|
|
|
CORE.IRQ.DEV ldx #0
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
.1 lda IRQ.Vectors+1,x
|
|
|
|
|
beq .9
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
sta .10+2
|
|
|
|
|
lda IRQ.Vectors,x
|
|
|
|
|
sta .10+1
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
phx
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
.10 jsr $ffff SELF MODIFIED
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
plx
|
|
|
|
|
bcc .8 CC, IRQ cleared by device
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
.2 inx
|
|
|
|
|
inx
|
|
|
|
|
.3 cpx #K.IRQDEV.MAX*2
|
|
|
|
|
bne .1
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
.9 sec
|
2021-05-15 16:35:24 +02:00
|
|
|
|
|
2020-09-04 17:21:15 +02:00
|
|
|
|
.8 clv clear V (no task switching)
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2023-01-11 19:34:34 +01:00
|
|
|
|
CORE.IRQGSOff .OP 65816
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
xce go to native mode
|
|
|
|
|
rep #$30 long M,X
|
|
|
|
|
|
|
|
|
|
pea $0003 Disable vertical blanking interrupts
|
|
|
|
|
>TKCALL IntSource
|
|
|
|
|
bcs *
|
|
|
|
|
|
|
|
|
|
pea $000C Vertical blanking interrupt handler
|
|
|
|
|
lda IRQ.GSVect+2
|
|
|
|
|
pha
|
|
|
|
|
lda IRQ.GSVect
|
|
|
|
|
pha
|
|
|
|
|
>TKCALL SetVector
|
|
|
|
|
bcs *
|
|
|
|
|
|
|
|
|
|
sep #$30 short M,X
|
|
|
|
|
sec
|
|
|
|
|
xce back to emulation mode
|
|
|
|
|
|
|
|
|
|
.OP 65C02
|
2020-09-24 17:31:48 +02:00
|
|
|
|
|
|
|
|
|
rts
|
2020-11-25 17:29:06 +01:00
|
|
|
|
*--------------------------------------
|
2023-01-11 19:34:34 +01:00
|
|
|
|
CORE.IRQTKOff ldx IRQ.n0
|
2020-09-24 17:31:48 +02:00
|
|
|
|
stz $c080,x
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
|
|
|
|
lda $c088,x
|
|
|
|
|
lda $c080,x
|
|
|
|
|
|
2020-09-25 14:05:23 +02:00
|
|
|
|
ldx IRQ.0n
|
2020-11-25 17:29:06 +01:00
|
|
|
|
stz $478,x
|
2020-12-15 14:23:22 +01:00
|
|
|
|
stz $7f8,x
|
2021-04-29 13:56:34 +02:00
|
|
|
|
*--------------------------------------
|
2023-01-11 19:34:34 +01:00
|
|
|
|
CORE.IRQOff rts
|
2020-11-25 17:29:06 +01:00
|
|
|
|
*--------------------------------------
|
2023-01-11 19:34:34 +01:00
|
|
|
|
CORE.IRQMOff ldy CORE.IRQMOff.1+2 Cn
|
2020-09-25 14:05:23 +02:00
|
|
|
|
ldy IRQ.n0
|
2020-09-24 17:31:48 +02:00
|
|
|
|
lda #0
|
2023-01-11 19:34:34 +01:00
|
|
|
|
CORE.IRQMOff.1 jmp $ffff SELF MODIFIED
|
2020-09-24 17:31:48 +02:00
|
|
|
|
*--------------------------------------
|
2020-08-23 21:46:37 +02:00
|
|
|
|
IRQ.InKernel .BS 1
|
|
|
|
|
IRQ.InLib .BS 1
|
2020-09-25 14:05:23 +02:00
|
|
|
|
IRQ.Skip .BS 1
|
2020-08-23 21:46:37 +02:00
|
|
|
|
|
2023-01-11 19:34:34 +01:00
|
|
|
|
IRQ.GSVect .BS 4
|
|
|
|
|
|
2020-08-23 21:46:37 +02:00
|
|
|
|
IRQ.IntNum .BS 1
|
2020-09-25 14:05:23 +02:00
|
|
|
|
IRQ.n0 .BS 1
|
|
|
|
|
IRQ.0n .BS 1
|
2020-08-23 21:46:37 +02:00
|
|
|
|
IRQ.Mode .BS 1
|
|
|
|
|
IRQ.Tick .BS 1
|
|
|
|
|
*--------------------------------------
|
2020-09-04 17:21:15 +02:00
|
|
|
|
IRQ.Vectors .BS K.IRQDEV.MAX*2
|
|
|
|
|
*--------------------------------------
|
2017-08-29 17:19:09 +02:00
|
|
|
|
MAN
|
2020-12-15 14:23:22 +01:00
|
|
|
|
SAVE usr/src/sys/kernel.s.core
|
|
|
|
|
LOAD usr/src/sys/kernel.s
|
2017-08-29 17:19:09 +02:00
|
|
|
|
ASM
|