# HG changeset patch # User boisy # Date 1113011664 0 # Node ID 49c4db9a5f6960cad441da29a55e4c38802c0fd9 # Parent 9d95e3246a613e2a68a368c8186f92f8abf673f2 Comment additions diff -r 9d95e3246a61 -r 49c4db9a5f69 level2/modules/kernel/krn.asm --- a/level2/modules/kernel/krn.asm Fri Apr 08 02:37:48 2005 +0000 +++ b/level2/modules/kernel/krn.asm Sat Apr 09 01:54:24 2005 +0000 @@ -57,11 +57,11 @@ fdb L0CD2+Where D.Clock absolute address at the start fdb XSWI3+Where D.XSWI3 fdb XSWI2+Where D.XSWI2 - fdb D.Crash D.XFIRQ crash on an FIRQ + fdb D.Crash D.XFIRQ crash on an FIRQ fdb XIRQ+Where D.XIRQ fdb XSWI+Where D.XSWI - fdb D.Crash D.XNMI crash on an NMI - fdb $0055 D.ErrRst ??? Not used as far as I can tell + fdb D.Crash D.XNMI crash on an NMI + fdb $0055 D.ErrRst ??? Not used as far as I can tell fdb Sys.Vec+Where Initial Kernel system call vector DisSize equ *-DisTable * DO NOT ADD ANYTHING BETWEEN THESE 2 TABLES: see code using 'SubSiz', below @@ -92,28 +92,12 @@ * Let's start by initializing system page entry equ * - ifeq Level-1 ifne H6309 - ldq #(D.FMBM*256)+($400-D.FMBM) - leay ================================== -* | | -* | | -* $0020-$0111 | System Globals (D.FMBM-D.XNMI) | -* | | -* | | -* $0200---->|==================================| -* | Free Memory Bitmap | -* $0200-$021F | (1 bit = 256 byte page) | -* |----------------------------------| -* | System Dispatch Table | -* $0222-$0291 | (Room for 56 addresses) | -* |----------------------------------| -* $0292-$02FF | User Dispatch Table | -* | (Room for 56 addresses) | -* $0300---->|==================================| -* | | -* | | -* $0300-$03FF | Module Directory Entries | -* | (Room for 64 entries) | -* | | -* $0400---->|==================================| -* | | -* $0400-$04FF | System Stack | -* | | -* $0500---->|==================================| - - ldd #$200 - std $0100,x S = $500 (system stack) - else std R.Flip0,pc - ldu #LowSub somewhere in block 0 that's never modified + ldu #LowSub somewhere in block 0 that's never modified stu SysCall,pc Setup System service routine entry vector @@ -261,7 +198,7 @@ leax >S.SvcIRQ,pc Setup in system IRQ service vector stx S.Poll,pc Setup interrupt polling vector - stx S.AltIRQ,pc Setup alternate IRQ vector: pts to an RTS stx $FFA5 Map block into block 6 of my task +L0111 asld get next block # + stb >$FFA5 Map block into block 6 of my task ste >-$6000,x save marker to that block - cmpe ,x did it ghost to block 0? - bne L0111 No, keep going till ghost is found + cmpe ,x did it ghost to block 0? + bne L0111 No, keep going till ghost is found stb $FFA5 map blocks in + std >$FFA5 map blocks in ifne H6309 - ldw #R$Size get size of register stack - tfm x+,y+ copy it + ldw #R$Size get size of register stack + tfm x+,y+ copy it else ldb #R$Size Loop5 lda ,x+ @@ -658,59 +595,59 @@ * Process software interupts from system state * Entry: U=Register stack pointer -SysCall leau ,s get pointer to register stack +SysCall leau ,s get pointer to register stack lda D.SvcIRQ] execute irq service bcc L0D5B - ldx D.SvcIRQ] (Normally routine in Clock calling D.Poll) inc DAT.Task Save to GIME as well & return @@ -834,16 +772,16 @@ L0E28 rti * return from a system call -L0E29 clra Force System task # to 0 (non-GRDRV) +L0E29 clra Force System task # to 0 (non-GRDRV) L0E2B ldx DAT.Task Save to GIME as well & return -Fst2 leas ,u Stack ptr=U & return +Fst2 leas ,u Stack ptr=U & return rti * Switch to new process, X=Process descriptor pointer, U=Stack pointer @@ -857,14 +795,14 @@ sta DAT.Task save it to GIME - leas ,y point to new stack - tstb is the stack at SWISTACK? - bne MyRTI no, we're doing a system-state rti + leas ,y point to new stack + tstb is the stack at SWISTACK? + bne MyRTI no, we're doing a system-state rti ifne H6309 - ldf #R$Size E=0 from call to L0E8D before + ldf #R$Size E=0 from call to L0E8D before ldu #Where+SWIStack point to the stack - tfm u+,y+ move the stack from top of memory to user memory + tfm u+,y+ move the stack from top of memory to user memory else ldb #R$Size ldu #Where+SWIStack point to the stack @@ -873,7 +811,7 @@ decb bne RtiLoop endc -MyRTI rti return from IRQ +MyRTI rti return from IRQ * Execute routine in task 1 pointed to by U @@ -892,8 +830,8 @@ * Flip to task 1 (used by GRF/WINDInt to switch to GRFDRV) (pointed to * by DAT.Task save it to GIME register inc $xxxx) +L0EB8 clra (faster than CLR >$xxxx) sta >DAT.Task Force to Task 0 (system state) ifne H6309 tfr 0,dp setup DP @@ -971,20 +909,20 @@ SWI2VCT orcc #IntMasks disasble IRQ's ldx #D.SWI2 get DP offset of vector +* This routine is called from an SWI, SWI2, or SWI3 * saves 1 cycle on system-system calls * saves about 200 cycles (calls to I.LDABX and L029E) on grfdrv-system, * or user-system calls. -SWICall ldb [R$PC,s] --- get callcode of the system call +SWICall ldb [R$PC,s] get callcode of the system call * NOTE: Alan DeKok claims that this is BAD. It crashed Colin McKay's * CoCo 3. Instead, we should do a clra/sta >DAT.Task. -* clr >DAT.Task go to map type 1 +* clr >DAT.Task go to map type 1 clra sta >DAT.Task +* set DP to zero ifne H6309 - tfr 0,dp set DP to zero + tfr 0,dp else -* 6809 version: we don't need to clra anymore since we're doing it above now -* clra tfr a,dp endc @@ -996,13 +934,13 @@ * CANNOT be vectored to L0EBF cause the user SWI service routine has been * changed lda DAT.Task ??? - beq MapT0 in map 0: restore hardware and do system service + beq MapT0 in map 0: restore hardware and do system service tst