changeset 2065:3bd91f399082

Login now uses sysgo to get strings. Fixed single-sided booting
author boisy
date Fri, 05 May 2006 15:33:17 +0000
parents c8bb06c82d68
children 208c8e8dd175
files level1/cmds/login.asm level1/modules/boot_1773.asm
diffstat 2 files changed, 196 insertions(+), 187 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/login.asm	Fri May 05 15:26:03 2006 +0000
+++ b/level1/cmds/login.asm	Fri May 05 15:33:17 2006 +0000
@@ -32,82 +32,35 @@
 
          mod   eom,name,tylg,atrv,start,size
 
+NUMTRIES	set	3
+
          org   0
 u0000    rmb   1
-PassPath rmb   1
-u0002    rmb   1
-u0003    rmb   1
-DefUID   rmb   1
-u0005    rmb   1
-u0006    rmb   2
+passpath rmb   1
+motdpath rmb   1
+retries  rmb   1
+defuid   rmb   1
+priority rmb   1
+passline rmb   2
 rdbufptr rmb   2
 buffnext rmb   2
-u000C    rmb   1
-timebuff rmb   256
+convbyte rmb   1
+timebuff rmb   5
 linebuff rmb   128
 readbuff rmb   80
-u01DD    rmb   80
-u022D    rmb   32
+outbuf   rmb   80
+popts    rmb   32
+stack    rmb   251
 size     equ   .
 
 name     fcs   /Login/
          fcb   edition
 
 
-PassFile fcc   "SYS/PASSWORD"
+initmod  fcs   "init"
+
+passfile fcc   "SYS/PASSWORD"
          fcb   C$CR
-WideMsg  fcb   C$LF,C$LF
-         fcc   "NitrOS-9/"
-         IFNE  H6309
-         fcc   "6309"
-         ELSE
-         fcc   "6809"
-         ENDC
-         fcc   " Timesharing System"
-         fcb   C$LF
-         fcc   "Level "
-         IFEQ  Level-1
-         fcc   "1"
-         ELSE
-         IFEQ  Level-2
-         fcc   "2"
-         ELSE
-         fcc   "3"
-         ENDC
-         ENDC
-         fcc   " V0"
-         fcb   48+NOS9VER
-         fcc   ".0"
-         fcb   48+NOS9MAJ
-         fcc   ".0"
-         fcb   48+NOS9MIN
-         fcb   C$LF
-WideMsgL equ   *-WideMsg
-NrrwMsg  fcb   C$LF,C$LF
-         fcc   "NitrOS-9/"
-         IFNE  H6309
-         fcc   "6309"
-         ELSE
-         fcc   "6809"
-         ENDC
-         fcc   " Level "
-         IFEQ  Level-1
-         fcc   "1"
-         ELSE
-         IFEQ  Level-2
-         fcc   "2"
-         ELSE
-         fcc   "3"
-         ENDC
-         ENDC
-         fcc   " V0"
-         fcb   48+NOS9VER
-         fcc   ".0"
-         fcb   48+NOS9MAJ
-         fcc   ".0"
-         fcb   48+NOS9MIN
-         fcb   C$LF
-NrrwMsgL equ   *-NrrwMsg
 UName    fcb   C$LF
          fcc   "User name?: "
 UNameLen equ   *-UName
@@ -140,6 +93,9 @@
 Syntax   fcb   C$LF
          fcc   "Syntax Error in password file"
 
+onthe    fcc   "on the "
+onthel   equ   *-onthe
+
 Sorry    fcb   C$LF
          fcc   "It's been nice communicating with you."
          fcb   C$LF
@@ -149,10 +105,19 @@
 MOTD     fcc   "SYS/MOTD"
          fcb   C$CR
 
-Root     fcc   "...... "
+root     fcc   "...... "
 
 IcptRtn  rti			note, was rts in original code
 
