Mercurial > hg > Members > kono > nitros9-code
changeset 2804:eee10f550b6b lwtools-port
Removed old as files since .asm files exist
author | Boisy Pitre <boisy.pitre@nuance.com> |
---|---|
date | Fri, 01 Feb 2013 19:45:19 -0600 |
parents | d911fcfc0211 |
children | dedf1ca5dc0a |
files | level1/cmds/attr.as level1/cmds/load.as level1/cmds/tee.as level1/cmds/touch.as level1/cmds/tsmon.as |
diffstat | 5 files changed, 0 insertions(+), 882 deletions(-) [+] |
line wrap: on
line diff
--- a/level1/cmds/attr.as Fri Feb 01 19:42:08 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,267 +0,0 @@ - -* Attr - Modify file attributes -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 11 ????/??/?? -* From Tandy OS-9 Level Two VR 02.00.01. - - nam Attr - ttl Modify file attributes - -* Disassembled 98/09/11 11:44:51 by Disasm v1.6 (C) 1988 by RML - - use defsfile.d - -DOHELP set 0 - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $00 -edition set 11 - - - section .bss -fpath rmb 1 -rawpath rmb 1 -parmptr rmb 2 -cmdperms rmb 2 -u0006 rmb 1 -u0007 rmb 1 -pathopts rmb 20 -u001C rmb 2 -u001E rmb 1 -u001F rmb 9 -u0028 rmb 32 -filename rmb 32 -fdesc rmb 16 -u0078 rmb 46 - endsect - - section code -* psect tee_a,Prgrm+Objct,ReEnt+rev,edition,200,start - - - IFNE DOHELP -HelpMsg fcb C$LF - fcc "Use: Attr <pathname> {[-]<opts>}" - fcb C$LF - fcc " opts: -d s r w e pr pw pe -a" - fcb C$CR - ENDC -NotOwner fcb C$LF - fcc "You do not own that file." - fcb C$CR -UseMkDir fcb C$LF - fcc "Use Makdir to create a directory" - fcb C$CR -DirNtEmt fcb C$LF - fcc "ERROR; the directory is not empty" - fcb C$CR -Attrs fcc "dsewrewr" - fcb $FF - -__start stx parmptr save param ptr - clr u0007 - com u0007 -* Open file at X as file - clra - os9 I$Open open file on commandline - bcc L00D9 branch if ok -* If error, try to open as directory with read permission - ldx parmptr get saved param ptr - lda #DIR.+READ. load perms - os9 I$Open open as directory - bcc L00D9 branch if ok -* One last time, try open as directory only - ldx parmptr get param ptr - lda #DIR. load different perms - os9 I$Open try one more time - bcs L0114 branch if error -L00D9 sta fpath save off path - stx cmdperms save updated parm ptr - leax pathopts point X to buffer - ldb #SS.Opt load with status code - os9 I$GetStt get status - bcs L0114 branch if error - clrb - lda ,x get path type - cmpa #DT.RBF check if rbf path - lbne ShowHelp branch if not - ldx parmptr else get parm ptr - leay filename point to buffer - lda ,x+ get file name character - cmpa #PDELIM path delimiter? - bne L0106 no -L00FA sta ,y+ else save char in Y - lda ,x+ get next file name char - cmpa #C$PERD period? - bcs L0106 branch if not - cmpa #PDELIM path delimiter? - bne L00FA branch if not -L0106 lda #PENTIR - ldb #C$SPAC - std ,y++ - leax filename point X to filename - lda #READ.+WRITE. load perms - os9 I$Open open in raw mode -L0114 lbcs ShowHelp branch if error - sta rawpath - lda fpath - clr u001F - pshs u - ldx u001C get MS 16 bits - ldu u001E get LS 16 bits - lda rawpath get path - os9 I$Seek seek - puls u - bcs ShowHelp branch if error - leax fdesc point to buffer - ldy #FD.SEG - os9 I$Read - bcs ShowHelp - os9 F$ID get ID - cmpy #$0000 super user? - beq L014B branch if so - cmpy fdesc+FD.OWN is user same as file's owner? - bne L01C1 branch if not -L014B ldx cmdperms point to perms on cmd line - lbsr L021D - bcs L018B -L0152 lbsr L021D - bcc L0152 - clrb - lda ,x - cmpa #C$CR - bne ShowHelp - pshs u - ldx u001C - ldu u001E - lda rawpath - os9 I$Seek seek - puls u - bcs ShowHelp branch if error - leax fdesc point to file desc - ldy #1 only 1 byte - os9 I$Write write out new attributes - bcs ShowHelp branch if error - os9 I$Close close file - bcs ShowHelp branch if error - lda fpath get file path - os9 I$Close close file - bcs ShowHelp branch if error - ldb u0007 - beq L01BE -L018B ldb fdesc get attribute - leax >Attrs,pcr - leay u0078 - lda ,x+ -L0197 lslb - bcs L019C - lda #'- -L019C sta ,y+ - lda ,x+ - bpl L0197 - lda #C$CR - sta ,y+ - leax u0078 - clrb - bra L01B0 -ShowHelp equ * - IFNE DOHELP - leax >HelpMsg,pcr - ELSE - clrb - bra L01BE - ENDC -L01B0 pshs b - lda #2 - ldy #256 - os9 I$WritLn - comb - puls b -L01BE os9 F$Exit -L01C1 clrb - leax >NotOwner,pcr - bra L01B0 -L01C8 leax >UseMkDir,pcr - clrb - bra L01B0 -L01CF pshs u,y,x - lda fpath - ldx #$0000 - ldu #DIR.SZ*2 - os9 I$Seek - ldu $04,s - bcs L01BE -L01E0 leax u0028 - ldy #DIR.SZ - os9 I$Read - bcs L01F7 - tst ,x - beq L01E0 - leax >DirNtEmt,pcr - clrb - bra L01B0 -L01F7 puls u,y,x - cmpb #E$EOF - bne ShowHelp - rts -L01FE fdb $ff41 - fdb $ff80,$44ff,$4053,$ff01,$52ff,$0257,$ff04,$45ff - fdb $0850,$52ff,$1050,$57ff,$2050,$45ff - fcb $00 -L021D clr u0006 -L021F lda ,x+ - cmpa #C$SPAC - beq L021F - cmpa #C$COMA - beq L021F - cmpa #'- - bne L0231 - com u0006 - lda ,x+ -L0231 leax -1,x - leay >L01FE,pcr -L0237 ldb ,y+ - pshs y,x - beq L027F -L023D lda ,x+ - eora ,y+ - anda #$DF - beq L023D - lda -1,y - bmi L0251 - puls y,x -L024B lda ,y+ - bpl L024B - bra L0237 -L0251 lda ,-x - cmpa #$30 - bcc L027F - cmpb #$FF - beq L0278 - bitb #$80 - beq L0268 - tst u0006 - lbeq L01C8 - lbsr L01CF -L0268 puls y,b,a - lda fdesc - eora u0006 - ora -$01,y - eora u0006 - sta fdesc - clrb - rts -L0278 eorb u0006 - stb u0007 - clrb - puls pc,y,b,a -L027F coma - puls pc,y,x - - endsect
--- a/level1/cmds/load.as Fri Feb 01 19:42:08 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -******************************************************************** -* Load - Load a module -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 4 ????/??/?? -* From Tandy OS-9 Level One VR 02.00.00. - - nam Load - ttl Load a module - - use defsfile.d - -rev set $00 -edition set 4 - - section .bss -u0000 rmb 200 - endsect - -* psect load_a,Prgrm+Objct,ReEnt+rev,edition,200,start - section code - -__start os9 F$Load - bcs Exit - lda ,x - cmpa #C$CR - bne start - clrb -Exit os9 F$Exit - - endsect
--- a/level1/cmds/tee.as Fri Feb 01 19:42:08 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -******************************************************************** -* Tee - Split output to multiple devices -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 2 ????/??/?? -* From Tandy OS-9 Level One VR 02.00.00. - - nam Tee - ttl Split output to multiple devices - -* Disassembled 98/09/14 23:50:52 by Disasm v1.6 (C) 1988 by RML - - section bss -u0000 rmb 1 -parray rmb 13 -pcount rmb 1 -buff rmb 256 - rmb 450 - endsect - - section __os9 -rev set $00 -edition set 2 -stack set 200 - endsect - - section code -__start clrb - clr pcount,u clear path counter - cmpy #$0000 any parameters? - lbeq exitok exit if none - leay parray,u else point Y to path array - -* Walk the command line parameters -parse lda ,x+ - cmpa #C$SPAC - beq parse - cmpa #C$COMA - beq parse - cmpa #C$CR - lbeq parsex -* We've found a file or device name - leax -1,x - lda #WRITE. - ldb #PREAD.+UPDAT. - os9 I$Create open a path to the device or file - bcs exit branch if error - ldb pcount,u else get path counter - sta b,y save new path in the array offset - incb increment counter - stb pcount,u and save - bra parse continue parsing command line -parsex stb pcount,u - -* Devices on command line are open, start pumping data -L0044 clra - leax buff,u - ldy #256 - os9 I$ReadLn - bcc L0057 - cmpb #E$EOF - beq exitok - coma - bra exit -L0057 inca - os9 I$WritLn - tst pcount,u - beq L0044 - clrb -L0060 leay parray,u - lda b,y - leax buff,u - ldy #256 - os9 I$WritLn - bcs exit - incb - cmpb pcount,u - bne L0060 - bra L0044 -exitok clrb -exit os9 F$Exit - - endsect
--- a/level1/cmds/touch.as Fri Feb 01 19:42:08 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,414 +0,0 @@ -******************************************************************** -* Touch - Changes last modification date/time -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 2 2003/01/11 Boisy G. Pitre -* Rewrote touch from scratch, made almost 90% smaller than C version -* found in the OS-9 Development System. - - nam Touch - ttl Changes last modification date/time - - use defsfile.d - -rev set $00 -edition set 2 - -* Here are some tweakable options -DOHELP set 0 1 = include help info -STACKSZ set 128 estimated stack size -PARMSZ set 256 estimated parameter size -ZOPTSIZ set 64 max size of -z option's parameter - -* Module header definitions -rev set $00 -edition set 2 - -* Your utility's static storage vars go here - section .bss -parmptr rmb 2 pointer to our command line params -bufptr rmb 2 pointer to user expandable buffer -bufsiz rmb 2 size of user expandable buffer -* What follows are utility specific options -nocreate rmb 1 -quiterr rmb 1 -filemode rmb 1 -filecnt rmb 1 -zoptflg rmb 1 1 = this option has been processed once already -zpath rmb 1 path to -z file -cleartop equ * everything up to here gets cleared at start -zopt rmb ZOPTSIZ buffer for what follows after -c= - endsect - -* Next is a user adjustable buffer with # modifier on command line. -* Some utilities won't need this, some will. -* Currently set up to be larger for Level 2 than Level 1 -* Note: this buffer must come just before the stack - section data - IFGT Level-1 -bigbuff rmb 8*1024 8K default buffer for Level 2 - ELSE -bigbuff rmb 512 512 byte default buffer for Level 1 - ENDC - endsect - -* psect touch_a,Prgrm+Objct,ReEnt+rev,edition,200,start - section code - -* Place constant strings here - IFNE DOHELP -HlpMsg fcb C$LF - fcc /Use: Touch [<opts>] <path> [<path>] [<opts>]/ - fcb C$LF - fcc / -c = don't create files/ - fcb C$LF - fcc / -q = don't quit on error/ - fcb C$LF - fcc / -x = search execution directory/ - fcb C$LF - fcc / -z = get files from standard input/ - fcb C$LF - fcc / -z=<file> get files from <file>/ - fcb C$LF -CR fcb C$CR -HlpMsgL equ *-HlpMsg - ENDC -UnkOpt fcc /unknown option: / -UnkOptL equ *-UnkOpt -CantTch fcc /can't touch "/ -CantTchL equ *-CantTch -EndCant fcc /" - / -EndCantL equ *-EndCant - -* Here's how registers are set when this process is forked: -* -* +-----------------+ <-- Y (highest address) -* ! Parameter ! -* ! Area ! -* +-----------------+ <-- X, SP -* ! Data Area ! -* +-----------------+ -* ! Direct Page ! -* +-----------------+ <-- U, DP (lowest address) -* -* D = parameter area size -* PC = module entry point abs. address -* CC = F=0, I=0, others undefined - -* The start of the program is here. -* Before any command line processing is done, we clear out -* our static memory from U to cleartop, then determine the -* size of our data area (minus the stack). -__start pshs u,x save registers for later - leax <cleartop point to end of area to zero out - IFNE H6309 - subr u,x subtract U from X - tfr x,w and put X in W - clr ,-s put a zero on the stack - tfm s,u+ and use TFM to clear starting at U - leas 1,s clean up the stack - ELSE - pshs x save end pointer on stack -clrnxt clr ,u+ clear out - cmpu ,s done? - bne clrnxt branch if not - leas 2,s else clear stack - ENDC - puls x,u and restore our earlier saved registers - leay bigbuff,u point Y to copy buffer offset in U - stx <parmptr save parameter pointer - sty <bufptr save pointer to buffer - tfr s,d place top of stack in D - IFNE H6309 - subr y,d - ELSE - pshs y save Y on stack - subd ,s++ get size of space between copybuf and X - ENDC - subd #STACKSZ+PARMSZ subtract out our stack - std <bufsiz size of our buffer - -* At this point we have determined our buffer space and saved pointers -* for later use. Now we will parse the command line for options that -* begin with - - lda ,x - cmpa #C$CR CR? - lbeq ShowHelp if so, no parameters... show help and exit -GetChar lda ,x+ get next character on cmd line - cmpa #C$CR CR? - lbeq DoTouch if so, do whatever this utility does - cmpa #'- is it an option? - beq GetDash if so, process it - inc <filecnt else must be a non-option argument (file) - lbsr SkipNSpc move past the argument -ChkDash lbsr SkipSpcs and any following spaces - bra GetChar start processing again -GetDash lda #C$SPAC get a space char - sta -1,x and wipe out the dash from the cmd line -GetDash2 ldd ,x+ load option char and char following - ora #$20 make lowercase -IsItC cmpa #'c is it this option? - bne IsItQ branch if not - sta <nocreate - lbra FixCmdLn -IsItQ cmpa #'q is it this option? - bne IsItX branch if not - inc <quiterr - lbra FixCmdLn -IsItX cmpa #'x is it this option? - bne IsItZ branch if not - lda #EXEC. - sta <filemode - bra FixCmdLn -IsItZ cmpa #'z is it this option? - bne BadOpt branch if not - tst <zoptflg was this option already specified? - bne BadOpt show help if so - sta <zoptflg else tag this option as parsed - cmpb #'= 2nd char =? - bne FixCmdLn -GetZFile ldb #C$SPAC get space - stb -$01,x write over c - stb ,x+ and = sign, inc X to dest dir -* check for valid char after -z= - lda ,x - cmpa #C$SPAC - lbeq ShowHelp - cmpa #C$COMA - lbeq ShowHelp - cmpa #C$CR - lbeq ShowHelp - leay <zopt,u point Y to parameber buffer - tfr y,d transfer Y to D - addd #ZOPTSIZ - pshs b,a save updated ptr value - ldb #C$SPAC get space -L0339 lda ,x get byte at X - stb ,x+ store space at X and inc - sta ,y+ save loaded byte at Y and inc - cmpy ,s are we at end? - beq L035D branch if so (buffer too small) - cmpa #C$SPAC else is char in A a space? - beq L0350 branch if so - cmpa #C$COMA coma? - beq L0350 branch if so - cmpa #C$CR cr? - bne L0339 get next byte if not -L0350 leax -1,x - sta ,x restore previous A - leas $02,s kill stack -* attempt to open a path to the file - pshs x - leax <zopt,u - lda #READ. - os9 I$Open - lbcs Exit - sta <zpath - puls x - lbra ChkDash -L035D leas $02,s - ldb #$BF else buffer size too small - orcc #Carry - lbra Exit -FixCmdLn lda #C$SPAC get space - sta -$01,x and wipe out option character - cmpb #'0 - lblt ChkDash start dash option processing again - lbra GetDash possibly another option following? - -* We branch here if we encounter an unknown option character -* A = bad option character -BadOpt leax UnkOpt,pcr - ldy #UnkOptL - ldb #C$CR - pshs d save bad option and CR on stack - lda #$02 stderr - os9 I$Write - leax ,s point X at option char on stack - os9 I$WritLn print option and CR - puls d clean up stack - lbra ShowHelp - - -* At this point options are processed. -* We load X with our parameter pointer and go down the command line -* looking at each file to process (options have been wiped out with -* spaces) -* -* Note, the following two instructions may not be needed, depending on -* if your utility requires a non-option on the command line. -DoTouch tst <zoptflg -z specified? - beq DoFiles no, do any files on command line -ReadZ lda <zpath - ldy #80 - os9 I$ReadLn - lbsr SkipSpcs - cmpa #C$CR - beq ClosEx - bcs TestErr - bsr ProcFile - bra ReadZ -TestErr cmpb #E$EOF - lbne Exit - tsta - lbeq ExitOk -ClosEx os9 I$Close close path to -z= file - lbra ExitOk - -DoFiles tst <filecnt we should have at least one file on cmdline - lbeq ShowHelp if not, exit with error - ldx <parmptr get our parameter pointer off stack -DoLoop lbsr SkipSpcs skip any leading spaces - cmpa #C$CR end of parameters? - beq ExitOk if so, end the utility - pshs x save pointer to arg - bsr ProcFile process file at X - puls x get arg pointer - lbsr SkipNSpc skip the argument we just processed - bra DoLoop - -* This routine processes one file at a time. -* Entry: X = ptr to argument on the command line. -* On exit, X can point to the argument or past it. -* Note that there are NO leading spaces. -* They have been skipped by the caller. -* The following code just echos the command line argument, followed -* by a carriage return. -ProcFile - lda #WRITE. - ora <filemode - pshs x - os9 I$Open - puls x - bcc CloseIt - ora #DIR. - pshs x - os9 I$Open - puls x - bcc CloseIt -* open failed... should we do create? - tst <nocreate - beq DoCreate -ChkQuit bsr CantTouch - tst <quiterr - beq ExitOk - bra ProcRTS -DoCreate ldb #PREAD.+UPDAT. - pshs x - os9 I$Create - puls x - bcs ChkQuit -CloseIt os9 I$Close -ProcRTS rts - -CantTouch - pshs x,b save pointer to file and error code - leax CantTch,pcr - lda #$02 - ldy #CantTchL - os9 I$Write - ldx 1,s - pshs x - bsr StrLen - puls x - os9 I$Write - leax EndCant,pcr - ldy #EndCantL - os9 I$Write - puls b - os9 F$PErr - puls x,pc - -ShowHelp equ * - IFNE DOHELP - leax >HlpMsg,pcr point to help message - ldy #HlpMsgL get length - lda #$02 std error - os9 I$WritLn write it - ENDC -ExitOk clrb clear carry -Exit os9 F$Exit and exit - -* This routine counts the number of non-whitespace characters -* starting at X -* -* Entry: -* X = ptr to string (space, comma or CR terminated) -* Exit: -* Y = length of string -* X = ptr to byte after string -StrLen pshs a - ldy #$0000 -StrLenLp lda ,x+ - cmpa #C$SPAC - beq StrLenEx - cmpa #C$COMA - beq StrLenEx - cmpa #C$CR - beq StrLenEx - leay 1,y - bra StrLenLp -StrLenEx puls a,pc - -* This routine copies a string of text from X to Y until -* a whitespace character or CR is encountered -* -* Entry: -* X = ptr to src string -* Y = ptr to dest string -* Exit: -* D = number of bytes copied -* X = ptr to byte after original string -* Y = ptr to byte after copied string -StrCpy pshs u - ldu #$0000 -CopyFnLp lda ,x+ - cmpa #C$SPAC - beq CopyFnEx - cmpa #C$COMA - beq CopyFnEx - cmpa #C$CR - beq CopyFnEx - sta ,y+ - leau 1,u - bra CopyFnLp -CopyFnEx tfr u,d - puls u,pc - -* This routine skip over spaces and commas -* -* Entry: -* X = ptr to data to parse -* Exit: -* X = ptr to first non-whitespace char -* A = non-whitespace char -SkipSpcs lda ,x+ - cmpa #C$SPAC - beq SkipSpcs - cmpa #C$COMA - beq SkipSpcs - leax -1,x - rts - -* This routine skips over everything but spaces, commas and CRs -* -* Entry: -* X = ptr to data to parse -* Exit: -* X = ptr to first whitespace char -* A = whitespace char -SkipNSpc lda ,x+ - cmpa #C$SPAC - beq EatOut - cmpa #C$COMA - beq EatOut - cmpa #C$CR - bne SkipNSpc -EatOut leax -1,x - rts - - endsect
--- a/level1/cmds/tsmon.as Fri Feb 01 19:42:08 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -******************************************************************* -* Tsmon - Timesharing monitor -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 6 ????/??/?? -* From Tandy OS-9 Level Two VR 02.00.01. - - nam Tsmon - ttl Timesharing monitor - - use defsfile.d - -rev set $00 -edition set 2 - - section .bss -childid rmb 1 -parmptr rmb 2 -parmlen rmb 2 -inbuff rmb 128 - endsect - -* psect tsmon_a,Prgrm+Objct,ReEnt+rev,edition,200,start - section code - -Login fcc "LOGIN" -LoginPrm fcb C$CR - -IcptRtn rti - -__start stx parmptr save parameter pointer - std parmlen save parameter length - leax IcptRtn,pcr point to intercept routine - os9 F$Icpt and set it -L0024 ldx parmptr get pointer to parameter - ldd parmlen and length - cmpd #$0002 - bcs L0052 - lda ,x get byte at command line - cmpa #C$CR cr? - beq L0052 if so, branch - clra stdin - os9 I$Close close it - lda #UPDAT. - os9 I$Open open device on command line - bcs Exit branch if error - inca A = 1 - os9 I$Close close stdout - inca A = 2 - os9 I$Close close stderr - clra stdin path - os9 I$Dup dup to stdout - bcs Exit branch if error - os9 I$Dup dup to stderr - bcs Exit branch if error -L0052 clra stdin - leax inbuff point to buffer - ldy #$0001 read 1 byte - os9 I$ReadLn read line - bcs L0024 branch if error - lda #Objct object - clrb no additional mem - leax <Login,pcr point to login - leau <LoginPrm,pcr and to parameters - ldy #$0000 parameter size - os9 F$Fork fork program - bcs L0024 branch if error - sta childid else save process ID of child -L0072 os9 F$Wait wait for it to finish - cmpa childid same as PID we forked? - bne L0072 if not, wait more - bra L0024 else go back -Exit os9 F$Exit exit - - endsect