changeset 2017:f273e28ea8d0

Breaking kernel down into individual files... added comments
author boisy
date Tue, 07 Mar 2006 12:20:16 +0000
parents 0e6b61d99cac
children 505c8d261ef6
files level1/modules/kernel/fallbit.asm level1/modules/kernel/fsrqmem.asm level1/modules/kernel/fssvc.asm level1/modules/kernel/krn.asm
diffstat 4 files changed, 224 insertions(+), 221 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/level1/modules/kernel/fallbit.asm	Tue Mar 07 12:20:16 2006 +0000
@@ -0,0 +1,126 @@
+FAllBit  ldd   R$D,u
+         leau  R$X,u
+         pulu  y,x
+L065A    pshs  y,x,b,a
+         bsr   L0690
+         tsta
+         pshs  a
+         bmi   L0671
+         lda   ,x
+L0665    ora   ,s
+         leay  -1,y
+         beq   L0689
+         lsr   ,s
+         bcc   L0665
+         sta   ,x+
+L0671    tfr   y,d
+         sta   ,s
+         lda   #$FF
+         bra   L067B
+L0679    sta   ,x+
+L067B    subb  #$08
+         bcc   L0679
+         dec   ,s
+         bpl   L0679
+L0683    lsla
+         incb
+         bne   L0683
+         ora   ,x
+L0689    sta   ,x
+         clra
+         leas  1,s
+         puls  pc,y,x,b,a
+L0690    pshs  b
+         lsra
+         rorb
+         lsra
+         rorb
+         lsra
+         rorb
+         leax  d,x
+         puls  b
+         lda   #$80
+         andb  #$07
+         beq   L06A6
+L06A2    lsra
+         decb
+         bne   L06A2
+L06A6    rts
+
+FDelBit  ldd   R$D,u
+         leau  R$X,u
+         pulu  y,x
+L06AD    pshs  y,x,b,a
+         bsr   L0690
+         coma
+         pshs  a
+         bpl   L06C4
+         lda   ,x
+L06B8    anda  ,s
+         leay  -1,y
+         beq   L06D8
+         asr   ,s
+         bcs   L06B8
+         sta   ,x+
+L06C4    tfr   y,d
+         bra   L06CA
+L06C8    clr   ,x+
+L06CA    subd  #$0008
+         bhi   L06C8
+         beq   L06D8
+L06D1    lsla
+         incb
+         bne   L06D1
+         coma
+         anda  ,x
+L06D8    sta   ,x
+         clr   ,s+
+         puls  pc,y,x,b,a
+
+FSchBit  pshs  u
+         ldd   R$D,u
+         ldx   R$X,u
+         ldy   R$Y,u
+         ldu   R$U,u
+         bsr   L06F3
+         puls  u
+         std   R$D,u
+         sty   R$Y,u
+         rts
+L06F3    pshs  u,y,x,b,a
+         pshs  y,b,a
+         clr   8,s
+         clr   9,s
+         tfr   d,y
+         bsr   L0690
+         pshs  a
+         bra   L0710
+L0703    leay  $01,y
+         sty   $05,s
+L0708    lsr   ,s
+         bcc   L0714
+         ror   ,s
+         leax  $01,x
+L0710    cmpx  $0B,s
+         bcc   L0732
+L0714    lda   ,x
+         anda  ,s
+         bne   L0703
+         leay  $01,y
+         tfr   y,d
+         subd  $05,s
+         cmpd  $03,s
+         bcc   L0739
+         cmpd  $09,s
+         bls   L0708
+         std   $09,s
+         ldd   $05,s
+         std   $01,s
+         bra   L0708
+L0732    ldd   $01,s
+         std   $05,s
+         coma
+         bra   L073B
+L0739    std   $09,s
+L073B    leas  $05,s
+         puls  pc,u,y,x,b,a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/level1/modules/kernel/fsrqmem.asm	Tue Mar 07 12:20:16 2006 +0000
@@ -0,0 +1,60 @@
+FSRqMem  ldd   R$D,u
+         addd  #$00FF
+         clrb
+         std   R$D,u
+         ldx   <D.FMBM+2
+         ldd   #$01FF
+         pshs  b,a
+         bra   L0604
+L05FA    dec   $01,s
+         ldb   $01,s
+L05FE    lsl   ,s
+         bcc   L060A
+         rol   ,s
+L0604    leax  -1,x
+         cmpx  <D.FMBM
+         bcs   L0620
+L060A    lda   ,x
+         anda  ,s
+         bne   L05FA
+         dec   1,s
+         subb  1,s
+         cmpb  1,u
+         rora
+         addb  1,s
+         rola
+         bcs   L05FE
+         ldb   1,s
+         clra
+         incb
+L0620    leas  2,s
+         bcs   L0635
+         ldx   <D.FMBM
+         tfr   d,y
+         ldb   1,u
+         clra
+         exg   d,y
+         bsr   L065A
+         exg   a,b
+         std   8,u
+L0633    clra
+         rts
+L0635    comb
+         ldb   #E$MemFul
+         rts
+
+FSRtMem  ldd   R$D,u
+         addd  #$00FF
+         tfr   a,b
+         clra
+         tfr   d,y
+         ldd   R$U,u
+         beq   L0633
+         tstb
+         beq   L064E
+         comb
+         ldb   #E$BPAddr
+         rts
+L064E    exg   a,b
+         ldx   <D.FMBM
+         bra   L06AD
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/level1/modules/kernel/fssvc.asm	Tue Mar 07 12:20:16 2006 +0000
@@ -0,0 +1,23 @@
+FSSvc    ldy   R$Y,u                   get caller's Y
+         bra   InstSSvc                install the service
+SSvcLoop tfr   b,a                     put syscall code in A
+         anda  #$7F                    kill hi bit
+         cmpa  #$7F                    is code $7F?
+         beq   SSvcOK
+         cmpa  #$37                    compare against highest call allowed
+         bcs   SSvcOK                  branch if A less than highest call
+         comb
+         ldb   #E$ISWI
+         rts
+SSvcOK   lslb
+         ldu   <D.SysDis
+         leau  b,u                     U points to entry in table
+         ldd   ,y++                    get addr of func
+         leax  d,y                     get absolute addr
+         stx   ,u                      store in system table
+         bcs   InstSSvc                branch if system only
+         stx   <$70,u                  else store in user table too
+InstSSvc ldb   ,y+                     get system call code in B
+         cmpb  #$80                    end of table?
+         bne   SSvcLoop                branch if not
+         rts
--- a/level1/modules/kernel/krn.asm	Tue Mar 07 12:11:03 2006 +0000
+++ b/level1/modules/kernel/krn.asm	Tue Mar 07 12:20:16 2006 +0000
@@ -342,6 +342,7 @@
 Poll     comb
          rts
 