+* Entry: X = pointer to start of nul terminated string
+* Exit:  D = length of string
+strlen   pshs  x
+         ldd   #-1
+go@      addd  #$0001
+         tst   ,x+
+         bne   go@
+         puls  x,pc
+
 start    leas  >linebuff,u
          pshs  y,x
          leax  <IcptRtn,pcr
@@ -164,8 +129,8 @@
          ENDC
 L0172    puls  y,x
          lbcs  Exit
-         clr   <u0000
-         leay  >u01DD,u
+*         clr   <u0000
+         leay  >outbuf,u
          sty   <buffnext
          leay  >readbuff,u
          sty   <rdbufptr
@@ -175,41 +140,67 @@
          sta   ,y+
          cmpa  #C$CR
          bne   L018C
-L0194    lda   #$01
-         ldb   #SS.ScSiz
-         os9   I$GetStt 
-         bcc   L01A4
-         cmpb  #E$UnkSvc
-         beq   L01AB
-         lbra  L0280
-L01A4    cmpx  #51
-         bcc   L01AB
-         inc   <u0000
+L0194
+*         lda   #$01
+*         ldb   #SS.ScSiz
+*         os9   I$GetStt 
+*         bcc   L01A4
+*         cmpb  #E$UnkSvc
+*         beq   L01AB
+*         lbra  L0280
+*L01A4    cmpx  #51
+*         bcc   L01AB
+*         inc   <u0000
 L01AB    lda   #READ.
-         leax  >Root,pcr
-         os9   I$ChgDir 
+         leax  >root,pcr			point to root dir string
+         os9   I$ChgDir				and change to that directory
          lda   #READ.
-         leax  >PassFile,pcr
-         os9   I$Open   
+         leax  >passfile,pcr
+         os9   I$Open   			open password file
          lbcs  Exit
-         sta   <PassPath
-         lda   #$03
-         sta   <u0003
+         sta   <passpath			and save path
+         lda   #NUMTRIES
+         sta   <retries				initialize the retry counter
          ldd   ,s++
          beq   L01D3
          ldx   <rdbufptr
          lda   ,x
          cmpa  #C$CR
          bne   L0209
-L01D3    tst   <u0000
-         beq   L01E1
-         leax  >NrrwMsg,pcr
-         ldy   #NrrwMsgL
-         bra   L01E9
-L01E1    leax  >WideMsg,pcr
-         ldy   #WideMsgL
-L01E9    lbsr  L032F
-L01EC    dec   <u0003
+L01D3
+*         tst   <u0000
+*         beq   L01E1
+*         leax  >NrrwMsg,pcr
+*         ldy   #NrrwMsgL
+*         bra   L01E9
+L01E1    
+         leax  initmod,pcr
+         clra
+         pshs  u
+         os9   F$Link
+         tfr   u,x
+         puls  u
+         bcs   L01EC
+         pshs  x
+         ldd   OSName,x					point to OS name in INIT module
+         leax  d,x						point to install name in INIT module
+         lbsr  strlen         
+         tfr   d,y
+         lbsr  copystr
+         lbsr  putspace
+         leax  onthe,pcr
+         ldy   #onthel
+         lbsr  copystr
+
+         puls  x
+         ldd   InstallName,x
+         leax  d,x						point to install name in INIT module
+         lbsr  strlen         
+         tfr   d,y
+         lbsr  strandtime
+         lbsr  L04A4
+
+L01EC    dec   <retries
          leax  >Sorry,pcr
          lbmi  L031F
          leax  >readbuff,u
@@ -218,10 +209,10 @@
          ldy   #UNameLen
          lbsr  L0347
          bcs   L020E
-L0209    lbsr  L0393
+L0209    lbsr  readpassword
          bcc   L0217
 L020E    leax  >Who,pcr
-L0212    lbsr  L0325
+L0212    lbsr  writeX
          bra   L01EC
 L0217    lbsr  L03B9
          bcc   L0253
@@ -232,11 +223,11 @@
          lda   #C$COMA
          sta   ,x+
          stx   <rdbufptr
