changeset 2817:5c6b71612ce4 lwtools-port

Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver. Fixed up shellplus labels.
author Boisy Pitre <boisy.pitre@nuance.com>
date Wed, 01 May 2013 08:38:04 -0500
parents 8babf9987e22
children 05426dd4e24e
files level1/cmds/shellplus.asm level1/modules/llcocosdc.asm level1/modules/superdesc.asm level2/coco3/bootfiles/makefile level2/coco3/makefile level2/coco3/modules/makefile
diffstat 6 files changed, 470 insertions(+), 134 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/shellplus.asm	Thu Feb 14 07:29:48 2013 -0600
+++ b/level1/cmds/shellplus.asm	Wed May 01 08:38:04 2013 -0500
@@ -233,7 +233,7 @@
          lbsr  L16A6          Get user #, and make 2 digit ASCII ver. @ 1EC
          lbsr  L1674          Make shell logging pathname @ CBD
          leax  <L003D,pc      Point to default shell prompt string
-         lbsr  L0A14          Go create shell prompt string & prompt itself
+         lbsr  CmdPEq         Go create shell prompt string & prompt itself
          leax  >u05A8,u       Point to start of shell variables
          ldd   #C$CR*256+20   Carriage return (blank entries) & all 20 of them
 L009C    sta   ,x             Mark shell variable as blank
@@ -360,7 +360,7 @@
          lbeq  L010D          No, go print shell prompt/process next line
          clr   <u0046         Clear GOTO label flag
          leax  >u0C4C,u       Point to copy of GOTO label name
-         lbsr  L0FD0          Go process GOTO line
+         lbsr  CmdGOTO        Go process GOTO line
          lbra  L010D          Go print shell prompt/process next line
 
 * No error received on line
@@ -387,7 +387,7 @@
          bra   L0191          Go handle error
 
 L01EC    fcc   'eof'
-         fcb   $0d
+         fcb   C$CR
 
 * <ESC> received
 L01F0    tst   <u001D         Shell prompting on?
@@ -434,7 +434,7 @@
          puls  pc,y,x,d       Restore regs & return
 
 * R= command (redirect specific paths)
-L0245    lda   ,x             Get char from input line
+CmdREq   lda   ,x             Get char from input line
          cmpa  #'<            Is it input path?
          beq   L0251          Yes, skip ahead
          cmpa  #'>            Is it an output/error path?
@@ -473,9 +473,9 @@
          ldx   <u0048         Get ptr to redirected dev/file name & return
          rts   
 * Z= command (immortal shell setting, but kill parent process)
-L0296    inc   <u0013         Flag we want to kill parent
+CmdZEq   inc   <u0013         Flag we want to kill parent
 * I= command (immortal shell setting)
-L0298    lbsr  L0CD2
+CmdIEq   lbsr  L0CD2
          lbcs  L0B96
          bsr   L02A3
          bra   L02D4
@@ -529,123 +529,125 @@
          rts   
 
 * Command list
-L0300    fdb   L0B87-L0300    $0887
+CmdList  fdb   L0B87-*
          fcs   '*'
-L0303    fdb   L12D1-L0303    $0fce
+         fdb   CmdW-*
          fcs   'W'
-L0306    fdb   L09BD-L0306    $06b7
+         fdb   CmdCHD-*
          fcs   'CHD'
-L030B    fdb   L09B5-L030B    $06aa
+         fdb   CmdCHX-*
          fcs   'CHX'
-L0310    fdb   L09BD-L0310    $06ad
+         fdb   CmdCLS-*
+         fcs   'CLS'
+         fdb   CmdCHD-*
          fcs   'CD'
-L0314    fdb   L09B5-L0314    $06a1
+         fdb   CmdCHX-*
          fcs   'CX'
-L0318    fdb   L0987-L0318    $066f
+         fdb   CmdEX-*
          fcs   'EX'
-L031C    fdb   L16DD-L031C    $13c1
+         fdb   CmdKill-*
          fcs   'KILL'
-L0322    fdb   L09EF-L0322    $06cd
+         fdb   CmdX-*
          fcs   'X'
-L0325    fdb   L09F3-L0325    $06ce
+         fdb   CmdNX-*
          fcs   '-X'
-L0329    fdb   L0A14-L0329    $06eb
+         fdb   CmdPEq-*
          fcs   'P='
-L032D    fdb   L09D7-L032D    $06aa
+         fdb   CmdP-*
          fcs   'P'
-L0330    fdb   L09DA-L0330    $06aa
+         fdb   CmdNP-*
          fcs   '-P'
-L0334    fdb   L09DF-L0334    $06ab
+         fdb   CmdT-*
          fcs   'T'
-L0337    fdb   L09E3-L0337    $06ac
+         fdb   CmdNT-*
          fcs   '-T'
-L033B    fdb   L170D-L033B    $13d2
+         fdb   CmdSETPR-*
          fcs   'SETPR'
-L0342    fdb   L0298-L0342    $ff56
+         fdb   CmdIEq-*
          fcs   'I='
-L0346    fdb   L0245-L0346    $feff
+         fdb   CmdREq-*
          fcs   'R='
-L034A    fdb   L0296-L034A    $ff4c
+         fdb   CmdZEq-*
          fcs   'Z='
-L034E    fdb   L0927-L034E    $05d9
+         fdb   CmdSEMI-*
          fcs   ';'
-L0351    fdb   L176B-L0351    $141a
+         fdb   CmdPWD-*
          fcs   '.PWD'
-L0357    fdb   L177D-L0357    $1426
+         fdb   CmdPXD-*
          fcs   '.PXD'
-L035D    fdb   L1029-L035D    $0ccc
+         fdb   CmdMEq-*
          fcs   'M='
-L0361    fdb   L105A-L0361    $0cf9
+         fdb   CmdVAR-*
          fcs   'VAR.'
