Mercurial > hg > Members > kono > nitros9-code
changeset 2018:505c8d261ef6
Futher division of krn, commnents added
author | boisy |
---|---|
date | Wed, 08 Mar 2006 01:58:50 +0000 |
parents | f273e28ea8d0 |
children | 51a12746307c |
files | level1/modules/kernel/fallbit.asm level1/modules/kernel/faproc.asm level1/modules/kernel/fcrc.asm level1/modules/kernel/krn.asm |
diffstat | 4 files changed, 176 insertions(+), 138 deletions(-) [+] |
line wrap: on
line diff
--- a/level1/modules/kernel/fallbit.asm Tue Mar 07 12:20:16 2006 +0000 +++ b/level1/modules/kernel/fallbit.asm Wed Mar 08 01:58:50 2006 +0000 @@ -1,8 +1,21 @@ -FAllBit ldd R$D,u - leau R$X,u +************************************************** +* System Call: F$AllBit +* +* Function: Sets bits in an allocation bitmap +* +* Input: X = Address of allocation bitmap +* D = Number of first bit to set +* Y = Bit count (number of bits to set) +* +* Output: None +* +* Error: CC = C bit set; B = error code +* +FAllBit ldd R$D,u get bit # to start with + leau R$X,u get address of allocation bit map pulu y,x L065A pshs y,x,b,a - bsr L0690 + bsr CalcBit calculate byte & position & get first bit mask tsta pshs a bmi L0671 @@ -30,7 +43,21 @@ clra leas 1,s puls pc,y,x,b,a -L0690 pshs b + +* Calculate address of first byte we want, and which bit in that byte, from +* a bit allocation map given the address of the map & the bit # we want to +* point to +* Entry: D=Bit # +* X=Ptr to bit mask table +* Exit: A=Mask to point to bit # within byte we are starting on +* X=Ptr in allocation map to first byte we are starting on +CalcBit pshs b + IFNE H6309 + lsrd divide bit # by 8 to calculate byte # to start + lsrd allocating at + lsrd + addr d,x offset that far into the map + ELSE lsra rorb lsra @@ -38,20 +65,35 @@ lsra rorb leax d,x + ENDC puls b lda #$80 - andb #$07 + andb #$07 round it down to nearest bit beq L06A6 L06A2 lsra decb bne L06A2 L06A6 rts -FDelBit ldd R$D,u - leau R$X,u + +************************************************** +* System Call: F$DelBit +* +* Function: Clears bits in an allocation bitmap +* +* Input: X = Address of allocation bitmap +* D = Number of first bit to clear +* Y = Bit count (number of bits to clear) +* +* Output: None +* +* Error: CC = C bit set; B = error code +* +FDelBit ldd R$D,u get bit # to start with + leau R$X,u get addr. of bit allocation map pulu y,x L06AD pshs y,x,b,a - bsr L0690 + bsr CalcBit coma pshs a bpl L06C4 @@ -77,11 +119,27 @@ clr ,s+ puls pc,y,x,b,a + +************************************************** +* System Call: F$SchBit +* +* Function: Search bitmap for a free area +* +* Input: X = Address of allocation bitmap +* D = Starting bit number +* Y = Bit count (free bit block size) +* U = Address of end of allocation bitmap +* +* Output: D = Beginning bit number +* Y = Bit count +* +* Error: CC = C bit set; B = error code +* FSchBit pshs u - ldd R$D,u - ldx R$X,u - ldy R$Y,u - ldu R$U,u + ldd R$D,u get start bit # + ldx R$X,u get addr. of allocation bitmap + ldy R$Y,u get bit count + ldu R$U,u get address of end of allocation bitmap bsr L06F3 puls u std R$D,u @@ -92,7 +150,7 @@ clr 8,s clr 9,s tfr d,y - bsr L0690 + bsr CalcBit pshs a bra L0710 L0703 leay $01,y
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/kernel/faproc.asm Wed Mar 08 01:58:50 2006 +0000 @@ -0,0 +1,50 @@ +************************************************** +* System Call: F$AProc +* +* Function: Insert process into active process queue +* +* Input: X = Address of process descriptor +* +* Output: None (U and Y are preserved) +* +* Error: CC = C bit set; B = error code +* +* "An Ode to Dr. Lee" +* (1:27PM, Feb 23, 2006) +* +* Sitting in CMPS 455, I listen to Dr. Lee, +* His teaching style is as awful as any can be. +* Operating System Principles I have seen many times before, +* And as a result, this class is a major bore. +* As he talks about file systems, I work on NitrOS-9, +* even though I pay no attention, I do not fall behind. +* +* - Anonymous Student who returned +* to university to complete his +* computer science degree while working +* on The NitrOS-9 Project. +* +FAProc ldx R$X,u get ptr to process to activate +L021A pshs u,y save U/Y on stack + ldu #(D.AProcQ-P$Queue) + bra L0228 +L0221 ldb P$Age,u get process age + incb update it + beq L0228 branch if wrap + stb P$Age,u save it back to proc desc +L0228 ldu P$Queue,u get pointer to queue this process queue + bne L0221 branch if process is in active queue + ldu #(D.AProcQ-P$Queue) + lda P$Prior,x get process priority + sta P$Age,x save it as age (How long its been around) + orcc #IntMasks mask interrupts +L0235 leay ,u point Y to current process + ldu P$Queue,u get pointer to queue + beq L023F + cmpa P$Age,u match process ages? + bls L0235 no, skip update +L023F stu P$Queue,x + stx P$Queue,y + clrb + puls pc,u,y restore U/Y and return +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/modules/kernel/fcrc.asm Wed Mar 08 01:58:50 2006 +0000 @@ -0,0 +1,51 @@ +* F$CRC +FCRC ldx R$X,u + ldy R$Y,u + beq L0402 + ldu R$U,u +L03FA lda ,x+ + bsr CRCAlgo + leay -1,y + bne L03FA +L0402 clrb + rts + +CRCAlgo eora ,u + pshs a + ldd $01,u + std ,u + clra + ldb ,s + lslb + rola + eora 1,u + std 1,u + clrb + lda ,s + lsra + rorb + lsra + rorb + eora 1,u + eorb 2,u + std 1,u + lda ,s + lsla + eora ,s + sta ,s + lsla + lsla + eora ,s + sta ,s + lsla + lsla + lsla + lsla + eora ,s+ + bpl L0442 + ldd #$8021 + eora ,u + sta ,u + eorb 2,u + stb 2,u +L0442 rts
--- a/level1/modules/kernel/krn.asm Tue Mar 07 12:20:16 2006 +0000 +++ b/level1/modules/kernel/krn.asm Wed Mar 08 01:58:50 2006 +0000 @@ -405,57 +405,8 @@ * puls cc,b,x,y,u,pc -************************************************** -* System Call: F$AProc -* -* Function: Insert process into active process queue -* -* Input: X = Address of process descriptor -* -* Output: None (U and Y are preserved) -* -* Error: CC = C bit set; B = error code -* -* "An Ode to Dr. Lee" -* (1:27PM, Feb 23, 2006) -* -* Sitting in CMPS 455, I listen to Dr. Lee, -* His teaching style is as awful as any can be. -* Operating System Principles I have seen many times before, -* And as a result, this class is a major bore. -* As he talks about file systems, I work on NitrOS-9, -* even though I pay no attention, I do not fall behind. -* -* - Anonymous Student who returned -* to university to complete his -* computer science degree while working -* on The NitrOS-9 Project. -* -FAProc ldx R$X,u get ptr to process to activate -L021A pshs u,y save U/Y on stack - ldu #(D.AProcQ-P$Queue) - bra L0228 -L0221 ldb P$Age,u get process age - incb update it - beq L0228 branch if wrap - stb P$Age,u save it back to proc desc -L0228 ldu P$Queue,u get pointer to queue this process queue - bne L0221 branch if process is in active queue - ldu #(D.AProcQ-P$Queue) - lda P$Prior,x get process priority - sta P$Age,x save it as age (How long its been around) - orcc #IntMasks mask interrupts -L0235 leay ,u point Y to current process - ldu P$Queue,u get pointer to queue - beq L023F - cmpa P$Age,u match process ages? - bls L0235 no, skip update -L023F stu P$Queue,x - stx P$Queue,y - clrb - puls pc,u,y restore U/Y and return - - + use faproc.asm + * User-State system call entry point UsrSvc leay <L024E,pcr orcc #IntMasks @@ -699,57 +650,7 @@ ldb #E$BMCRC L03EF puls pc,y,x -* F$CRC -FCRC ldx R$X,u - ldy R$Y,u - beq L0402 - ldu R$U,u -L03FA lda ,x+ - bsr CRCAlgo - leay -1,y - bne L03FA -L0402 clrb - rts - -CRCAlgo eora ,u - pshs a - ldd $01,u - std ,u - clra - ldb ,s - lslb - rola - eora 1,u - std 1,u - clrb - lda ,s - lsra - rorb - lsra - rorb - eora 1,u - eorb 2,u - std 1,u - lda ,s - lsla - eora ,s - sta ,s - lsla - lsla - eora ,s - sta ,s - lsla - lsla - lsla - lsla - eora ,s+ - bpl L0442 - ldd #$8021 - eora ,u - sta ,u - eorb 2,u - stb 2,u -L0442 rts + use fcrc.asm L0443 ldu #$0000 tfr a,b @@ -970,29 +871,7 @@ use fcmpnam.asm -*FCmpNam ldb R$B,u -* leau R$X,u -* pulu y,x -*L07AB pshs y,x,b,a -*L07AD lda ,y+ -* bmi L07BE -* decb -* beq L07BA -* eora ,x+ -* anda #$DF -* beq L07AD -*L07BA orcc #Carry -* puls pc,y,x,b,a -*L07BE decb -* bne L07BA -* eora ,x -* anda #$5F -* bne L07BA -* puls y,x,b,a -*L07C9 andcc #^Carry -* rts - - use fssvc.asm + use fssvc.asm emod eom equ *