-         lbsr  L0357
+         lbsr  killecho
          leax  >Pass,pcr
          ldy   #PassLen
          lbsr  L0347
-         lbsr  L037F
+         lbsr  setopts
          bcs   L020E
          lbsr  L03B9
          bcc   L0253
@@ -246,7 +237,7 @@
          bcc   L0217
          leax  >nvPass,pcr
          bra   L0212
-L0253    lda   <PassPath
+L0253    lda   <passpath
          os9   I$Close  
          lbsr  L0408
          tfr   d,y
@@ -258,48 +249,48 @@
          lbne  L031B
          tstb  
          lbeq  L031B
-         stb   <u0005
+         stb   <priority
          os9   F$ID     		get user id
-         sta   <DefUID			save off
+         sta   <defuid			save off
          lda   #READ.
          leax  >MOTD,pcr
          os9   I$Open   
          bcc   L0280
          clra  
-L0280    sta   <u0002
+L0280    sta   <motdpath
          lda   #$04
          bsr   L02F7
          lda   #$03
          bsr   L02F7
          leax  >ProcNum,pcr
          ldy   #ProcNumL
-         lbsr  L033D
-         leax  DefUID,u
+         lbsr  copystr
+         leax  defuid,u
          lbsr  L0471
-         tst   <u0000
-         beq   L02A8
-         leax  >lo2,pcr
-         ldy   #lo2len
-         bra   L02B0
+*         tst   <u0000
+*         beq   L02A8
+*         leax  >lo2,pcr
+*         ldy   #lo2len
+*         bra   L02B0
 L02A8    leax  >lo1,pcr
          ldy   #lo1len
-L02B0    bsr   L032F
+L02B0    bsr   strandtime
          leax  >Welcome,pcr
-         bsr   L0325
+         bsr   writeX
          lbsr  L03F0
          clrb  
-         ldx   <u0006
+         ldx   <passline		get password line in X
          leau  ,x
 L02C0    lda   ,u+
          cmpa  #'0
          bcc   L02C0
          cmpa  #C$COMA
          beq   L02CC
-         leau  -PassPath,u
+         leau  -passpath,u
 L02CC    lda   ,u+
          cmpa  #C$SPAC
          beq   L02CC
-         leau  -PassPath,u
+         leau  -passpath,u
          pshs  u
          ldy   #$0000
 L02DA    lda   ,u+
@@ -307,17 +298,17 @@
          cmpa  #C$CR
          bne   L02DA
          puls  u
-         lda   <DefUID
-         ldb   <u0005
+         lda   <defuid
+         ldb   <priority
          os9   F$SPrior 	set priority
          ldd   #256
          os9   F$Chain  
          os9   F$PErr   
 Exit     os9   F$Exit   
-L02F7    ldx   <u0006
+L02F7    ldx   <passline
          os9   I$ChgDir 
          bcs   L0315
-         ldx   <u0006
+         ldx   <passline
 L0300    lda   ,x+
          cmpa  #C$CR
          beq   L031B
@@ -327,80 +318,90 @@
 L030C    cmpa  ,x+
          beq   L030C
          leax  ,-x
-         stx   <u0006
+         stx   <passline
          rts   
 L0315    leax  >DirNotFnd,pcr
          bra   L031F
 L031B    leax  >Syntax,pcr
-L031F    bsr   L0325
+L031F    bsr   writeX
          clrb  
          os9   F$Exit   
-L0325    ldy   #256
+
+* Entry: X = ptr to string to write
+writeX   ldy   #256
          lda   #$01
          os9   I$WritLn 
          rts   
-L032F    bsr   L033D
-         lbsr  SpcInBuf
-         lbsr  SpcInBuf
-         lbsr  SpcInBuf
-         lbra  L0454
-L033D    lda   ,x+
-         lbsr  AinBuf
+
+strandtime
+         bsr   copystr
+         lbsr  putspace
+         lbsr  putspace
+         lbra  puttime
+
+* Entry: X = ptr to string to copy
+*        Y = length of string
+copystr  lda   ,x+
+         lbsr  puta
          leay  -$01,y