-L0367    fdb   L09E7-L0367    $0680
+         fdb   CmdV-*
          fcs   'V'
-L036A    fdb   L09EA-L036A    $0680
+         fdb   CmdNV-*
          fcs   '-V'
-L036E    fdb   L1209-L036E    $0e9b
+         fdb   CmdPATHEq-*
          fcs   'PATH='
-L0375    fdb   L11CF-L0375    $0e5a
+         fdb   CmdPAUSE-*
          fcs   'PAUSE'
-L037C    fdb   L1126-L037C    $0daa
+         fdb   CmdINC-*
          fcs   'INC.'
-L0382    fdb   L1131-L0382    $0daf
+         fdb   CmdDEC-*
          fcs   'DEC.'
-L0388    fdb   L0D62-L0388    $09da
+         fdb   CmdIF-*
          fcs   'IF'
-L038C    fdb   L0E0B-L038C    $0a7f
+         fdb   CmdTHEN-*
          fcs   'THEN'
-L0392    fdb   L0F8C-L0392    $0bfa
+         fdb   CmdELSE-*
          fcs   'ELSE'
-L0398    fdb   L0E0B-L0398    $0a73
+         fdb   CmdTHEN-*
          fcs   'FI'
-L039C    fdb   L0E0B-L039C    $0a6f
+         fdb   CmdTHEN-*
          fcs   'ENDIF'
-L03A3    fdb   L0F3F-L03A3    $0b9c
+         fdb   CmdCLRIF-*
          fcs   'CLRIF'
-L03AA    fdb   L0FD0-L03AA    $0c26
+         fdb   CmdGOTO-*
 L03AC    fcs   'GOTO'
-L03B0    fdb   L0F93-L03B0    $0be3
+         fdb   CmdONERR-*
          fcs   'ONERR'
-L03B7    fdb   L09CF-L03B7    $0618
+         fdb   CmdL-*
          fcs   'L'
-L03BA    fdb   L09D3-L03BA    $0619
+         fdb   CmdNL-*
          fcs   '-L'
-L03BE    fdb   L0969-L03BE    $05ab
+         fdb   CmdSTARTUP-*
          fcs   'S.T.A.R.T.U.P'
          fdb   $0000
-L03CF    fdb   L1634-L03CF    $1265
+L03CF    fdb   CmdPIPE-*
          fcs   '!'
-L03D2    fdb   L1634-L03D2    $1262
+         fdb   CmdPIPE-*
          fcs   '|'
-L03D5    fdb   L12A0-L03D5    $0ecb
+         fdb   CmdSEMIC-*
          fcs   ';'
-L03D8    fdb   L12C3-L03D8    $0eeb
+         fdb   CmdAmp-*
          fcs   '&'
-L03DB    fdb   L1299-L03DB    $0ebe
-         fcb   $8d            CR
-L03DE    fdb   L0CCE-L03DE    $08f0
+         fdb   CmdCR-*
+         fcb   $80+C$CR
+L03DE    fdb   CmdIOE-*
          fcs   '<>>>'
-L03E4    fdb   L0CE5-L03E4    $0901
+         fdb   CmdIE-*
          fcs   '<>>'
-L03E9    fdb   L0CD7-L03E9    $08ee
+         fdb   CmdIO-*
          fcs   '<>'
-L03ED    fdb   L0CF3-L03ED    $0906
+         fdb   CmdOE-*
          fcs   '>>>'
-L03F2    fdb   L0C01-L03F2    $080f
+         fdb   CmdErr-*
          fcs   '>>'
-L03F6    fdb   L0BFA-L03F6    $0804
+         fdb   CmdIn-*
          fcs   '<'
-L03F9    fdb   L0C08-L03F9    $080f
+         fdb   CmdOut-*
          fcs   '>'
-L03FC    fdb   L1277-L03FC    $0e7b
+         fdb   CmdMem-*
          fcs   '#'
-L03FF    fdb   L1265-L03FF    $0e66
+         fdb   CmdCaret-*
          fcs   '^'
          fdb   $0000          End of table marker
 
-L0404    fcb   $0d
+L0404    fcb   C$CR
          fcc   '()'
          fcb   $ff
-L0408    fcb   $0d
+L0408    fcb   C$CR
          fcc   '!#&;<>^|'
          fcb   $ff
          
@@ -1262,7 +1264,7 @@
          sta   <u0022         Flag we don't change priority for forked process
          sta   <u0003         Clear out # pages of data mem for forked process
          sta   <u000E         Clear out signal code
-         leay  >L0300,pc      Point to main command list
+         leay  >CmdList,pc      Point to main command list
          lbsr  L08D1          Parse keywords from list
          bcs   L08A0          Keyword found but generated error, done line
          cmpa  #C$CR          Is 1st non-keyword char a carriage return?
@@ -1337,7 +1339,7 @@
          leax  -1,x           Bump source ptr back
          ldb   #E$BPNam       Bad Path Name error & return
          rts   
-* Entry: Y=ptr to command list (L0300)
+* Entry: Y=ptr to command list (CmdList)
 L08D1    bsr   L0907          Go find 1st non-space char
          pshs  y              Save command list ptr
          bsr   L092A          Parse for keyword or special char
@@ -1388,7 +1390,7 @@
          beq   L0921
          leax  -1,x           Point to 1st non-space char
 * ; (1st pass) comes here
-L0927    andcc #^Carry        No carry & return
+CmdSEMI  andcc #^Carry        No carry & return
          rts   
 * Command line parser
 L092A    pshs  y,x            Preserve command table ptr & input line ptr
@@ -1425,7 +1427,8 @@
          fcb   C$CR
 
 * Create child shell to run 'startup' file
-L0969    pshs  u,y,x          Preserve regs
+CmdSTARTUP
+         pshs  u,y,x          Preserve regs
          leax  L000D,pc       Point to 'shell' (module name)
          leau  L0961,pc       Point to 'startup' (parameter for 'shell')
          ldy   #$0008         Size of 'startup<CR>'
