# HG changeset patch # User boisy # Date 1264286236 0 # Node ID b399116a3b5fb8c765cafb23d7b8729bcfc274d4 # Parent d5ecf07aae74f08d4a6b0337f8e884a859f8747c Now we have a /N descriptor... and the code in scdwn.asm to handle it. diff -r d5ecf07aae74 -r b399116a3b5f level1/coco/modules/makefile --- a/level1/coco/modules/makefile Sat Jan 23 14:55:34 2010 +0000 +++ b/level1/coco/modules/makefile Sat Jan 23 22:37:16 2010 +0000 @@ -43,7 +43,7 @@ nil.dd p_scbbp.dd p_scdwp.dd pipe.dd ssp.dd \ term_scbbt.dt term_sc6551.dt t1_scbbt.dd t2_sc6551.dd t3_sc6551.dd \ term32.dt term51.dt \ - scdwn.dr term_scdwn.dt n1_scdwn.dd n2_scdwn.dd \ + scdwn.dr term_scdwn.dt n_scdwn.dd n1_scdwn.dd n2_scdwn.dd \ n3_scdwn.dd n4_scdwn.dd n5_scdwn.dd n6_scdwn.dd n7_scdwn.dd \ n8_scdwn.dd n9_scdwn.dd n10_scdwn.dd n11_scdwn.dd n12_scdwn.dd \ n13_scdwn.dd n14_scdwn.dd @@ -146,6 +146,9 @@ term_scdwn.dt: scdwndesc.asm $(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=0 +n_scdwn.dd: scdwndesc.asm + $(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=255 + n1_scdwn.dd: scdwndesc.asm $(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=1 diff -r d5ecf07aae74 -r b399116a3b5f level1/modules/dw3.asm --- a/level1/modules/dw3.asm Sat Jan 23 14:55:34 2010 +0000 +++ b/level1/modules/dw3.asm Sat Jan 23 22:37:16 2010 +0000 @@ -409,12 +409,12 @@ * NEW: root through all process descriptors. if any has a path open to this * device, send then S$HUP ldx D.DWStat - ENDC - beq tell + ifgt Level-1 + ldx D.DWStat + endc + beq tell ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax ; leax DW.StatTbl,x - clr a,x ;clear out + clr a,x ;clear out ; tell server -tell - lda #OP_SERTERM ; load command - pshs a ; command store on stack - leax ,s ; point X to stack - ldy #2 ; 2 bytes to send +tell + lda #OP_SERTERM ; load command + pshs a ; command store on stack + leax ,s ; point X to stack + ldy #2 ; 2 bytes to send - pshs u + pshs u - IFGT Level-1 - ldu D.DWSubAddr - ENDC - beq nosub - jsr 6,u ; call DWrite + ifgt Level-1 + ldu D.DWSubAddr + endc + beq nosub + jsr 6,u ; call DWrite -nosub - puls u - leas 2,s ; clean 3 DWsub args from stack - clrb - rts +nosub + puls u + leas 2,s ; clean 3 DWsub args from stack +termbye clrb + rts *********************************************************************** * Init @@ -110,90 +114,92 @@ * CC = carry set on error * B = error code * - -Init equ * + +Init equ * ; link to subroutine module ; has the link already been done? - IFGT Level-1 - ldx D.DWSubAddr - ENDC - bne already ; if so, do not bother - - pshs u ; preserve u since os9 link is coming up + ifgt Level-1 + ldx D.DWSubAddr + endc + bne already ; if so, do not bother + + pshs u ; preserve u since os9 link is coming up + + ifgt Level-1 + ldx D.DWSubAddr + endc + jsr ,y ; call DW init routine + + puls u ; restore u - IFGT Level-1 - ldx D.DWSubAddr - ENDC - jsr ,y ; call DW init routine - - puls u ; restore u - -already +already ; tell DW we have a new port opening (port mode already on stack) - ldb D.DWSubAddr - ENDC - jsr 6,u ; call DWrite - puls u - + ldb D.DWSubAddr + endc + jsr 6,u ; call DWrite + puls u + ; set up local buffer - ldb #RxBufDSz ; default Rx buffer size - leax RxBuff,u ; default Rx buffer address - stb RxBufSiz,u ; save Rx buffer size - stx RxBufPtr,u ; save Rx buffer address - stx RxBufGet,u ; set initial Rx buffer input address - stx RxBufPut,u ; set initial Rx buffer output address - abx ; add buffer size to buffer start.. - stx RxBufEnd,u ; save Rx buffer end address + ldb #RxBufDSz ; default Rx buffer size + leax RxBuff,u ; default Rx buffer address + stb RxBufSiz,u ; save Rx buffer size + stx RxBufPtr,u ; save Rx buffer address + stx RxBufGet,u ; set initial Rx buffer input address + stx RxBufPut,u ; set initial Rx buffer output address + abx ; add buffer size to buffer start.. + stx RxBufEnd,u ; save Rx buffer end address - tfr u,d ; (A = high page of statics) - puls b - puls b ; (B = port number) - IFGT Level-1 - ldx D.DWStat - ENDC + tfr u,d ; (A = high page of statics) + puls b + puls b ; (B = port number) + ifgt Level-1 + ldx D.DWStat + endc ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax ; leax DW.StatTbl,x - sta b,x -InitEx equ * - rts -InitEx2 - puls u - rts + sta b,x +InitEx equ * + rts +InitEx2 + puls u + rts ; drivewire info -dw3name fcs /dw3/ +dw3name fcs /dw3/ ***************************************************************************** @@ -208,26 +214,26 @@ * CC = carry set on error * B = error code * -Write equ * - pshs a ; character to send on stack - ldb D.DWSubAddr - ENDC - jsr 6,u -WriteOK clrb -WriteExit puls a,x,pc ; clean stack, return +Write equ * + pshs a ; character to send on stack + ldb D.DWSubAddr + endc + jsr 6,u +WriteOK clrb +WriteExit puls a,x,pc ; clean stack, return - -NotReady comb - ldb #E$NotRdy - rts + +NotReady comb + ldb #E$NotRdy + rts ************************************************************************************* * Read @@ -241,100 +247,100 @@ * CC = carry set on error * B = error code * -Read equ * +Read equ * * Check to see if there is a signal-on-data-ready set for this path. * If so, we return a Not Ready error. - lda D.Proc ; process descriptor address MSB - sta D.Proc ; process descriptor address MSB + sta D.Proc ; process descriptor address - ldb P$Signal,x ; pending signal for this process? - beq ChkState ; no, go check process state... - cmpb #S$HUP ; (S$HUP or lower) - bls ErrExit ; yes, go do it... + ldx >D.Proc ; process descriptor address + ldb P$Signal,x ; pending signal for this process? + beq ChkState ; no, go check process state... + cmpb #S$HUP ; (S$HUP or lower) + bls ErrExit ; yes, go do it... -ChkState equ * +ChkState equ * ; have we been condemned to die? - IFNE H6309 - tim #Condem,P$State,x - ELSE - ldb P$State,x - bitb #Condem - ENDC - bne PrAbtErr ; yes, go do it... - + ifne H6309 + tim #Condem,P$State,x + else + ldb P$State,x + bitb #Condem + endc + bne PrAbtErr ; yes, go do it... + ; check that our waiter byte was cleared by ISR instance - tst D.DWSubAddr - ENDC - jsr 6,u - leas 3,s - puls a,y,x,u,pc + pshs a,y,x,u + leas -3,s + leax ,s + stb ,x + sta 2,x + ldb V.PORT+1,u + stb 1,x + ldy #$0003 + ifgt LEVEL-1 + ldu D.DWSubAddr + endc + jsr 6,u + leas 3,s + puls a,y,x,u,pc ************************************************************************* * SetStat @@ -430,156 +436,189 @@ * CC = carry set on error * B = error code * -SetStat - ldb #OP_SERSETSTAT - bsr SendStat - cmpa #SS.Open - beq open - cmpa #SS.Close - beq ex - cmpa #SS.ComSt - beq comst - cmpa #SS.SSig - beq ssig - cmpa #SS.Relea - lbne donebad -relea lda PD.CPR,y get curr proc # - cmpa D.DWSubAddr - ENDC - jsr 6,u - clrb - rts +comst leax PD.OPT,y + ldy #OPTCNT + ifgt LEVEL-1 + ldu D.DWSubAddr + endc + jsr 6,u + clrb + rts * SS.Open processor * Entry: X=Register stack pointer +* U=Static memory pointer * Y=Path descriptor pointer -* U=Static memory pointer -open pshs u,y - tst D.DWStat - ENDC +open pshs u,y preserve registers + tst D.DWStat + endc ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax ; leax DW.StatTbl,x - clrb -next tst ,x+ - beq found - incb - cmpb #DW.StatCnt-1 - blt next - comb - ldb #E$MNF failed to find device -openex puls y,u,pc +* start at /N1 + ldb #1 + leax 1,x +next tst ,x+ + beq found + incb + cmpb #DW.StatCnt-1 + blt next + puls u,y,x purge stack + comb set carry + ldb #E$MNF get module not found error + rts return + +* Found a free spot +found pshs b save # of free entry + leas -5,s + leay ,s + ldb #'N get netdev name prefix + stb ,y+ put it in buffer + ldb 5,s get netdev # that was free +* Convert netdev # in B to ASCII eqivalent with high bit set + + IFNE H6309 + divd #10 divide it by 10 + ELSE + lda #-1 +L0B87b inca + subb #10 + bcc L0B87b + addb #10 + exg a,b + cmpb #0 + ENDC + beq L0B87 if answer is 0 there is only 1 digit, skip ahead + orb #$30 make first digit ASCII + stb ,y+ put it in buffer +L0B87 ora #$B0 make remainder ASCII with high bit set + sta ,y+ put it in buffer +L0B92 leas -2,s make a buffer for process decriptor pointer + IFGT Level-1 + lbsr L0238 switch to system process descriptor + ENDC + leax 2,s Point to calculated dsc. name + lda #Devic+Objct get module type + os9 F$Link try & link it + IFGT Level-1 + lbsr L0244 switch back to current process + ENDC + leas 7,s purge stack + bcc L0BAB it's linked, skip ahead +L0BA7 leas 1,s purge netdev # + bra L0B58 go look for another one -* we have found a free device (B holds #), build name, link it, then -* put into device table -found -* build name - leas -4,s - leax ,s - lda #'N - sta ,x+ -* take byte in B and turn into ASCII string at X - lda #'0 - cmpb #9 - bls lo1 -lo10 subb #10 - bcs hi10 - inca - bra lo10 -hi10 addb #10 - sta ,x+ - lda #'0 -lo1 decb - bmi hi1 - inca - bra lo1 -hi1 -* terminate with CR - ldb #13 - std ,x -* switch to system process descriptor - IFGT Level-1 - ldd