-         bne   L033D
+         bne   copystr
          rts   
-L0347    bsr   L033D
-         lbsr  L04AC
+
+L0347    bsr   copystr
+         lbsr  writestr
          ldx   <rdbufptr
          ldy   #80
          clra  
          os9   I$ReadLn 
          rts   
-L0357    pshs  x,b,a
-         leax  >u022D,u
-         ldb   #SS.Opt
-         clra  
-         os9   I$GetStt 
-         bcs   L0379
-         lda   ,x
-         cmpa  #$00
-         bne   L0379
-         lda   $04,x
-         pshs  a
-         clr   $04,x
-         bsr   L037F
+
+killecho pshs  x,b,a
+         leax  >popts,u
+         ldb   #SS.Opt			get path options
+         clra  					for stdin
+         os9   I$GetStt 		get status
+         bcs   notscf			branch if error
+         lda   (PD.OPT-PD.FST),x				get path type
+         cmpa  #DT.SCF			SCF device?
+         bne   notscf			branch if not
+         lda   (PD.EKO-PD.FST),x
+         pshs  a				save path echo flag
+         clr   (PD.EKO-PD.FST),x
+         bsr   setopts
          puls  a
-         sta   $04,x
+         sta   (PD.EKO-PD.FST),x
          puls  pc,x,b,a
-L0379    lda   #$FF
-         sta   ,x
+notscf   lda   #$FF
+         sta   (PD.OPT-PD.FST),x
          puls  pc,x,b,a
-L037F    pshs  x,b,a,cc
-         leax  >u022D,u
-         lda   ,x
-         cmpa  #$00
+setopts  pshs  x,b,a,cc
+         leax  >popts,u
+         lda   (PD.OPT-PD.FST),x
+         cmpa  #DT.SCF
          bne   L0391
          ldb   #SS.Opt
          clra  
          os9   I$SetStt 
 L0391    puls  pc,x,b,a,cc
-L0393    pshs  u
-         lda   <PassPath
-         ldx   #$0000
+
+readpassword
+         pshs  u
+         lda   <passpath			get path to password file
+         ldx   #$0000				seek to file position zero
          leau  ,x
-         os9   I$Seek   
+         os9   I$Seek   			now...
          puls  u
-L03A1    lda   <PassPath
-         leax  >linebuff,u
+L03A1    lda   <passpath
+         leax  >linebuff,u			read a line from the password file
          ldy   #128
          os9   I$ReadLn 
-         bcs   L03B8
-         stx   <u0006
+         bcs   L03B8				branch if error
+         stx   <passline				else save pointer to line
          bsr   L03B9
          bcs   L03A1
-         stx   <u0006
+         stx   <passline
 L03B8    rts   
-L03B9    ldx   <u0006
+L03B9    ldx   <passline
          ldy   <rdbufptr
 L03BE    lda   ,x+
          cmpa  #C$COMA
@@ -424,21 +425,22 @@
          beq   L03DE
          leay  -$01,y
          sty   <rdbufptr
-         stx   <u0006
+         stx   <passline
          clrb  
          rts   
-L03ED    lbsr  L0325
-L03F0    lda   <u0002
+L03ED    lbsr  writeX
+L03F0    lda   <motdpath
          beq   L0406
          leax  >readbuff,u
          ldy   #80
          os9   I$ReadLn 
          bcc   L03ED
-         lda   <u0002
+         lda   <motdpath
          os9   I$Close  
 L0406    clrb  
          rts   
-L0408    ldx   <u0006
+
+L0408    ldx   <passline
          clra  
          clrb  
          pshs  y,x,b,a
@@ -466,22 +468,23 @@
 L043C    lda   -$01,x
          cmpa  #C$COMA
          lbne  L031B