@@ -1442,7 +1445,7 @@
          rts   
 
 * EX command
-L0987    lbsr  L08A3          Go check for valid device name (module)
+CmdEX    lbsr  L08A3          Go check for valid device name (module)
          bcs   L09AB          If none, exit
          clra                 Std in path
          bsr   L09B0          Go close it
@@ -1464,12 +1467,12 @@
 L09B0    pshs  a              Save path #
          lbra  L0BBC          close path if it is open
 * CHX & CX commands
-L09B5    clr   <u0038
+CmdCHX   clr   <u0038
          lda   #DIR.+EXEC.
          os9   I$ChgDir 
          rts   
 * CHD & CD commands
-L09BD    lda   #DIR.+READ.    (bug fix, originally opened in UPDATE)
+CmdCHD   lda   #DIR.+READ.    (bug fix, originally opened in UPDATE)
          os9   I$ChgDir       Change the directory
          bcs   L09CE          Error, exit with it
          clr   <u0037         Flag .pwd entry as invalid
@@ -1478,38 +1481,38 @@
          bsr   L0A04          Go update shell expanded prompt if needed
 L09CE    rts   
 * L command - Logging ON
-L09CF    lda   #$01
+CmdL     lda   #$01
          bra   L09D4
 * -L command - Logging OFF
-L09D3    clra  
+CmdNL    clra  
 L09D4    sta   <u001C
          rts   
 * P command - Prompting ON
-L09D7    clra  
+CmdP     clra  
          bra   L09DC
 * -P command - Prompting OFF
-L09DA    lda   #$01
+CmdNP    lda   #$01
 L09DC    sta   <u001D
          rts   
 * T command - Echo input ON
-L09DF    lda   #$01
+CmdT     lda   #$01
          bra   L09E4
 * -T command - Echo input OFF
-L09E3    clra  
+CmdNT    clra  
 L09E4    sta   <u001E
          rts   
 * V command - Turn variable expansion ON
-L09E7    clra  
+CmdV     clra  
          bra   L09EC
 * -V command - Turn variable expansion OFF
-L09EA    lda   #$01
+CmdNV    lda   #$01
 L09EC    sta   <u001F
          rts   
 * X command - Kill Shell when error occurs ON
-L09EF    lda   #$01
+CmdX     lda   #$01
          bra   L09F4
 * -X command - Kill Shell when error occurs OFF
-L09F3    clra  
+CmdNX    clra  
 L09F4    sta   <u0020
          rts   
 
@@ -1525,13 +1528,13 @@
 L0A08    puls  y              Restore Y
          pshs  x              Preserve X
          leax  >L003D,pc      Point to default prompt string
-         bsr   L0A14          Put that into working shell prompt string
+         bsr   CmdPEq         Put that into working shell prompt string
          puls  pc,x           Restore X & return
 
 * P= (prompt set) command
 * Make shell prompt string (default or user-specified)
 * Entry: X=ptr to source of new shell prompt string
-L0A14    pshs  y              Preserve Y
+CmdPEq   pshs  y              Preserve Y
          leay  >u01F9,u       Point to working prompt text buffer
          ldd   #C$LF*256+22   Line feed & max count for prompt string+1
          sta   ,y+            Save LF as first char
@@ -1663,9 +1666,9 @@
 
 * Separator table for date & time strings
 L0B35    fcc   '//'
-         fcb   $0d
+         fcb   C$CR
          fcc   '::'
-         fcb   $0d
+         fcb   C$CR
 
 * Get current date (2E0-2E8) & time (2E9-2EF)
 L0B3B    pshs  y,x            Preserve shell prompt string & shell prompt ptrs
@@ -1712,7 +1715,7 @@
          lda   #$01           Only do std in & out (not error)
          bra   L0B9A
 
-* Any errors from any of the L0300 subroutines go here
+* Any errors from any of the CmdList subroutines go here
 * If child process had error/status code it goes here (u005D cleared,B=Status
 * code)
 L0B96    pshs  d,cc           Preserve error code, flags & A
@@ -1769,15 +1772,15 @@
          clr   <u0019
          lbra  L00CC
 * < processing
-L0BFA    ldd   #$0001
+CmdIn    ldd   #$0001
          orb   <u000F
          bra   L0C1A
 * >> processing
-L0C01    ldd   #$020D
+CmdErr   ldd   #$020D
          stb   -$02,x
          bra   L0C0A
 * > processing
-L0C08    lda   #$01
+CmdOut   lda   #$01
 L0C0A    ldb   #$02
          bra   L0C1A
 * if from z= or i=, A=0, B=3
@@ -1871,14 +1874,14 @@
 L0CC8    ldd   #$0003         Std in & ???
          lbra  L0C0E
 * <>>> processing
-L0CCE    lda   #C$CR
+CmdIOE   lda   #C$CR
          sta   -$04,x
 * i= & z= both come here right off the bat
 L0CD2    bsr   L0CDB
          bcc   L0CFF
 L0CD6    rts   
 * <> processing
-L0CD7    lda   #C$CR
+CmdIO    lda   #C$CR
          sta   -$02,x
 
 L0CDB    bsr   L0CC8
@@ -1886,14 +1889,14 @@
          ldd   #$0180
          lbra  L0C0E
 * <>> processing
-L0CE5    lda   #C$CR
+CmdIE    lda   #C$CR
          sta   -$03,x
          bsr   L0CC8
          bcs   L0CD6
          ldd   #$0280
          lbra  L0C0E
 * >>> processing
-L0CF3    lda   #C$CR
+CmdOE    lda   #C$CR
          sta   -$03,x
          ldd   #$0102
          lbsr  L0C0E
@@ -1939,11 +1942,11 @@
          lbra  L0CBE
 
 L0D56    fcc   'TRUE '