+* Default clock routine - executed 60 times/sec
 Clock    ldx   <D.SProcQ
          beq   L01FD
          lda   P$State,x
@@ -363,15 +364,15 @@
          ldd   P$SP,u
          beq   L01E7
 L01FB    stx   <D.SProcQ
-L01FD    dec   <D.Slice
-         bne   ClockRTI
-         lda   <D.TSlice
-         sta   <D.Slice
-         ldx   <D.Proc
-         beq   ClockRTI
-         lda   P$State,x
-         ora   #TimOut
-         sta   P$State,x
+L01FD    dec   <D.Slice                decrement slice
+         bne   ClockRTI                if not 0, exit ISR
+         lda   <D.TSlice               else get default time slice
+         sta   <D.Slice                and save it as slice
+         ldx   <D.Proc                 get proc desc of current proc
+         beq   ClockRTI                if none, exit ISR
+         lda   P$State,x               get process state
+         ora   #TimOut                 set timeout bit
+         sta   P$State,x               and store back
          bpl   L0212                   branch if not system state
 ClockRTI rti
 
@@ -961,194 +962,9 @@
 L05E5    ldb   #E$IForkP
 L05E7    puls  pc,u,x
 
-FSRqMem  ldd   R$D,u
-         addd  #$00FF
-         clrb
-         std   R$D,u
-         ldx   <D.FMBM+2
-         ldd   #$01FF
-         pshs  b,a
-         bra   L0604
-L05FA    dec   $01,s
-         ldb   $01,s
-L05FE    lsl   ,s
-         bcc   L060A
-         rol   ,s
-L0604    leax  -1,x
-         cmpx  <D.FMBM
-         bcs   L0620
-L060A    lda   ,x
-         anda  ,s
-         bne   L05FA
-         dec   1,s
-         subb  1,s
-         cmpb  1,u
-         rora
-         addb  1,s
-         rola
-         bcs   L05FE
-         ldb   1,s
-         clra
-         incb
-L0620    leas  2,s
-         bcs   L0635
-         ldx   <D.FMBM
-         tfr   d,y
-         ldb   1,u
-         clra
-         exg   d,y
-         bsr   L065A
-         exg   a,b
-         std   8,u
-L0633    clra
-         rts
-L0635    comb
-         ldb   #E$MemFul
-         rts
-
-FSRtMem  ldd   R$D,u
-         addd  #$00FF
-         tfr   a,b
-         clra
-         tfr   d,y
-         ldd   R$U,u
-         beq   L0633
-         tstb
-         beq   L064E
-         comb
-         ldb   #E$BPAddr
-         rts
-L064E    exg   a,b
-         ldx   <D.FMBM
-         bra   L06AD
-
-FAllBit  ldd   R$D,u
-         leau  R$X,u
-         pulu  y,x
-L065A    pshs  y,x,b,a
-         bsr   L0690
-         tsta
-         pshs  a
-         bmi   L0671
-         lda   ,x
-L0665    ora   ,s
-         leay  -1,y
-         beq   L0689
-         lsr   ,s
-         bcc   L0665
-         sta   ,x+
-L0671    tfr   y,d
-         sta   ,s
-         lda   #$FF
-         bra   L067B
-L0679    sta   ,x+
-L067B    subb  #$08
-         bcc   L0679
-         dec   ,s
-         bpl   L0679
-L0683    lsla
-         incb
-         bne   L0683
-         ora   ,x
-L0689    sta   ,x
-         clra
-         leas  1,s
-         puls  pc,y,x,b,a
-L0690    pshs  b
-         lsra
-         rorb
-         lsra
-         rorb
-         lsra
-         rorb
-         leax  d,x
-         puls  b
-         lda   #$80
-         andb  #$07
-         beq   L06A6
-L06A2    lsra
-         decb
-         bne   L06A2
-L06A6    rts
-
-FDelBit  ldd   R$D,u
-         leau  R$X,u
-         pulu  y,x
-L06AD    pshs  y,x,b,a
-         bsr   L0690
-         coma
-         pshs  a
-         bpl   L06C4
-         lda   ,x
-L06B8    anda  ,s
-         leay  -1,y
-         beq   L06D8
-         asr   ,s
-         bcs   L06B8
-         sta   ,x+
-L06C4    tfr   y,d
-         bra   L06CA
-L06C8    clr   ,x+
-L06CA    subd  #$0008
-         bhi   L06C8
-         beq   L06D8
-L06D1    lsla
-         incb
-         bne   L06D1
-         coma
-         anda  ,x
-L06D8    sta   ,x
-         clr   ,s+
-         puls  pc,y,x,b,a
-
-FSchBit  pshs  u
-         ldd   R$D,u
-         ldx   R$X,u
-         ldy   R$Y,u
-         ldu   R$U,u
-         bsr   L06F3
-         puls  u
-         std   R$D,u
-         sty   R$Y,u
-         rts
-L06F3    pshs  u,y,x,b,a
-         pshs  y,b,a
-         clr   8,s
-         clr   9,s
-         tfr   d,y
-         bsr   L0690
-         pshs  a
-         bra   L0710
-L0703    leay  $01,y
-         sty   $05,s
-L0708    lsr   ,s
-         bcc   L0714
-         ror   ,s
-         leax  $01,x
-L0710    cmpx  $0B,s
-         bcc   L0732
-L0714    lda   ,x
-         anda  ,s
-         bne   L0703
-         leay  $01,y
-         tfr   y,d
-         subd  $05,s
-         cmpd  $03,s
-         bcc   L0739
-         cmpd  $09,s
-         bls   L0708
-         std   $09,s
-         ldd   $05,s
-         std   $01,s
-         bra   L0708
-L0732    ldd   $01,s
-         std   $05,s
-         coma
-         bra   L073B
-L0739    std   $09,s
-L073B    leas  $05,s
-         puls  pc,u,y,x,b,a
-
+         use   fsrqmem.asm
+         
+         use   fallbit.asm
          
          use   fprsnam.asm
 
@@ -1176,30 +992,8 @@
 *L07C9    andcc #^Carry
 *         rts
 
-FSSvc    ldy   R$Y,u                   get caller's Y
-         bra   InstSSvc                install the service
-SSvcLoop tfr   b,a                     put syscall code in A
-         anda  #$7F                    kill hi bit
-         cmpa  #$7F                    is code $7F?
-         beq   SSvcOK
-         cmpa  #$37                    compare against highest call allowed
-         bcs   SSvcOK                  branch if A less than highest call
-         comb
-         ldb   #E$ISWI
-         rts
-SSvcOK   lslb
-         ldu   <D.SysDis
-         leau  b,u                     U points to entry in table
-         ldd   ,y++                    get addr of func
-         leax  d,y                     get absolute addr
-         stx   ,u                      store in system table
-         bcs   InstSSvc                branch if system only
-         stx   <$70,u                  else store in user table too
-InstSSvc ldb   ,y+                     get system call code in B
-         cmpb  #$80                    end of table?
-         bne   SSvcLoop                branch if not
-         rts
-
+          use    fssvc.asm
+          
          emod
 eom      equ   *