-         stx   <u0006
+         stx   <passline
          lda   ,s+
          beq   L0452
          tst   ,s
          lbne  L031B
          sta   ,s
 L0452    puls  pc,y,x,b,a
-L0454    leax  timebuff,u
+
+puttime  leax  timebuff,u
          os9   F$Time   		get current time
-         bsr   Y2K
-         bsr   SpcInBuf
+         bsr   Y2K				put Y2K compliant time string
+         bsr   putspace			put space
          bsr   L0461
          bra   L04A4
 L0461    bsr   L0471
-         bsr   L0465
-L0465    lda   #$3A
+         bsr   putcolon
+putcolon lda   #':
          bra   L046F
 
 Y2K      lda   #19			start out in 19th century
@@ -497,10 +500,10 @@
 L0469    bsr   L0471
          bsr   Slash
 Slash    lda   #'/
-L046F    bsr   AinBuf			add slash to buffer
+L046F    bsr   puta			add slash to buffer
 L0471    ldb   ,x+
 Byt2ASC  lda   #$2F
-         clr   <u000C
+         clr   <convbyte
 L0477    inca  
          subb  #100
          bcc   L0477
@@ -509,19 +512,19 @@
 L0480    deca  
          addb  #10
          bcc   L0480
-         bsr   AinBuf
+         bsr   puta
          tfr   b,a
          adda  #'0
-         bra   AinBuf
-L048D    inc   <u000C
+         bra   puta
+L048D    inc   <convbyte
          cmpa  #'0
-         bne   AinBuf
-         dec   <u000C
-         bne   AinBuf
+         bne   puta
+         dec   <convbyte
+         bne   puta
          rts   
 
-SpcInBuf lda   #C$SPAC
-AinBuf   pshs  x
+putspace lda   #C$SPAC
+puta     pshs  x
          ldx   <buffnext
          sta   ,x+
          stx   <buffnext
@@ -529,10 +532,10 @@
 
 L04A4    pshs  a
          lda   #C$CR
-         bsr   AinBuf
+         bsr   puta
          puls  a
-L04AC    pshs  y,x,b,a
-         leax  >u01DD,u
+writestr pshs  y,x,b,a
+         leax  >outbuf,u
          ldd   <buffnext
          stx   <buffnext
          subd  <buffnext
--- a/level1/modules/boot_1773.asm	Fri May 05 15:26:03 2006 +0000
+++ b/level1/modules/boot_1773.asm	Fri May 05 15:33:17 2006 +0000
@@ -32,6 +32,9 @@
 *
 *   8      2006/03/03  Boisy G. Pitre
 * Drive motors now turned off before returning to kernel.
+*
+*   9      2006/05/05  Boisy G. Pitre
+* Fixed bug where single sided booting was broken
 
          nam   Boot
          ttl   WD1773 Boot module
@@ -83,7 +86,7 @@
 tylg     set   Systm+Objct
 atrv     set   ReEnt+rev
 rev      set   $00
-edition  set   8
+edition  set   9
 
          mod   eom,name,tylg,atrv,start,size
 
@@ -254,7 +257,7 @@
 r@       rts
 
 Seek2Sect
-         lda   #MOTON			permit alternate drives
+         lda   #MOTON		permit alternate drives
          ora   WhichDrv,pcr		permit alternate drives
          sta   drvsel,u		save byte to static mem
          clr   side,u		start on side 1
@@ -262,14 +265,17 @@
          cmpd  #$0000		zero?
          beq   L016C		branch if so
          clr   ,-s			else clear space on stack
-         tst   ddfmt,u	double sided disk?
+         pshs  a
+         lda   ddfmt,u
+         bita  #FMT.SIDE	double sided disk?
+         puls  a
          beq   SnglSid		branch if not
          bra   DblSid
 * Double-sided code
 L0152    com   side,u		flag side 2
          bne   DblSid
          inc   ,s
-DblSid    subb  ddtks,u		
+DblSid   subb  ddtks,u		
          sbca  #$00
          bcc   L0152
          bra   L0168