-L0D5B    fcb   $0d
+L0D5B    fcb   C$CR
 L0D5C    fcc   'FALSE'
-         fcb   $0d
+         fcb   C$CR
 
-L0D62    lda   ,x+
+CmdIF    lda   ,x+
          cmpa  #'[
          bne   L0D6B
          lbsr  L0E15
@@ -2015,11 +2018,11 @@
 L0DF8    clr   <u0043
          leax  >L0D56,pc      Point to 'TRUE'
 L0DFE    tst   <u001E         Command echo on?
-         beq   L0E0B          No, skip ahead
+         beq   CmdTHEN        No, skip ahead
          ldy   #$0006         Print result of IF to std error
          lda   #$02
          os9   I$WritLn 
-L0E0B    leax  >u0124,u
+CmdTHEN  leax  >u0124,u
          lda   #C$CR
          sta   ,x
          clrb  
@@ -2166,11 +2169,11 @@
          lbra  L0191
 
 L0F1D    cmpa  #$03
-         beq   L0F3F
+         beq   CmdCLRIF
          cmpa  #$02
          bne   L0F2B
          dec   <u0044
-         blt   L0F3F
+         blt   CmdCLRIF
          bra   L0F43
 
 L0F2B    cmpa  #$01
@@ -2179,13 +2182,13 @@
          cmpa  #$02
          bne   L0F43
          tst   <u0044
-         beq   L0F3F
+         beq   CmdCLRIF
          bra   L0F43
 
 L0F3B    inc   <u0044
          bra   L0F43
 
-L0F3F    clr   <u0043
+CmdCLRIF clr   <u0043
          clr   <u0044
 L0F43    clrb  
          rts   
@@ -2223,11 +2226,11 @@
          inca                 No, ???
          bra   L0F6D          Process this one
 
-L0F8C    lda   #$01
+CmdELSE  lda   #$01
          sta   <u0043
-         lbra  L0E0B
+         lbra  CmdTHEN
 
-L0F93    lbsr  L0907          Go find 1st non-space char or single char modifier
+CmdONERR lbsr  L0907          Go find 1st non-space char or single char modifier
          bne   L0F9B
          clr   <u0046
 L0F8B    rts   
@@ -2255,7 +2258,7 @@
          stx   <u0058       Save it & return
          rts
 
-L0FD0    lda   ,x
+CmdGOTO  lda   ,x
          cmpa  #'+
          bne   L0FDA
          leax  1,x
@@ -2303,7 +2306,7 @@
          puls  pc,y,x         Restore regs & return
 
 * M= command (???)
-L1029    ldb   #C$CR
+CmdMEq   ldb   #C$CR
          stb   -$01,x
          tst   <u006B
          bne   L1057
@@ -2328,7 +2331,7 @@
 L1057    lbra  L0BCF
 
 * VAR. command
-L105A    leay  >u05A8,u
+CmdVAR   leay  >u05A8,u
          lda   ,x+
          cmpa  #'?
          beq   L10C9
@@ -2416,13 +2419,13 @@
          puls  pc,x
 
 * INC. command (increment shell variable by 1)
-L1126    bsr   L1144
+CmdINC   bsr   L1144
          lbcs  L0191
          addd  #$0001
          bra   L113A
 
 * DEC. command (decrement shell variable by 1)
-L1131    bsr   L1144
+CmdDEC   bsr   L1144
          lbcs  L0191
          subd  #$0001
 L113A    bsr   L11A7
@@ -2510,7 +2513,7 @@
 
 * PAUSE command - may display text message, and then waits for key press or
 * mouse button
-L11CF    ldy   #394           Write up to 394 chars of pause string
+CmdPAUSE ldy   #394           Write up to 394 chars of pause string
          lda   #$02           To standard error
          os9   I$WritLn 
          lbcs  L0191
@@ -2535,7 +2538,8 @@
          puls  pc,x
 
 * Parse PATH=, add paths to PATH buffer list
-L1209    pshs  x              Preserve ptr to string after 'PATH='
+CmdPATHEq
+         pshs  x              Preserve ptr to string after 'PATH='
          lda   ,x             Get 1st char
          cmpa  #'?            User requesting current paths?
          beq   L1245          Yes, go do that
@@ -2581,7 +2585,7 @@
          rts   
 
 * ^ (set priority on the fly) command
-L1265    ldb   #C$CR          Plop a CR onto the end
+CmdCaret ldb   #C$CR          Plop a CR onto the end
          stb   -$01,x
          ldb   <u0022         Any priority already set?
          lbne  L0BCF          Yes, print 'WHAT?'
@@ -2590,7 +2594,7 @@
          lbra  L0907          Continue processing for modifiers
 
 * # (set data memory size) command
-L1277    ldb   #C$CR
+CmdMem   ldb   #C$CR
          stb   -1,x
          ldb   <u0003       Already have a data mem size set?
          lbne  L0BCF        Yes, print 'WHAT?'
@@ -2607,12 +2611,12 @@
          lbra  L0907        Continue processing command line
 
 * Carriage return processing
-L1299    leax  -1,x
+CmdCR    leax  -1,x
          lbsr  L145D
          bra   L12A3
 
 * ; (separator) command (also called by others)
-L12A0    lbsr  L1459
+CmdSEMIC lbsr  L1459
 L12A3    bcs   L12BA
          lbsr  L0B96          Go do the path stuff
          tst   <u005D         Is there a module that is unlinking?
@@ -2633,7 +2637,7 @@
          lbra  L0B96          ??? Go close some paths & return?
 
 * & (background operation) command
-L12C3    lbsr  L1459
+CmdAmp   lbsr  L1459
          bcs   L12BA
          bsr   L12BA
          ldb   #$26
@@ -2641,7 +2645,7 @@
          bra   L12AE
 
 * W command - Wait for a child to die
-L12D1    clra                 Clear process ID #
+CmdW     clra                 Clear process ID #
 * Entered here if commands are separated with ';' (or '()' groups)
 L12D2    pshs  a              Save ID # of process?
 L12D4    os9   F$Wait         Wait for child to die or until signal received
@@ -3074,7 +3078,7 @@
          bne   L1592          Yes, skip ahead
          ldx   <u0004         Get module name ptr
          ldu   4,s
-         lbsr  L0BFA          Set up paths
+         lbsr  CmdIn          Set up paths
          lbcs  L162B          If error, exit with it
          bra   L1592          Start up shell with '-P X PATH=(current)'
 
@@ -3210,7 +3214,7 @@
 L162E    fcc   '/pipe'
          fcb   C$CR
 
-L1634    pshs  x
+CmdPIPE  pshs  x
          leax  <L162E,pc      Point to '/pipe'
          ldd   #$0103
          lbsr  L0C0E
@@ -3234,7 +3238,7 @@
 
 * Filename for shell log-append mode because of leading '+'
 L1666    fcc   '+/dd/log/uxxx'
-         fcb   $0d
+         fcb   C$CR
 
 * Make shell logging filename @ u0CBD,u
 L1674    leax  <L1666,pc      Point to log name string (append mode)
@@ -3296,7 +3300,7 @@
          puls  pc,y,x,d       Restore other regs & return
 
 * KILL command
-L16DD    bsr   L16EB          Go get process # to kill
+CmdKill  bsr   L16EB          Go get process # to kill
          cmpb  #2             Trying to kill the system process or 1st shell?
          bls   L170A          Yes, print 'WHAT?' & ignore it
          tfr   b,a            Move process # to proper reg
@@ -3304,6 +3308,18 @@
          os9   F$Send         Send it to the process & return
          rts   
 
+* Clear Screen by writing $0C to stdout
+ClrByte  fcb   $0C
+ClrLen   equ   *-ClrByte
+
+CmdCLS
+         pshs  x
+         lda   #$01
+         leax  ClrByte,pcr
+         ldy   #ClrLen
+         os9   I$Write
+         puls  x,pc
+
 * Set priority - subroutine to calculate binary version of #
 * (used for both process # & priority values)
 L16EB    clrb                 Initialize # for loop
@@ -3325,7 +3341,7 @@
 L1708    leas  2,s            Yes, eat RTS address & exit with error
 L170A    lbra  L0BCF          Print 'WHAT?'
 * SETPR routine
-L170D    bsr   L16EB          Go calculate process #
+CmdSETPR    bsr   L16EB          Go calculate process #
          stb   <u0021         Save it
          lbsr  L0907          Find next field (after commas/spaces)
          bsr   L16EB          Go calculate priority (into B)
@@ -3341,7 +3357,7 @@
 L175B    fcc   'pwd: read error'
          fcb   C$CR
          
-L176B    clr   <u003D
+CmdPWD   clr   <u003D
 L176D    pshs  y,x
          leay  >u02F2,u
          lda   #$81
@@ -3350,7 +3366,7 @@
          ldx   <u0039
          bra   L17F7
 * .PXD command
-L177D    clr   <u003D
+CmdPXD   clr   <u003D
          pshs  y,x
          leay  >u0375,u
          lda   #$85
@@ -3361,7 +3377,7 @@
 L178F    sta   <u0029
          sty   <u003E
 L1794    leax  >$0080,y
-         lda   #$0D
+         lda   #C$CR
          sta   ,x
          stx   <u002A
          leax  <L1759,pc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/level1/modules/llcocosdc.asm	Wed May 01 08:38:04 2013 -0500
@@ -0,0 +1,235 @@
+********************************************************************
+* llcocosdc - CoCo SD Low-level driver
+*
+* $Id$
+*
+* Edt/Rev  YYYY/MM/DD  Modified by
+* Comment
+* ------------------------------------------------------------------
+*          2004/??/??  Boisy G. Pitre
+* Created.
+
+               NAM       llcocosdc
+               TTL       CoCo SDC Low-level driver
+
+               USE       defsfile
+               USE       rbsuper.d
+
+tylg           SET       Sbrtn+Objct
+atrv           SET       ReEnt+rev
+rev            SET       0
+
+
+               MOD       eom,name,tylg,atrv,start,0
+
+               ORG       V.LLMem
+* Low-level driver static memory area
+
+name           FCS       /llcocosdc/
+
+start          bra       ll_init
+               nop       
+               lbra      ll_read
+               lbra      ll_write
+               bra       ll_getstat
+               nop       
+               lbra      ll_setstat
+*         lbra  ll_term   
+
+* ll_term
+*
+* Entry:
+*    Y  = address of device descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code
+*
+ll_term                  
+               clrb      
+               rts       
+
+* ll_init
+*
+* Entry:
+*    Y  = address of device descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code
+*
+ll_init                  
+               clrb      
+               rts       
+
+
+* ll_getstat
+*
+* Entry:
+*    Y  = address of path descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code
+*
+ll_getstat               
+               lda       R$B,x
+               cmpa      #SS.DSize
+               beq       SSDSize
+               ldb       #E$UnkSvc
+               coma      
+               rts       
+
+
+* SS.DSize - Return size information about a device
+*
+* Entry: B = SS.DSize
+* Exit:  Carry = 1; error with code in B
+*        Carry = 0:
+*          IF B = 0
+*            A = Sector Size (1 = 256, 2 = 512, 4 = 1024, 8 = 2048)
+*            X = Number of Sectors (bits 31-16)
+*            Y = Number of Sectors (Bits 15-0)
+*          IF B != 0
+*            A = Sector Size (1 = 256, 2 = 512, 4 = 1024, 8 = 2048)
+*            X = Number of Logical Cylinders
+*            B = Number of Logical Sides
+*            Y = Number of Logical Sectors/Track
+*
+SSDSize                  
+               clrb      
+               rts
+
+
+* ll_setstat
+*
+* Entry:
+*    Y  = address of path descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code
+*
+ll_setstat               
+               clrb      
+               rts       
+
+* ll_read
+*
+* Entry:
+*    Y  = address of path descriptor
+*    U  = address of device memory area
+*
+* Static memory referenced:
+*    V.CchPSpot     = address of spot in cache where physical sector data will go
+*    sectsize       = sector size (0=256,1=512,2=1024,3=2048)
+*    V.SectCnt      = sectors to read
+*    V.PhysSect = physical sector to start read from
+ll_read                  
+               lda       PD.DRV,y
+               ldb       V.PhysSect,u
+               ldx       V.PhysSect+1,u
+               ldu       V.CchPSpot,u
+ ldy #$FF4A
+ stb -1,y
+ stx ,y
+ ldb #$43
+ stb $FF40
+ ora #$80
+ sta -2,y
+ exg a,a
+
+ ldx #0
+rdWait lda -2,y
+ bmi rdFail
+ bita #2
+ bne rdRdy
+ leax -1,x
+ bne rdWait
+rdFail clr $FF40
+ ldb #E$Read
+ coma
+ rts
+
+rdRdy leax ,u
+ ldd #32*256+8
+rdChnk ldu ,y
+ stu ,x
+ ldu ,y
+ stu 2,x
+ ldu ,y
+ stu 4,x
+ ldu ,y
+ stu 6,x
+ abx
+ deca
+ bne rdChnk
+
+ clr $FF40
+ rts
+
+
+* ll_write
+*
+* Entry:
+*    Y  = address of path descriptor
+*    U  = address of device memory area
+*
+* Static memory referenced:
+*    V.CchPSpot     = address of spot in cache where physical sector data is
+*    sectsize       = sector size (0=256,1=512,2=1024,3=2048)
+*    V.SectCnt      = sectors to read
+*    V.PhysSect     = physical sector to start read from
+ll_write                 
+               lda       PD.DRV,y
+               ldb       V.PhysSect,u
+               ldx       V.PhysSect+1,u
+               ldu       V.CchPSpot,u
+
+ ldy #$FF4A
+ stb -1,y
+ stx ,y
+ ldb #$43
+ stb $FF40
+ ora #$A0
+ sta -2,y
+ exg a,a
+
+ ldx #0
+wrWait lda -2,y
+ bmi wrFail
+ bita #2
+ bne wrRdy
+ leax -1,x
+ bne wrWait
+wrFail clr $FF40
+ ldb  #E$Write
+ coma
+ rts
+
+wrRdy leax ,u
+ ldd #64*256+4
+wrChnk ldu ,x
+ stu ,y
+ ldu 2,x
+ stu ,y
+ abx
+ deca
+ bne wrChnk
+
+wrComp lda -2,y
+ bmi wrFail
+ lsra
+ bcs wrComp
+
+ clr $FF40
+ rts
+
+               EMOD      
+eom            EQU       *
+               END       
+
--- a/level1/modules/superdesc.asm	Thu Feb 14 07:29:48 2013 -0600
+++ b/level1/modules/superdesc.asm	Wed May 01 08:38:04 2013 -0500
@@ -182,7 +182,7 @@
                FCB       ITDRV+$B0
                ENDC
                ELSE
-               IFNE      SD
+               IFNE      COCOSDC
 name           FCC       /SD/
                IFNE      HB
                FCS       /H/
@@ -228,8 +228,8 @@
                FCS       /llide/
                FCB       0,0
                ELSE
-               IFNE      SD
-               FCS       /llsd/
+               IFNE      COCOSDC
+               FCS       /llcocosdc/
                FCB       0,0,0
                ENDC
                ENDC
--- a/level2/coco3/bootfiles/makefile	Thu Feb 14 07:29:48 2013 -0600
+++ b/level2/coco3/bootfiles/makefile	Wed May 01 08:38:04 2013 -0500
@@ -42,6 +42,8 @@
 		$(MD)/w5.dw $(MD)/w6.dw $(MD)/w7.dw
 RBDW       = $(MD)/rbdw.dr $(MD)/dwio.sb \
 		$(MD)/x1.dd $(MD)/x2.dd $(MD)/x3.dd
+RBCOCOSDC  = $(MD)/rbsuper.dr $(MD)/llcocosdc.dr \
+		$(MD)/sd0_cocosdc.dd $(MD)/sd1_cocosdc.dd
 RBDWARDUINO = $(MD)/rbdw.dr $(MD)/dwio_arduino.sb \
 		$(MD)/x1.dd $(MD)/x2.dd $(MD)/x3.dd
 RBDWBECKER = $(MD)/rbdw.dr $(MD)/dwio_becker.sb \
@@ -156,6 +158,17 @@
 		$(PIPE) \
 		$(CLOCK60HZDW)
 
+# NitrOS-9 disk bootfile to allow booting from CoCo SD
+BOOTFILE_COCOSDC	= $(MD)/krnp2 $(MD)/ioman $(MD)/init \
+		$(MD)/rbf.mn \
+                $(FLOPPY_40D) \
+		$(RBCOCOSDC) \
+                $(MD)/ddsd_cocosdc.dd \
+		$(MD)/scf.mn \
+		$(VTIO_COGRF_80) \
+		$(PIPE) \
+		$(CLOCK60HZ)
+
 # NitrOS-9 disk bootfile to allow booting from WD1773 disk controller
 BOOTFILE_40D	= $(MD)/krnp2 $(MD)/ioman $(MD)/init \
 		$(MD)/rbf.mn \
@@ -196,7 +209,7 @@
 BOOTFILES	= bootfile_40d bootfile_40d_50hz bootfile_80d \
 		bootfile_80d_50hz bootfile_dw bootfile_dw_headless \
 		bootfile_becker bootfile_arduino bootfile_becker_headless \
-		bootfile_arduino_headless
+		bootfile_arduino_headless bootfile_cocosdc
 KERNELS		= kernel_1773 kernel_1773_50hz kernel_dw kernel_becker kernel_arduino
 
 ALLOBJS		= $(BOOTFILES) $(KERNELS)
@@ -234,6 +247,9 @@
 bootfile_arduino_headless: $(BOOTFILE_ARDUINO_HEADLESS) $(DEPENDS)
 	$(MERGE) $(BOOTFILE_ARDUINO_HEADLESS)>$@
 
+bootfile_cocosdc: $(BOOTFILE_COCOSDC) $(DEPENDS)
+	$(MERGE) $(BOOTFILE_COCOSDC)>$@
+
 # Kernels
 kernel_becker: $(KERNEL_BECKER) $(DEPENDS)
 	$(MERGE) $(KERNEL_BECKER)>$@
--- a/level2/coco3/makefile	Thu Feb 14 07:29:48 2013 -0600
+++ b/level2/coco3/makefile	Wed May 01 08:38:04 2013 -0500
@@ -11,6 +11,7 @@
 DISTROVER	= $(DISTRONAME)$(NITROS9VER)$(PORT)
 BOOTFILE_BECKER	= bootfiles/bootfile_becker
 BOOTFILE_ARDUINO	= bootfiles/bootfile_arduino
+BOOTFILE_COCOSDC	= bootfiles/bootfile_cocosdc
 BOOTFILE_BECKER_HEADLESS	= bootfiles/bootfile_becker_headless
 BOOTFILE_ARDUINO_HEADLESS	= bootfiles/bootfile_arduino_headless
 BOOTFILE_DW 	= bootfiles/bootfile_dw
@@ -57,6 +58,7 @@
 LDSK360K_1_50HZ	= $(DISTRONAME)_40d_1_50hz.dsk
 DSKBECKER	= $(DISTROVER)_becker.dsk
 DSKARDUINO	= $(DISTROVER)_arduino.dsk
+DSKCOCOSDC	= $(DISTROVER)_cocosdc.dsk
 DSKBECKERHEADLESS	= $(DISTROVER)_becker_headless.dsk
 DSKARDUINOHEADLESS	= $(DISTROVER)_arduino_headless.dsk
 DSK360K_2	= $(DISTROVER)_40d_2.dsk
@@ -67,6 +69,7 @@
 LDSK720K_50HZ	= $(DISTRONAME)_80d_50hz.dsk
 LDSKBECKER	= $(DISTRONAME)_becker.dsk
 LDSKARDUINO	= $(DISTRONAME)_arduino.dsk
+LDSKCOCOSDC	= $(DISTRONAME)_cocosdc.dsk
 LDSKBECKERHEADLESS	= $(DISTRONAME)_becker_headless.dsk
 LDSKARDUINOHEADLESS	= $(DISTRONAME)_arduino_headless.dsk
 TESTDSK		= test.dsk
@@ -74,11 +77,11 @@
 DSKS		= $(DSKDW) $(DSK360K_1) $(DSK360K_1_50HZ) $(DSK360K_2) \
 		$(DSK720K) $(DSK720K_50HZ) $(DSKDW) $(DSKDWHEADLESS) \
 		$(DSKBECKER) $(DSKARDUINO) $(DSKBECKERHEADLESS) \
-		$(DSKARDUINOHEADLESS)
+		$(DSKARDUINOHEADLESS) $(DSKCOCOSDC)
 LDSKS		= $(LDSKDW) $(LDSK360K_1) $(LDSK360K_1_50HZ) $(LDSK360K_2) \
 		$(LDSK720K) $(LDSK720K_50HZ) $(LDSKDW) $(LDSKDWHEADLESS) \
 		$(LDSKBECKER) $(LDSKARDUINO) $(LDSKBECKERHEADLESS) \
-		$(LDSKARDUINOHEADLESS)
+		$(LDSKARDUINOHEADLESS) $(LDSKCOCOSDC)
 
 # Make all components
 all:
@@ -216,6 +219,60 @@
 	$(RM) $(LDSKARDUINO)
 	$(SOFTLINK) $@ $(LDSKARDUINO)
 
+$(DSKCOCOSDC):
+	-$(RM) $@
+	os9 format -t1024 -q -e $@ -n"NitrOS-9/$(CPU) Level 2"
+	$(OS9GEN) $@ -b=$(BOOTFILE_COCOSDC) -t=$(KERNELFILE)
+	$(MAKDIR) $@,CMDS
+	$(MAKDIR) $@,SYS
+	$(MAKDIR) $@,DEFS
+	$(CP) modules/$(CCBKRN) $@,$(CCBKRN)
+	$(CP) modules/$(SYSGO) $@,sysgo
+	$(OS9ATTR_EXEC) $@,sysgo
+	$(CD) cmds; $(CP) $(CMDS_DW) ../$@,CMDS
+	$(foreach file, $(CMDS_DW), $(OS9ATTR_EXEC) $@,CMDS/$(file);)
+	$(CD) sys; $(CP) $(SYSBIN) ../$@,SYS
+	$(foreach file, $(SYSBIN), $(OS9ATTR_TEXT) $@,SYS/$(file);)
+	$(CD) sys; $(CPL) $(SYSTEXT) ../$@,SYS
+	$(foreach file, $(SYSTEXT), $(OS9ATTR_TEXT) $@,SYS/$(file);)
+	$(CD) defs; $(CPL) $(DEFS) ../$@,DEFS
+	$(foreach file, $(DEFS), $(OS9ATTR_TEXT) $@,DEFS/$(file);)
+	$(CPL) $(STARTUP_DW) $@,startup
+	$(OS9ATTR_TEXT) $@,startup
+	$(MAKDIR) $@,NITROS9
+	$(MAKDIR) $@,NITROS9/$(DISTRO)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/CMDS
+	$(CD) cmds; $(CP) $(MODULECMDS) ../$@,NITROS9/$(DISTRO)/CMDS
+	$(foreach file, $(MODULECMDS), $(OS9ATTR_EXEC) $@,NITROS9/$(DISTRO)/CMDS/$(file);)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/BOOTTRACK
+	$(CD) modules; $(CP) $(BOOTTRACK) ../$@,NITROS9/$(DISTRO)/MODULES/BOOTTRACK
+	$(foreach file, $(BOOTTRACK), $(OS9ATTR_EXEC) $@,NITROS9/$(DISTRO)/MODULES/BOOTTRACK/$(file);)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/KERNEL
+	$(CD) modules; $(CP) $(KERNEL) ../$@,NITROS9/$(DISTRO)/MODULES/KERNEL
+	$(foreach file, $(KERNEL), $(OS9ATTR_EXEC) $@,NITROS9/$(DISTRO)/MODULES/KERNEL/$(file);)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/SYSMODS
+	$(CD) modules; $(CP) $(SYSMODS) ../$@,NITROS9/$(DISTRO)/MODULES/SYSMODS
+	$(foreach file, $(SYSMODS), $(OS9ATTR_EXEC) $@,NITROS9/$(DISTRO)/MODULES/SYSMODS/$(file);)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/CLOCKS
+	$(CD) modules; $(CP) $(CLOCKS) ../$@,NITROS9/$(DISTRO)/MODULES/CLOCKS
+	$(foreach file, $(CLOCKS), $(OS9ATTR_EXEC) $@,NITROS9/$(DISTRO)/MODULES/CLOCKS/$(file);)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/RBF
+	$(CD) modules; $(CP) $(RBF) ../$@,NITROS9/$(DISTRO)/MODULES/RBF
+	$(foreach file, $(RBF), $(OS9ATTR_EXEC) $@,NITROS9/$(DISTRO)/MODULES/RBF/$(file);)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/SCF
+	$(CD) modules; $(CP) $(SCF) ../$@,NITROS9/$(DISTRO)/MODULES/SCF
+	$(foreach file, $(SCF), $(OS9ATTR_EXEC) $@,NITROS9/$(DISTRO)/MODULES/SCF/$(file);)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/MODULES/PIPE
+	$(CD) modules; $(CP) $(PIPE) ../$@,NITROS9/$(DISTRO)/MODULES/PIPE
+	$(foreach file, $(PIPE), $(OS9ATTR_EXEC) $@,NITROS9/$(DISTRO)/MODULES/PIPE/$(file);)
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/BOOTLISTS
+	$(CD) bootlists; $(CPL) *.bl ../$@,NITROS9/$(DISTRO)/BOOTLISTS
+	$(MAKDIR) $@,NITROS9/$(DISTRO)/SCRIPTS
+	$(CD) scripts; $(CPL) mb* ../$@,NITROS9/$(DISTRO)/SCRIPTS
+	$(RM) $(LDSKCOCOSDC)
+	$(SOFTLINK) $@ $(LDSKCOCOSDC)
+
 $(DSKDW):
 	-$(RM) $@
 	$(OS9FORMAT_DW) -q $@ -n"NitrOS-9/$(CPU) Level 2"
--- a/level2/coco3/modules/makefile	Thu Feb 14 07:29:48 2013 -0600
+++ b/level2/coco3/modules/makefile	Wed May 01 08:38:04 2013 -0500
@@ -17,6 +17,7 @@
 CLOCKJVEMU      = -DRTCJVEmu=1
 TC3FLAGS        = $(AFLAGS) -DTC3=1 $(FLAGS)
 IDEFLAGS        = $(AFLAGS) -DIDE=1 $(FLAGS)
+SDFLAGS         = $(AFLAGS) -DCOCOSDC=1 -DITTYP=128 $(FLAGS)
 
 DEPENDS		= ./makefile
 TPB		= $(3RDPARTY)/booters
@@ -42,10 +43,11 @@
 		rammer.dr r0_8k.dd r0_96k.dd r0_128k.dd r0_192k.dd \
 		ddr0_8k.dd ddr0_96k.dd ddr0_128k.dd ddr0_192k.dd md.dd \
 		ddx0.dd x0.dd x1.dd x2.dd x3.dd \
-		rbsuper.dr lltc3.dr llide.dr \
+		rbsuper.dr lltc3.dr llide.dr llcocosdc.dr \
 		ddi0_ide.dd i0_ide.dd i1_ide.dd ih_ide.dd \
 		dds0_tc3.dd s0_tc3.dd s1_tc3.dd s2_tc3.dd s3_tc3.dd s4_tc3.dd \
-		s5_tc3.dd s6_tc3.dd sh_tc3.dd
+		s5_tc3.dd s6_tc3.dd sh_tc3.dd \
+		ddsd_cocosdc.dd sd0_cocosdc.dd sd1_cocosdc.dd
 
 SCF		= scf.mn \
 		vtio.dr vrn.dr scbbp.dr scbbt.dr scdwp.dr sspak.dr sc6551.dr \
@@ -381,6 +383,16 @@
 ih_ide.dd: superdesc.asm
 	$(AS) $(ASOUT)$@ $< $(IDEFLAGS) $(HDBDOS)
 
+# SuperSD Descriptors
+ddsd_cocosdc.dd: superdesc.asm
+	$(AS) $(ASOUT)$@ $< $(SDFLAGS) -DDD=1
+
+sd0_cocosdc.dd: superdesc.asm
+	$(AS) $(ASOUT)$@ $< $(SDFLAGS) -DITDRV=0
+
+sd1_cocosdc.dd: superdesc.asm
+	$(AS) $(ASOUT)$@ $< $(SDFLAGS) -DITDRV=1
+
 # RFM descriptors
 ddy0.dd: rfmdesc.asm
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) -DDD=1 -DDNum=0