Mercurial > hg > Members > kono > nitros9-code
changeset 2783:03f26e88b809 lwtools-port
Renamed files and setup for lwasm/lwlink work
author | Boisy Pitre <boisy.pitre@nuance.com> |
---|---|
date | Sat, 26 Jan 2013 17:18:24 -0600 |
parents | aaba193af04f |
children | 2594295f9cc7 |
files | level1/cmds/attr.a level1/cmds/attr.as level1/cmds/dw.a level1/cmds/dw.as level1/cmds/inetd.a level1/cmds/inetd.as level1/cmds/load.a level1/cmds/load.as level1/cmds/tee.a level1/cmds/tee.as level1/cmds/telnet.a level1/cmds/telnet.as level1/cmds/touch.a level1/cmds/touch.as level1/cmds/tsmon.a level1/cmds/tsmon.as level2/coco3/cmds/makefile lib/alib/asc_bin.a lib/alib/asc_bin.as lib/alib/b09strlen.a lib/alib/b09strlen.as lib/alib/bin2hex.a lib/alib/bin2hex.as lib/alib/bin_asc.a lib/alib/bin_asc.as lib/alib/bin_dec.a lib/alib/bin_dec.as lib/alib/bin_hex.a lib/alib/bin_hex.as lib/alib/bin_rom.a lib/alib/bin_rom.as lib/alib/compare.a lib/alib/compare.as lib/alib/datestr.a lib/alib/datestr.as lib/alib/dec_bin.a lib/alib/dec_bin.as lib/alib/dectab.a lib/alib/dectab.as lib/alib/div16x16.a lib/alib/div16x16.as lib/alib/div16x8.a lib/alib/div16x8.as lib/alib/div8x8.a lib/alib/div8x8.as lib/alib/fgetc.a lib/alib/fgetc.as lib/alib/fgets.a lib/alib/fgets.as lib/alib/fgety.a lib/alib/fgety.as lib/alib/fputc.a lib/alib/fputc.as lib/alib/fputcr.a lib/alib/fputcr.as lib/alib/fputs.a lib/alib/fputs.as lib/alib/fputspace.a lib/alib/fputspace.as lib/alib/fputy.a lib/alib/fputy.as lib/alib/frewind.a lib/alib/frewind.as lib/alib/ftoeof.a lib/alib/ftoeof.as lib/alib/ftrans.a lib/alib/ftrans.as lib/alib/getc.a lib/alib/getc.as lib/alib/getfmd.a lib/alib/getfmd.as lib/alib/gets.a lib/alib/gets.as lib/alib/gety.a lib/alib/gety.as lib/alib/hex_bin.a lib/alib/hex_bin.as lib/alib/inkey.a lib/alib/inkey.as lib/alib/is_alnum.a lib/alib/is_alnum.as lib/alib/is_alpha.a lib/alib/is_alpha.as lib/alib/is_cntrl.a lib/alib/is_cntrl.as lib/alib/is_digit.a lib/alib/is_digit.as lib/alib/is_lower.a lib/alib/is_lower.as lib/alib/is_print.a lib/alib/is_print.as lib/alib/is_punct.a lib/alib/is_punct.as lib/alib/is_space.a lib/alib/is_space.as lib/alib/is_termin.a lib/alib/is_termin.as lib/alib/is_upper.a lib/alib/is_upper.as lib/alib/is_xdigit.a lib/alib/is_xdigit.as lib/alib/jsr_cmd.a lib/alib/jsr_cmd.as lib/alib/jsr_cmd2.a lib/alib/jsr_cmd2.as lib/alib/linedit.a lib/alib/linedit.as lib/alib/makefile lib/alib/memmove.a lib/alib/memmove.as lib/alib/memset.a lib/alib/memset.as lib/alib/mktemp.a lib/alib/mktemp.as lib/alib/mult16x16.a lib/alib/mult16x16.as lib/alib/mult16x8.a lib/alib/mult16x8.as lib/alib/parsnstr.a lib/alib/parsnstr.as lib/alib/print_asc.a lib/alib/print_asc.as lib/alib/print_dec.a lib/alib/print_dec.as lib/alib/print_hex.a lib/alib/print_hex.as lib/alib/prints.a lib/alib/prints.as lib/alib/ptsearch.a lib/alib/ptsearch.as lib/alib/putc.a lib/alib/putc.as lib/alib/putcr.a lib/alib/putcr.as lib/alib/puts.a lib/alib/puts.as lib/alib/putspace.a lib/alib/putspace.as lib/alib/puty.a lib/alib/puty.as lib/alib/rnd.a lib/alib/rnd.as lib/alib/sho_regs.a lib/alib/sho_regs.as lib/alib/stimestr.a lib/alib/stimestr.as lib/alib/strcat.a lib/alib/strcat.as lib/alib/strcmp.a lib/alib/strcmp.as lib/alib/strcpy.a lib/alib/strcpy.as lib/alib/strhcpy.a lib/alib/strhcpy.as lib/alib/strhlen.a lib/alib/strhlen.as lib/alib/strlen.a lib/alib/strlen.as lib/alib/strncmp.a lib/alib/strncmp.as lib/alib/strncpy.a lib/alib/strncpy.as lib/alib/to_lower.a lib/alib/to_lower.as lib/alib/to_lowrs.a lib/alib/to_lowrs.as lib/alib/to_non_sp.a lib/alib/to_non_sp.as lib/alib/to_sp.a lib/alib/to_sp.as lib/alib/to_upper.a lib/alib/to_upper.as lib/alib/to_upprs.a lib/alib/to_upprs.as lib/alib/windefs.a lib/alib/windefs.as lib/drivewire.as lib/makefile lib/net.a lib/net.as lib/os9.as lib/os9defs.a lib/pipe.as lib/pipedefs.a lib/rbf.as lib/rbfdefs.a lib/scf.as lib/scfdefs.a lib/sys6309l2.a lib/sys6309l2.as lib/sys6809l1.a lib/sys6809l1.as lib/sys6809l2.a lib/sys6809l2.as lib/systype.a lib/systype.as rules.mak |
diffstat | 197 files changed, 8241 insertions(+), 8224 deletions(-) [+] |
line wrap: on
line diff
--- a/level1/cmds/attr.a Sat Jan 26 08:26:31 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 data -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 text -* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/attr.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,267 @@ + +* 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 data +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 text +* 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/dw.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -******************************************************************** -* dw - command interface to the server -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1 2010/01/02 Aaron Wolfe -* Most basic implementation using new DW utility API - - nam dw - ttl command interface to the server - -tylg set $01 Prgrm+Objct -atrv set $80+rev ReEnt+rev -rev set $00 -edition set 1 - - section data -pbuffer rmb 256 -pbend rmb 2 -cbuffer rmb 256 -portdev rmb 10 -portpath rmb 1 -outpath rmb 1 -numbyt rmb 1 -die rmb 1 - endsect - - section text -* psect dw_a,$01,$80,1,200,start - -* signal handling -icpt lda #1 - sta die,u - rti - -command fcc 'dw ' - -* save initial parameters -start: pshs d - pshs x - clr die,u -* set intercept handler - leax icpt,pcr *ptr to handler - os9 F$Icpt - - clra - lbsr TCPOpen - lbcs errex1 - - -gotport sta portpath,u - -* rawpath - lbsr RawPath - -* write command to port - lda portpath,u - ldy #3 - leax command,pc - os9 I$Write - lbcs errex2 - -* write parameters to port - X = start addr, y = # bytes, A = path# - puls x - puls y - - os9 I$WritLn - lbcs errex2 - -* read result - leax pbuffer,u - lda portpath,u - ldy #1 -rrloop os9 I$Read - lbcs errex2 - ldb ,x+ - cmpb #C$CR * end of response - bne rrloop - -* look for Fail - ldb pbuffer,u - cmpb #'F - bne gotconn * we connected - -* display failure message - lda #1 - ldy #1 - leax pbuffer,u - ldb #9 *skip proto error info (FAIL xxx ) - abx -prloop os9 I$Write - ldb ,x+ - cmpb #C$CR *end of response - bne prloop - - ldy #2 - leax crlf,pc - os9 I$Write - - lbra done - -crlf fcb C$CR - fcb C$LF - -* response loop -* read 1 byte, this is how many bytes follow in this set. 0 for end of response -gotconn nop - -* check for incoming serial data -rloop lda portpath,u - ldb #SS.Ready - os9 I$GetStt - bcc serinc read and print the byte - -* if we got no data and die is set, bail - lda die,u - bne done - -* sleep a while - ldx #0001 - os9 F$Sleep - bra rloop - -* read B bytes from serial, print on screen -serinc clra - tfr d,y - lda portpath,u - leax pbuffer,u - os9 I$Read - lbcs errex2 -* print the data to stdout - lda #1 - leax pbuffer,u - os9 I$Write - bra rloop - -done clrb *no errors here -* close port -errex2 lda portpath,u - os9 I$Close - -errex1 os9 F$Exit *goodbye - endsect - - - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/dw.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,150 @@ +******************************************************************** +* dw - command interface to the server +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1 2010/01/02 Aaron Wolfe +* Most basic implementation using new DW utility API + + nam dw + ttl command interface to the server + +tylg set $01 Prgrm+Objct +atrv set $80+rev ReEnt+rev +rev set $00 +edition set 1 + + section data +pbuffer rmb 256 +pbend rmb 2 +cbuffer rmb 256 +portdev rmb 10 +portpath rmb 1 +outpath rmb 1 +numbyt rmb 1 +die rmb 1 + endsect + + section text +* psect dw_a,$01,$80,1,200,start + +* signal handling +icpt lda #1 + sta die,u + rti + +command fcc 'dw ' + +* save initial parameters +start: pshs d + pshs x + clr die,u +* set intercept handler + leax icpt,pcr *ptr to handler + os9 F$Icpt + + clra + lbsr TCPOpen + lbcs errex1 + + +gotport sta portpath,u + +* rawpath + lbsr RawPath + +* write command to port + lda portpath,u + ldy #3 + leax command,pc + os9 I$Write + lbcs errex2 + +* write parameters to port - X = start addr, y = # bytes, A = path# + puls x + puls y + + os9 I$WritLn + lbcs errex2 + +* read result + leax pbuffer,u + lda portpath,u + ldy #1 +rrloop os9 I$Read + lbcs errex2 + ldb ,x+ + cmpb #C$CR * end of response + bne rrloop + +* look for Fail + ldb pbuffer,u + cmpb #'F + bne gotconn * we connected + +* display failure message + lda #1 + ldy #1 + leax pbuffer,u + ldb #9 *skip proto error info (FAIL xxx ) + abx +prloop os9 I$Write + ldb ,x+ + cmpb #C$CR *end of response + bne prloop + + ldy #2 + leax crlf,pc + os9 I$Write + + lbra done + +crlf fcb C$CR + fcb C$LF + +* response loop +* read 1 byte, this is how many bytes follow in this set. 0 for end of response +gotconn nop + +* check for incoming serial data +rloop lda portpath,u + ldb #SS.Ready + os9 I$GetStt + bcc serinc read and print the byte + +* if we got no data and die is set, bail + lda die,u + bne done + +* sleep a while + ldx #0001 + os9 F$Sleep + bra rloop + +* read B bytes from serial, print on screen +serinc clra + tfr d,y + lda portpath,u + leax pbuffer,u + os9 I$Read + lbcs errex2 +* print the data to stdout + lda #1 + leax pbuffer,u + os9 I$Write + bra rloop + +done clrb *no errors here +* close port +errex2 lda portpath,u + os9 I$Close + +errex1 os9 F$Exit *goodbye + endsect + + + +
--- a/level1/cmds/inetd.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,538 +0,0 @@ -******************************************************************** -* inetd - internet daemon -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1 2010/01/08 Boisy G. Pitre -* Started. -* -* 2 2010/01/22 Boisy G. Pitre -* Now reads inetd.conf file. -* -* 3 2011/08/07 Boisy G. Pitre -* Fixed bug where conf file wasn't being processed correctly. - - nam inetd - ttl internet daemon - -tylg set $01 Prgrm+Objct -atrv set $80+rev ReEnt+rev -rev set $00 -edition set 3 - - section data -targetport rmb 2 -netdatardy rmb 1 -nbufferl equ 128 -nbuffer rmb nbufferl -lbufferl equ 128 -lbuffer rmb lbufferl -nnext rmb 2 -token rmb 2 -orgstdin rmb 1 -orgstdout rmb 1 -orgstderr rmb 1 -childnetpath rmb 1 -netpath rmb 1 -targetprog rmb 128 -targetparams rmb 128 -tmodeparamlen rmb 1 -tmodeparams rmb 128 - endsect - -* psect inetd_a,$01,$80,1,200,start - section text - -DEBUG equ 1 - - -NetSig equ 2 - -tmode fcs /tmode/ - -* signal intercept routine -sigint cmpb #NetSig - bne sigex - inc netdatardy,u -sigex rti - -**** Entry Point **** -start: -* setup signal intercept - leax sigint,pcr - os9 F$Icpt - - clr netdatardy,u - - leax nbuffer,u - stx nnext,u - -* Turn off pause in standard out - ldd #$01*256+SS.Opt - leas -32,s - tfr s,x - os9 I$GetStt - bcs opterr - clr PD.PAU-PD.OPT,x - os9 I$SetStt -opterr - leas 32,s - -* open the path to the control channel - lbsr TCPOpen - lbcs errex - sta netpath,u - leax SetupPorts,pcr - lbsr ProcInetd - lbcs errex - - IFNE DEBUG - lbsr PRINTS - fcc /Got netpath and setup ports/ - fcb C$CR - fcb $00 - ENDC - -ssignetpath - IFNE DEBUG - lbsr PRINTS - fcc /SS.SSig on NetPath/ - fcb C$CR - fcb $00 - ENDC - - lda netpath,u - ldb #SS.SSig send signal on data ready - ldx #NetSig - os9 I$SetStt - lbcs errex - -**** MAIN LOOP **** -mainloop - pshs cc - orcc #IntMasks - tst netdatardy,u - bne gotdata - -* wait for a child to die (or wake up via signal) - os9 F$Wait - bcc chkrdy - cmpb #E$NoChld - bne chkrdy got error other than "no children" -* if no children, go to sleep - ldx #$0000 - os9 F$Sleep - -chkrdy puls cc - bra ssignetpath - -gotdata puls cc - dec netdatardy,u -* read the data from netpath - IFNE DEBUG - lbsr PRINTS - fcc /Reading data from netpath/ - fcb C$CR - fcb $00 - ENDC - - lda netpath,u - ldb #SS.Ready - os9 I$GetStt - bcs ssignetpath - - clra - tfr d,y - lda netpath,u - ldx nnext,u - os9 I$Read - lbcs errex - tfr y,d - leax d,x - stx nnext,u - lda -1,x - cmpa #C$CR - lbne ssignetpath - - leax nbuffer,u - stx nnext,u - - lda #1 - ldy #256 - os9 I$WritLn - -* determine response - lda ,x - cmpa #'9 - ble incoming - - cmpa #'F - lbra ssignetpath - -* get token number -incoming - lbsr DEC_BIN - std token,u - IFNE DEBUG - pshs d - lbsr PRINTS - fcc /Got token / - fcb $00 - puls d - lbsr PRINT_DEC - lbsr PRINTS - fcb C$CR - fcb $00 - ENDC - -* skip over token number - IFNE DEBUG - lbsr PRINTS - fcc /To Space.../ - fcb C$CR - fcb $00 - ENDC - lbsr TO_SP - IFNE DEBUG - lbsr PRINTS - fcc /To Non-Space.../ - fcb C$CR - fcb $00 - ENDC - lbsr TO_NON_SP - -* get port number - lbsr DEC_BIN - std targetport,u - - IFNE DEBUG - pshs d - lbsr PRINTS - fcc /Got request for port / - fcb $00 - ldd ,s - lbsr PRINT_DEC - lbsr PRINTS - fcb C$CR - fcb $00 - puls d - ENDC - - leax ForkProcForPort,pcr - lbsr ProcInetd - lbra ssignetpath we may want to tell server we have no app - -errex os9 F$Exit - - -* Process inetd.conf file -* -* Entry: X = processor routine -* -* - open conf file -* - read each line and get first parameter (port number) -* - send it to the processor routine at x -* - if error or end of file, close and return -ProcInetd pshs x - leax inetdconf,pcr - lda #READ. - os9 I$Open - bcs adex - IFNE DEBUG - pshs d - lbsr PRINTS - fcc /Opened inetd.conf ok/ - fcb C$CR - fcb $00 - puls d - ENDC -nextline leax lbuffer,u - ldy #lbufferl-1 - lbsr FGETS - bcs closeup - lbsr TO_NON_SP skip any leading spaces - ldb ,x check for EOL or comment - cmpb #C$CR - beq nextline - cmpb #'# - beq nextline - IFNE DEBUG - pshs d,x - lbsr PRINTS - fcc /Reading line: / - fcb $00 - ldx 2,s - lbsr PUTS - puls d,x - ENDC - pshs a - jsr [1,s] - puls a - bcc nextline -closeup cmpb #E$EOF - bne closeandex - clrb -closeandex pshs b,cc - os9 I$Close - puls b,cc -adex puls x,pc - - -* Setup ports -* Extract first parameter at X and send to server -SetupPorts lbsr DEC_BIN - cmpd #0 - beq ret0 -* find comma and change it to nul - tfr x,y -setuploop lda ,y+ - cmpa #C$CR - beq ret0 - cmpa #', - bne setuploop -setuplisten - clr -1,y - IFNE DEBUG - pshs d,x - lbsr PRINTS - fcc /Send listen/ - fcb C$CR - fcb $00 - puls d,x - ENDC - lda netpath,u - lbsr TCPListen -ret0 rts - -retcc clrb - rts - -* Fork Proccess that matches target port -* Extract first parameter at X and see if it matches target port -* if so, read rest of line and fork the process -* Line looks like this: portnumberplusoptions,prog,params,path opts -ForkProcForPort -* get port number - lbsr DEC_BIN - IFNE DEBUG - pshs d - lbsr PRINTS - fcc /Reading port / - fcb $00 - ldd ,s - lbsr PRINT_DEC - lbsr PRINTS - fcb C$CR - fcb $00 - lbsr PRINTS - fcc /Comparing to port / - fcb $00 - ldd targetport,u - lbsr PRINT_DEC - lbsr PRINTS - fcb C$CR - fcb $00 - puls d - ENDC - cmpd targetport,u - lbne retcc -* point Y to byte after comma -portloop lda ,y+ - cmpa #C$CR - beq ret0 - cmpa #', - bne portloop - tfr y,x -* copy bytes up to comma at X - leay targetprog,u -prgloop lda ,x+ - cmpa #', - beq sethi - cmpa #C$CR - lbeq ret - sta ,y+ - bra prgloop -sethi lda -1,y - ora #$80 - sta -1,y -copypar clr tmodeparamlen,u - leay targetparams,u -parloop lda ,x+ - sta ,y+ - cmpa #', - beq procopts - cmpa #C$CR - beq gotprocparms - -procopts - leay tmodeparams,u -procoptsloop lda ,x+ - sta ,y+ - inc targetparams,u - cmpa #C$CR - beq procoptsloop - -gotprocparms - IFNE DEBUG - pshs d - lbsr PRINTS - fcc /Got proc and params to fork/ - fcb C$CR - fcb $00 - puls d - ENDC - -* ignore client port number and hostname for now - lbsr TCPOpen - bcc savechild - - ldd token,u - leas -8,s - leax ,s - lbsr BIN_DEC - lda netpath,u - tfr x,y - lbsr TCPKill - leas 8,s - lbra forkex - -savechild - sta childnetpath,u - ldd token,u - leas -8,s - leax ,s - lbsr BIN_DEC - lda childnetpath,u - tfr x,y - lbsr TCPJoin - leas 8,s - bcc turnonechoalf - os9 I$Close - lbra forkex - -turnonechoalf - IFNE DEBUG - pshs d - lbsr PRINTS - fcc /Turning on PD.EKO and PD.ALF/ - fcb C$CR - fcb $00 - puls d - ENDC - lbsr SetEchoOn - lbcs ret - lbsr SetAutoLFOn - lbcs ret - -* dup paths -duper - IFNE DEBUG - pshs d - lbsr PRINTS - fcc /Duping paths/ - fcb C$CR - fcb $00 - puls d - ENDC - - clra - os9 I$Dup - lbcs errex - sta orgstdin,u - lda #1 - os9 I$Dup - lbcs errex - sta orgstdout,u - lda #2 - os9 I$Dup - lbcs errex - sta orgstderr,u - -* close original stdin/out/err paths - clra - os9 I$Close - inca - os9 I$Close - inca - os9 I$Close - -* Dup child net path to stdin/stdout/stderr - lda childnetpath,u - os9 I$Dup - lbcs errex - os9 I$Dup - lbcs errex - os9 I$Dup - lbcs errex - -* fork tmode process if tmode param length > 0 - tst tmodeparamlen,u - beq forkchild - pshs u - leax tmode,pcr - leau tmodeparams,u - lda #Objct - clrb - ldy #256 - os9 F$Fork - puls u - os9 F$Wait - -* fork child process -forkchild - pshs u - leax targetprog,u - leau targetparams,u - lda #Objct - clrb - ldy #256 - os9 F$Fork - puls u -* If our F$Fork fails, do not error out... -* bcs ret2 - -* restore orginal paths - clra - os9 I$Close - inca - os9 I$Close - inca - os9 I$Close - - lda orgstdin,u - os9 I$Dup - lbcs errex - lda orgstdout,u - os9 I$Dup - lbcs errex - lda orgstderr,u - os9 I$Dup - lbcs errex - lda orgstdin,u - os9 I$Close - lda orgstdout,u - os9 I$Close - lda orgstderr,u - os9 I$Close - lda childnetpath,u - os9 I$Close - - IFNE DEBUG - pshs d - lbsr PRINTS - fcc /Proc forked/ - fcb C$CR - fcb $00 - puls d - ENDC - -forkex comb - ldb #E$EOF -ret rts - -inetdconf fcc "....../SYS/inetd.conf" - fcb C$CR - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/inetd.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,538 @@ +******************************************************************** +* inetd - internet daemon +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1 2010/01/08 Boisy G. Pitre +* Started. +* +* 2 2010/01/22 Boisy G. Pitre +* Now reads inetd.conf file. +* +* 3 2011/08/07 Boisy G. Pitre +* Fixed bug where conf file wasn't being processed correctly. + + nam inetd + ttl internet daemon + +tylg set $01 Prgrm+Objct +atrv set $80+rev ReEnt+rev +rev set $00 +edition set 3 + + section data +targetport rmb 2 +netdatardy rmb 1 +nbufferl equ 128 +nbuffer rmb nbufferl +lbufferl equ 128 +lbuffer rmb lbufferl +nnext rmb 2 +token rmb 2 +orgstdin rmb 1 +orgstdout rmb 1 +orgstderr rmb 1 +childnetpath rmb 1 +netpath rmb 1 +targetprog rmb 128 +targetparams rmb 128 +tmodeparamlen rmb 1 +tmodeparams rmb 128 + endsect + +* psect inetd_a,$01,$80,1,200,start + section text + +DEBUG equ 1 + + +NetSig equ 2 + +tmode fcs /tmode/ + +* signal intercept routine +sigint cmpb #NetSig + bne sigex + inc netdatardy,u +sigex rti + +**** Entry Point **** +start: +* setup signal intercept + leax sigint,pcr + os9 F$Icpt + + clr netdatardy,u + + leax nbuffer,u + stx nnext,u + +* Turn off pause in standard out + ldd #$01*256+SS.Opt + leas -32,s + tfr s,x + os9 I$GetStt + bcs opterr + clr PD.PAU-PD.OPT,x + os9 I$SetStt +opterr + leas 32,s + +* open the path to the control channel + lbsr TCPOpen + lbcs errex + sta netpath,u + leax SetupPorts,pcr + lbsr ProcInetd + lbcs errex + + IFNE DEBUG + lbsr PRINTS + fcc /Got netpath and setup ports/ + fcb C$CR + fcb $00 + ENDC + +ssignetpath + IFNE DEBUG + lbsr PRINTS + fcc /SS.SSig on NetPath/ + fcb C$CR + fcb $00 + ENDC + + lda netpath,u + ldb #SS.SSig send signal on data ready + ldx #NetSig + os9 I$SetStt + lbcs errex + +**** MAIN LOOP **** +mainloop + pshs cc + orcc #IntMasks + tst netdatardy,u + bne gotdata + +* wait for a child to die (or wake up via signal) + os9 F$Wait + bcc chkrdy + cmpb #E$NoChld + bne chkrdy got error other than "no children" +* if no children, go to sleep + ldx #$0000 + os9 F$Sleep + +chkrdy puls cc + bra ssignetpath + +gotdata puls cc + dec netdatardy,u +* read the data from netpath + IFNE DEBUG + lbsr PRINTS + fcc /Reading data from netpath/ + fcb C$CR + fcb $00 + ENDC + + lda netpath,u + ldb #SS.Ready + os9 I$GetStt + bcs ssignetpath + + clra + tfr d,y + lda netpath,u + ldx nnext,u + os9 I$Read + lbcs errex + tfr y,d + leax d,x + stx nnext,u + lda -1,x + cmpa #C$CR + lbne ssignetpath + + leax nbuffer,u + stx nnext,u + + lda #1 + ldy #256 + os9 I$WritLn + +* determine response + lda ,x + cmpa #'9 + ble incoming + + cmpa #'F + lbra ssignetpath + +* get token number +incoming + lbsr DEC_BIN + std token,u + IFNE DEBUG + pshs d + lbsr PRINTS + fcc /Got token / + fcb $00 + puls d + lbsr PRINT_DEC + lbsr PRINTS + fcb C$CR + fcb $00 + ENDC + +* skip over token number + IFNE DEBUG + lbsr PRINTS + fcc /To Space.../ + fcb C$CR + fcb $00 + ENDC + lbsr TO_SP + IFNE DEBUG + lbsr PRINTS + fcc /To Non-Space.../ + fcb C$CR + fcb $00 + ENDC + lbsr TO_NON_SP + +* get port number + lbsr DEC_BIN + std targetport,u + + IFNE DEBUG + pshs d + lbsr PRINTS + fcc /Got request for port / + fcb $00 + ldd ,s + lbsr PRINT_DEC + lbsr PRINTS + fcb C$CR + fcb $00 + puls d + ENDC + + leax ForkProcForPort,pcr + lbsr ProcInetd + lbra ssignetpath we may want to tell server we have no app + +errex os9 F$Exit + + +* Process inetd.conf file +* +* Entry: X = processor routine +* +* - open conf file +* - read each line and get first parameter (port number) +* - send it to the processor routine at x +* - if error or end of file, close and return +ProcInetd pshs x + leax inetdconf,pcr + lda #READ. + os9 I$Open + bcs adex + IFNE DEBUG + pshs d + lbsr PRINTS + fcc /Opened inetd.conf ok/ + fcb C$CR + fcb $00 + puls d + ENDC +nextline leax lbuffer,u + ldy #lbufferl-1 + lbsr FGETS + bcs closeup + lbsr TO_NON_SP skip any leading spaces + ldb ,x check for EOL or comment + cmpb #C$CR + beq nextline + cmpb #'# + beq nextline + IFNE DEBUG + pshs d,x + lbsr PRINTS + fcc /Reading line: / + fcb $00 + ldx 2,s + lbsr PUTS + puls d,x + ENDC + pshs a + jsr [1,s] + puls a + bcc nextline +closeup cmpb #E$EOF + bne closeandex + clrb +closeandex pshs b,cc + os9 I$Close + puls b,cc +adex puls x,pc + + +* Setup ports +* Extract first parameter at X and send to server +SetupPorts lbsr DEC_BIN + cmpd #0 + beq ret0 +* find comma and change it to nul + tfr x,y +setuploop lda ,y+ + cmpa #C$CR + beq ret0 + cmpa #', + bne setuploop +setuplisten + clr -1,y + IFNE DEBUG + pshs d,x + lbsr PRINTS + fcc /Send listen/ + fcb C$CR + fcb $00 + puls d,x + ENDC + lda netpath,u + lbsr TCPListen +ret0 rts + +retcc clrb + rts + +* Fork Proccess that matches target port +* Extract first parameter at X and see if it matches target port +* if so, read rest of line and fork the process +* Line looks like this: portnumberplusoptions,prog,params,path opts +ForkProcForPort +* get port number + lbsr DEC_BIN + IFNE DEBUG + pshs d + lbsr PRINTS + fcc /Reading port / + fcb $00 + ldd ,s + lbsr PRINT_DEC + lbsr PRINTS + fcb C$CR + fcb $00 + lbsr PRINTS + fcc /Comparing to port / + fcb $00 + ldd targetport,u + lbsr PRINT_DEC + lbsr PRINTS + fcb C$CR + fcb $00 + puls d + ENDC + cmpd targetport,u + lbne retcc +* point Y to byte after comma +portloop lda ,y+ + cmpa #C$CR + beq ret0 + cmpa #', + bne portloop + tfr y,x +* copy bytes up to comma at X + leay targetprog,u +prgloop lda ,x+ + cmpa #', + beq sethi + cmpa #C$CR + lbeq ret + sta ,y+ + bra prgloop +sethi lda -1,y + ora #$80 + sta -1,y +copypar clr tmodeparamlen,u + leay targetparams,u +parloop lda ,x+ + sta ,y+ + cmpa #', + beq procopts + cmpa #C$CR + beq gotprocparms + +procopts + leay tmodeparams,u +procoptsloop lda ,x+ + sta ,y+ + inc targetparams,u + cmpa #C$CR + beq procoptsloop + +gotprocparms + IFNE DEBUG + pshs d + lbsr PRINTS + fcc /Got proc and params to fork/ + fcb C$CR + fcb $00 + puls d + ENDC + +* ignore client port number and hostname for now + lbsr TCPOpen + bcc savechild + + ldd token,u + leas -8,s + leax ,s + lbsr BIN_DEC + lda netpath,u + tfr x,y + lbsr TCPKill + leas 8,s + lbra forkex + +savechild + sta childnetpath,u + ldd token,u + leas -8,s + leax ,s + lbsr BIN_DEC + lda childnetpath,u + tfr x,y + lbsr TCPJoin + leas 8,s + bcc turnonechoalf + os9 I$Close + lbra forkex + +turnonechoalf + IFNE DEBUG + pshs d + lbsr PRINTS + fcc /Turning on PD.EKO and PD.ALF/ + fcb C$CR + fcb $00 + puls d + ENDC + lbsr SetEchoOn + lbcs ret + lbsr SetAutoLFOn + lbcs ret + +* dup paths +duper + IFNE DEBUG + pshs d + lbsr PRINTS + fcc /Duping paths/ + fcb C$CR + fcb $00 + puls d + ENDC + + clra + os9 I$Dup + lbcs errex + sta orgstdin,u + lda #1 + os9 I$Dup + lbcs errex + sta orgstdout,u + lda #2 + os9 I$Dup + lbcs errex + sta orgstderr,u + +* close original stdin/out/err paths + clra + os9 I$Close + inca + os9 I$Close + inca + os9 I$Close + +* Dup child net path to stdin/stdout/stderr + lda childnetpath,u + os9 I$Dup + lbcs errex + os9 I$Dup + lbcs errex + os9 I$Dup + lbcs errex + +* fork tmode process if tmode param length > 0 + tst tmodeparamlen,u + beq forkchild + pshs u + leax tmode,pcr + leau tmodeparams,u + lda #Objct + clrb + ldy #256 + os9 F$Fork + puls u + os9 F$Wait + +* fork child process +forkchild + pshs u + leax targetprog,u + leau targetparams,u + lda #Objct + clrb + ldy #256 + os9 F$Fork + puls u +* If our F$Fork fails, do not error out... +* bcs ret2 + +* restore orginal paths + clra + os9 I$Close + inca + os9 I$Close + inca + os9 I$Close + + lda orgstdin,u + os9 I$Dup + lbcs errex + lda orgstdout,u + os9 I$Dup + lbcs errex + lda orgstderr,u + os9 I$Dup + lbcs errex + lda orgstdin,u + os9 I$Close + lda orgstdout,u + os9 I$Close + lda orgstderr,u + os9 I$Close + lda childnetpath,u + os9 I$Close + + IFNE DEBUG + pshs d + lbsr PRINTS + fcc /Proc forked/ + fcb C$CR + fcb $00 + puls d + ENDC + +forkex comb + ldb #E$EOF +ret rts + +inetdconf fcc "....../SYS/inetd.conf" + fcb C$CR + endsect
--- a/level1/cmds/load.a Sat Jan 26 08:26:31 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 data -u0000 rmb 200 - endsect - -* psect load_a,Prgrm+Objct,ReEnt+rev,edition,200,start - section text - -start os9 F$Load - bcs Exit - lda ,x - cmpa #C$CR - bne start - clrb -Exit os9 F$Exit - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/load.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,35 @@ +******************************************************************** +* 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 data +u0000 rmb 200 + endsect + +* psect load_a,Prgrm+Objct,ReEnt+rev,edition,200,start + section text + +start os9 F$Load + bcs Exit + lda ,x + cmpa #C$CR + bne start + clrb +Exit os9 F$Exit + + endsect
--- a/level1/cmds/tee.a Sat Jan 26 08:26:31 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 - - use defsfile.d - -rev set $00 -edition set 2 - - section data -u0000 rmb 1 -parray rmb 13 -pcount rmb 1 -buff rmb 200 - endsect - -* psect tee_a,Prgrm+Objct,ReEnt+rev,edition,200,start - section text - -start clrb - clr pcount clear path counter - cmpy #$0000 any parameters? - lbeq exitok exit if none - leay parray 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 else get path counter - sta b,y save new path in the array offset - incb increment counter - stb pcount and save - bra parse continue parsing command line -parsex stb pcount - -* Devices on command line are open, start pumping data -L0044 clra - leax buff - ldy #256 - os9 I$ReadLn - bcc L0057 - cmpb #E$EOF - beq exitok - coma - bra exit -L0057 inca - os9 I$WritLn - tst pcount - beq L0044 - clrb -L0060 leay parray - lda b,y - leax buff - ldy #256 - os9 I$WritLn - bcs exit - incb - cmpb pcount - bne L0060 - bra L0044 -exitok clrb -exit os9 F$Exit - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/tee.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,87 @@ +******************************************************************** +* 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 + + use defsfile.d + +rev set $00 +edition set 2 + + section data +u0000 rmb 1 +parray rmb 13 +pcount rmb 1 +buff rmb 200 + endsect + +* psect tee_a,Prgrm+Objct,ReEnt+rev,edition,200,start + section text + +start clrb + clr pcount clear path counter + cmpy #$0000 any parameters? + lbeq exitok exit if none + leay parray 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 else get path counter + sta b,y save new path in the array offset + incb increment counter + stb pcount and save + bra parse continue parsing command line +parsex stb pcount + +* Devices on command line are open, start pumping data +L0044 clra + leax buff + ldy #256 + os9 I$ReadLn + bcc L0057 + cmpb #E$EOF + beq exitok + coma + bra exit +L0057 inca + os9 I$WritLn + tst pcount + beq L0044 + clrb +L0060 leay parray + lda b,y + leax buff + ldy #256 + os9 I$WritLn + bcs exit + incb + cmpb pcount + bne L0060 + bra L0044 +exitok clrb +exit os9 F$Exit + + endsect
--- a/level1/cmds/telnet.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,516 +0,0 @@ -******************************************************************** -* telnet - telnet client -* -* $Id$ -* -* Notes: -* This utility works in similar fashion to telnet commands on other systems. -* The user can telnet to a location, and once there, press the TELESCAPE key -* to invoke telnet command mode. -* -* Two sets of path options are kept for the standard input. The first is an -* unmodified copy and the second is a modifable copy. The second is set up -* for raw mode and is used when communicating with the host. The first will -* be used when going into telnet command mode or exiting the telnet program. -* -* The signal handler catches the S$HUP signal and shuts down gracefully. It -* also looks for the ABORT/QUIT characters and relays them to the session. -* -* Reference used: http://www.faqs.org/rfcs/rfc854.html -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1 2010/01/02 Aaron Wolfe -* Most basic implementation using new DW utility API -* -* 2 2010/01/06 Boisy G. Pitre -* Reformatted and optimized source. Added SS.Opt support, added telnet -* command mode which can be entered by pressing the TELESCAPE key. -* -* 3 2010/01/07 Boisy G. Pitre -* Reworked buffer processing routine. -* -* 4 2010/01/12 Boisy G. Pitre -* We allow host to do echo if it wants, we also now advertise the -* escape character when a connection is successful. -* -* 5 2010/01/15 Boisy G. Pitre -* Modified to be an rma assembled module and use the netlib library. - -* Set to 1 if you want to see telnet CTRL chars from host -DEBUG set 0 - - nam telnet - ttl program module - -tylg set $01 Prgrm+Objct -atrv set $80+rev ReEnt+rev -rev set $00 -edition set 5 - - section data -connected rmb 1 -netdatardy rmb 1 -keydatardy rmb 1 -lastsig rmb 1 -port rmb 2 -hostname rmb 2 -pbuffer rmb 256 -pbufferl equ * -pbend rmb 2 -cbuffer rmb 256 -ccount rmb 1 -opts rmb 32 -orgopts rmb 32 -tcmdbufl equ 32 -tcmdbuf rmb tcmdbufl -portdev rmb 10 -netpath rmb 1 -outpath rmb 1 -numbyt rmb 1 -state rmb 1 -telctrlbuf rmb 3 - endsect - -* psect telnet_a,tylg,atrv,edition,200,start - section text - -TELESCAPE equ 'Y-$40 * CTRL-Y - -NetSig equ 32 -KeySig equ 33 - -SE equ 240 * end of subnegotiation parameters -NOP equ 241 * no operation -DataMark equ 242 * the data stream portion of a Synch. This should always be accompanied by a TCP Urgent notification. -Break equ 243 * NVT character BRK. -IntProc equ 244 * the function IP -AbortOut equ 245 * the function AO. -AreUThere equ 246 * the function AYT -EraseChar equ 247 * the function EC. -EraseLine equ 248 * the function EL. -GoAhead equ 249 * the GA signal. -SB equ 250 * indicates that what follows is subnegotiation of the indicated option. -WILL equ 251 * indicates the desire to begin performing, or confirmation that you are now performing, the indicated option. -WONT equ 252 * indicates the refusal to perform, or continue performing, the indicated option. -DO equ 253 * indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option. -DONT equ 254 * indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option. -IAC equ 255 * data byte 255. - -* Telnet Options -TO_ECHO equ $01 - -escprompt fcc /Escape character is '^/ - fcb TELESCAPE+$40 - fcc /'./ -crlf fcb C$CR,C$LF -escpromptl equ *-escprompt -tprompt fcc /telnet> / -tpromptl equ *-tprompt - -trying fcc /Trying.../ - fcb C$CR -tryingl equ *-trying - -peerclosm fcc /Connection closed by foreign host./ - fcb C$CR -peerclosml equ *-peerclosm - -using fcc 'Using port ' -usingl equ *-using - -defportstr fcc '23' - fcb 0 - -peerclosed - clr connected,u - leax peerclosm,pcr - ldy #peerclosml - os9 I$WritLn - lbra done - -* signal intercept routine -sigint - stb lastsig,u * save our signal received - cmpb #KeySig - bne netchk - inc keydatardy,u - rti -netchk cmpb #NetSig - bne hupchk - inc netdatardy,u - rti -hupchk cmpb #S$HUP * disconnect from peer signal received? - beq peerclosed * yep, exit nicely - lda #$03 * usual interrupt character - cmpb #S$Intrpt - beq chksig - lda #$05 * usual quit character - cmpb #S$Abort - bne sigex -chksig tst connected,u - lbeq done - pshs a - leax ,s - ldy #$0001 - lda netpath,u - os9 I$Write - puls a -sigex rti - -* save initial parameters -start pshs x - clr connected,u - clr netdatardy,u - clr keydatardy,u - -* setup signal intercept - leax sigint,pcr - os9 F$Icpt - -* get path options (original and modifiable copy) - leax orgopts,u - ldd #SS.Opt - os9 I$GetStt - lbcs errex2 - - leax opts,u - ldd #SS.Opt - os9 I$GetStt - lbcs errex2 - -* set up our path to be raw (we will actually set it later) - leax PD.UPC-PD.OPT,x - ldb #PD.INT-PD.UPC -rawloop clr ,x+ - decb - bne rawloop - -* set address as nul terminated string -addrloop - ldx ,s -addrloop2 - lda ,x+ - cmpa #C$SPAC - beq nilit - cmpa #C$CR - beq nilit - bra addrloop2 - -nilit clr -1,x nil terminate previous param - cmpa #C$CR are we at end of command line? - beq defaultport yep, set default port - -skipspc lda ,x+ - cmpa #C$CR - beq defaultport - cmpa #C$SPAC - beq skipspc -* if here, we have a second parameter... probably port number - leay -1,x - bra parsedone -defaultport leay defportstr,pcr -parsedone puls x - -* X holds pointer to nul terminated address -* Y holds port number string (nil terminated) -* do the open and connect - pshs y - std port,u - stx hostname,u - -* announce our attempt to try to connect - lda #1 - ldy #tryingl - leax trying,pcr - os9 I$WritLn - - lbsr TCPOpen - puls y - lbcs errex1 - sta netpath,u - ldx hostname,u - lbsr TCPConnectToHost - lbcs errex2 - lbsr RawPath - -* we're connected... - lda #1 - sta connected,u - leax escprompt,pcr - ldy #escpromptl - os9 I$WritLn - -* make our stdin opts raw - leax opts,u - ldd #SS.Opt - os9 I$SetStt - lbcs errex2 - -* setup data ready signal on stdin - clra - ldb #SS.SSig - ldx #KeySig - os9 I$SetStt - lbcs errex2 - -* setup data ready signal on netpath - lda netpath,u - ldb #SS.SSig - ldx #NetSig - os9 I$SetStt - lbcs errex2 - -* response loop -* check for typed characters -rloop - pshs cc save interrupt state - orcc #IntMasks mask interrupts - tst netdatardy,u - bne GetNetData - tst keydatardy,u - bne GetKeyData -* sleep until signal - ldx #$0000 - os9 F$Sleep - puls cc - bra rloop - -GetKeyData puls cc - dec keydatardy,u - bra stdinc - -GetNetData puls cc - dec netdatardy,u - lda netpath,u - ldb #SS.Ready - os9 I$GetStt - lbcc serinc read and print the byte - bra rloop - -* telnet command interface -cmdint -* restore original opts for now - leax orgopts,u - ldd #SS.Opt - os9 I$SetStt - bcs errex2 - -* write CR - lda #1 - leax crlf,pcr - ldy #$02 - os9 I$Write - -* show prompt -cmdloop - lda #1 - leax tprompt,pcr - ldy #tpromptl - os9 I$Write - -* read command - leax tcmdbuf,u - ldy #tcmdbufl - clra - os9 I$ReadLn - bcs errex2 - -* process command - lda ,x - anda #$5F * make uppercase - - cmpa #C$CR - beq ret2tel * just CR... return to telnet session - cmpa #'Q - beq okex - bra cmdloop - -* return to telnet session -ret2tel - leax opts,u - ldd #SS.Opt - os9 I$SetStt - bcs errex2 - -* read one byte from stdin, send to server -stdinc ldy #$0001 - clra - leax numbyt,u - os9 I$Read - bcs errex2 - -* check if it is an escape character - lda ,x - cmpa #TELESCAPE - beq cmdint - -outc ldy #$0001 - lda netpath,u - leax numbyt,u - os9 I$Write - bcs errex2 - -* setup data ready signal on stdin - clra - ldb #SS.SSig - ldx #KeySig - os9 I$SetStt - lbcs errex2 - - lbra rloop - -done -okex clrb *no errors here -* close port -errex2 - pshs b,cc - lda netpath,u - lbsr TCPDisconnect - clr connected,u - - leax orgopts,u - ldd #SS.Opt - os9 I$SetStt *restore original path options - puls b,cc - -errex1 os9 F$Exit *goodbye - -* read B bytes from serial -serinc clra - tfr d,y - lda netpath,u - leax pbuffer,u - os9 I$Read - bcs errex2 - -* set buffer - tfr y,d - leax pbuffer,u - abx - stx pbend,u *set end addr - clrb - leax pbuffer,u - leay cbuffer,u - clr ccount,u - -* call buffer processor - bsr procbuf - -* print buffer - ldb ccount,u - beq serincex - clra - tfr d,y - lda #1 - leax cbuffer,u - os9 I$Write - bcs errex2 - -* return to loop -serincex -* setup data ready signal on netpath - lda netpath,u - ldb #SS.SSig - ldx #NetSig - os9 I$SetStt - lbcs errex2 - - lbra rloop - - - -* buffer processing routine -procbuf cmpx pbend,u - beq procbufex -* not at end of buffer, get next char - lda ,x+ -* check state to see what we do with this byte - tst state,u - bne telctrl - cmpa #IAC - beq telstate - sta ,y+ - inc ccount,u - bra procbuf -procbufex rts - -conv anda #$0F - cmpa #$09 - bgt alpha - adda #$30 - fcb $8C -alpha adda #$41-$0A - rts - - IFEQ DEBUG-1 -printhex pshs d,x,y - bsr conv - pshs a - lda 1,s - lsra - lsra - lsra - lsra - bsr conv - pshs a - lda #'$ - pshs a - leax ,s - ldy #$0003 - lda #$01 - os9 I$Write - leas 3,s - puls d,x,y,pc - ENDC - -telstate sta telctrlbuf,u - IFEQ DEBUG-1 - bsr printhex - ENDC - inc state,u - bra procbuf - -clrngo clr state,u - bra procbuf - -* handles telnet control sequence... A = byte -telctrl - IFEQ DEBUG-1 - bsr printhex - ENDC - ldb state,u - cmpb #1 - bne telctrl2 - cmpa #SB - ble clrngo - sta telctrlbuf+1,u - inc state,u - bra procbuf -telctrl2 sta telctrlbuf+2,u - clr state,u -* here we have a complete telnet control sequence - ldd telctrlbuf+1,u - cmpa #DO - beq dowont - cmpa #WILL - lbne procbuf - cmpb #TO_ECHO - bne dodont -* allow host to echo - lda #DO - fcb $8C -dodont lda #DONT - fcb $8C -dowont lda #WONT - sta telctrlbuf+1,u - ldy #3 - lda netpath,u - pshs x - leax telctrlbuf,u - os9 I$Write - puls x - lbra procbuf - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/telnet.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,516 @@ +******************************************************************** +* telnet - telnet client +* +* $Id$ +* +* Notes: +* This utility works in similar fashion to telnet commands on other systems. +* The user can telnet to a location, and once there, press the TELESCAPE key +* to invoke telnet command mode. +* +* Two sets of path options are kept for the standard input. The first is an +* unmodified copy and the second is a modifable copy. The second is set up +* for raw mode and is used when communicating with the host. The first will +* be used when going into telnet command mode or exiting the telnet program. +* +* The signal handler catches the S$HUP signal and shuts down gracefully. It +* also looks for the ABORT/QUIT characters and relays them to the session. +* +* Reference used: http://www.faqs.org/rfcs/rfc854.html +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1 2010/01/02 Aaron Wolfe +* Most basic implementation using new DW utility API +* +* 2 2010/01/06 Boisy G. Pitre +* Reformatted and optimized source. Added SS.Opt support, added telnet +* command mode which can be entered by pressing the TELESCAPE key. +* +* 3 2010/01/07 Boisy G. Pitre +* Reworked buffer processing routine. +* +* 4 2010/01/12 Boisy G. Pitre +* We allow host to do echo if it wants, we also now advertise the +* escape character when a connection is successful. +* +* 5 2010/01/15 Boisy G. Pitre +* Modified to be an rma assembled module and use the netlib library. + +* Set to 1 if you want to see telnet CTRL chars from host +DEBUG set 0 + + nam telnet + ttl program module + +tylg set $01 Prgrm+Objct +atrv set $80+rev ReEnt+rev +rev set $00 +edition set 5 + + section data +connected rmb 1 +netdatardy rmb 1 +keydatardy rmb 1 +lastsig rmb 1 +port rmb 2 +hostname rmb 2 +pbuffer rmb 256 +pbufferl equ * +pbend rmb 2 +cbuffer rmb 256 +ccount rmb 1 +opts rmb 32 +orgopts rmb 32 +tcmdbufl equ 32 +tcmdbuf rmb tcmdbufl +portdev rmb 10 +netpath rmb 1 +outpath rmb 1 +numbyt rmb 1 +state rmb 1 +telctrlbuf rmb 3 + endsect + +* psect telnet_a,tylg,atrv,edition,200,start + section text + +TELESCAPE equ 'Y-$40 * CTRL-Y + +NetSig equ 32 +KeySig equ 33 + +SE equ 240 * end of subnegotiation parameters +NOP equ 241 * no operation +DataMark equ 242 * the data stream portion of a Synch. This should always be accompanied by a TCP Urgent notification. +Break equ 243 * NVT character BRK. +IntProc equ 244 * the function IP +AbortOut equ 245 * the function AO. +AreUThere equ 246 * the function AYT +EraseChar equ 247 * the function EC. +EraseLine equ 248 * the function EL. +GoAhead equ 249 * the GA signal. +SB equ 250 * indicates that what follows is subnegotiation of the indicated option. +WILL equ 251 * indicates the desire to begin performing, or confirmation that you are now performing, the indicated option. +WONT equ 252 * indicates the refusal to perform, or continue performing, the indicated option. +DO equ 253 * indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option. +DONT equ 254 * indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option. +IAC equ 255 * data byte 255. + +* Telnet Options +TO_ECHO equ $01 + +escprompt fcc /Escape character is '^/ + fcb TELESCAPE+$40 + fcc /'./ +crlf fcb C$CR,C$LF +escpromptl equ *-escprompt +tprompt fcc /telnet> / +tpromptl equ *-tprompt + +trying fcc /Trying.../ + fcb C$CR +tryingl equ *-trying + +peerclosm fcc /Connection closed by foreign host./ + fcb C$CR +peerclosml equ *-peerclosm + +using fcc 'Using port ' +usingl equ *-using + +defportstr fcc '23' + fcb 0 + +peerclosed + clr connected,u + leax peerclosm,pcr + ldy #peerclosml + os9 I$WritLn + lbra done + +* signal intercept routine +sigint + stb lastsig,u * save our signal received + cmpb #KeySig + bne netchk + inc keydatardy,u + rti +netchk cmpb #NetSig + bne hupchk + inc netdatardy,u + rti +hupchk cmpb #S$HUP * disconnect from peer signal received? + beq peerclosed * yep, exit nicely + lda #$03 * usual interrupt character + cmpb #S$Intrpt + beq chksig + lda #$05 * usual quit character + cmpb #S$Abort + bne sigex +chksig tst connected,u + lbeq done + pshs a + leax ,s + ldy #$0001 + lda netpath,u + os9 I$Write + puls a +sigex rti + +* save initial parameters +start pshs x + clr connected,u + clr netdatardy,u + clr keydatardy,u + +* setup signal intercept + leax sigint,pcr + os9 F$Icpt + +* get path options (original and modifiable copy) + leax orgopts,u + ldd #SS.Opt + os9 I$GetStt + lbcs errex2 + + leax opts,u + ldd #SS.Opt + os9 I$GetStt + lbcs errex2 + +* set up our path to be raw (we will actually set it later) + leax PD.UPC-PD.OPT,x + ldb #PD.INT-PD.UPC +rawloop clr ,x+ + decb + bne rawloop + +* set address as nul terminated string +addrloop + ldx ,s +addrloop2 + lda ,x+ + cmpa #C$SPAC + beq nilit + cmpa #C$CR + beq nilit + bra addrloop2 + +nilit clr -1,x nil terminate previous param + cmpa #C$CR are we at end of command line? + beq defaultport yep, set default port + +skipspc lda ,x+ + cmpa #C$CR + beq defaultport + cmpa #C$SPAC + beq skipspc +* if here, we have a second parameter... probably port number + leay -1,x + bra parsedone +defaultport leay defportstr,pcr +parsedone puls x + +* X holds pointer to nul terminated address +* Y holds port number string (nil terminated) +* do the open and connect + pshs y + std port,u + stx hostname,u + +* announce our attempt to try to connect + lda #1 + ldy #tryingl + leax trying,pcr + os9 I$WritLn + + lbsr TCPOpen + puls y + lbcs errex1 + sta netpath,u + ldx hostname,u + lbsr TCPConnectToHost + lbcs errex2 + lbsr RawPath + +* we're connected... + lda #1 + sta connected,u + leax escprompt,pcr + ldy #escpromptl + os9 I$WritLn + +* make our stdin opts raw + leax opts,u + ldd #SS.Opt + os9 I$SetStt + lbcs errex2 + +* setup data ready signal on stdin + clra + ldb #SS.SSig + ldx #KeySig + os9 I$SetStt + lbcs errex2 + +* setup data ready signal on netpath + lda netpath,u + ldb #SS.SSig + ldx #NetSig + os9 I$SetStt + lbcs errex2 + +* response loop +* check for typed characters +rloop + pshs cc save interrupt state + orcc #IntMasks mask interrupts + tst netdatardy,u + bne GetNetData + tst keydatardy,u + bne GetKeyData +* sleep until signal + ldx #$0000 + os9 F$Sleep + puls cc + bra rloop + +GetKeyData puls cc + dec keydatardy,u + bra stdinc + +GetNetData puls cc + dec netdatardy,u + lda netpath,u + ldb #SS.Ready + os9 I$GetStt + lbcc serinc read and print the byte + bra rloop + +* telnet command interface +cmdint +* restore original opts for now + leax orgopts,u + ldd #SS.Opt + os9 I$SetStt + bcs errex2 + +* write CR + lda #1 + leax crlf,pcr + ldy #$02 + os9 I$Write + +* show prompt +cmdloop + lda #1 + leax tprompt,pcr + ldy #tpromptl + os9 I$Write + +* read command + leax tcmdbuf,u + ldy #tcmdbufl + clra + os9 I$ReadLn + bcs errex2 + +* process command + lda ,x + anda #$5F * make uppercase + + cmpa #C$CR + beq ret2tel * just CR... return to telnet session + cmpa #'Q + beq okex + bra cmdloop + +* return to telnet session +ret2tel + leax opts,u + ldd #SS.Opt + os9 I$SetStt + bcs errex2 + +* read one byte from stdin, send to server +stdinc ldy #$0001 + clra + leax numbyt,u + os9 I$Read + bcs errex2 + +* check if it is an escape character + lda ,x + cmpa #TELESCAPE + beq cmdint + +outc ldy #$0001 + lda netpath,u + leax numbyt,u + os9 I$Write + bcs errex2 + +* setup data ready signal on stdin + clra + ldb #SS.SSig + ldx #KeySig + os9 I$SetStt + lbcs errex2 + + lbra rloop + +done +okex clrb *no errors here +* close port +errex2 + pshs b,cc + lda netpath,u + lbsr TCPDisconnect + clr connected,u + + leax orgopts,u + ldd #SS.Opt + os9 I$SetStt *restore original path options + puls b,cc + +errex1 os9 F$Exit *goodbye + +* read B bytes from serial +serinc clra + tfr d,y + lda netpath,u + leax pbuffer,u + os9 I$Read + bcs errex2 + +* set buffer + tfr y,d + leax pbuffer,u + abx + stx pbend,u *set end addr + clrb + leax pbuffer,u + leay cbuffer,u + clr ccount,u + +* call buffer processor + bsr procbuf + +* print buffer + ldb ccount,u + beq serincex + clra + tfr d,y + lda #1 + leax cbuffer,u + os9 I$Write + bcs errex2 + +* return to loop +serincex +* setup data ready signal on netpath + lda netpath,u + ldb #SS.SSig + ldx #NetSig + os9 I$SetStt + lbcs errex2 + + lbra rloop + + + +* buffer processing routine +procbuf cmpx pbend,u + beq procbufex +* not at end of buffer, get next char + lda ,x+ +* check state to see what we do with this byte + tst state,u + bne telctrl + cmpa #IAC + beq telstate + sta ,y+ + inc ccount,u + bra procbuf +procbufex rts + +conv anda #$0F + cmpa #$09 + bgt alpha + adda #$30 + fcb $8C +alpha adda #$41-$0A + rts + + IFEQ DEBUG-1 +printhex pshs d,x,y + bsr conv + pshs a + lda 1,s + lsra + lsra + lsra + lsra + bsr conv + pshs a + lda #'$ + pshs a + leax ,s + ldy #$0003 + lda #$01 + os9 I$Write + leas 3,s + puls d,x,y,pc + ENDC + +telstate sta telctrlbuf,u + IFEQ DEBUG-1 + bsr printhex + ENDC + inc state,u + bra procbuf + +clrngo clr state,u + bra procbuf + +* handles telnet control sequence... A = byte +telctrl + IFEQ DEBUG-1 + bsr printhex + ENDC + ldb state,u + cmpb #1 + bne telctrl2 + cmpa #SB + ble clrngo + sta telctrlbuf+1,u + inc state,u + bra procbuf +telctrl2 sta telctrlbuf+2,u + clr state,u +* here we have a complete telnet control sequence + ldd telctrlbuf+1,u + cmpa #DO + beq dowont + cmpa #WILL + lbne procbuf + cmpb #TO_ECHO + bne dodont +* allow host to echo + lda #DO + fcb $8C +dodont lda #DONT + fcb $8C +dowont lda #WONT + sta telctrlbuf+1,u + ldy #3 + lda netpath,u + pshs x + leax telctrlbuf,u + os9 I$Write + puls x + lbra procbuf + + endsect
--- a/level1/cmds/touch.a Sat Jan 26 08:26:31 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 data -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 text - -* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/touch.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,414 @@ +******************************************************************** +* 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 data +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 text + +* 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.a Sat Jan 26 08:26:31 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 data -childid rmb 1 -parmptr rmb 2 -parmlen rmb 2 -inbuff rmb 128 - endsect - -* psect tsmon_a,Prgrm+Objct,ReEnt+rev,edition,200,start - section text - -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/tsmon.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,79 @@ +******************************************************************* +* 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 data +childid rmb 1 +parmptr rmb 2 +parmlen rmb 2 +inbuff rmb 128 + endsect + +* psect tsmon_a,Prgrm+Objct,ReEnt+rev,edition,200,start + section text + +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
--- a/level2/coco3/cmds/makefile Sat Jan 26 08:26:31 2013 -0600 +++ b/level2/coco3/cmds/makefile Sat Jan 26 17:18:24 2013 -0600 @@ -1,12 +1,12 @@ PORT = coco3 include $(NITROS9DIR)/rules.mak -vpath %.a $(LEVEL2)/cmds:$(LEVEL1)/cmds +vpath %.as $(LEVEL2)/cmds:$(LEVEL1)/cmds vpath %.asm $(LEVEL2)/cmds:$(LEVEL1)/cmds:$(NITROS9DIR)/3rdparty/packages/basic09 DEPENDS = ./makefile AFLAGS += --includedir=$(NITROS9DIR)/3rdparty/packages/basic09 -LFLAGS += --library=$(NITROS9DIR)/lib/net.l --library=$(NITROS9DIR)/lib/alib.l --library=$(NITROS9DIR)/lib/sys6809l1.l +LFLAGS += $(NITROS9DIR)/lib/sys6809l1.a $(NITROS9DIR)/lib/net.a $(NITROS9DIR)/lib/alib.a CMDS = asm attr backup binex build cmp cobbler copy cputype \ date dcheck debug ded deiniz del deldir devs dir dirsort disasm \
--- a/lib/alib/asc_bin.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -****************************************** -* -* ASCII String to binary byte conversion - -* OTHER MODULES NEEDED: IS_TERMIN - -* ENTRY: X = start of string of binary digits (001101) -* terminated by space, comma, CR or null. - -* EXIT: D = value -* CC carry set if error (string too long, not binary digits) -* Y = terminator or error pos. - - - nam ASCII String to Binary Conversion - ttl Assembler Library Module - - - section .text - -ASC_BIN: - clra msb/lsb=0 - clrb - pshs a,b,x - -ascbn1 - ldb ,x+ get a digit - lbsr IS_TERMIN see if space/comma/null/cr - beq ascbn2 - subb #$30 strip off ASCII - bmi error less than "0".. - cmpb #1 - BHI error geater than "1" - rorb get bit into carry - ROL 1,S into LSB - ROL ,S into MSB - inca bump string length - cmpa #16 - BLS ascbn1 length ok, loop - BRA error - -ascbn2 - clrb = no errors - tsta len = 0? - bne done no, skip - -* error -- too long or null - -error - CLR ,S force data to 0 - CLR 1,S - ORCC #1 set carry flag - -done - leay -1,x end of string/error char - PULS A,B,X,PC get data; restore & return - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/asc_bin.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,60 @@ +****************************************** +* +* ASCII String to binary byte conversion + +* OTHER MODULES NEEDED: IS_TERMIN + +* ENTRY: X = start of string of binary digits (001101) +* terminated by space, comma, CR or null. + +* EXIT: D = value +* CC carry set if error (string too long, not binary digits) +* Y = terminator or error pos. + + + nam ASCII String to Binary Conversion + ttl Assembler Library Module + + + section .text + +ASC_BIN: + clra msb/lsb=0 + clrb + pshs a,b,x + +ascbn1 + ldb ,x+ get a digit + lbsr IS_TERMIN see if space/comma/null/cr + beq ascbn2 + subb #$30 strip off ASCII + bmi error less than "0".. + cmpb #1 + BHI error geater than "1" + rorb get bit into carry + ROL 1,S into LSB + ROL ,S into MSB + inca bump string length + cmpa #16 + BLS ascbn1 length ok, loop + BRA error + +ascbn2 + clrb = no errors + tsta len = 0? + bne done no, skip + +* error -- too long or null + +error + CLR ,S force data to 0 + CLR 1,S + ORCC #1 set carry flag + +done + leay -1,x end of string/error char + PULS A,B,X,PC get data; restore & return + + endsect + +
--- a/lib/alib/b09strlen.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -********************************** - -* BASIC09 String Length: find length of a BASIC09 string -* which can be terminated by a $ff -* =or= allocated storage size - -* ENTRY: X=start of string -* D=max allocated - -* EXIT: D=actual length -* all other regs (except cc) preserved - - nam Find Basic09 String Length - ttl Assembler Library Module - - - section .text - -B09STRLEN: - pshs d,x,y - tfr d,y max. possible size to Y - -loop - lda ,x+ get char from string - inca this effects a cmpa #$ff - beq exit reached terminator - leay -1,y if string max leng, no terminator - bne loop no yet, check more - -exit - puls d get max possible size - pshs y unused size in memory - subd ,s++ find actual length - puls x,y,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/b09strlen.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,37 @@ +********************************** + +* BASIC09 String Length: find length of a BASIC09 string +* which can be terminated by a $ff +* =or= allocated storage size + +* ENTRY: X=start of string +* D=max allocated + +* EXIT: D=actual length +* all other regs (except cc) preserved + + nam Find Basic09 String Length + ttl Assembler Library Module + + + section .text + +B09STRLEN: + pshs d,x,y + tfr d,y max. possible size to Y + +loop + lda ,x+ get char from string + inca this effects a cmpa #$ff + beq exit reached terminator + leay -1,y if string max leng, no terminator + bne loop no yet, check more + +exit + puls d get max possible size + pshs y unused size in memory + subd ,s++ find actual length + puls x,y,pc + + endsect +
--- a/lib/alib/bin2hex.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -**************************************** - -* Convert hex byte to 2 hex digits - -* OTHER MODULES REQUIRED: none - -* ENTRY: B= value to convert - -* EXIT: D=2 byte hex digits - - - nam Convert Byte to Hex - ttl Assembler Library Module - - section .text - -BIN2HEX: - pshs b - lsrb get msn - lsrb - lsrb - lsrb fall through to convert msn and return - bsr ToHex - tfr b,a 1st digit in A - puls b get lsn - andb #%00001111 keep msn - -ToHex - addb #'0 convert to ascii - cmpb #'9 - bls ToHex1 - addb #7 convert plus 9 to A..F -ToHex1 - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/bin2hex.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,37 @@ +**************************************** + +* Convert hex byte to 2 hex digits + +* OTHER MODULES REQUIRED: none + +* ENTRY: B= value to convert + +* EXIT: D=2 byte hex digits + + + nam Convert Byte to Hex + ttl Assembler Library Module + + section .text + +BIN2HEX: + pshs b + lsrb get msn + lsrb + lsrb + lsrb fall through to convert msn and return + bsr ToHex + tfr b,a 1st digit in A + puls b get lsn + andb #%00001111 keep msn + +ToHex + addb #'0 convert to ascii + cmpb #'9 + bls ToHex1 + addb #7 convert plus 9 to A..F +ToHex1 + rts + + endsect +
--- a/lib/alib/bin_asc.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -****************************************** - -* Binary word to ASCII string conversion - -* OTHER MODULES NEEDED: none - -* ENTRY: D = binary value -* X = buffer for 16 bit number - -* EXIT: all registers (except cc) preserved - - nam Convert # to Ascii String - ttl Assembler Library Module - - - section .text - -BIN_ASC: - pshs a,b,x save registers - pshs a,b save data again - ldb #16 total bits to convert - andcc #%11111110 clear CARRY to start - -binas1 - lda #'0 get ASCII 0 - rol 1,S get hi bit in LSB to carry - rol ,S and into MSB; is it 1 or 0? - bcc binas2 0, skip - inca get ASCII 1 - -binas2 - sta ,x+ put it in the buffer - decb done all bits? - bne binas1 no, loop - clr ,x mark end of string - leas 2,s clean up - puls a,b,x,pc restore & return - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/bin_asc.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,40 @@ +****************************************** + +* Binary word to ASCII string conversion + +* OTHER MODULES NEEDED: none + +* ENTRY: D = binary value +* X = buffer for 16 bit number + +* EXIT: all registers (except cc) preserved + + nam Convert # to Ascii String + ttl Assembler Library Module + + + section .text + +BIN_ASC: + pshs a,b,x save registers + pshs a,b save data again + ldb #16 total bits to convert + andcc #%11111110 clear CARRY to start + +binas1 + lda #'0 get ASCII 0 + rol 1,S get hi bit in LSB to carry + rol ,S and into MSB; is it 1 or 0? + bcc binas2 0, skip + inca get ASCII 1 + +binas2 + sta ,x+ put it in the buffer + decb done all bits? + bne binas1 no, loop + clr ,x mark end of string + leas 2,s clean up + puls a,b,x,pc restore & return + + endsect +
--- a/lib/alib/bin_dec.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -************************************************ -* -* Binary to decimal conversion - -* OTHER MODULES NEEDED: DECTAB$ - -* ENTRY: X=buffer for ascii string -* D=binary value to convert - -* EXIT: all registers (except cc) preserved - -* BGP - 04/11/2009 - Fixed issue where BIN_DEC was printing negative -* sign in certain cases. Cleared nega flag to fix issue. - - nam Binary to Decimal Conversion - ttl Assembler Library Module - - - section .bss -nega rmb 1 - endsect - - section .text -BIN_SDEC: - clr nega,u - tsta - bpl BIN_DEC - sta nega,u - comb - coma - addd #$0001 - bra BIN_DEC_COMMON +++ added BGP - -BIN_DEC: - clr nega,u +++ added BGP -BIN_DEC_COMMON - pshs a,b,x,y - lda #7 clear out 7 bytes in buffer - -bindc1 - clr ,x+ - deca - bne bindc1 - ldx 2,s restore buffer start address - ldd ,s get data - bne bindc2 not 0, do convert - lda #'0 - sta ,x - bra bindc8 exit - -bindc2 - tst nega,u - beq bindc25 - pshs a - lda #'- - sta ,x+ - puls a -bindc25 - leay DECTAB$,pcr point to conversion table - clr ,--s temps, flag 1st dgt not placed - -bindc3 - clr 1,s current digit=0 - -bindc4 - subd ,y sub table element - bcs bindc5 too far, correct - inc 1,s bump digit - bra bindc4 loop til done - -bindc5 - addd ,y restore, 1 too many subtracts - pshs a,b save rest of number - lda 3,s get the digit - adda #$30 make it ascii - cmpa #'0 is it zero? - bne bindc6 no, skip - tst 2,s is it 1st digit in string? - beq bindc7 yes, don't do leading 0s - -bindc6 - inc 2,s indidicate at least 1 digit - sta ,x+ save in buffer - -bindc7 - leay 2,y next table entry - tst 1,y end of table - puls a,b restore data - bne bindc3 no..loop - leas 2,s - -bindc8 - puls a,b,x,y,pc restore and return - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/bin_dec.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,96 @@ +************************************************ +* +* Binary to decimal conversion + +* OTHER MODULES NEEDED: DECTAB$ + +* ENTRY: X=buffer for ascii string +* D=binary value to convert + +* EXIT: all registers (except cc) preserved + +* BGP - 04/11/2009 - Fixed issue where BIN_DEC was printing negative +* sign in certain cases. Cleared nega flag to fix issue. + + nam Binary to Decimal Conversion + ttl Assembler Library Module + + + section .bss +nega rmb 1 + endsect + + section .text +BIN_SDEC: + clr nega,u + tsta + bpl BIN_DEC + sta nega,u + comb + coma + addd #$0001 + bra BIN_DEC_COMMON +++ added BGP + +BIN_DEC: + clr nega,u +++ added BGP +BIN_DEC_COMMON + pshs a,b,x,y + lda #7 clear out 7 bytes in buffer + +bindc1 + clr ,x+ + deca + bne bindc1 + ldx 2,s restore buffer start address + ldd ,s get data + bne bindc2 not 0, do convert + lda #'0 + sta ,x + bra bindc8 exit + +bindc2 + tst nega,u + beq bindc25 + pshs a + lda #'- + sta ,x+ + puls a +bindc25 + leay DECTAB$,pcr point to conversion table + clr ,--s temps, flag 1st dgt not placed + +bindc3 + clr 1,s current digit=0 + +bindc4 + subd ,y sub table element + bcs bindc5 too far, correct + inc 1,s bump digit + bra bindc4 loop til done + +bindc5 + addd ,y restore, 1 too many subtracts + pshs a,b save rest of number + lda 3,s get the digit + adda #$30 make it ascii + cmpa #'0 is it zero? + bne bindc6 no, skip + tst 2,s is it 1st digit in string? + beq bindc7 yes, don't do leading 0s + +bindc6 + inc 2,s indidicate at least 1 digit + sta ,x+ save in buffer + +bindc7 + leay 2,y next table entry + tst 1,y end of table + puls a,b restore data + bne bindc3 no..loop + leas 2,s + +bindc8 + puls a,b,x,y,pc restore and return + + endsect +
--- a/lib/alib/bin_hex.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -******************************************** -* -* Binary to hexadecimal convertor -* -* This subroutine will convert the binary value in -* 'D' to a 4 digit hexadecimal ascii string. - - -* OTHER MODULES NEEDED: BIN2HEX - -* ENTRY: D=value to convert -* X=buffer for hex string-null terminated - -* EXIT all registers (except CC) preserved. - - nam Convert # to Hex String - ttl Assembler Library Module - - - section .text - -BIN_HEX: - pshs d,x - ldb ,s - lbsr BIN2HEX convert 1 byte - std ,x++ - ldb 1,s - lbsr BIN2HEX convert 2nd byte - std ,x++ - clr ,x term with null - puls d,x - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/bin_hex.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,35 @@ +******************************************** +* +* Binary to hexadecimal convertor +* +* This subroutine will convert the binary value in +* 'D' to a 4 digit hexadecimal ascii string. + + +* OTHER MODULES NEEDED: BIN2HEX + +* ENTRY: D=value to convert +* X=buffer for hex string-null terminated + +* EXIT all registers (except CC) preserved. + + nam Convert # to Hex String + ttl Assembler Library Module + + + section .text + +BIN_HEX: + pshs d,x + ldb ,s + lbsr BIN2HEX convert 1 byte + std ,x++ + ldb 1,s + lbsr BIN2HEX convert 2nd byte + std ,x++ + clr ,x term with null + puls d,x + + endsect + +
--- a/lib/alib/bin_rom.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -*************************************** - -* Subroutine to convert binary number to roman numerals - -* OTHER MODULES NEEDED: none - -* ENTRY: D=number to convert -* X=start of buffer (20 bytes) - - -* EXIT: all registers preserved - -* Note: the buffer should be set to 20 bytes. This permits the -* longest possible number to be converted without a buffer overflow. -* This routine trunates any numbers >8191 to ensure that no number -* is longer than 19 characters (plus null terminator). -* The number 7888 converts to a 19 character string. To permit larger -* number conversions one could delete the anda #%00011111 statement. - -* This routine has been converted from the BASIC09 sample in -* the Basic09 Reference Manual (Microware) page a-3. - - nam Binary to Roman numberal conversion - ttl Assembler Library Module - - - section .text - - -BIN_ROM: - pshs d,x,y,u - - leau nums,pcr number conversion table - clr ,-s counter on stack - lda 1,s restore value - anda #%00011111 ensure no value>8191 permitted - -roman1 - cmpd ,u - blo roman2 - leay chars,pcr - bsr addchar - subd ,u - bra roman1 - -roman2 - pshs d - ldd ,u - subd 2,u - cmpd ,s - puls d - bhi roman3 - - leay subs,pcr - bsr addchar - leay chars,pcr - bsr addchar - subd ,u - addd 2,u - -roman3 - leau 4,u next pair of values - pshs d - inc 2,s counter - lda 2,s - cmpa #7 done? - puls d - bne roman1 no, do more - - puls a - clr ,x null terminator - - puls d,x,y,u,pc - -addchar - pshs d - lda 4,s get loop count - lda a,y get char - sta ,x+ - puls d,pc - -nums fdb 1000,100 - fdb 500,100 - fdb 100,10 - fdb 50,10 - fdb 10,1 - fdb 5,1 - fdb 1,0 - -chars fcc /MDCLXVI/ -subs fcc /CCXXII/ - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/bin_rom.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,94 @@ +*************************************** + +* Subroutine to convert binary number to roman numerals + +* OTHER MODULES NEEDED: none + +* ENTRY: D=number to convert +* X=start of buffer (20 bytes) + + +* EXIT: all registers preserved + +* Note: the buffer should be set to 20 bytes. This permits the +* longest possible number to be converted without a buffer overflow. +* This routine trunates any numbers >8191 to ensure that no number +* is longer than 19 characters (plus null terminator). +* The number 7888 converts to a 19 character string. To permit larger +* number conversions one could delete the anda #%00011111 statement. + +* This routine has been converted from the BASIC09 sample in +* the Basic09 Reference Manual (Microware) page a-3. + + nam Binary to Roman numberal conversion + ttl Assembler Library Module + + + section .text + + +BIN_ROM: + pshs d,x,y,u + + leau nums,pcr number conversion table + clr ,-s counter on stack + lda 1,s restore value + anda #%00011111 ensure no value>8191 permitted + +roman1 + cmpd ,u + blo roman2 + leay chars,pcr + bsr addchar + subd ,u + bra roman1 + +roman2 + pshs d + ldd ,u + subd 2,u + cmpd ,s + puls d + bhi roman3 + + leay subs,pcr + bsr addchar + leay chars,pcr + bsr addchar + subd ,u + addd 2,u + +roman3 + leau 4,u next pair of values + pshs d + inc 2,s counter + lda 2,s + cmpa #7 done? + puls d + bne roman1 no, do more + + puls a + clr ,x null terminator + + puls d,x,y,u,pc + +addchar + pshs d + lda 4,s get loop count + lda a,y get char + sta ,x+ + puls d,pc + +nums fdb 1000,100 + fdb 500,100 + fdb 100,10 + fdb 50,10 + fdb 10,1 + fdb 5,1 + fdb 1,0 + +chars fcc /MDCLXVI/ +subs fcc /CCXXII/ + + endsect +
--- a/lib/alib/compare.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -************************************** - -* COMPARE: Subroutine for string comparsion routines. -* Compares chars in A/B, will convert both to -* uppercase first if CASEMTCH is set (negative) - - -* OTHER MODULES NEEDED: TO_UPPER - -* ENTRY: A/B=characters to compare -* CASEMTCH=0 (or positive value) if A<>a -* -1 (or neg value) if A=a - - -* EXIT: CC zero set if characters match. -* All other registers preserved. - - - nam Compare 2 Chars - ttl Assembler Library Module - - - section .bss - -CASEMTCH: rmb 1 - - endsect - - section .text - - -COMPARE: - pshs d - tst CASEMTCH need to covert to upper? - bpl no - lbsr TO_UPPER - exg a,b - lbsr TO_UPPER -no - pshs a somewhere to compare it - cmpb ,s+ do compare, set zero - puls d,pc go home - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/compare.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,44 @@ +************************************** + +* COMPARE: Subroutine for string comparsion routines. +* Compares chars in A/B, will convert both to +* uppercase first if CASEMTCH is set (negative) + + +* OTHER MODULES NEEDED: TO_UPPER + +* ENTRY: A/B=characters to compare +* CASEMTCH=0 (or positive value) if A<>a +* -1 (or neg value) if A=a + + +* EXIT: CC zero set if characters match. +* All other registers preserved. + + + nam Compare 2 Chars + ttl Assembler Library Module + + + section .bss + +CASEMTCH: rmb 1 + + endsect + + section .text + + +COMPARE: + pshs d + tst CASEMTCH need to covert to upper? + bpl no + lbsr TO_UPPER + exg a,b + lbsr TO_UPPER +no + pshs a somewhere to compare it + cmpb ,s+ do compare, set zero + puls d,pc go home + + endsect
--- a/lib/alib/datestr.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -***************************************** - -* Convert a date to a string. This can be used -* for converting the system time as well as -* modify/create dates from files. The date must -* be 6 bytes -- null pad file dates. - - -* OTHER MODULES NEEDED: BIN_ASC - -* ENTRY: X=binary date -* Y=buffer for ascii - -* EXIT: all registers preserved (except cc) - - nam Get ASCII Date - ttl Assembler Library Module - - - section .text - -DATESTR: - pshs d,x,y,u - leau delims,pcr - -loop - bsr get1 convert a byte - lda ,u+ get next delimiter - sta ,y+ add to ascii buffer - bne loop not end yet - puls d,x,y,u,pc - -get1 - ldb ,x+ get next byte to convert - clra only doing one byte value - pshs x save ptr to date packet - leas -8,s buffer for ascii number - tfr s,x - lbsr BIN_DEC convert - ldd ,x get ascii - tstb 1byte number? - bne get2 no - tfr a,b - lda #'0 leading "0" - -get2 - std ,y++ to buffer - leas 8,s - puls x,pc - -delims - fcc '// ::' - fcb 0 - - endsect -t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/datestr.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,56 @@ +***************************************** + +* Convert a date to a string. This can be used +* for converting the system time as well as +* modify/create dates from files. The date must +* be 6 bytes -- null pad file dates. + + +* OTHER MODULES NEEDED: BIN_ASC + +* ENTRY: X=binary date +* Y=buffer for ascii + +* EXIT: all registers preserved (except cc) + + nam Get ASCII Date + ttl Assembler Library Module + + + section .text + +DATESTR: + pshs d,x,y,u + leau delims,pcr + +loop + bsr get1 convert a byte + lda ,u+ get next delimiter + sta ,y+ add to ascii buffer + bne loop not end yet + puls d,x,y,u,pc + +get1 + ldb ,x+ get next byte to convert + clra only doing one byte value + pshs x save ptr to date packet + leas -8,s buffer for ascii number + tfr s,x + lbsr BIN_DEC convert + ldd ,x get ascii + tstb 1byte number? + bne get2 no + tfr a,b + lda #'0 leading "0" + +get2 + std ,y++ to buffer + leas 8,s + puls x,pc + +delims + fcc '// ::' + fcb 0 + + endsect +t
--- a/lib/alib/dec_bin.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -**************************************** - -* DECIMAL to BINARY conversion routine - -* OTHER MODULES NEEDED: DECTAB$, IS_TERMIN - -* ENTRY: X = start of asci decimal string terminated by -* a space, comma, CR or null. - -* EXIT: D = binary value -* CC carry set if error (too large, not numeric) -* Y = terminator or error char. - - nam Convert Decimal String to Binary - ttl Assembler Library Module - - - section .bss -nega rmb 1 - endsect - - section .text - -DEC_BIN: - clra set result to 0 - clrb - pshs a,b,x - leas -1,s temp variable - - clr nega,u - ldb ,x+ - cmpb #'- - bne decbn15 - stb nega,u -decbn1 - LDB ,X+ get a digit -decbn15 - LBSR IS_DIGIT - bne decbn3 end of string... - INCA bump string len - BRA decbn1 loop for whole string - -decbn3 - lbsr IS_TERMIN valid terminator? - bne error - -ok - TSTA length = 0? - BEQ error yes, error - CMPA #6 more than 6 chars? - BHI error yes, error - - ldx 3,s get start of string again - - PSHS A - lda ,x - cmpa #'- - bne decbn35 - leax 1,x -decbn35 - LDA #5 max length - SUBA ,S+ adjust for offset - ASLA 2 bytes per table entry - LEAY DECTAB$,PCR addr of conversion table - LEAY A,Y add in offset for actual len - -decbn4 - LDA ,X+ get a digit - SUBA #$30 strip off ASCII - BEQ decbn6 zero, skip - sta ,s save digit=# of adds - LDD 1,S get binary data - -decbn5 - ADDD ,Y add in table value - BCS error past 0, too big - DEC ,S count down digit size - BNE decbn5 loop til 0 - STD 1,S save binary data - - -decbn6 - LEAY 2,Y next entry - tst 1,y end of table? - BNE decbn4 loop til done - clr ,s+ clean up and clear carry - bra exit - - -error - clr 0,s force data = 0 - clr 1,s - com ,s+ clean up and set carry - -exit - tfr x,y end of string/error char - puls a,b,x - bcs leave - tst nega,u - beq leave - subd #$0001 - coma - comb - andcc #$FE -leave - rts - - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/dec_bin.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,110 @@ +**************************************** + +* DECIMAL to BINARY conversion routine + +* OTHER MODULES NEEDED: DECTAB$, IS_TERMIN + +* ENTRY: X = start of asci decimal string terminated by +* a space, comma, CR or null. + +* EXIT: D = binary value +* CC carry set if error (too large, not numeric) +* Y = terminator or error char. + + nam Convert Decimal String to Binary + ttl Assembler Library Module + + + section .bss +nega rmb 1 + endsect + + section .text + +DEC_BIN: + clra set result to 0 + clrb + pshs a,b,x + leas -1,s temp variable + + clr nega,u + ldb ,x+ + cmpb #'- + bne decbn15 + stb nega,u +decbn1 + LDB ,X+ get a digit +decbn15 + LBSR IS_DIGIT + bne decbn3 end of string... + INCA bump string len + BRA decbn1 loop for whole string + +decbn3 + lbsr IS_TERMIN valid terminator? + bne error + +ok + TSTA length = 0? + BEQ error yes, error + CMPA #6 more than 6 chars? + BHI error yes, error + + ldx 3,s get start of string again + + PSHS A + lda ,x + cmpa #'- + bne decbn35 + leax 1,x +decbn35 + LDA #5 max length + SUBA ,S+ adjust for offset + ASLA 2 bytes per table entry + LEAY DECTAB$,PCR addr of conversion table + LEAY A,Y add in offset for actual len + +decbn4 + LDA ,X+ get a digit + SUBA #$30 strip off ASCII + BEQ decbn6 zero, skip + sta ,s save digit=# of adds + LDD 1,S get binary data + +decbn5 + ADDD ,Y add in table value + BCS error past 0, too big + DEC ,S count down digit size + BNE decbn5 loop til 0 + STD 1,S save binary data + + +decbn6 + LEAY 2,Y next entry + tst 1,y end of table? + BNE decbn4 loop til done + clr ,s+ clean up and clear carry + bra exit + + +error + clr 0,s force data = 0 + clr 1,s + com ,s+ clean up and set carry + +exit + tfr x,y end of string/error char + puls a,b,x + bcs leave + tst nega,u + beq leave + subd #$0001 + coma + comb + andcc #$FE +leave + rts + + + endsect +
--- a/lib/alib/dectab.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -********************************************************************* - -* table of decimal numbers for use by binary/decimal conversion -* routines. - - - nam Decimal Number Table - ttl Assembler Library Module - - - section .text - -DECTAB$: - fdb 10000,1000,100,10,1,0 - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/dectab.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,17 @@ +********************************************************************* + +* table of decimal numbers for use by binary/decimal conversion +* routines. + + + nam Decimal Number Table + ttl Assembler Library Module + + + section .text + +DECTAB$: + fdb 10000,1000,100,10,1,0 + + endsect +
--- a/lib/alib/div16x16.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -********************************************* -* 16 x 16 bit integer divide - -* OTHER MODULES NEEDED: none - -* ENTRY: D = divisor -* X = dividend - -* EXIT: X = quotient -* D = remainder - - nam 16x16 bit Divide - ttl Assembler Library Module - - - section .bss -negcount rmb 1 - endsect - - section .text - -* Signed Divide -SDIV16: - clr negcount,u - PSHS D,X - tst ,s - bpl testquo - ldd ,s - comb - coma - addd #$0001 - std ,s - inc negcount,u -testquo - tst 2,s - bpl ok - ldd 2,s - comb - coma - addd #$0001 - std 2,s - inc negcount,u -ok - puls d,x - bsr DIV16 - dec negcount,u - bne goforit - pshs d,x - ldd ,s - coma - comb - addd #$0001 - std ,s - ldd 2,s - coma - comb - addd #$0001 - std 2,s - puls d,x -goforit - rts - - -* Unsigned Divide -DIV16: - PSHS D,X save divisor & dividend - LDA #16 bit counter - PSHS A - CLRA initialize remainder - CLRB - -div1 - ASL 4,S shift dividend & quotient - ROL 3,S - ROLB shift dividend into B - ROLA - CMPD 1,S trial subtraction reqd? - BLO div2 - SUBD 1,S yes, do subtraction - INC 4,S increment quotient - -div2 - DEC ,S count down another bit - BNE div1 - LDX 3,S get quotient - LEAS 5,S clean stack - RTS - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/div16x16.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,90 @@ +********************************************* +* 16 x 16 bit integer divide + +* OTHER MODULES NEEDED: none + +* ENTRY: D = divisor +* X = dividend + +* EXIT: X = quotient +* D = remainder + + nam 16x16 bit Divide + ttl Assembler Library Module + + + section .bss +negcount rmb 1 + endsect + + section .text + +* Signed Divide +SDIV16: + clr negcount,u + PSHS D,X + tst ,s + bpl testquo + ldd ,s + comb + coma + addd #$0001 + std ,s + inc negcount,u +testquo + tst 2,s + bpl ok + ldd 2,s + comb + coma + addd #$0001 + std 2,s + inc negcount,u +ok + puls d,x + bsr DIV16 + dec negcount,u + bne goforit + pshs d,x + ldd ,s + coma + comb + addd #$0001 + std ,s + ldd 2,s + coma + comb + addd #$0001 + std 2,s + puls d,x +goforit + rts + + +* Unsigned Divide +DIV16: + PSHS D,X save divisor & dividend + LDA #16 bit counter + PSHS A + CLRA initialize remainder + CLRB + +div1 + ASL 4,S shift dividend & quotient + ROL 3,S + ROLB shift dividend into B + ROLA + CMPD 1,S trial subtraction reqd? + BLO div2 + SUBD 1,S yes, do subtraction + INC 4,S increment quotient + +div2 + DEC ,S count down another bit + BNE div1 + LDX 3,S get quotient + LEAS 5,S clean stack + RTS + + endsect +
--- a/lib/alib/div16x8.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -**************************************** -* 16 x 8 bit integer divide - -* Result must be an 8 bit value - -* ENTRY: A = divisor -* X = dividend - -* EXIT: A = remainder -* B = quotient -* all other registers (except CC) preserved - - nam 16x8 bit Divide - ttl Assembler Library Module - - - section .bss -negcount rmb 1 - endsect - - section .text - -* Signed Divide -SDIV168: - clr negcount,u - PSHS A,X - tst ,s - bpl testquo - lda ,s - coma - inca - sta ,s - inc negcount,u -testquo - tst 1,s - bpl ok - ldd 1,s - comb - coma - addd #$0001 - std 1,s - inc negcount,u -ok - puls a,x - bsr DIV168 - dec negcount,u - bne goforit - pshs a,x - lda ,s - coma - inca - sta ,s - ldd 1,s - coma - comb - addd #$0001 - std 1,s - puls a,x -goforit - rts - - -DIV168: - LDB #8 bit counter - PSHS A,B,X save count and divisor and value - TFR X,D put dividend in D - -div1 - ASLB shift dividend and quotient - ROLA - CMPA 0,S is trial subtraction successful? - BCS div2 - SUBA 0,S yes, subtract and set bit - INCB in quotient - -div2 - DEC 1,S count down bits - BNE div1 loop till done - LEAS 2,S clean stack - PULS X,PC return - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/div16x8.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,83 @@ +**************************************** +* 16 x 8 bit integer divide + +* Result must be an 8 bit value + +* ENTRY: A = divisor +* X = dividend + +* EXIT: A = remainder +* B = quotient +* all other registers (except CC) preserved + + nam 16x8 bit Divide + ttl Assembler Library Module + + + section .bss +negcount rmb 1 + endsect + + section .text + +* Signed Divide +SDIV168: + clr negcount,u + PSHS A,X + tst ,s + bpl testquo + lda ,s + coma + inca + sta ,s + inc negcount,u +testquo + tst 1,s + bpl ok + ldd 1,s + comb + coma + addd #$0001 + std 1,s + inc negcount,u +ok + puls a,x + bsr DIV168 + dec negcount,u + bne goforit + pshs a,x + lda ,s + coma + inca + sta ,s + ldd 1,s + coma + comb + addd #$0001 + std 1,s + puls a,x +goforit + rts + + +DIV168: + LDB #8 bit counter + PSHS A,B,X save count and divisor and value + TFR X,D put dividend in D + +div1 + ASLB shift dividend and quotient + ROLA + CMPA 0,S is trial subtraction successful? + BCS div2 + SUBA 0,S yes, subtract and set bit + INCB in quotient + +div2 + DEC 1,S count down bits + BNE div1 loop till done + LEAS 2,S clean stack + PULS X,PC return + + endsect +
--- a/lib/alib/div8x8.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -********************************* -* 8 x 8 Divide - -* OTHER MODULES NEEDED: none - -* ENTRY: A = divisor -* B = dividend - -* EXIT: A = remainder -* B = quotient - - nam 8x8 bit Divide - ttl Assembler Library Module - - - section .bss -negcount rmb 1 - endsect - - section .text - -* Signed Divide -SDIV88: - clr negcount,u - PSHS D - tst ,s - bpl testquo - lda ,s - coma - inca - sta ,s - inc negcount,u -testquo - tst 1,s - bpl ok - ldd 1,s - coma - adda #$01 - std 1,s - inc negcount,u -ok - puls d - bsr DIV88 - dec negcount,u - bne goforit - pshs d - lda ,s - coma - inca - sta ,s - lda 1,s - coma - inca - sta 1,s - puls d -goforit - rts - - -DIV88: - PSHS A save divisor - LDA #8 bit counter - PSHS A - CLRA initialize remainder - -div1 - ASLB shift dividend & quotient - ROLA - CMPA 1,S trial subtraction needed - BLO div2 - SUBA 1,S - INCB - -div2 - DEC 0,S count down # of bits - BNE div1 - LEAS 2,S clean up stack - RTS - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/div8x8.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,81 @@ +********************************* +* 8 x 8 Divide + +* OTHER MODULES NEEDED: none + +* ENTRY: A = divisor +* B = dividend + +* EXIT: A = remainder +* B = quotient + + nam 8x8 bit Divide + ttl Assembler Library Module + + + section .bss +negcount rmb 1 + endsect + + section .text + +* Signed Divide +SDIV88: + clr negcount,u + PSHS D + tst ,s + bpl testquo + lda ,s + coma + inca + sta ,s + inc negcount,u +testquo + tst 1,s + bpl ok + ldd 1,s + coma + adda #$01 + std 1,s + inc negcount,u +ok + puls d + bsr DIV88 + dec negcount,u + bne goforit + pshs d + lda ,s + coma + inca + sta ,s + lda 1,s + coma + inca + sta 1,s + puls d +goforit + rts + + +DIV88: + PSHS A save divisor + LDA #8 bit counter + PSHS A + CLRA initialize remainder + +div1 + ASLB shift dividend & quotient + ROLA + CMPA 1,S trial subtraction needed + BLO div2 + SUBA 1,S + INCB + +div2 + DEC 0,S count down # of bits + BNE div1 + LEAS 2,S clean up stack + RTS + + endsect +
--- a/lib/alib/fgetc.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -*************************************** - -* Subroutine to input one character. - -* OTHER MODULES NEEDED: none - -* ENTRY: A=path - - -* EXIT: A character -* CC carry set if error (from I$Read) -* B error code if any - - nam Input Single Character - ttl Assembler Library Module - - - section .text - -FGETC: - pshs a,x,y - ldy #1 number of char to print - tfr s,x point x at 1 char buffer - os9 I$Read - puls a,x,y,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/fgetc.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,28 @@ +*************************************** + +* Subroutine to input one character. + +* OTHER MODULES NEEDED: none + +* ENTRY: A=path + + +* EXIT: A character +* CC carry set if error (from I$Read) +* B error code if any + + nam Input Single Character + ttl Assembler Library Module + + + section .text + +FGETC: + pshs a,x,y + ldy #1 number of char to print + tfr s,x point x at 1 char buffer + os9 I$Read + puls a,x,y,pc + + endsect +
--- a/lib/alib/fgets.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -*************************************** - -* Subroutine to input a null terminated string. - -* OTHER MODULES NEEDED: none - -* ENTRY: A=path -* X=buffer for string -* Y=max buffer size (leave room for null!!) - -* EXIT: CC carry set if error (from I$ReadLn) -* B error code if any - - -* NOTE: The string entered must end with an end-of-record char -* (usually a $0D), the null is appended for ease in string -* handling. - - - nam Input Null Terminated String - ttl Assembler Library Module - - - section .text - -FGETS_NOCR: - pshs d,x - bsr FGETS - bcs bye - tfr y,d - leax -1,x - clr d,x -bye puls d,x,pc - -FGETS: - pshs a,x - os9 I$ReadLn get line - bcs exit return error code - tfr y,d - clr d,x add null - clrb no error.. - -exit - puls a,x,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/fgets.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,47 @@ +*************************************** + +* Subroutine to input a null terminated string. + +* OTHER MODULES NEEDED: none + +* ENTRY: A=path +* X=buffer for string +* Y=max buffer size (leave room for null!!) + +* EXIT: CC carry set if error (from I$ReadLn) +* B error code if any + + +* NOTE: The string entered must end with an end-of-record char +* (usually a $0D), the null is appended for ease in string +* handling. + + + nam Input Null Terminated String + ttl Assembler Library Module + + + section .text + +FGETS_NOCR: + pshs d,x + bsr FGETS + bcs bye + tfr y,d + leax -1,x + clr d,x +bye puls d,x,pc + +FGETS: + pshs a,x + os9 I$ReadLn get line + bcs exit return error code + tfr y,d + clr d,x add null + clrb no error.. + +exit + puls a,x,pc + + endsect +
--- a/lib/alib/fgety.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -*************************************** - -* Subroutine to input one word in Y. - -* OTHER MODULES NEEDED: none - -* ENTRY: A=path - - -* EXIT: Y value -* CC carry set if error (from I$Read) -* B error code if any - - nam Input word - ttl Assembler Library Module - - - section .text - -FGETY: - pshs x,y - ldy #2 number of char to read - leax 2,s point x at 2 char buffer - os9 I$Read - puls x,y,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/fgety.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,27 @@ +*************************************** + +* Subroutine to input one word in Y. + +* OTHER MODULES NEEDED: none + +* ENTRY: A=path + + +* EXIT: Y value +* CC carry set if error (from I$Read) +* B error code if any + + nam Input word + ttl Assembler Library Module + + + section .text + +FGETY: + pshs x,y + ldy #2 number of char to read + leax 2,s point x at 2 char buffer + os9 I$Read + puls x,y,pc + + endsect
--- a/lib/alib/fputc.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -*************************************** - -* Subroutine to print one character. - -* OTHER MODULES NEEDED: none - -* ENTRY: A=path -* B=char to print - -* EXIT: CC carry set if error (from I$WritLn) -* B error code if any - - nam Output Single Char. - ttl Assembler Library Module - - - section .text - -FPUTC: - pshs b,x,y - ldy #1 number of char to print - tfr s,x point x at char to print - os9 I$WritLn - leas 1,s don't care about char anymore (B now = error) - puls x,y,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/fputc.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,28 @@ +*************************************** + +* Subroutine to print one character. + +* OTHER MODULES NEEDED: none + +* ENTRY: A=path +* B=char to print + +* EXIT: CC carry set if error (from I$WritLn) +* B error code if any + + nam Output Single Char. + ttl Assembler Library Module + + + section .text + +FPUTC: + pshs b,x,y + ldy #1 number of char to print + tfr s,x point x at char to print + os9 I$WritLn + leas 1,s don't care about char anymore (B now = error) + puls x,y,pc + + endsect +
--- a/lib/alib/fputcr.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -**************************************** - -* Subroutine to print a carriage return - -* OTHER MODULES REQUIRED: FPUTC - -* ENTRY: A=path - -* EXIT: CC carry set if error (from I$WritLn) -* B error code if any. - - - nam Output Carriage Return - ttl Assembler Library Module - - - section .text - -FPUTCR: - ldb #$0d - lbra FPUTC - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/fputcr.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,23 @@ +**************************************** + +* Subroutine to print a carriage return + +* OTHER MODULES REQUIRED: FPUTC + +* ENTRY: A=path + +* EXIT: CC carry set if error (from I$WritLn) +* B error code if any. + + + nam Output Carriage Return + ttl Assembler Library Module + + + section .text + +FPUTCR: + ldb #$0d + lbra FPUTC + + endsect
--- a/lib/alib/fputs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -************************************** - -* FPUTS: print null terminated string to "A". - -* OTHER MODULES REQUIRED: none - -* ENTRY: X=start of string -* A=path - -* EXIT: CC carry set if error -* B = OS9 error if any (from I$WritLn) - -* NOTE: string is feed through I$WritLn for editing (adding LF, etc.) - - nam Output String - ttl Assembler Library Module - - - section .text - -FPUTS: - pshs a,x,y,u - tfr x,u start of 1st segment to print - -loop - pshs u start of this segment - ldy #-1 size of this seg. - -l1 - leay 1,y count size - ldb ,u+ check for null/cr - beq doit null=do last seg. - cmpb #$0d cr=do this seg. - bne l1 - leay 1,y count CR as one of the ones to print - -doit - puls x get start of this segment - OS9 I$WritLn - bcs exit - tst -1,u at end? - bne loop - -exit - puls a,x,y,u,pc return with status in CC,error code in B - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/fputs.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,47 @@ +************************************** + +* FPUTS: print null terminated string to "A". + +* OTHER MODULES REQUIRED: none + +* ENTRY: X=start of string +* A=path + +* EXIT: CC carry set if error +* B = OS9 error if any (from I$WritLn) + +* NOTE: string is feed through I$WritLn for editing (adding LF, etc.) + + nam Output String + ttl Assembler Library Module + + + section .text + +FPUTS: + pshs a,x,y,u + tfr x,u start of 1st segment to print + +loop + pshs u start of this segment + ldy #-1 size of this seg. + +l1 + leay 1,y count size + ldb ,u+ check for null/cr + beq doit null=do last seg. + cmpb #$0d cr=do this seg. + bne l1 + leay 1,y count CR as one of the ones to print + +doit + puls x get start of this segment + OS9 I$WritLn + bcs exit + tst -1,u at end? + bne loop + +exit + puls a,x,y,u,pc return with status in CC,error code in B + + endsect
--- a/lib/alib/fputspace.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -**************************************** - -* Subroutine to print a space - -* OTHER MODULES REQUIRED: FPUTC - -* ENTRY: A=path - -* EXIT: CC carry set if error (from I$WritLn) -* B error code if any. - - nam Output One Space Char. - ttl Assembler Library Module - - - section .text - -FPUTSPACE: - ldb #$20 - lbra FPUTC - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/fputspace.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,22 @@ +**************************************** + +* Subroutine to print a space + +* OTHER MODULES REQUIRED: FPUTC + +* ENTRY: A=path + +* EXIT: CC carry set if error (from I$WritLn) +* B error code if any. + + nam Output One Space Char. + ttl Assembler Library Module + + + section .text + +FPUTSPACE: + ldb #$20 + lbra FPUTC + + endsect
--- a/lib/alib/fputy.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -*************************************** - -* Subroutine to save word in Y to file - -* OTHER MODULES NEEDED: none - -* ENTRY: A=path -* Y=value to save - -* EXIT: CC carry set if error (from I$Write) -* B error code if any - - nam Save word to file - ttl Assembler Library Module - - - section .text - -FPUTY: - pshs x,y - ldy #2 number of chars to write - leax 2,s point X at value - os9 I$Write - puls x,y,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/fputy.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,27 @@ +*************************************** + +* Subroutine to save word in Y to file + +* OTHER MODULES NEEDED: none + +* ENTRY: A=path +* Y=value to save + +* EXIT: CC carry set if error (from I$Write) +* B error code if any + + nam Save word to file + ttl Assembler Library Module + + + section .text + +FPUTY: + pshs x,y + ldy #2 number of chars to write + leax 2,s point X at value + os9 I$Write + puls x,y,pc + + endsect +
--- a/lib/alib/frewind.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -*************************************** - -* Subroutine rewind file - -* OTHER MODULES NEEDED: none - -* ENTRY: A=path - - -* EXIT: CC carry set if error (from I$Seek) -* B error code if any - - nam Rewind open RBF file - ttl Assembler Library Module - - - section .text - -FREWIND: - pshs x,u - ldx #0 - tfr x,u - os9 I$Seek seek to pos 0 - puls x,u,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/frewind.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,27 @@ +*************************************** + +* Subroutine rewind file + +* OTHER MODULES NEEDED: none + +* ENTRY: A=path + + +* EXIT: CC carry set if error (from I$Seek) +* B error code if any + + nam Rewind open RBF file + ttl Assembler Library Module + + + section .text + +FREWIND: + pshs x,u + ldx #0 + tfr x,u + os9 I$Seek seek to pos 0 + puls x,u,pc + + endsect +
--- a/lib/alib/ftoeof.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -*************************************** - -* Subroutine seek to end of file - -* OTHER MODULES NEEDED: none - -* ENTRY: A=path - - -* EXIT: CC carry set if error (from I$Seek) -* B error code if any - - nam Seek EOF of open RBF file - ttl Assembler Library Module - - - section .text - -FTOEOF: - pshs x,u - ldb #SS.Size first get filesize - os9 I$GetStt - bcs exit - os9 I$Seek seek to end of file -exit - puls x,u,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/ftoeof.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,28 @@ +*************************************** + +* Subroutine seek to end of file + +* OTHER MODULES NEEDED: none + +* ENTRY: A=path + + +* EXIT: CC carry set if error (from I$Seek) +* B error code if any + + nam Seek EOF of open RBF file + ttl Assembler Library Module + + + section .text + +FTOEOF: + pshs x,u + ldb #SS.Size first get filesize + os9 I$GetStt + bcs exit + os9 I$Seek seek to end of file +exit + puls x,u,pc + + endsect
--- a/lib/alib/ftrans.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -*************************************** - -* Subroutine to transfer data for one file to another - -* OTHER MODULES NEEDED: none - -* ENTRY: A=source path -* B=destination path -* Y=number of bytes to transfer -* X=buffer for this routine -* U=buffer size - - -* EXIT: CC carry set if error (from I$Read or I$Write) -* B error code if any - - nam File data transfer - ttl Assembler Library Module - - section .data - -* this sets up a stack frame used for variable references - -count rmb 2 number of bytes to transfer (2nd Y) -inpath rmb 1 source file (A) -Breg rmb 1 copy of B register -outpath equ Breg dest file -buffer rmb 2 buffer memory (X) - rmb 2 copy of Y -bufsize rmb 2 buffer size (U) - - endsect - - section .text - -FTRANS: - pshs a,b,x,y,u - pshs y - -loop - ldy count,s bytes left to send - beq exit all done? - - lda inpath,s source file - ldx buffer,s buffer area - cmpy bufsize,s is remainder > buffer size - blo get no, get all of remainder - ldy bufsize,s use buffer size - -get - os9 I$Read get data - bcs error - lda outpath,s - os9 I$Write - bcs error - - pshs y number of bytes got/sent - ldd count+2,s adjust count remaining - subd ,s++ - std count,s - bra loop - -exit - clra no error - bra exit2 - -error - coma signal error - stb Breg,s set B - -exit2 - puls y - puls a,b,x,y,u,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/ftrans.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,75 @@ +*************************************** + +* Subroutine to transfer data for one file to another + +* OTHER MODULES NEEDED: none + +* ENTRY: A=source path +* B=destination path +* Y=number of bytes to transfer +* X=buffer for this routine +* U=buffer size + + +* EXIT: CC carry set if error (from I$Read or I$Write) +* B error code if any + + nam File data transfer + ttl Assembler Library Module + + section .data + +* this sets up a stack frame used for variable references + +count rmb 2 number of bytes to transfer (2nd Y) +inpath rmb 1 source file (A) +Breg rmb 1 copy of B register +outpath equ Breg dest file +buffer rmb 2 buffer memory (X) + rmb 2 copy of Y +bufsize rmb 2 buffer size (U) + + endsect + + section .text + +FTRANS: + pshs a,b,x,y,u + pshs y + +loop + ldy count,s bytes left to send + beq exit all done? + + lda inpath,s source file + ldx buffer,s buffer area + cmpy bufsize,s is remainder > buffer size + blo get no, get all of remainder + ldy bufsize,s use buffer size + +get + os9 I$Read get data + bcs error + lda outpath,s + os9 I$Write + bcs error + + pshs y number of bytes got/sent + ldd count+2,s adjust count remaining + subd ,s++ + std count,s + bra loop + +exit + clra no error + bra exit2 + +error + coma signal error + stb Breg,s set B + +exit2 + puls y + puls a,b,x,y,u,pc + + endsect
--- a/lib/alib/getc.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -*************************************** - -* Subroutine to input one character from std in. - -* OTHER MODULES NEEDED: FGETC - -* ENTRY: none - - -* EXIT: A character -* CC carry set if error (from I$Read) -* B error code if any - - nam Input Single Character - ttl Assembler Library Module - - - section .text - -GETC: - clra std in - lbra FGETC - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/getc.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,25 @@ +*************************************** + +* Subroutine to input one character from std in. + +* OTHER MODULES NEEDED: FGETC + +* ENTRY: none + + +* EXIT: A character +* CC carry set if error (from I$Read) +* B error code if any + + nam Input Single Character + ttl Assembler Library Module + + + section .text + +GETC: + clra std in + lbra FGETC + + endsect +
--- a/lib/alib/getfmd.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -************************************ - -* Get the "last modified" date of an open file - -* NOTE: Even though OS9 does not save seconds in its -* files this routine stores a zero in this position. -* This is done to make the routine compatible with -* DATESTR. - -* OTHER MODULES NEEDED: none - -* ENTRY: X=buffer for 6 byte date -* A=path of open file - -* EXIT: CC carry set if error -* B error code (if any) from SS.FD - - - nam Get Last Modified Date - ttl Assembler Library Module - - section .text - -BUFSIZ equ 8 - -GETFMD: - pshs x,y - leas -BUFSIZ,s where to put FD sector info - tfr s,x pointer for FD sector info - ldy #BUFSIZ bytes to read from FD sector - ldb #$0F SS.FD - os9 I$GetStt - bcs exit - ldy BUFSIZ,s get back orig X - ldx 3,s get 2 bytes - stx ,y++ move year,month - ldx 5,s - stx ,y++ move date,hour - lda 7,s - sta ,y+ move minutes - clr ,y null for seconds - -exit - leas BUFSIZ,s - puls x,y,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/getfmd.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,48 @@ +************************************ + +* Get the "last modified" date of an open file + +* NOTE: Even though OS9 does not save seconds in its +* files this routine stores a zero in this position. +* This is done to make the routine compatible with +* DATESTR. + +* OTHER MODULES NEEDED: none + +* ENTRY: X=buffer for 6 byte date +* A=path of open file + +* EXIT: CC carry set if error +* B error code (if any) from SS.FD + + + nam Get Last Modified Date + ttl Assembler Library Module + + section .text + +BUFSIZ equ 8 + +GETFMD: + pshs x,y + leas -BUFSIZ,s where to put FD sector info + tfr s,x pointer for FD sector info + ldy #BUFSIZ bytes to read from FD sector + ldb #$0F SS.FD + os9 I$GetStt + bcs exit + ldy BUFSIZ,s get back orig X + ldx 3,s get 2 bytes + stx ,y++ move year,month + ldx 5,s + stx ,y++ move date,hour + lda 7,s + sta ,y+ move minutes + clr ,y null for seconds + +exit + leas BUFSIZ,s + puls x,y,pc + + endsect +
--- a/lib/alib/gets.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -*************************************** - -* Subroutine to input a null terminated string from Std. In - -* OTHER MODULES NEEDED: GETS - -* ENTRY: X=buffer for string -* Y=max buffer size (leave room for null!!) - -* EXIT: CC carry set if error (from I$ReadLn) -* B error code if any - -* NOTE: The string entered must end with an end-of-record char -* (usually a $0D), the null is appended for ease in string -* handling. - - nam Input Null Terminated String from Std. In - ttl Assembler Library Module - - - section .text - -GETS: - pshs a - clra std in. - lbsr FGETS - puls a,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/gets.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,30 @@ +*************************************** + +* Subroutine to input a null terminated string from Std. In + +* OTHER MODULES NEEDED: GETS + +* ENTRY: X=buffer for string +* Y=max buffer size (leave room for null!!) + +* EXIT: CC carry set if error (from I$ReadLn) +* B error code if any + +* NOTE: The string entered must end with an end-of-record char +* (usually a $0D), the null is appended for ease in string +* handling. + + nam Input Null Terminated String from Std. In + ttl Assembler Library Module + + + section .text + +GETS: + pshs a + clra std in. + lbsr FGETS + puls a,pc + + endsect +
--- a/lib/alib/gety.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -*************************************** - -* Subroutine to input a word in Y - -* OTHER MODULES NEEDED: FGETY - -* ENTRY: none - - -* EXIT: Y value -* CC carry set if error (from I$Read) -* B error code if any - - nam Input Word for stdin - ttl Assembler Library Module - - - section .text - -GETY: - pshs a - clra std in - lbsr FGETY - puls a,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/gety.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,26 @@ +*************************************** + +* Subroutine to input a word in Y + +* OTHER MODULES NEEDED: FGETY + +* ENTRY: none + + +* EXIT: Y value +* CC carry set if error (from I$Read) +* B error code if any + + nam Input Word for stdin + ttl Assembler Library Module + + + section .text + +GETY: + pshs a + clra std in + lbsr FGETY + puls a,pc + + endsect
--- a/lib/alib/hex_bin.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -***************************************** - -* Hexadecimal string to BINARY conversion - -* OTHER MODULES REQUIRED: TO_UPPER, IS_TERMIN, IS_XDIGIT - -* ENTRY: X=start of a hex string terminated by a space, -* comma, CR, or NULL. - -* EXIT: D=binary number -* CC carry set iferror (too large, non-numeric) -* Y=terminator position or error char. - - - nam Convert Hex String to Binary - ttl Assembler Library Module - - section .text - - -HEX_BIN: - clra init number - clrb - pshs d,x - tfr d,y digit counter - -loop - ldb ,x+ get next digit - lbsr TO_UPPER convert to uppercase - lbsr IS_TERMIN end of string? - beq exit yes, go home - lbsr IS_XDIGIT make sure it's valid digit - bne error not 0..9, a..f - cmpb #'9 convert to binary value - bls notAtoF - subb #7 fix a..f -notAtoF - subb #'0 convert to binary 0..15 - -* now shift the digit to bits 7..4 - - lslb - lslb - lslb - lslb - -* now shift the value in to the result - - lda #4 number of bits -l1 - lslb digit bit to carry - rol 1,s carry bit to result - rol 0,s - deca done 4? - bne l1 no, loop - - leay 1,y number of digits done - cmpy #4 - bhi error more than 4 - bra loop keep going - - -exit - clrb clear carry=no error - sty -2,s test y (count) - bne done no digits? - -error - clr 0,s - clr 1,s - orcc #1 set carry - -done - leay -1,x terminator/error pos - puls d,x,pc - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/hex_bin.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,79 @@ +***************************************** + +* Hexadecimal string to BINARY conversion + +* OTHER MODULES REQUIRED: TO_UPPER, IS_TERMIN, IS_XDIGIT + +* ENTRY: X=start of a hex string terminated by a space, +* comma, CR, or NULL. + +* EXIT: D=binary number +* CC carry set iferror (too large, non-numeric) +* Y=terminator position or error char. + + + nam Convert Hex String to Binary + ttl Assembler Library Module + + section .text + + +HEX_BIN: + clra init number + clrb + pshs d,x + tfr d,y digit counter + +loop + ldb ,x+ get next digit + lbsr TO_UPPER convert to uppercase + lbsr IS_TERMIN end of string? + beq exit yes, go home + lbsr IS_XDIGIT make sure it's valid digit + bne error not 0..9, a..f + cmpb #'9 convert to binary value + bls notAtoF + subb #7 fix a..f +notAtoF + subb #'0 convert to binary 0..15 + +* now shift the digit to bits 7..4 + + lslb + lslb + lslb + lslb + +* now shift the value in to the result + + lda #4 number of bits +l1 + lslb digit bit to carry + rol 1,s carry bit to result + rol 0,s + deca done 4? + bne l1 no, loop + + leay 1,y number of digits done + cmpy #4 + bhi error more than 4 + bra loop keep going + + +exit + clrb clear carry=no error + sty -2,s test y (count) + bne done no digits? + +error + clr 0,s + clr 1,s + orcc #1 set carry + +done + leay -1,x terminator/error pos + puls d,x,pc + + endsect + +
--- a/lib/alib/inkey.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -*************************************** - -* Subroutine to input one character from std in. if ready -* like an INKEY$... - -* OTHER MODULES NEEDED: FGETC - -* ENTRY: none - - -* EXIT: A character, 0=no char -* CC carry set if error (from I$Read) -* B error code if any - - nam Inkey - ttl Assembler Library Module - - - section .text - -INKEY: - clra std in - ldb #SS.Ready - os9 I$GetStt see if key ready - bcc getit - cmpb #E$NotRdy no keys ready=no error - bne exit other error, report it - clra no error - bra exit - -getit - lbsr FGETC go get the key - -* this inst. needed since ctrl/: sometimes returns a null -* usually callers are not expecting a null.... - - tsta - -exit - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/inkey.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,43 @@ +*************************************** + +* Subroutine to input one character from std in. if ready +* like an INKEY$... + +* OTHER MODULES NEEDED: FGETC + +* ENTRY: none + + +* EXIT: A character, 0=no char +* CC carry set if error (from I$Read) +* B error code if any + + nam Inkey + ttl Assembler Library Module + + + section .text + +INKEY: + clra std in + ldb #SS.Ready + os9 I$GetStt see if key ready + bcc getit + cmpb #E$NotRdy no keys ready=no error + bne exit other error, report it + clra no error + bra exit + +getit + lbsr FGETC go get the key + +* this inst. needed since ctrl/: sometimes returns a null +* usually callers are not expecting a null.... + + tsta + +exit + rts + + endsect +
--- a/lib/alib/is_alnum.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -***************************************** - -* See if character in "B" is a alpha letter a..z or A..Z or digit 0..9 - -* OTHER MODULES NEEDED: IS_ALPHA, IS_DIGIT - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if alphanumeric, 0 if not - - - nam Is Char AlphaNumeric? - ttl Assembler Library Module - - - section .text - - -IS_ALNUM: - lbsr IS_ALPHA - BEQ yes upper/lowercase letters are alphanumeric - lbsr IS_DIGIT last chance to set flags. - -yes - rts - - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_alnum.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,29 @@ +***************************************** + +* See if character in "B" is a alpha letter a..z or A..Z or digit 0..9 + +* OTHER MODULES NEEDED: IS_ALPHA, IS_DIGIT + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if alphanumeric, 0 if not + + + nam Is Char AlphaNumeric? + ttl Assembler Library Module + + + section .text + + +IS_ALNUM: + lbsr IS_ALPHA + BEQ yes upper/lowercase letters are alphanumeric + lbsr IS_DIGIT last chance to set flags. + +yes + rts + + + endsect +
--- a/lib/alib/is_alpha.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -***************************************** - -* See if character in "B" is a alpha letter a..z or A..Z - -* OTHER MODULES NEEDED: IS_LOWER, IS_UPPER - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if alpha, 0 if not - - nam Is Char Alphabetic? - ttl Assembler Library Module - - - section .text - - -IS_ALPHA: - lbsr IS_UPPER - BEQ yes uppercase letters are alpha - lbsr IS_LOWER last chance to set flags. - -yes - rts - - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_alpha.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,28 @@ +***************************************** + +* See if character in "B" is a alpha letter a..z or A..Z + +* OTHER MODULES NEEDED: IS_LOWER, IS_UPPER + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if alpha, 0 if not + + nam Is Char Alphabetic? + ttl Assembler Library Module + + + section .text + + +IS_ALPHA: + lbsr IS_UPPER + BEQ yes uppercase letters are alpha + lbsr IS_LOWER last chance to set flags. + +yes + rts + + + endsect +
--- a/lib/alib/is_cntrl.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -***************************************** - -* See if character in "B" is a control character -* controls are defined as $00..$1F and $7F+ - -* OTHER MODULES NEEDED: none - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if control, 0 if not - - nam Is Char a Control? - ttl Assembler Library Module - - - section .text - - -IS_CNTRL: - cmpb #$7f - bhs yes - cmpb #$1f - bhi exit not control, zero cleared - -yes - orcc #%00000100 set zero - -exit - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_cntrl.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,32 @@ +***************************************** + +* See if character in "B" is a control character +* controls are defined as $00..$1F and $7F+ + +* OTHER MODULES NEEDED: none + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if control, 0 if not + + nam Is Char a Control? + ttl Assembler Library Module + + + section .text + + +IS_CNTRL: + cmpb #$7f + bhs yes + cmpb #$1f + bhi exit not control, zero cleared + +yes + orcc #%00000100 set zero + +exit + rts + + endsect +
--- a/lib/alib/is_digit.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -***************************************** - -* See if character in "B" is a digit 0..9 - -* OTHER MODULES NEEDED: none - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if digit, 0 if not - - nam Is Char a Digit? - ttl Assembler Library Module - - - section .text - - -IS_DIGIT: - cmpb #'0 - blo no not digit, zero cleared - cmpb #'9 if equal, zero set - bhi no not digit, zero cleared - orcc #%00000100 set zero - -no - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_digit.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,29 @@ +***************************************** + +* See if character in "B" is a digit 0..9 + +* OTHER MODULES NEEDED: none + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if digit, 0 if not + + nam Is Char a Digit? + ttl Assembler Library Module + + + section .text + + +IS_DIGIT: + cmpb #'0 + blo no not digit, zero cleared + cmpb #'9 if equal, zero set + bhi no not digit, zero cleared + orcc #%00000100 set zero + +no + rts + + endsect +
--- a/lib/alib/is_lower.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -***************************************** - -* See if character in "B" is a lowercase letter - -* OTHER MODULES NEEDED: none - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if lowercase, 0 if not - - nam Is Char. Lowercase? - ttl Assembler Library Module - - - section .text - - -IS_LOWER: - cmpb #'a - blo no not lowercase, zero cleared - cmpb #'z if equal, zero set - bhi no not lowc, zero cleared - orcc #%00000100 set zero - -no - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_lower.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,29 @@ +***************************************** + +* See if character in "B" is a lowercase letter + +* OTHER MODULES NEEDED: none + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if lowercase, 0 if not + + nam Is Char. Lowercase? + ttl Assembler Library Module + + + section .text + + +IS_LOWER: + cmpb #'a + blo no not lowercase, zero cleared + cmpb #'z if equal, zero set + bhi no not lowc, zero cleared + orcc #%00000100 set zero + +no + rts + + endsect +
--- a/lib/alib/is_print.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -***************************************** - -* See if character in "B" is a printable character -* controls are defined as $00..$1F and $7F+ -- all others are printable - -* OTHER MODULES NEEDED: IS_CNTRL - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if printable, 0 if not - - - nam Is Char Printable? - ttl Assembler Library Module - - - section .text - -IS_PRINT: - lbsr IS_CNTRL - beq no - orcc #%00000100 set zero - rts - -no - andcc #%11111011 clear zero - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_print.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,30 @@ +***************************************** + +* See if character in "B" is a printable character +* controls are defined as $00..$1F and $7F+ -- all others are printable + +* OTHER MODULES NEEDED: IS_CNTRL + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if printable, 0 if not + + + nam Is Char Printable? + ttl Assembler Library Module + + + section .text + +IS_PRINT: + lbsr IS_CNTRL + beq no + orcc #%00000100 set zero + rts + +no + andcc #%11111011 clear zero + rts + + endsect +
--- a/lib/alib/is_punct.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -***************************************** - -* See if character in "B" is a punctuation character - -* OTHER MODULES NEEDED: IS_ALNUM, IS_CNTRL - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if punct., 0 if not - - - nam Is Char Punctuation? - ttl Assembler Library Module - - - section .text - - -IS_PUNCT: - lbsr IS_ALNUM - BEQ no if its a.z,A.Z or 0.9 not punct - lbsr IS_CNTRL - BEQ no controls not punct. - orcc #%00000100 set carry - rts - -no - andcc #%11111011 clear zero - rts - - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_punct.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,33 @@ +***************************************** + +* See if character in "B" is a punctuation character + +* OTHER MODULES NEEDED: IS_ALNUM, IS_CNTRL + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if punct., 0 if not + + + nam Is Char Punctuation? + ttl Assembler Library Module + + + section .text + + +IS_PUNCT: + lbsr IS_ALNUM + BEQ no if its a.z,A.Z or 0.9 not punct + lbsr IS_CNTRL + BEQ no controls not punct. + orcc #%00000100 set carry + rts + +no + andcc #%11111011 clear zero + rts + + + endsect +
--- a/lib/alib/is_space.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -***************************************** - -* See if character in "B" is a space ($20) - -* NOTE: This module is included for completeness only, -* it is much more efficient to do an inline test. - -* OTHER MODULES NEEDED: none - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if space, 0 if not - - - nam Is Char a Space? - ttl Assembler Library Module - - - section .text - - -IS_SPACE: - cmpb #$20 - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_space.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,27 @@ +***************************************** + +* See if character in "B" is a space ($20) + +* NOTE: This module is included for completeness only, +* it is much more efficient to do an inline test. + +* OTHER MODULES NEEDED: none + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if space, 0 if not + + + nam Is Char a Space? + ttl Assembler Library Module + + + section .text + + +IS_SPACE: + cmpb #$20 + rts + + endsect +
--- a/lib/alib/is_termin.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -***************************************** - -* See if character in "B" is a valid string terminator. - -* NOTE: This module is used by HEX_BIN, DEC_BIN, etc. It permits -* SPACE, CR, COMMA and NULL to be used as a delimiter -- useful -* for paramater and list processing.... - -* OTHER MODULES NEEDED: none - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if space, 0 if not - - - nam Is Char a Terminator? - ttl Assembler Library Module - - - section .text - - -IS_TERMIN: - tstb null? - beq exit - cmpb #$20 space - beq exit - cmpb #$0d carriage return - beq exit - cmpb #', comma? - -exit - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_termin.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,36 @@ +***************************************** + +* See if character in "B" is a valid string terminator. + +* NOTE: This module is used by HEX_BIN, DEC_BIN, etc. It permits +* SPACE, CR, COMMA and NULL to be used as a delimiter -- useful +* for paramater and list processing.... + +* OTHER MODULES NEEDED: none + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if space, 0 if not + + + nam Is Char a Terminator? + ttl Assembler Library Module + + + section .text + + +IS_TERMIN: + tstb null? + beq exit + cmpb #$20 space + beq exit + cmpb #$0d carriage return + beq exit + cmpb #', comma? + +exit + rts + + endsect +
--- a/lib/alib/is_upper.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -***************************************** - -* See if character in "B" is a uppercase letter - -* OTHER MODULES NEEDED: none - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if uppercase, 0 if not - - nam Is Char Uppercase? - ttl Assembler Library Module - - - section .text - - -IS_UPPER: - cmpb #'A - blo no not uppercase, zero cleared - cmpb #'Z if equal, zero set - bhi no not upperc, zero cleared - orcc #%00000100 set zero - -no - rts - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_upper.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,29 @@ +***************************************** + +* See if character in "B" is a uppercase letter + +* OTHER MODULES NEEDED: none + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if uppercase, 0 if not + + nam Is Char Uppercase? + ttl Assembler Library Module + + + section .text + + +IS_UPPER: + cmpb #'A + blo no not uppercase, zero cleared + cmpb #'Z if equal, zero set + bhi no not upperc, zero cleared + orcc #%00000100 set zero + +no + rts + + endsect +
--- a/lib/alib/is_xdigit.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -***************************************** - -* See if character in "B" is a hexdigit 0..9, A..F or a..f - -* OTHER MODULES NEEDED: IS_DIGIT - -* ENTRY: B=character to test - -* EXIT: CC zero=1 if hex digit, 0 if not - - nam Is Char a Hex Digit? - ttl Assembler Library Module - - - section .text - - -IS_XDIGIT: - pshs b - lbsr IS_DIGIT - beq exit digits are okay - cmpb #'A - blo exit exit, zero not set - cmpb #'f - bhi exit zero not set - cmpb #'a - bhs yes - cmpb #'F - bhi exit - -yes - orcc #%00000100 set zero - -exit - puls b,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/is_xdigit.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,38 @@ +***************************************** + +* See if character in "B" is a hexdigit 0..9, A..F or a..f + +* OTHER MODULES NEEDED: IS_DIGIT + +* ENTRY: B=character to test + +* EXIT: CC zero=1 if hex digit, 0 if not + + nam Is Char a Hex Digit? + ttl Assembler Library Module + + + section .text + + +IS_XDIGIT: + pshs b + lbsr IS_DIGIT + beq exit digits are okay + cmpb #'A + blo exit exit, zero not set + cmpb #'f + bhi exit zero not set + cmpb #'a + bhs yes + cmpb #'F + bhi exit + +yes + orcc #%00000100 set zero + +exit + puls b,pc + + endsect +
--- a/lib/alib/jsr_cmd.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -*************************************** - -* Subroutine to jsr to subroutine from 1 character command table - -* OTHER MODULES NEEDED: none - -* ENTRY: A=1 char command -* X=start of jump table - -* EXIT: CC carry set if entry not found -* all other regs can be modified by subs - -* Note format of table: each entry is three bytes -* 0-match character (command) -* 1..2-offset to routine - -* It is the user's job to set commands to proper case for matching... - -* end of table=NULL - -* sample table: fcc /A/ -* fdb routineA-* -* fcc /B/ -* fdb routineB-* -* fcb 0 - - - nam Jsr to 1 char Command - ttl Assembler Library Module - - section .text - -JSR_CMD: - tst ,x end of table? - beq jsrerr - - cmpa ,x+ found match? - beq docmd yes, go do it - - leax 2,x next entry - bra JSR_CMD - -* no match found, return with carry set - -jsrerr - coma set error flag - rts - -* command found, do call and return - -docmd - ldd ,x get offset to routine - jsr d,x - andcc #%11111110 clear carry - rts - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/jsr_cmd.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,57 @@ +*************************************** + +* Subroutine to jsr to subroutine from 1 character command table + +* OTHER MODULES NEEDED: none + +* ENTRY: A=1 char command +* X=start of jump table + +* EXIT: CC carry set if entry not found +* all other regs can be modified by subs + +* Note format of table: each entry is three bytes +* 0-match character (command) +* 1..2-offset to routine + +* It is the user's job to set commands to proper case for matching... + +* end of table=NULL + +* sample table: fcc /A/ +* fdb routineA-* +* fcc /B/ +* fdb routineB-* +* fcb 0 + + + nam Jsr to 1 char Command + ttl Assembler Library Module + + section .text + +JSR_CMD: + tst ,x end of table? + beq jsrerr + + cmpa ,x+ found match? + beq docmd yes, go do it + + leax 2,x next entry + bra JSR_CMD + +* no match found, return with carry set + +jsrerr + coma set error flag + rts + +* command found, do call and return + +docmd + ldd ,x get offset to routine + jsr d,x + andcc #%11111110 clear carry + rts + + endsect
--- a/lib/alib/jsr_cmd2.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -*************************************** - -* Subroutine to jsr to subroutine from 2 character command table - -* OTHER MODULES NEEDED: none - -* ENTRY: D=2 char command -* X=start of jump table - -* EXIT: CC carry set if entry not found -* all other regs can be modified by subs -* D and X always modified - -* Note format of table: each entry is four bytes -* 0..1-match characters (command) -* 2..3-offset to routine - -* It is the user's job to set commands to proper case for matching... - -* end of table=NULL - -* sample table: fcc /A1/ -* fdb routineA-* -* fcc /B1/ -* fdb routineB-* -* fcb 0 - - - nam Jsr to 2 char Command - ttl Assembler Library Module - - section .text - -JSR_CMD2: - tst ,x end of table? - beq jsrerr - - cmpd ,x++ found match? - beq docmd yes, go do it - - leax 2,x next entry - bra JSR_CMD2 - -* no match found, return with carry set - -jsrerr - coma set error flag - rts - -* command found, do call and return - -docmd - ldd ,x get offset to routine - jsr d,x - andcc #%11111110 clear carry - rts - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/jsr_cmd2.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,58 @@ +*************************************** + +* Subroutine to jsr to subroutine from 2 character command table + +* OTHER MODULES NEEDED: none + +* ENTRY: D=2 char command +* X=start of jump table + +* EXIT: CC carry set if entry not found +* all other regs can be modified by subs +* D and X always modified + +* Note format of table: each entry is four bytes +* 0..1-match characters (command) +* 2..3-offset to routine + +* It is the user's job to set commands to proper case for matching... + +* end of table=NULL + +* sample table: fcc /A1/ +* fdb routineA-* +* fcc /B1/ +* fdb routineB-* +* fcb 0 + + + nam Jsr to 2 char Command + ttl Assembler Library Module + + section .text + +JSR_CMD2: + tst ,x end of table? + beq jsrerr + + cmpd ,x++ found match? + beq docmd yes, go do it + + leax 2,x next entry + bra JSR_CMD2 + +* no match found, return with carry set + +jsrerr + coma set error flag + rts + +* command found, do call and return + +docmd + ldd ,x get offset to routine + jsr d,x + andcc #%11111110 clear carry + rts + + endsect
--- a/lib/alib/linedit.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,259 +0,0 @@ -*************************************** - -* Edit/input line. - -* This routine does not use cursor positioning, -* instead it uses backspacing, etc. This means it -* can be used without a GOTOXY module, however it -* is a bit slow, especially when lines get longer than -* one line. If the buffer contains data, you will be -* able to edit; to enter new data pass a buffer of -* blanks. - -* OTHER MODULES NEEDED: STRLEN,IS_PRINT, FPUTS, FPUTC, FGETC, MEMMOVE - -* ENTRY: X=null terminated string to edit -* A=input path (normally 0) -* B=output path (normally 1) - -* EXIT: B=key used to end editing -* CC carry set if error (GetStt, Setstt, Write, Read, etc.) -* B=error code, if any - - nam Edit/Input Line - ttl Assembler Library Module - - - section .text - -* these variable are all referenced via the -* U stack pointer. - -modPD equ 0 first buffer of copy of path descriptor -echo equ $04 echo mode -bso equ $02 backspace mode -bse equ $12 backspace echo char -bsp equ $09 backspace char -int equ $10 interupt char -qut equ $11 quit char -bell equ $13 line-overflow char - -maxsize equ 35 temp variable -dupPD equ 38 2nd path desc. - -vsize equ dupPD+32 variable stack size -strptr equ vsize+2 x on stack -inpath equ vsize+0 a on stack -outpath equ inpath+1 b on stack - -LINEDIT: - pshs a,b,x,y,u - leas -vsize,s variable storage area - tfr s,u point U to var. area - lbsr STRLEN - std maxsize,u save max leng. - lbeq exit - -* get 2 copies of path descriptor, one to restore with, one to modify - - lda outpath,u - leax dupPD,u - clrb SS.OPT - OS9 I$GetStt - bcs err1 - leax modPD,u - clrb - OS9 I$GetStt - bcs err1 - - clrb - clr echo,u turn off echo - clr int,u ignore keyboard interupt - clr qut,u ignore quit - clr bso,u backspace overstrike - os9 I$SetStt -err1 - lbcs exit - -* parse string and change all controls to space - -fixloop - lda ,x+ - beq fixx - lbsr IS_PRINT is it printable? - beq fixloop yes, test next - lda #$20 change control to space - sta -1,x - bra fixloop -fixx - -* print string at current cursor pos.... - - lda outpath,u - ldy maxsize,u - ldx strptr,u get string start - lbsr FPUTS print string - bra shiftl1 go to line start - -loop - pshs a save outpath - lda inpath,u - lbsr FGETC get one char - tfr a,b keypress to B - puls a restore outpath - lbcs out - cmpb bsp,u backspace? - bne delete no, try next - -* backspace one position - - sty -2,s test y - beq loop ignore if already at start - lbsr bs do a backspace - leax -1,x - bra loop - -* Delete char at cursor - -delete - cmpb #$10 delete char? - bne inspace no, try next - pshs d,x,y - ldd maxsize,u max leng - subd 4,s -current pos - tfr x,y destination - leax 1,x source - lbsr MEMMOVE - leax d,y end of string - lda #$20 put space at end of string - sta -1,x - tfr y,x - -del1 - puls d get outpath and char - lbsr FPUTS reprint string - ldy maxsize,u - -del2 - cmpy 2,s back up to current cur pos - beq del3 - lbsr bs - bra del2 - -del3 - puls x,y clean up and loop - -del4 - bra loop - - -inspace - cmpb #$11 insert space? - bne shiftl no, try next - pshs d,x,y - ldd maxsize,u - subd 4,s - subd #1 - leay 1,x X=source, Y=dest - lbsr MEMMOVE - ldb #$20 insert space in hole - stb ,x - bra del1 go reprint and loop - -* move cursor to start of line - -shiftl - cmpb #$18 shift left? - bne shiftr no, try next - -shiftl1 - bsr startln backup to start of line - ldx strptr,u reset x to start of line - bra asciix go loop - -* move cursor to end of line - -shiftr - cmpb #$19 shift right? - bne right - -shiftr1 - cmpy maxsize,u - bhs del4 back to loop - ldb ,x+ move to end by printing string - lbsr FPUTC - leay 1,y - bra shiftr1 - -* move 1 pos right - -right - cmpb #$09 - bne maybasci - ldb ,x get current char and insert it - lbeq loop at end, don't move - -* insert ascii char into buffer - -maybasci - tstb insert ascii into buffer - lbmi out not ascii - cmpb #$20 - lblo out - cmpy maxsize,u room for this? - blo ascii yes, insert it - ldb bell,u - lbsr FPUTC - bra asciix to main loop - -ascii - stb ,x+ - lbsr FPUTC - leay 1,y -asciix - lbra loop - -out - pshs b save keypress - bsr startln - ldx strptr,u - lbsr FPUTS - - - leax dupPD,u get original pd - lda outpath,u - clrb - os9 I$SetStt - puls a get keypress - bcc out1 - tfr b,a set error to A -out1 - sta outpath,s set B to error/keypress - -* when exiting CARRY will be set if error. B will contain -* either the keypress or the error code. - -exit - leas vsize,s - puls a,b,x,y,u,pc - -* move cursor to start of line - -startln - sty -2,s - beq startlnx exit if at start -startln1 - bsr bs - bne startln1 - -startlnx - rts - -bs - pshs b - ldb bse,u - lbsr FPUTC - leay -1,y - puls b,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/linedit.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,259 @@ +*************************************** + +* Edit/input line. + +* This routine does not use cursor positioning, +* instead it uses backspacing, etc. This means it +* can be used without a GOTOXY module, however it +* is a bit slow, especially when lines get longer than +* one line. If the buffer contains data, you will be +* able to edit; to enter new data pass a buffer of +* blanks. + +* OTHER MODULES NEEDED: STRLEN,IS_PRINT, FPUTS, FPUTC, FGETC, MEMMOVE + +* ENTRY: X=null terminated string to edit +* A=input path (normally 0) +* B=output path (normally 1) + +* EXIT: B=key used to end editing +* CC carry set if error (GetStt, Setstt, Write, Read, etc.) +* B=error code, if any + + nam Edit/Input Line + ttl Assembler Library Module + + + section .text + +* these variable are all referenced via the +* U stack pointer. + +modPD equ 0 first buffer of copy of path descriptor +echo equ $04 echo mode +bso equ $02 backspace mode +bse equ $12 backspace echo char +bsp equ $09 backspace char +int equ $10 interupt char +qut equ $11 quit char +bell equ $13 line-overflow char + +maxsize equ 35 temp variable +dupPD equ 38 2nd path desc. + +vsize equ dupPD+32 variable stack size +strptr equ vsize+2 x on stack +inpath equ vsize+0 a on stack +outpath equ inpath+1 b on stack + +LINEDIT: + pshs a,b,x,y,u + leas -vsize,s variable storage area + tfr s,u point U to var. area + lbsr STRLEN + std maxsize,u save max leng. + lbeq exit + +* get 2 copies of path descriptor, one to restore with, one to modify + + lda outpath,u + leax dupPD,u + clrb SS.OPT + OS9 I$GetStt + bcs err1 + leax modPD,u + clrb + OS9 I$GetStt + bcs err1 + + clrb + clr echo,u turn off echo + clr int,u ignore keyboard interupt + clr qut,u ignore quit + clr bso,u backspace overstrike + os9 I$SetStt +err1 + lbcs exit + +* parse string and change all controls to space + +fixloop + lda ,x+ + beq fixx + lbsr IS_PRINT is it printable? + beq fixloop yes, test next + lda #$20 change control to space + sta -1,x + bra fixloop +fixx + +* print string at current cursor pos.... + + lda outpath,u + ldy maxsize,u + ldx strptr,u get string start + lbsr FPUTS print string + bra shiftl1 go to line start + +loop + pshs a save outpath + lda inpath,u + lbsr FGETC get one char + tfr a,b keypress to B + puls a restore outpath + lbcs out + cmpb bsp,u backspace? + bne delete no, try next + +* backspace one position + + sty -2,s test y + beq loop ignore if already at start + lbsr bs do a backspace + leax -1,x + bra loop + +* Delete char at cursor + +delete + cmpb #$10 delete char? + bne inspace no, try next + pshs d,x,y + ldd maxsize,u max leng + subd 4,s -current pos + tfr x,y destination + leax 1,x source + lbsr MEMMOVE + leax d,y end of string + lda #$20 put space at end of string + sta -1,x + tfr y,x + +del1 + puls d get outpath and char + lbsr FPUTS reprint string + ldy maxsize,u + +del2 + cmpy 2,s back up to current cur pos + beq del3 + lbsr bs + bra del2 + +del3 + puls x,y clean up and loop + +del4 + bra loop + + +inspace + cmpb #$11 insert space? + bne shiftl no, try next + pshs d,x,y + ldd maxsize,u + subd 4,s + subd #1 + leay 1,x X=source, Y=dest + lbsr MEMMOVE + ldb #$20 insert space in hole + stb ,x + bra del1 go reprint and loop + +* move cursor to start of line + +shiftl + cmpb #$18 shift left? + bne shiftr no, try next + +shiftl1 + bsr startln backup to start of line + ldx strptr,u reset x to start of line + bra asciix go loop + +* move cursor to end of line + +shiftr + cmpb #$19 shift right? + bne right + +shiftr1 + cmpy maxsize,u + bhs del4 back to loop + ldb ,x+ move to end by printing string + lbsr FPUTC + leay 1,y + bra shiftr1 + +* move 1 pos right + +right + cmpb #$09 + bne maybasci + ldb ,x get current char and insert it + lbeq loop at end, don't move + +* insert ascii char into buffer + +maybasci + tstb insert ascii into buffer + lbmi out not ascii + cmpb #$20 + lblo out + cmpy maxsize,u room for this? + blo ascii yes, insert it + ldb bell,u + lbsr FPUTC + bra asciix to main loop + +ascii + stb ,x+ + lbsr FPUTC + leay 1,y +asciix + lbra loop + +out + pshs b save keypress + bsr startln + ldx strptr,u + lbsr FPUTS + + + leax dupPD,u get original pd + lda outpath,u + clrb + os9 I$SetStt + puls a get keypress + bcc out1 + tfr b,a set error to A +out1 + sta outpath,s set B to error/keypress + +* when exiting CARRY will be set if error. B will contain +* either the keypress or the error code. + +exit + leas vsize,s + puls a,b,x,y,u,pc + +* move cursor to start of line + +startln + sty -2,s + beq startlnx exit if at start +startln1 + bsr bs + bne startln1 + +startlnx + rts + +bs + pshs b + ldb bse,u + lbsr FPUTC + leay -1,y + puls b,pc + + endsect
--- a/lib/alib/makefile Sat Jan 26 08:26:31 2013 -0600 +++ b/lib/alib/makefile Sat Jan 26 17:18:24 2013 -0600 @@ -2,49 +2,49 @@ include $(NITROS9DIR)/rules.mak -SRC = stimestr.a datestr.a getfmd.a mktemp.a linedit.a sho_regs.a \ - print_dec.a print_hex.a print_asc.a \ - mult16x8.a mult16x16.a div16x8.a div16x16.a div8x8.a \ - dec_bin.a bin_dec.a asc_bin.a bin_asc.a hex_bin.a \ - bin_hex.a bin2hex.a dectab.a bin_rom.a \ - strcat.a strcpy.a strncpy.a parsnstr.a strhcpy.a strhlen.a \ - strcmp.a strncmp.a strlen.a memmove.a ptsearch.a compare.a \ - b09strlen.a \ - to_upprs.a to_upper.a to_lowrs.a to_lower.a \ - is_punct.a is_print.a is_cntrl.a is_space.a is_xdigit.a \ - is_alnum.a is_alpha.a is_digit.a is_lower.a is_upper.a is_termin.a \ - prints.a puts.a fputs.a putcr.a fputcr.a putspace.a fputspace.a \ - putc.a fputc.a inkey.a getc.a fgetc.a gets.a fgets.a puty.a fputy.a \ - gety.a fgety.a ftrans.a \ - frewind.a ftoeof.a \ - jsr_cmd.a jsr_cmd2.a \ - to_sp.a to_non_sp.a memset.a rnd.a +SRC = stimestr.as datestr.as getfmd.as mktemp.as linedit.as sho_regs.as \ + print_dec.as print_hex.as print_asc.as \ + mult16x8.as mult16x16.as div16x8.as div16x16.as div8x8.as \ + dec_bin.as bin_dec.as asc_bin.as bin_asc.as hex_bin.as \ + bin_hex.as bin2hex.as dectab.as bin_rom.as \ + strcat.as strcpy.as strncpy.as parsnstr.as strhcpy.as strhlen.as \ + strcmp.as strncmp.as strlen.as memmove.as ptsearch.as compare.as \ + b09strlen.as \ + to_upprs.as to_upper.as to_lowrs.as to_lower.as \ + is_punct.as is_print.as is_cntrl.as is_space.as is_xdigit.as \ + is_alnum.as is_alpha.as is_digit.as is_lower.as is_upper.as is_termin.as \ + prints.as puts.as fputs.as putcr.as fputcr.as putspace.as fputspace.as \ + putc.as fputc.as inkey.as getc.as fgetc.as gets.as fgets.as puty.as fputy.as \ + gety.as fgety.as ftrans.as \ + frewind.as ftoeof.as \ + jsr_cmd.as jsr_cmd2.as \ + to_sp.as to_non_sp.as memset.as rnd.as -MODS = stimestr.r datestr.r getfmd.r mktemp.r linedit.r sho_regs.r \ - print_dec.r print_hex.r print_asc.r \ - mult16x8.r mult16x16.r div16x8.r div16x16.r div8x8.r \ - dec_bin.r bin_dec.r asc_bin.r bin_asc.r hex_bin.r \ - bin_hex.r bin2hex.r dectab.r bin_rom.r \ - strcat.r strcpy.r strncpy.r parsnstr.r strhcpy.r strhlen.r \ - strcmp.r strncmp.r strlen.r memmove.r ptsearch.r compare.r \ - b09strlen.r \ - to_upprs.r to_upper.r to_lowrs.r to_lower.r \ - is_punct.r is_print.r is_cntrl.r is_space.r is_xdigit.r \ - is_alnum.r is_alpha.r is_digit.r is_lower.r is_upper.r is_termin.r \ - prints.r puts.r fputs.r putcr.r fputcr.r putspace.r fputspace.r \ - putc.r fputc.r inkey.r getc.r fgetc.r gets.r fgets.r puty.r fputy.r \ - gety.r fgety.r ftrans.r \ - frewind.r ftoeof.r \ - jsr_cmd.r jsr_cmd2.r \ - to_sp.r to_non_sp.r memset.r rnd.r +MODS = stimestr.o datestr.o getfmd.o mktemp.o linedit.o sho_regs.o \ + print_dec.o print_hex.o print_asc.o \ + mult16x8.o mult16x16.o div16x8.o div16x16.o div8x8.o \ + dec_bin.o bin_dec.o asc_bin.o bin_asc.o hex_bin.o \ + bin_hex.o bin2hex.o dectab.o bin_rom.o \ + strcat.o strcpy.o strncpy.o parsnstr.o strhcpy.o strhlen.o \ + strcmp.o strncmp.o strlen.o memmove.o ptsearch.o compare.o \ + b09strlen.o \ + to_upprs.o to_upper.o to_lowrs.o to_lower.o \ + is_punct.o is_print.o is_cntrl.o is_space.o is_xdigit.o \ + is_alnum.o is_alpha.o is_digit.o is_lower.o is_upper.o is_termin.o \ + prints.o puts.o fputs.o putcr.o fputcr.o putspace.o fputspace.o \ + putc.o fputc.o inkey.o getc.o fgetc.o gets.o fgets.o puty.o fputy.o \ + gety.o fgety.o ftrans.o \ + frewind.o ftoeof.o \ + jsr_cmd.o jsr_cmd2.o \ + to_sp.o to_non_sp.o memset.o rnd.o -all: ../alib.l +all: ../alib.a -../alib.l: $(MODS) +../alib.a: $(MODS) lwar -c $@ $? dskclean: clean clean: - $(RM) *.r ../alib.l ../alib.zip + $(RM) *.o ../alib.a
--- a/lib/alib/memmove.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -************************************** - -* Memory move - -* NOTE: This routine properly moves overlapping areas of memory. -* Uses fast move algorithm - -* ENTRY: X=source data -* Y=destination -* D=count - -* EXIT: all registers (except CC) preserved - - nam Move Memory - ttl Assembler Library Module - - - - section .text - -MEMMOVE: - pshs d,x,y,u - std -2,s test u - beq exit zero count, exit - tfr y,u use u for dest - tfr d,y count in y - cmpu 2,s compare dest. to source (x) - beq exit same, no need to move - bhi down u>x - -up - bitb #1 see if odd number to move - beq up1 - lda ,x+ move odd byte - sta ,u+ - leay -1,y could be only one - beq exit - -up1 - ldd ,x++ move 2 bytes - std ,u++ - leay -2,y count down - bne up1 - bra exit - -down - leau d,u u=dest end (count in D) - leax d,x x=source end - - bitb #1 - beq down2 - lda ,-x move odd byte - sta ,-u - leay -1,y could be only one to do - beq exit - -down2 - ldd ,--x get 2 bytes - std ,--u move them - leay -2,y count down - bne down2 - -exit - puls d,x,y,u,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/memmove.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,66 @@ +************************************** + +* Memory move + +* NOTE: This routine properly moves overlapping areas of memory. +* Uses fast move algorithm + +* ENTRY: X=source data +* Y=destination +* D=count + +* EXIT: all registers (except CC) preserved + + nam Move Memory + ttl Assembler Library Module + + + + section .text + +MEMMOVE: + pshs d,x,y,u + std -2,s test u + beq exit zero count, exit + tfr y,u use u for dest + tfr d,y count in y + cmpu 2,s compare dest. to source (x) + beq exit same, no need to move + bhi down u>x + +up + bitb #1 see if odd number to move + beq up1 + lda ,x+ move odd byte + sta ,u+ + leay -1,y could be only one + beq exit + +up1 + ldd ,x++ move 2 bytes + std ,u++ + leay -2,y count down + bne up1 + bra exit + +down + leau d,u u=dest end (count in D) + leax d,x x=source end + + bitb #1 + beq down2 + lda ,-x move odd byte + sta ,-u + leay -1,y could be only one to do + beq exit + +down2 + ldd ,--x get 2 bytes + std ,--u move them + leay -2,y count down + bne down2 + +exit + puls d,x,y,u,pc + + endsect
--- a/lib/alib/memset.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -************************************ - -* MEMSET: Set bytes in memory to specified value - -* OTHER MODULES NEEDED: none - -* ENTRY: X=start of memory -* Y=number of bytes to set -* B=character to set - -* EXIT: all registers (except cc) preserved - - nam Set memory - ttl Assembler Library Module - - - section .text - -MEMSET: - pshs x,y - -loop - stb ,x+ - leay -1,y dec count - bne loop till zero - - puls x,y,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/memset.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,29 @@ +************************************ + +* MEMSET: Set bytes in memory to specified value + +* OTHER MODULES NEEDED: none + +* ENTRY: X=start of memory +* Y=number of bytes to set +* B=character to set + +* EXIT: all registers (except cc) preserved + + nam Set memory + ttl Assembler Library Module + + + section .text + +MEMSET: + pshs x,y + +loop + stb ,x+ + leay -1,y dec count + bne loop till zero + + puls x,y,pc + + endsect
--- a/lib/alib/mktemp.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -****************************************** -* -* This subroutine creates a temorary filename -* by adding a "." and a 2digit hex value based -* on the process id. -* IMPORTANT: there must be room after the filename -* for at least 6 bytes!! Filename must be variable -* area, not parameter or program sections!!! - -* OTHER MODULES NEEDED: BIN_HEX - -* ENTRY: X= filename - -* EXIT: no registers (expect cc) modified -* filename ends in ".processid",$0d - - nam Make Unique Filename - ttl Assembler Library Module - - - section .text - -MKTEMP: - pshs d,x,y - - OS9 F$PrsNam find end of name - tfr y,x - - lda #'. - sta ,x+ put "." in name - - OS9 F$ID - tfr a,b convert to 4 digit hex - lbsr BIN2HEX - std ,x++ - lda #$0d end name with cr - sta ,x - puls d,x,y,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/mktemp.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,40 @@ +****************************************** +* +* This subroutine creates a temorary filename +* by adding a "." and a 2digit hex value based +* on the process id. +* IMPORTANT: there must be room after the filename +* for at least 6 bytes!! Filename must be variable +* area, not parameter or program sections!!! + +* OTHER MODULES NEEDED: BIN_HEX + +* ENTRY: X= filename + +* EXIT: no registers (expect cc) modified +* filename ends in ".processid",$0d + + nam Make Unique Filename + ttl Assembler Library Module + + + section .text + +MKTEMP: + pshs d,x,y + + OS9 F$PrsNam find end of name + tfr y,x + + lda #'. + sta ,x+ put "." in name + + OS9 F$ID + tfr a,b convert to 4 digit hex + lbsr BIN2HEX + std ,x++ + lda #$0d end name with cr + sta ,x + puls d,x,y,pc + + endsect
--- a/lib/alib/mult16x16.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -************************************ - -* 16 x 16 Multiply - -* ENTRY: D = multiplier -* X = multiplicand - -* EXIT: Y = product 2 msbs -* U = " 2 lsbs -* D & X preserved - - nam 16x16 bit Multiply - ttl Assembler Library Module - - - section .text - -MULT16: - PSHS D,X,Y,U save #s and make stack room - CLR 4,S reset overflow flag - LDA 3,S get byte - MUL - STD 6,S save B x Xl - LDD 1,S - MUL B x Xh - ADDB 6,S - ADCA #0 - STD 5,S add 1st 2 mult. - LDB 0,S - LDA 3,S - MUL A x Xl - ADDD 5,S - STD 5,S add result to previous - BCC no.ov branch if no overflow - INC 4,S set overflow flag - -no.ov - LDA 0,S - LDB 2,S - MUL A x Xh - ADDD 4,S - STD 4,S - PULS D,X,Y,U,PC return - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/mult16x16.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,47 @@ +************************************ + +* 16 x 16 Multiply + +* ENTRY: D = multiplier +* X = multiplicand + +* EXIT: Y = product 2 msbs +* U = " 2 lsbs +* D & X preserved + + nam 16x16 bit Multiply + ttl Assembler Library Module + + + section .text + +MULT16: + PSHS D,X,Y,U save #s and make stack room + CLR 4,S reset overflow flag + LDA 3,S get byte + MUL + STD 6,S save B x Xl + LDD 1,S + MUL B x Xh + ADDB 6,S + ADCA #0 + STD 5,S add 1st 2 mult. + LDB 0,S + LDA 3,S + MUL A x Xl + ADDD 5,S + STD 5,S add result to previous + BCC no.ov branch if no overflow + INC 4,S set overflow flag + +no.ov + LDA 0,S + LDB 2,S + MUL A x Xh + ADDD 4,S + STD 4,S + PULS D,X,Y,U,PC return + + endsect + +
--- a/lib/alib/mult16x8.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -*********************************** - -* 16 x 8 Multiply (24 bit result) - -* OTHER MODULES NEEDED: none - -* ENTRY: A = multiplier -* X = multiplicand - -* EXIT: A = product byte 1 -* X = product bytes 2 & 3 - - nam 16x8 bit Multiply - ttl Assembler Library Module - - - section .text - -MULT168: - PSHS A,X save numbers - LEAS -3,S room for product - LDB 5,S get lsb of multiplicand - MUL - STD 1,S save partial product - LDD 3,S get mupltiplier & msb of multp. - MUL - ADDB 1,S add lsb to msb - ADCA #0 add carry - STD 0,S save sum of partial products - LDX 1,S get 2 lsb's - LEAS 6,S clean stack - RTS - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/mult16x8.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,35 @@ +*********************************** + +* 16 x 8 Multiply (24 bit result) + +* OTHER MODULES NEEDED: none + +* ENTRY: A = multiplier +* X = multiplicand + +* EXIT: A = product byte 1 +* X = product bytes 2 & 3 + + nam 16x8 bit Multiply + ttl Assembler Library Module + + + section .text + +MULT168: + PSHS A,X save numbers + LEAS -3,S room for product + LDB 5,S get lsb of multiplicand + MUL + STD 1,S save partial product + LDD 3,S get mupltiplier & msb of multp. + MUL + ADDB 1,S add lsb to msb + ADCA #0 add carry + STD 0,S save sum of partial products + LDX 1,S get 2 lsb's + LEAS 6,S clean stack + RTS + + endsect +
--- a/lib/alib/parsnstr.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -* Parse sign bit terminated string to convert it to a -* null terminated string. Note: if X and Y are the same -* the existing string will be overwritten -- don't do this -* with psects... - -* OTHER MODULES NEEDED: none - -* ENTRY: X=start of sign bit terminated string -* Y=buffer for null terminated string - -* EXIT: D=string size (not including null) -* All other regs (except cc) preserved - - - nam Parse sign-bit terminated string - ttl Assembler Library Module - - - section .text - - -PARSNSTR: - pshs x - lbsr STRHCPY copy string - tfr y,x point to moved string - lbsr STRHLEN find length of string - pshs d size - leax d,x - lda ,-x get final byte - anda #%01111111 clear sign bit - clrb add null terminator - std ,x - puls d,x,pc - - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/parsnstr.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,37 @@ +* Parse sign bit terminated string to convert it to a +* null terminated string. Note: if X and Y are the same +* the existing string will be overwritten -- don't do this +* with psects... + +* OTHER MODULES NEEDED: none + +* ENTRY: X=start of sign bit terminated string +* Y=buffer for null terminated string + +* EXIT: D=string size (not including null) +* All other regs (except cc) preserved + + + nam Parse sign-bit terminated string + ttl Assembler Library Module + + + section .text + + +PARSNSTR: + pshs x + lbsr STRHCPY copy string + tfr y,x point to moved string + lbsr STRHLEN find length of string + pshs d size + leax d,x + lda ,-x get final byte + anda #%01111111 clear sign bit + clrb add null terminator + std ,x + puls d,x,pc + + + endsect +
--- a/lib/alib/print_asc.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -*************************************** - -* Print binary number to standard out. - -* ENTRY: D=value to print - -* EXIT: CC carry set if error (from I$WritLn) -* B error code, if any - - nam Print # as ASCII String to Std. Out - ttl Assembler Library Module - - - section .text - -PRINT_ASC: - pshs a,x - leas -18,s buffer - tfr s,x - lbsr BIN_ASC convert to ascii - lbsr PUTS print to standard out - leas 18,s clean stack - puls a,x,pc return with error in B - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/print_asc.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,26 @@ +*************************************** + +* Print binary number to standard out. + +* ENTRY: D=value to print + +* EXIT: CC carry set if error (from I$WritLn) +* B error code, if any + + nam Print # as ASCII String to Std. Out + ttl Assembler Library Module + + + section .text + +PRINT_ASC: + pshs a,x + leas -18,s buffer + tfr s,x + lbsr BIN_ASC convert to ascii + lbsr PUTS print to standard out + leas 18,s clean stack + puls a,x,pc return with error in B + + endsect +
--- a/lib/alib/print_dec.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -*************************************** - -* Print decimal number to standard out. - -* ENTRY: D=value to print - -* EXIT: CC carry set if error (from I$WritLn) -* B error code, if any - - - nam Print # as Decimal String to Std Out - ttl Assembler Library Module - - - section .text - -PRINT_DEC: - pshs a,x - leas -8,s buffer - tfr s,x - lbsr BIN_DEC convert to decimal - lbsr PUTS print to standard out - leas 8,s clean stack - puls a,x,pc return with error in B - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/print_dec.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,27 @@ +*************************************** + +* Print decimal number to standard out. + +* ENTRY: D=value to print + +* EXIT: CC carry set if error (from I$WritLn) +* B error code, if any + + + nam Print # as Decimal String to Std Out + ttl Assembler Library Module + + + section .text + +PRINT_DEC: + pshs a,x + leas -8,s buffer + tfr s,x + lbsr BIN_DEC convert to decimal + lbsr PUTS print to standard out + leas 8,s clean stack + puls a,x,pc return with error in B + + endsect +
--- a/lib/alib/print_hex.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -*************************************** - -* Print hex number to standard out. - -* ENTRY: D=value to print - -* EXIT: CC carry set if error (from I$WritLn) -* B error code, if any - - - nam Print # as Hex String to Std Out - ttl Assembler Library Module - - - section .text - -PRINT_HEX: - pshs a,x - leas -6,s buffer - tfr s,x - lbsr BIN_HEX convert to hex - lbsr PUTS print to standard out - leas 6,s clean stack - puls a,x,pc return with error in B - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/print_hex.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,27 @@ +*************************************** + +* Print hex number to standard out. + +* ENTRY: D=value to print + +* EXIT: CC carry set if error (from I$WritLn) +* B error code, if any + + + nam Print # as Hex String to Std Out + ttl Assembler Library Module + + + section .text + +PRINT_HEX: + pshs a,x + leas -6,s buffer + tfr s,x + lbsr BIN_HEX convert to hex + lbsr PUTS print to standard out + leas 6,s clean stack + puls a,x,pc return with error in B + + endsect +
--- a/lib/alib/prints.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -*********************************** - -* Print a program-embedded, null terminated string to standard out. - -* OTHER MODULES NEEDED: puts - -* ENTRY: Null terminated string must follow PRINTS call -* eg: LBSR PRINTS -* fcc /this is stuff to print/ -* fcb $0d * a new line -* fcc /more stuff to print/ -* fcb $0d,0 the end -* lda #xx or whatever.. -* * the rest of the program.... - -* EXIT: CC carry set if error -* B error code (if any) - - - nam Print Embedded String to Std. Out - ttl Assembler Library Module - - - section .text - -PRINTS: - pshs x,u - ldx 4,s get start of string (old return address) - tfr x,u copy it - -loop - tst ,u+ advance U to end of string - bne loop - - stu 4,s one past null=return address - lbsr PUTS print from orig pos. - puls x,u,pc return to caller - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/prints.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,40 @@ +*********************************** + +* Print a program-embedded, null terminated string to standard out. + +* OTHER MODULES NEEDED: puts + +* ENTRY: Null terminated string must follow PRINTS call +* eg: LBSR PRINTS +* fcc /this is stuff to print/ +* fcb $0d * a new line +* fcc /more stuff to print/ +* fcb $0d,0 the end +* lda #xx or whatever.. +* * the rest of the program.... + +* EXIT: CC carry set if error +* B error code (if any) + + + nam Print Embedded String to Std. Out + ttl Assembler Library Module + + + section .text + +PRINTS: + pshs x,u + ldx 4,s get start of string (old return address) + tfr x,u copy it + +loop + tst ,u+ advance U to end of string + bne loop + + stu 4,s one past null=return address + lbsr PUTS print from orig pos. + puls x,u,pc return to caller + + endsect +
--- a/lib/alib/ptsearch.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -*************************************** - -* Pattern Search - -* OTHER MODULES REQUIRED: COMPARE - -* ENTRY: X=start of memory to search -* U=end of memory -* Y=start of pattern -* D=size of pattern -* CASEMTCH (a global variable in COMPARE) =0 if A<>a, -1 if A=a - -* EXIT: X=address of match if found, unchanged if no match -* CC zero set if match, clear for no-match -* A,B,U,Y preserved - - - nam Pattern Search - ttl Assembler Library Module - - - section .data - -pattend rmb 2 end of pattern in memory -memend rmb 2 realend-pattern size -patsize rmb 2 saved <D> -memstrt rmb 2 saved <X> -patstrt rmb 2 saved <Y> -realend rmb 2 saved <U> - - endsect - - section .text - -* set up stack frame for variables - -PTSEARCH: - pshs d,x,y,u - leas -4,s room for temps - tfr u,d end of memory to check - subd patsize,s end-pattern size - std memend,s where we stop looking - ldd patstrt,s - addd patsize,s - std pattend,s - -* loop here looking for a match of the first characters - -inmatch - cmpx memend,s raeched end of memory - bhs nomatch - lda ,x+ get char from memory - ldb ,y compare to pattern - lbsr COMPARE compare them - bne inmatch keep looking for inital match - -* see if rest of pattern matches - -more - tfr x,u save pointer - leay 1,y already matched that one - -more1 - cmpy pattend,s all chars matched, go home happy - beq match - lda ,x+ - ldb ,y+ - lbsr COMPARE - beq more1 keep matching - tfr u,x match fails, backup and do more - ldy patstrt,s start of pattern - bra inmatch - - -nomatch - lda #1 clear zero - bra exit - -match - leau -1,u start of match - stu memstrt,s where pattern starts - clra set zero flag=found - -exit - leas 4,s clean stack - puls d,x,y,u,pc - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/ptsearch.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,90 @@ +*************************************** + +* Pattern Search + +* OTHER MODULES REQUIRED: COMPARE + +* ENTRY: X=start of memory to search +* U=end of memory +* Y=start of pattern +* D=size of pattern +* CASEMTCH (a global variable in COMPARE) =0 if A<>a, -1 if A=a + +* EXIT: X=address of match if found, unchanged if no match +* CC zero set if match, clear for no-match +* A,B,U,Y preserved + + + nam Pattern Search + ttl Assembler Library Module + + + section .data + +pattend rmb 2 end of pattern in memory +memend rmb 2 realend-pattern size +patsize rmb 2 saved <D> +memstrt rmb 2 saved <X> +patstrt rmb 2 saved <Y> +realend rmb 2 saved <U> + + endsect + + section .text + +* set up stack frame for variables + +PTSEARCH: + pshs d,x,y,u + leas -4,s room for temps + tfr u,d end of memory to check + subd patsize,s end-pattern size + std memend,s where we stop looking + ldd patstrt,s + addd patsize,s + std pattend,s + +* loop here looking for a match of the first characters + +inmatch + cmpx memend,s raeched end of memory + bhs nomatch + lda ,x+ get char from memory + ldb ,y compare to pattern + lbsr COMPARE compare them + bne inmatch keep looking for inital match + +* see if rest of pattern matches + +more + tfr x,u save pointer + leay 1,y already matched that one + +more1 + cmpy pattend,s all chars matched, go home happy + beq match + lda ,x+ + ldb ,y+ + lbsr COMPARE + beq more1 keep matching + tfr u,x match fails, backup and do more + ldy patstrt,s start of pattern + bra inmatch + + +nomatch + lda #1 clear zero + bra exit + +match + leau -1,u start of match + stu memstrt,s where pattern starts + clra set zero flag=found + +exit + leas 4,s clean stack + puls d,x,y,u,pc + + endsect + +
--- a/lib/alib/putc.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -********************************** - -* Put single character to standard out. - -* OTHER MODULES NEEDED: FPUTC - -* ENTRY: B=character to print - -* EXIT: CC carry set if error -* B=error code if any - - nam Print Char to Std. Out - ttl Assembler Library Module - - - section .text - -PUTC: - pshs a - lda #1 stn out - lbsr FPUTC - puls a,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/putc.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,25 @@ +********************************** + +* Put single character to standard out. + +* OTHER MODULES NEEDED: FPUTC + +* ENTRY: B=character to print + +* EXIT: CC carry set if error +* B=error code if any + + nam Print Char to Std. Out + ttl Assembler Library Module + + + section .text + +PUTC: + pshs a + lda #1 stn out + lbsr FPUTC + puls a,pc + + endsect +
--- a/lib/alib/putcr.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -**************************************** - -* Subroutine to print a carriage return to std. out. - -* OTHER MODULES REQUIRED: FPUTCR - -* ENTRY: none - -* EXIT: CC carry set if error (from I$WritLn) -* B error code if any. - - - nam Output Carriage Return to Std. Out - ttl Assembler Library Module - - - section .text - -PUTCR: - pshs a - lda #1 std out - lbsr FPUTCR - puls a,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/putcr.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,25 @@ +**************************************** + +* Subroutine to print a carriage return to std. out. + +* OTHER MODULES REQUIRED: FPUTCR + +* ENTRY: none + +* EXIT: CC carry set if error (from I$WritLn) +* B error code if any. + + + nam Output Carriage Return to Std. Out + ttl Assembler Library Module + + + section .text + +PUTCR: + pshs a + lda #1 std out + lbsr FPUTCR + puls a,pc + + endsect
--- a/lib/alib/puts.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -*********************************** - -* Print a null terminated string to standard out. - -* OTHER MODULES NEEDED: fputs - -* ENTRY: X=string to print - -* EXIT: CC carry set if error -* B error code (if any) - - - nam Print String to Std. Out - ttl Assembler Library Module - - - section .text - -PUTS: - pshs a - lda #1 std out - lbsr FPUTS - puls a,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/puts.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,26 @@ +*********************************** + +* Print a null terminated string to standard out. + +* OTHER MODULES NEEDED: fputs + +* ENTRY: X=string to print + +* EXIT: CC carry set if error +* B error code (if any) + + + nam Print String to Std. Out + ttl Assembler Library Module + + + section .text + +PUTS: + pshs a + lda #1 std out + lbsr FPUTS + puls a,pc + + endsect +
--- a/lib/alib/putspace.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -**************************************** - -* Subroutine to print a space to std. out - -* OTHER MODULES REQUIRED: FPUTSPACE - -* ENTRY: none - -* EXIT: CC carry set if error (from I$WritLn) -* B error code if any. - - nam Output One Space Char. to Std. Out - ttl Assembler Library Module - - - section .text - -PUTSPACE: - pshs a - lda #1 - lbsr FPUTSPACE - puls a,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/putspace.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,24 @@ +**************************************** + +* Subroutine to print a space to std. out + +* OTHER MODULES REQUIRED: FPUTSPACE + +* ENTRY: none + +* EXIT: CC carry set if error (from I$WritLn) +* B error code if any. + + nam Output One Space Char. to Std. Out + ttl Assembler Library Module + + + section .text + +PUTSPACE: + pshs a + lda #1 + lbsr FPUTSPACE + puls a,pc + + endsect
--- a/lib/alib/puty.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -********************************** - -* Put the word in Y to std out - -* OTHER MODULES NEEDED: FPUTY - -* ENTRY: Y=value to save - -* EXIT: CC carry set if error -* B=error code if any - - nam Save word to std out - ttl Assembler Library Module - - - section .text - -PUTY: - pshs a - lda #1 stn out - lbsr FPUTY - puls a,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/puty.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,24 @@ +********************************** + +* Put the word in Y to std out + +* OTHER MODULES NEEDED: FPUTY + +* ENTRY: Y=value to save + +* EXIT: CC carry set if error +* B=error code if any + + nam Save word to std out + ttl Assembler Library Module + + + section .text + +PUTY: + pshs a + lda #1 stn out + lbsr FPUTY + puls a,pc + + endsect
--- a/lib/alib/rnd.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -*************************************** - -* Subroutine to calc. a random number -* Based on routine by L.A. Middaugh -* The Rainbow Jan/85 p. 277 - -* Value truncated so that it is =>0 and <=passed value in D. - -* OTHER MODULES NEEDED: none - -* ENTRY: D=max value of number to be returned -* EXIT: D = value - - - nam Rnd - ttl Assembler Library Module - - - section .bss - -SEED rmb 4 - - endsect - - section .text - -RND: - pshs d,x,u - -rnd0 - ldx #SEED point to seed - ldb #8 number of shifts -loop - lda 3,x exclusive or bit 28 with 31 - rora - rora - rora - eora 3,x - rora result in carry - rora - ror 0,x rotate carry into bit0 - ror 1,x - ror 2,x - ror 3,x - decb do 8 times - bne loop - ldd 1,x get rnd value - bne trunc ensure we never return a 0 - inc 1,x fudge it so we get a non-zero - inc 3,x - bra rnd0 - -trunc - cmpd ,s in range specified? - bls exit yes - subd ,s - bra trunc - -exit - leas 2,s forget original D - puls x,u,pc - - -********************************************** -* -* Subroutine to seed the random number buffer -* with the current system date - -* ENTRY: none -* EXIT: none - -SEEDRND: - pshs d,x - leas -6,s make room for date - tfr s,x point X to buffer - os9 F$Time - addd 4,x add min/secs to value in D - addd <SEED add to orig value - std <SEED set msb of seed - addd <SEED+2 add lsb of seed to new msb - std <SEED+2 - leas 6,s - puls d,x,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/rnd.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,85 @@ +*************************************** + +* Subroutine to calc. a random number +* Based on routine by L.A. Middaugh +* The Rainbow Jan/85 p. 277 + +* Value truncated so that it is =>0 and <=passed value in D. + +* OTHER MODULES NEEDED: none + +* ENTRY: D=max value of number to be returned +* EXIT: D = value + + + nam Rnd + ttl Assembler Library Module + + + section .bss + +SEED rmb 4 + + endsect + + section .text + +RND: + pshs d,x,u + +rnd0 + ldx #SEED point to seed + ldb #8 number of shifts +loop + lda 3,x exclusive or bit 28 with 31 + rora + rora + rora + eora 3,x + rora result in carry + rora + ror 0,x rotate carry into bit0 + ror 1,x + ror 2,x + ror 3,x + decb do 8 times + bne loop + ldd 1,x get rnd value + bne trunc ensure we never return a 0 + inc 1,x fudge it so we get a non-zero + inc 3,x + bra rnd0 + +trunc + cmpd ,s in range specified? + bls exit yes + subd ,s + bra trunc + +exit + leas 2,s forget original D + puls x,u,pc + + +********************************************** +* +* Subroutine to seed the random number buffer +* with the current system date + +* ENTRY: none +* EXIT: none + +SEEDRND: + pshs d,x + leas -6,s make room for date + tfr s,x point X to buffer + os9 F$Time + addd 4,x add min/secs to value in D + addd <SEED add to orig value + std <SEED set msb of seed + addd <SEED+2 add lsb of seed to new msb + std <SEED+2 + leas 6,s + puls d,x,pc + + endsect
--- a/lib/alib/sho_regs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -************************************ - -* Display the 6809 registers to standard error - -* OTHER MODULES NEEDED: BIN2HEX, BIN_HEX, PUTS - - -* ENTRY: none -* EXIT: none - - -* NOTE: The value used for PC is that of the calling routine -* S is assumed to be 2 greater than actual to comp for -* the subroutine call... - - - nam Show Register Values - ttl Assembler Library Module - - - section .data - -count rmb 1 counter for 9 regs. -buffer rmb 8 buffer for ascii strings -cc.r rmb 1 offsets to access values -a.r rmb 1 -b.r rmb 1 -dp.r rmb 1 -x.r rmb 2 -y.r rmb 2 -u.r rmb 2 -s.r rmb 2 -pc.r rmb 2 - - endsect - - section .text - -SHO_REGS: - leas -2,s room for copy of <S> - pshs cc,a,b,dp,x,y,u save rest - leas -cc.r,s room for ascii strings - tfr s,x - leax pc.r,x get old <S> - stx s.r,s stick on stack - leay cc.r,s point to regs - leau text,pcr register names - clr count,s int. counter - -* now we loop and display all the registers - -loop1 - leax buffer,s point to ascii buffer - ldd ,u++ get reg. name - std ,x++ - lda #'= add a "=" - sta ,x+ - lda count,s 1st 4 are 1 byte - cmpa #4 - bhs loop2 no, do a 2byte - ldb ,y+ get single value - lbsr BIN2HEX - std ,x save ascii number - clr 2,x - bra report go report -loop2 - cmpa #9 done all? - bhs exit yes, go home - ldd ,y++ get reg value - lbsr BIN_HEX convert it - -* report reg. value - -report - leax buffer,s start of buffer - lda #2 std err - lbsr FPUTS print it - ldb #$20 space - lbsr FPUTC - inc count,s do next reg - bra loop1 - -exit - ldb #$0d - lda #2 - lbsr FPUTC start new line - leas cc.r,s clear up stack - puls cc,a,b,dp,x,y,u - leas 2,s - rts go home - -text - fcc /cc/ - fcc / a/ - fcc / b/ - fcc /dp/ - fcc / x/ - fcc / y/ - fcc / u/ - fcc / s/ - fcc /pc/ - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/sho_regs.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,103 @@ +************************************ + +* Display the 6809 registers to standard error + +* OTHER MODULES NEEDED: BIN2HEX, BIN_HEX, PUTS + + +* ENTRY: none +* EXIT: none + + +* NOTE: The value used for PC is that of the calling routine +* S is assumed to be 2 greater than actual to comp for +* the subroutine call... + + + nam Show Register Values + ttl Assembler Library Module + + + section .data + +count rmb 1 counter for 9 regs. +buffer rmb 8 buffer for ascii strings +cc.r rmb 1 offsets to access values +a.r rmb 1 +b.r rmb 1 +dp.r rmb 1 +x.r rmb 2 +y.r rmb 2 +u.r rmb 2 +s.r rmb 2 +pc.r rmb 2 + + endsect + + section .text + +SHO_REGS: + leas -2,s room for copy of <S> + pshs cc,a,b,dp,x,y,u save rest + leas -cc.r,s room for ascii strings + tfr s,x + leax pc.r,x get old <S> + stx s.r,s stick on stack + leay cc.r,s point to regs + leau text,pcr register names + clr count,s int. counter + +* now we loop and display all the registers + +loop1 + leax buffer,s point to ascii buffer + ldd ,u++ get reg. name + std ,x++ + lda #'= add a "=" + sta ,x+ + lda count,s 1st 4 are 1 byte + cmpa #4 + bhs loop2 no, do a 2byte + ldb ,y+ get single value + lbsr BIN2HEX + std ,x save ascii number + clr 2,x + bra report go report +loop2 + cmpa #9 done all? + bhs exit yes, go home + ldd ,y++ get reg value + lbsr BIN_HEX convert it + +* report reg. value + +report + leax buffer,s start of buffer + lda #2 std err + lbsr FPUTS print it + ldb #$20 space + lbsr FPUTC + inc count,s do next reg + bra loop1 + +exit + ldb #$0d + lda #2 + lbsr FPUTC start new line + leas cc.r,s clear up stack + puls cc,a,b,dp,x,y,u + leas 2,s + rts go home + +text + fcc /cc/ + fcc / a/ + fcc / b/ + fcc /dp/ + fcc / x/ + fcc / y/ + fcc / u/ + fcc / s/ + fcc /pc/ + + endsect
--- a/lib/alib/stimestr.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -***************************************** - -* Get current system time as an ascii string. - - -* OTHER MODULES NEEDED: DATESTR - -* ENTRY: X=buffer for ascii - -* EXIT: all registers preserved (except cc) - - nam Get System Time String - ttl Assembler Library Module - - - section .text - -STIMESTR: - pshs x,y - tfr x,y ascii buffer to Y - leas -7,s buffer for time packet - tfr s,x - os9 F$Time get system time - lbsr DATESTR convert to ascii in Y buffer - leas 7,s - puls x,y,pc - - endsect -t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/stimestr.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,29 @@ +***************************************** + +* Get current system time as an ascii string. + + +* OTHER MODULES NEEDED: DATESTR + +* ENTRY: X=buffer for ascii + +* EXIT: all registers preserved (except cc) + + nam Get System Time String + ttl Assembler Library Module + + + section .text + +STIMESTR: + pshs x,y + tfr x,y ascii buffer to Y + leas -7,s buffer for time packet + tfr s,x + os9 F$Time get system time + lbsr DATESTR convert to ascii in Y buffer + leas 7,s + puls x,y,pc + + endsect +t
--- a/lib/alib/strcat.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -********************************** - -* STRCAT: append 2 null terminated strings -* User must ensure there is room in buffer!!! - -* OTHER MODULES NEEDED: STRCPY, STRLEN - -* ENTRY: X=start of string to move -* Y=start of string to append to - -* EXIT: all regs preserved (except cc) - - - nam Append 2 null terminated strings - ttl Assembler Library Module - - - section .text - -STRCAT: - pshs d,x,y - exg x,y - lbsr STRLEN find end of appended string - leax d,x point to end of "buffer" - exg x,y - lbsr STRCPY copy string - puls d,x,y,pc - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/strcat.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,31 @@ +********************************** + +* STRCAT: append 2 null terminated strings +* User must ensure there is room in buffer!!! + +* OTHER MODULES NEEDED: STRCPY, STRLEN + +* ENTRY: X=start of string to move +* Y=start of string to append to + +* EXIT: all regs preserved (except cc) + + + nam Append 2 null terminated strings + ttl Assembler Library Module + + + section .text + +STRCAT: + pshs d,x,y + exg x,y + lbsr STRLEN find end of appended string + leax d,x point to end of "buffer" + exg x,y + lbsr STRCPY copy string + puls d,x,y,pc + + endsect + +
--- a/lib/alib/strcmp.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -************************************** - -* STRCMP: compare two null terminated strings. - -* NOTE: This routine first finds the length of both -* strings and passes the length of the longer -* one to strncmp. - -* OTHER MODULES NEEDED: STRNCMP, STRLEN - - -* ENTRY: X=start of 1st string -* Y=start of 2nd string - -* EXIT: CC zero set if equal (beq) -* carry + zero clear if 1>2 (bhi) -* carry set if 1<2 (blo) - - - nam Compare Strings - ttl Assembler Library Module - - - section .text - -STRCMP: - pshs d - lbsr STRLEN find len of str1 - pshs d - exg y,x find len of str2 - lbsr STRLEN - exg y,x restore ptrs - cmpd ,s - bhi ok - ldd ,s get bigger value - -ok - leas 2,s clean stack - lbsr STRNCMP go compare - puls d,pc go home - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/strcmp.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,43 @@ +************************************** + +* STRCMP: compare two null terminated strings. + +* NOTE: This routine first finds the length of both +* strings and passes the length of the longer +* one to strncmp. + +* OTHER MODULES NEEDED: STRNCMP, STRLEN + + +* ENTRY: X=start of 1st string +* Y=start of 2nd string + +* EXIT: CC zero set if equal (beq) +* carry + zero clear if 1>2 (bhi) +* carry set if 1<2 (blo) + + + nam Compare Strings + ttl Assembler Library Module + + + section .text + +STRCMP: + pshs d + lbsr STRLEN find len of str1 + pshs d + exg y,x find len of str2 + lbsr STRLEN + exg y,x restore ptrs + cmpd ,s + bhi ok + ldd ,s get bigger value + +ok + leas 2,s clean stack + lbsr STRNCMP go compare + puls d,pc go home + + endsect +
--- a/lib/alib/strcpy.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -********************************** - -* STRCPY: copy a null terminated string -* User must ensure there is room in buffer!!! - -* OTHER MODULES NEEDED: STRNCPY - -* ENTRY: X=start of string to move -* Y=buffer for copy of string - -* EXIT: all regs preserved (except cc) - - - nam Copy Null Term. String - ttl Assembler Library Module - - - section .text - -STRCPY: - pshs d - ldd #$ffff pass very long value to STRNCPY - lbsr STRNCPY move it - puls d,pc - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/strcpy.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,28 @@ +********************************** + +* STRCPY: copy a null terminated string +* User must ensure there is room in buffer!!! + +* OTHER MODULES NEEDED: STRNCPY + +* ENTRY: X=start of string to move +* Y=buffer for copy of string + +* EXIT: all regs preserved (except cc) + + + nam Copy Null Term. String + ttl Assembler Library Module + + + section .text + +STRCPY: + pshs d + ldd #$ffff pass very long value to STRNCPY + lbsr STRNCPY move it + puls d,pc + + endsect + +
--- a/lib/alib/strhcpy.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -********************************** - -* STRHCPY: copy sign-bit terminated string -* User must ensure there is room in buffer!!! -* See also PARSNSTR, this routine does not change -* sign-bit termination. - -* OTHER MODULES NEEDED: strhlen,memmove - - -* ENTRY: X=start of string to move -* Y=buffer for copy of string - - -* EXIT: all regs preserved (except cc) - - - nam Copy sign-bit terminated String - ttl Assembler Library Module - - - section .text - -STRHCPY: - pshs d - lbsr STRHLEN find length of string - lbsr MEMMOVE move it - puls d,pc - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/strhcpy.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,32 @@ +********************************** + +* STRHCPY: copy sign-bit terminated string +* User must ensure there is room in buffer!!! +* See also PARSNSTR, this routine does not change +* sign-bit termination. + +* OTHER MODULES NEEDED: strhlen,memmove + + +* ENTRY: X=start of string to move +* Y=buffer for copy of string + + +* EXIT: all regs preserved (except cc) + + + nam Copy sign-bit terminated String + ttl Assembler Library Module + + + section .text + +STRHCPY: + pshs d + lbsr STRHLEN find length of string + lbsr MEMMOVE move it + puls d,pc + + endsect + +
--- a/lib/alib/strhlen.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -********************************** - -* String Length: find length of sign-bit terminated string. -* note: sign-bit set byte IS included in count. - -* OTHER MODULES NEEDED: none - - -* ENTRY: X=start of string - - -* EXIT: D=length -* all other regs (except cc) preserved - - - nam Find sign-bit term. String Length - ttl Assembler Library Module - - - section .text - -STRHLEN: - pshs x - clra it'll be at least one byte long - clrb - -loop - addd #1 bump count - tst ,x+ end? - bpl loop - - puls x,pc - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/strhlen.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,36 @@ +********************************** + +* String Length: find length of sign-bit terminated string. +* note: sign-bit set byte IS included in count. + +* OTHER MODULES NEEDED: none + + +* ENTRY: X=start of string + + +* EXIT: D=length +* all other regs (except cc) preserved + + + nam Find sign-bit term. String Length + ttl Assembler Library Module + + + section .text + +STRHLEN: + pshs x + clra it'll be at least one byte long + clrb + +loop + addd #1 bump count + tst ,x+ end? + bpl loop + + puls x,pc + + endsect + +
--- a/lib/alib/strlen.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -********************************** - -* String Length: find length of null terminated string. -* note:null NOT included in count. - -* ENTRY: X=start of string - -* EXIT: D=length -* all other regs (except cc) preserved - - nam Find String Length - ttl Assembler Library Module - - - section .text - -STRLEN: - pshs x - ldd #-1 comp for inital inc - -loop - addd #1 bump count - tst ,x+ end? - bne loop - - puls x,pc - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/strlen.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,30 @@ +********************************** + +* String Length: find length of null terminated string. +* note:null NOT included in count. + +* ENTRY: X=start of string + +* EXIT: D=length +* all other regs (except cc) preserved + + nam Find String Length + ttl Assembler Library Module + + + section .text + +STRLEN: + pshs x + ldd #-1 comp for inital inc + +loop + addd #1 bump count + tst ,x+ end? + bne loop + + puls x,pc + + endsect + +
--- a/lib/alib/strncmp.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -************************************* - -* STRNCMP: compare 2 null terminated strings -* maximum number of bytes to compare in D -* -* OTHER MODULES NEEDED: COMPARE - -* ENTRY: X=start of 1st string -* Y=start of 2nd string -* D=number of bytes to compare -* CASEMTCH:(a global variable in COMPARE) -* 0=match for case -* -1=ignore case differences - -* EXIT: CC zero set if equal (beq) -* carry + zero clear if 1>2 (bhi) -* carry set if 1<2 (blo) - - nam Compare 2 Strings - ttl Assembler Library Module - - - section .text - - -STRNCMP: - pshs d,x,y,u - - tfr y,u U=string2 - tfr d,y use Y for counter - leay 1,y comp for initial dec. - -loop - leay -1,y count down - beq exit no miss-matches - lda ,x+ get 2 to compare - ldb ,u+ - lbsr COMPARE go compare chars. - beq loop chars match, do more - -* exit with flags set. Do a beq, bhi or blo to correct -* routines.... - -exit - puls d,x,y,u,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/strncmp.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,47 @@ +************************************* + +* STRNCMP: compare 2 null terminated strings +* maximum number of bytes to compare in D +* +* OTHER MODULES NEEDED: COMPARE + +* ENTRY: X=start of 1st string +* Y=start of 2nd string +* D=number of bytes to compare +* CASEMTCH:(a global variable in COMPARE) +* 0=match for case +* -1=ignore case differences + +* EXIT: CC zero set if equal (beq) +* carry + zero clear if 1>2 (bhi) +* carry set if 1<2 (blo) + + nam Compare 2 Strings + ttl Assembler Library Module + + + section .text + + +STRNCMP: + pshs d,x,y,u + + tfr y,u U=string2 + tfr d,y use Y for counter + leay 1,y comp for initial dec. + +loop + leay -1,y count down + beq exit no miss-matches + lda ,x+ get 2 to compare + ldb ,u+ + lbsr COMPARE go compare chars. + beq loop chars match, do more + +* exit with flags set. Do a beq, bhi or blo to correct +* routines.... + +exit + puls d,x,y,u,pc + + endsect
--- a/lib/alib/strncpy.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -********************************** - -* STRNCPY: copy N bytes of a null terminated string -* User must ensure there is room in buffer!!! -* If N>string length only N bytes will be moved - -* OTHER MODULES NEEDED: STRLEN, MEMMOVE - -* ENTRY: X=start of string to move -* Y=buffer for copy of string - -* EXIT: D = actual number of bytes moved -* all other regs preserved (except cc) - - - nam Copy partial String - ttl Assembler Library Module - - - section .text - -STRNCPY: - pshs d bytes wanted to move - lbsr STRLEN find length of string - addd #1 move NULL also - cmpd ,s get smaller of passed/actual size - bls skip use actual leng - ldd ,s use passed leng²² -skip - lbsr MEMMOVE move it - leas 2,s - rts - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/strncpy.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,36 @@ +********************************** + +* STRNCPY: copy N bytes of a null terminated string +* User must ensure there is room in buffer!!! +* If N>string length only N bytes will be moved + +* OTHER MODULES NEEDED: STRLEN, MEMMOVE + +* ENTRY: X=start of string to move +* Y=buffer for copy of string + +* EXIT: D = actual number of bytes moved +* all other regs preserved (except cc) + + + nam Copy partial String + ttl Assembler Library Module + + + section .text + +STRNCPY: + pshs d bytes wanted to move + lbsr STRLEN find length of string + addd #1 move NULL also + cmpd ,s get smaller of passed/actual size + bls skip use actual leng + ldd ,s use passed leng²² +skip + lbsr MEMMOVE move it + leas 2,s + rts + + endsect + +
--- a/lib/alib/to_lower.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -*************************************************** - -* Convert character in "B" to lowercase - -* OTHER MODULES NEEDED: IS_UPPER - -* ENTRY: B=ascii value of character to convert - -* EXIT: B=ascii value of character in lowercase - -* Note: control codes, etc. are not effected. - - - nam Convert Char to Lowercase - ttl Assembler Library Module - - - section .text - -TO_LOWER: - pshs cc - lbsr IS_UPPER only uppercase can be converted - bne tolox no upper, exit - addb #$20 make lowercase - -tolox - puls cc,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/to_lower.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,30 @@ +*************************************************** + +* Convert character in "B" to lowercase + +* OTHER MODULES NEEDED: IS_UPPER + +* ENTRY: B=ascii value of character to convert + +* EXIT: B=ascii value of character in lowercase + +* Note: control codes, etc. are not effected. + + + nam Convert Char to Lowercase + ttl Assembler Library Module + + + section .text + +TO_LOWER: + pshs cc + lbsr IS_UPPER only uppercase can be converted + bne tolox no upper, exit + addb #$20 make lowercase + +tolox + puls cc,pc + + endsect +
--- a/lib/alib/to_lowrs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -******************************* - -* convert a null terminated string to all lowercase - -* OTHER MODULES NEEDED: TO_LOWER - -* ENTRY: X=start of string - -* EXIT: all registers preserved - - nam Convert String to Lowercase - ttl Assembler Library Module - - section .text - -TO_LOWRS: - pshs cc,b,x - -loop - ldb ,x get char to check - beq exit exit if all done - lbsr TO_LOWER convert to upper - stb ,x+ put back in string - bra loop loop till done - -exit - puls cc,b,x,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/to_lowrs.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,30 @@ +******************************* + +* convert a null terminated string to all lowercase + +* OTHER MODULES NEEDED: TO_LOWER + +* ENTRY: X=start of string + +* EXIT: all registers preserved + + nam Convert String to Lowercase + ttl Assembler Library Module + + section .text + +TO_LOWRS: + pshs cc,b,x + +loop + ldb ,x get char to check + beq exit exit if all done + lbsr TO_LOWER convert to upper + stb ,x+ put back in string + bra loop loop till done + +exit + puls cc,b,x,pc + + endsect +
--- a/lib/alib/to_non_sp.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -********************************** - -* Advance X to 1st non-space character - -* OTHER MODULES NEEDED: none - -* ENTRY: X=somewhere in a string - -* EXIT: X=1st non-space character in string -* B=char at X - - - nam Advance to non-space - ttl Assembler Library Module - - section .text - -TO_NON_SP: - ldb ,x+ - cmpb #$20 is it space? - beq TO_NON_SP yes, loop - leax -1,x point to non-space - rts - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/to_non_sp.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,25 @@ +********************************** + +* Advance X to 1st non-space character + +* OTHER MODULES NEEDED: none + +* ENTRY: X=somewhere in a string + +* EXIT: X=1st non-space character in string +* B=char at X + + + nam Advance to non-space + ttl Assembler Library Module + + section .text + +TO_NON_SP: + ldb ,x+ + cmpb #$20 is it space? + beq TO_NON_SP yes, loop + leax -1,x point to non-space + rts + + endsect
--- a/lib/alib/to_sp.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -********************************** - -* Advance X to 1st space character - -* OTHER MODULES NEEDED: none - -* ENTRY: X=somewhere in a string - -* EXIT: X=1st space character in string - - - nam Advance to space - ttl Assembler Library Module - - section .text - -TO_SP: - pshs b -spl - ldb ,x+ - cmpb #$20 is it space? - bne spl no, loop - leax -1,x point to space - puls b,pc - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/to_sp.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,26 @@ +********************************** + +* Advance X to 1st space character + +* OTHER MODULES NEEDED: none + +* ENTRY: X=somewhere in a string + +* EXIT: X=1st space character in string + + + nam Advance to space + ttl Assembler Library Module + + section .text + +TO_SP: + pshs b +spl + ldb ,x+ + cmpb #$20 is it space? + bne spl no, loop + leax -1,x point to space + puls b,pc + + endsect
--- a/lib/alib/to_upper.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -*************************************************** - -* Convert character in "B" to uppercase - -* OTHER MODULES NEEDED: IS_LOWER - -* ENTRY: B=ascii value of character to convert - -* EXIT: B=ascii value of character in uppercase - -* Note: control codes, etc. are not effected. - - - nam Convert Char to Uppercase - ttl Assembler Library Module - - - section .text - -TO_UPPER: - pshs cc - lbsr IS_LOWER only lowercase can be converted to upper - bne toupx - subb #$20 make uppercase - -toupx - puls cc,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/to_upper.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,30 @@ +*************************************************** + +* Convert character in "B" to uppercase + +* OTHER MODULES NEEDED: IS_LOWER + +* ENTRY: B=ascii value of character to convert + +* EXIT: B=ascii value of character in uppercase + +* Note: control codes, etc. are not effected. + + + nam Convert Char to Uppercase + ttl Assembler Library Module + + + section .text + +TO_UPPER: + pshs cc + lbsr IS_LOWER only lowercase can be converted to upper + bne toupx + subb #$20 make uppercase + +toupx + puls cc,pc + + endsect +
--- a/lib/alib/to_upprs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -******************************* - -* convert a null terminated string to all uppercase - -* OTHER MODULES NEEDED: TO_UPPER - -* ENTRY: X=start of string - -* EXIT: all registers (except CC) preserved - - - nam Convert String to Uppercase - ttl Assembler Library Module - - - section .text - -TO_UPPRS: - pshs cc,b,x - -loop - ldb ,x get char to check - beq exit exit if all done - lbsr TO_UPPER convert to upper - stb ,x+ put back in string - bra loop - -exit - puls cc,b,x,pc - - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/to_upprs.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,32 @@ +******************************* + +* convert a null terminated string to all uppercase + +* OTHER MODULES NEEDED: TO_UPPER + +* ENTRY: X=start of string + +* EXIT: all registers (except CC) preserved + + + nam Convert String to Uppercase + ttl Assembler Library Module + + + section .text + +TO_UPPRS: + pshs cc,b,x + +loop + ldb ,x get char to check + beq exit exit if all done + lbsr TO_UPPER convert to upper + stb ,x+ put back in string + bra loop + +exit + puls cc,b,x,pc + + endsect +
--- a/lib/alib/windefs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -************************************ -* -* This file contains the names for the various window -* commands avail for CoCo3 Level 2 OS9. - -* History: File created 88/04/24 - Bob van der Poel - -* Note that all these constants begin with a "W" - - ttl Window Definitions - - section .text - -WBColor: equ $1b33 background color -WBoldSw: equ $1b3d bold switch -WBorder: equ $1b34 border color -WCWArea: equ $1b25 change working area -WDefColr: equ $1b30 set default color -WDfnGPBuf: equ $1b28 define get/put buffer -WDWEnd: equ $1b24 device window end -WDWProtSw: equ $1b36 device window protect -WDWSet: equ $1b20 device window set -WFColor: equ $1b32 foreground color -WFont: equ $1b3a select font -WGCSet: equ $1b39 graphics cursor set -WGetBlk: equ $1b2c get block -WGPLoad: equ $1b2b get/put buffer load -WKilBuf: equ $1b2a kill get/put buffer -WLSet: equ $1b2f logic set -WOWEnd: equ $1b23 overlay window end -WOWSet: equ $1b22 overlay window set -WPalette: equ $1b31 change palette -WPropSw: equ $1b3f proportional switch -WPSet: equ $1b2e Pattern set -WPutBlk: equ $1b2d put block -WScaleSw: equ $1b35 scale switch -WSelect: equ $1b21 select window -WTCharSw: equ $1b3c transparent char switch - -* drawing commands - -WArc3P: equ $1b52 draw arc -WBar: equ $1b4a draw bar -WRBar: equ $1b4b draw bar relative -WBox: equ $1b48 draw box -WRBox: equ $1b49 draw box relative -WCircle: equ $1b50 draw circle -WEllipse: equ $1b51 draw ellipse -WFFill: equ $1b4f flood fill -WLine: equ $1b44 draw line -WRLine: equ $1b45 draw line relative -WLineM: equ $1b46 draw line and move -WRLineM: equ $1b47 draw line relative and move -WPoint: equ $1b42 set point -WRPoint: equ $1b43 set point relative -WPutGC: equ $1b4e put graphics cursor -WSetDPtr: equ $1b40 set draw pointer -WRSetDPtr: equ $1b41 set draw pointer relative - -* Text commands - -* these are one byte codes... - -WHomeCur: equ $01 home cursor -WPosCur: equ $02 position cursor -WErasLn: equ $03 erase line -WErasEOL: equ $04 erase to end of line -WErasEOS: equ $0b erase to end of screen -WErase: equ $0c erase screen and home cursor -WCurR: equ $06 move cursor right one pos -WCurL: equ $08 move cursor left one pos -WCurUp: equ $09 move cursor up one line -WCurDn: equ $0a move cursor down one line -WBell: equ $07 rings terminal bell -WCr: equ $0d sends a carriage return - -* two byte codes... - -WCurOff: equ $0520 turn off cursor -WCurOn: equ $0521 turn on cursor -WRvOn: equ $1f20 reverse video on -WRvOff: equ $1f21 reverse video off -WUlOn: equ $1f22 underlining on -WUlOff: equ $1f23 underlineing off -WBlnkOn: equ $1f24 blinking on -WBlnkOff: equ $1f25 blinking off -WInsLn: equ $1f30 insert line at cursor -WDelLn: equ $1f31 delete current line - - - endsect - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/alib/windefs.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,93 @@ +************************************ +* +* This file contains the names for the various window +* commands avail for CoCo3 Level 2 OS9. + +* History: File created 88/04/24 - Bob van der Poel + +* Note that all these constants begin with a "W" + + ttl Window Definitions + + section .text + +WBColor: equ $1b33 background color +WBoldSw: equ $1b3d bold switch +WBorder: equ $1b34 border color +WCWArea: equ $1b25 change working area +WDefColr: equ $1b30 set default color +WDfnGPBuf: equ $1b28 define get/put buffer +WDWEnd: equ $1b24 device window end +WDWProtSw: equ $1b36 device window protect +WDWSet: equ $1b20 device window set +WFColor: equ $1b32 foreground color +WFont: equ $1b3a select font +WGCSet: equ $1b39 graphics cursor set +WGetBlk: equ $1b2c get block +WGPLoad: equ $1b2b get/put buffer load +WKilBuf: equ $1b2a kill get/put buffer +WLSet: equ $1b2f logic set +WOWEnd: equ $1b23 overlay window end +WOWSet: equ $1b22 overlay window set +WPalette: equ $1b31 change palette +WPropSw: equ $1b3f proportional switch +WPSet: equ $1b2e Pattern set +WPutBlk: equ $1b2d put block +WScaleSw: equ $1b35 scale switch +WSelect: equ $1b21 select window +WTCharSw: equ $1b3c transparent char switch + +* drawing commands + +WArc3P: equ $1b52 draw arc +WBar: equ $1b4a draw bar +WRBar: equ $1b4b draw bar relative +WBox: equ $1b48 draw box +WRBox: equ $1b49 draw box relative +WCircle: equ $1b50 draw circle +WEllipse: equ $1b51 draw ellipse +WFFill: equ $1b4f flood fill +WLine: equ $1b44 draw line +WRLine: equ $1b45 draw line relative +WLineM: equ $1b46 draw line and move +WRLineM: equ $1b47 draw line relative and move +WPoint: equ $1b42 set point +WRPoint: equ $1b43 set point relative +WPutGC: equ $1b4e put graphics cursor +WSetDPtr: equ $1b40 set draw pointer +WRSetDPtr: equ $1b41 set draw pointer relative + +* Text commands + +* these are one byte codes... + +WHomeCur: equ $01 home cursor +WPosCur: equ $02 position cursor +WErasLn: equ $03 erase line +WErasEOL: equ $04 erase to end of line +WErasEOS: equ $0b erase to end of screen +WErase: equ $0c erase screen and home cursor +WCurR: equ $06 move cursor right one pos +WCurL: equ $08 move cursor left one pos +WCurUp: equ $09 move cursor up one line +WCurDn: equ $0a move cursor down one line +WBell: equ $07 rings terminal bell +WCr: equ $0d sends a carriage return + +* two byte codes... + +WCurOff: equ $0520 turn off cursor +WCurOn: equ $0521 turn on cursor +WRvOn: equ $1f20 reverse video on +WRvOff: equ $1f21 reverse video off +WUlOn: equ $1f22 underlining on +WUlOff: equ $1f23 underlineing off +WBlnkOn: equ $1f24 blinking on +WBlnkOff: equ $1f25 blinking off +WInsLn: equ $1f30 insert line at cursor +WDelLn: equ $1f31 delete current line + + + endsect + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/drivewire.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,7 @@ + section .data + RMB $81 +SS.Timer: RMB 1 Timer service +SS.EE: RMB 1 EEPROM service + endsect + +
--- a/lib/makefile Sat Jan 26 08:26:31 2013 -0600 +++ b/lib/makefile Sat Jan 26 17:18:24 2013 -0600 @@ -1,22 +1,24 @@ include $(NITROS9DIR)/rules.mak -SRC = os9s.a scfs.a rbfs.a pipes.a systype.a net.a drivewire.a +SRC = os9s.as scfs.as rbfs.as pipes.as systype.as net.as drivewire.as -all: sys6809l1.l sys6809l2.l sys6309l2.l net.l alib.l - -sys6809l1.l: sys6809l1.a +all: sys6809l1.a sys6809l2.a sys6309l2.a net.a -sys6809l2.l: sys6809l2.a - -sys6309l2.l: sys6309l2.a +sys6809l1.a: sys6809l1.o +sys6809l2.a: sys6809l2.o +sys6309l2.a: sys6309l2.o +net.a: net.o -net.l: net.a +sys6809l1.o: sys6809l1.as +sys6809l2.o: sys6809l2.as +sys6309l2.o: sys6309l2.as +net.o: net.as -drivewire.l: drivewire.a +drivewire.a: drivewire.a alib.l: cd alib; make clean: - $(RM) *.l *.r *.zip + $(RM) *.a *.o cd alib; make clean
--- a/lib/net.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +0,0 @@ -******************************************************************** -* net - network routines -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1 2010/01/08 Boisy G. Pitre -* Started. - - nam net.a - ttl network routines - - section .bss -nbufferl equ 128 -nbuffer rmb nbufferl - endsect - - section .text - -space fcb C$SPAC - -devnam fcs "/N" - - -getopts leax nbuffer,u - ldb #SS.Opt - os9 I$GetStt - rts - -setopts leax nbuffer,u - ldb #SS.Opt - os9 I$SetStt - rts - -* Set Echo On -* -* Entry: A = path to network device -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -SetEchoOn: pshs a,x - bsr getopts - bcs rawex - ldb #1 - stb PD.EKO-PD.OPT,x - bsr setopts - puls a,x,pc - - -* Set Echo Off -* -* Entry: A = path to network device -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -SetEchoOff: pshs a,x - bsr getopts - bcs rawex - clr PD.EKO-PD.OPT,x - bsr setopts - puls a,x,pc - - -* Set Auto Linefeed On -* -* Entry: A = path to network device -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -SetAutoLFOn: pshs a,x - bsr getopts - bcs rawex - ldb #1 - stb PD.ALF-PD.OPT,x - bsr setopts - puls a,x,pc - - -* Set Auto Linefeed Off -* -* Entry: A = path to network device -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -SetAutoLFOff: pshs a,x - bsr getopts - bcs rawex - clr PD.ALF-PD.OPT,x - bsr setopts - puls a,x,pc - - -* Put the path passed in A in raw mode -* -* Entry: A = path to network device -* -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -RawPath: pshs a,x - bsr getopts - bcs rawex - leax PD.UPC-PD.OPT,x - ldb #PD.QUT-PD.UPC -rawloop clr ,x+ - decb - bpl rawloop - bsr setopts -rawex puls a,x,pc - - -* Attempts to open and setup a path to the TCP server -* -* Exit: -* Success: A = path to network device, CC carry clear -* Failure: B = error code, CC carry set -TCPOpen: pshs x,y - lda #UPDAT. - leax devnam,pcr - os9 I$Open - bcs openerr - bsr SetEchoOff - bsr SetAutoLFOff -openerr - puls x,y,pc - - -* Informs the server that we are killing a session -* -* Entry: A = path to network device -* Y = pointer to token string (nul terminated) -* -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -TCPKill: pshs a,x,y - leax tcpkill,pcr - ldy #tcpkilll - os9 I$Write - lbcs connectex - bra writeport - -* Informs the server that we are joining a session -* -* Entry: A = path to network device -* Y = pointer to token string (nul terminated) -* -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -TCPJoin: pshs a,x,y - leax tcpjoin,pcr - ldy #tcpjoinl - os9 I$Write - lbcs connectex - bra writeport - -* Attempts to connect to a TCP/IP host via the server -* -* Entry: A = path to network device -* X = pointer to host name string (nul terminated) -* Y = pointer to port string (nul terminated) -* -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -TCPConnectToHost: - pshs a,x,y - leax tcpconnect,pcr - ldy #tcpconnectl - os9 I$Write - bcs connectex - ldx 1,s - lbsr STRLEN - tfr d,y - lda ,s - os9 I$Write -* write space - leax space,pcr - ldy #1 - os9 I$Write -* write port (we worry about response later) -writeport ldx 3,s get original Y on stack - pshs a - lbsr STRLEN - tfr d,y - puls a - os9 I$Write - leax acr,pcr - ldy #1 - os9 I$WritLn - -* read response from server -* Entry: A = path -readresponse - leax nbuffer,u - ldy #nbufferl - os9 I$ReadLn - bcs connectex - lda ,x - cmpa #'F - bne connectex -* failure case: read number and return it with carry set - leax 5,x skip over "FAIL " - lbsr DEC_BIN error will fit in B - coma set carry -connectex puls a,x,y,pc - -acr fcb C$CR - -* Requests to listen on a port -* -* Entry: A = path to network device -* X = pointer to parameter string (nul terminated) -* -* Exit: -* Success: CC carry clear -* Failure: CC carry set, B = error code -TCPListen: pshs a,x,y - leax tcplisten,pcr - ldy #tcplistenl - os9 I$Write - bcs connectex - ldx 1,s - lbsr STRLEN - tfr d,y - lda ,s - os9 I$Write - leax acr,pcr - ldy #1 - os9 I$WritLn - bra readresponse - -* Disconnects the TCP/IP host via the server -* -* Entry: A = path to network device -* -* Exit: -* Success: CC carry clear -* Failure: B = error code, CC carry set -TCPDisconnect: os9 I$Close - rts - -tcpconnect fcc 'tcp connect ' -tcpconnectl equ *-tcpconnect - -tcplisten fcc 'tcp listen ' -tcplistenl equ *-tcplisten - -tcpjoin fcc 'tcp join ' -tcpjoinl equ *-tcpjoin - -tcpkill fcc 'tcp kill ' -tcpkilll equ *-tcpkill - - endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/net.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,258 @@ +******************************************************************** +* net - network routines +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1 2010/01/08 Boisy G. Pitre +* Started. + + nam net.a + ttl network routines + + section .bss +nbufferl equ 128 +nbuffer rmb nbufferl + endsect + + section .text + +space fcb C$SPAC + +devnam fcs "/N" + + +getopts leax nbuffer,u + ldb #SS.Opt + os9 I$GetStt + rts + +setopts leax nbuffer,u + ldb #SS.Opt + os9 I$SetStt + rts + +* Set Echo On +* +* Entry: A = path to network device +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +SetEchoOn: pshs a,x + bsr getopts + bcs rawex + ldb #1 + stb PD.EKO-PD.OPT,x + bsr setopts + puls a,x,pc + + +* Set Echo Off +* +* Entry: A = path to network device +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +SetEchoOff: pshs a,x + bsr getopts + bcs rawex + clr PD.EKO-PD.OPT,x + bsr setopts + puls a,x,pc + + +* Set Auto Linefeed On +* +* Entry: A = path to network device +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +SetAutoLFOn: pshs a,x + bsr getopts + bcs rawex + ldb #1 + stb PD.ALF-PD.OPT,x + bsr setopts + puls a,x,pc + + +* Set Auto Linefeed Off +* +* Entry: A = path to network device +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +SetAutoLFOff: pshs a,x + bsr getopts + bcs rawex + clr PD.ALF-PD.OPT,x + bsr setopts + puls a,x,pc + + +* Put the path passed in A in raw mode +* +* Entry: A = path to network device +* +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +RawPath: pshs a,x + bsr getopts + bcs rawex + leax PD.UPC-PD.OPT,x + ldb #PD.QUT-PD.UPC +rawloop clr ,x+ + decb + bpl rawloop + bsr setopts +rawex puls a,x,pc + + +* Attempts to open and setup a path to the TCP server +* +* Exit: +* Success: A = path to network device, CC carry clear +* Failure: B = error code, CC carry set +TCPOpen: pshs x,y + lda #UPDAT. + leax devnam,pcr + os9 I$Open + bcs openerr + bsr SetEchoOff + bsr SetAutoLFOff +openerr + puls x,y,pc + + +* Informs the server that we are killing a session +* +* Entry: A = path to network device +* Y = pointer to token string (nul terminated) +* +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +TCPKill: pshs a,x,y + leax tcpkill,pcr + ldy #tcpkilll + os9 I$Write + lbcs connectex + bra writeport + +* Informs the server that we are joining a session +* +* Entry: A = path to network device +* Y = pointer to token string (nul terminated) +* +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +TCPJoin: pshs a,x,y + leax tcpjoin,pcr + ldy #tcpjoinl + os9 I$Write + lbcs connectex + bra writeport + +* Attempts to connect to a TCP/IP host via the server +* +* Entry: A = path to network device +* X = pointer to host name string (nul terminated) +* Y = pointer to port string (nul terminated) +* +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +TCPConnectToHost: + pshs a,x,y + leax tcpconnect,pcr + ldy #tcpconnectl + os9 I$Write + bcs connectex + ldx 1,s + lbsr STRLEN + tfr d,y + lda ,s + os9 I$Write +* write space + leax space,pcr + ldy #1 + os9 I$Write +* write port (we worry about response later) +writeport ldx 3,s get original Y on stack + pshs a + lbsr STRLEN + tfr d,y + puls a + os9 I$Write + leax acr,pcr + ldy #1 + os9 I$WritLn + +* read response from server +* Entry: A = path +readresponse + leax nbuffer,u + ldy #nbufferl + os9 I$ReadLn + bcs connectex + lda ,x + cmpa #'F + bne connectex +* failure case: read number and return it with carry set + leax 5,x skip over "FAIL " + lbsr DEC_BIN error will fit in B + coma set carry +connectex puls a,x,y,pc + +acr fcb C$CR + +* Requests to listen on a port +* +* Entry: A = path to network device +* X = pointer to parameter string (nul terminated) +* +* Exit: +* Success: CC carry clear +* Failure: CC carry set, B = error code +TCPListen: pshs a,x,y + leax tcplisten,pcr + ldy #tcplistenl + os9 I$Write + bcs connectex + ldx 1,s + lbsr STRLEN + tfr d,y + lda ,s + os9 I$Write + leax acr,pcr + ldy #1 + os9 I$WritLn + bra readresponse + +* Disconnects the TCP/IP host via the server +* +* Entry: A = path to network device +* +* Exit: +* Success: CC carry clear +* Failure: B = error code, CC carry set +TCPDisconnect: os9 I$Close + rts + +tcpconnect fcc 'tcp connect ' +tcpconnectl equ *-tcpconnect + +tcplisten fcc 'tcp listen ' +tcplistenl equ *-tcplisten + +tcpjoin fcc 'tcp join ' +tcpjoinl equ *-tcpjoin + +tcpkill fcc 'tcp kill ' +tcpkilll equ *-tcpkill + + endsect
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/os9.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,1314 @@ +******************************************************************** +* OS9Defs - NitrOS-9 System Definitions +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1985/08/29 KMZ +* Fixed DT.SBF/NFM values to 3/4 +* +* 1985/09/01 KMZ +* Added SS.FDInf, SS.Attr to accept 68K request thru NET. +* +* 1985/09/03 KMZ/Robert F. Doggett +* Eliminated E$BPrcID, made Error #238 become E$DNE for +* 68000 compatability. +* +* 1986/04/15 Mark G. Hawkins +* F$AlHRAM System call added for COCO. +* +* 1986/09/08 Mark G. Hawkins +* F$Alarm for COCO Clock Module. +* +* 1986/09/17 Mark G. Hawkins +* SS.Tone For COCO. +* +* 1986/09/23 Mark G. Hawkins +* Added F$NMLink and F$NMLoad for COCO. +* +* 1986/09/30 Mark G. Hawkins +* Added Reserved User $70 to $7f in sytem calls. +* +* 1986/09/30 Mark G. Hawkins +* Created Color Computer 3 Version of OS9Defs. +* +* 1998/10/03 Boisy G. Pitre +* Consoldated Level 1/Level 2 os9defs. +* +* 2002/04/04 Boisy G. Pitre +* Consoldated Level 2/Level 2 V3 os9defs. +* +* 2002/04/30 Boisy G. Pitre +* Added NitrOS-9 definitions. +* +* 2003/05/30 Boisy G. Pitre +* Added WD1002 sys vars to Level One section. +* +* 2003/06/02 Boisy G. Pitre +* Fixed incorrectly ordered D.X*** system globals for OS-9 Level One and +* changed the sizes from 2 to 3 bytes. +* DT.NFM is now the same for both Level One and Level Two. +* Added DT.CDFM type for future CD-ROM file manager +* +* 2003/11/05 Robert Gault +* Fixed MouseInf. Made it rmb 2 as it should be. Also changes to init and cc3io. +* +* 2005/11/02 P.Harvey-Smith +* Added definitions for boot areas on Dragon computers. +* +* 2006/03/03 Boisy G. Pitre +* Added F$Debug and D.DbgMem areas, common to all levels of NitrOS-9 + + NAM OS9Defs + IFEQ Level-1 + TTL NitrOS-9 Level 1 System Symbol Definitions + ELSE + IFEQ Level-2 + TTL NitrOS-9 Level 2 System Symbol Definitions + ELSE + TTL NitrOS-9 Level 3 System Symbol Definitions + ENDC + ENDC + +* Common definitions +true: EQU 1 useful name +false: EQU 0 useful name + + PAG +***************************************** +* System Service Request Code Definitions +* + section _constant +F$Link: RMB 1 Link to Module +F$Load: RMB 1 Load Module from File +F$UnLink: RMB 1 Unlink Module +F$Fork: RMB 1 Start New Process +F$Wait: RMB 1 Wait for Child Process to Die +F$Chain: RMB 1 Chain Process to New Module +F$Exit: RMB 1 Terminate Process +F$Mem: RMB 1 Set Memory Size +F$Send: RMB 1 Send Signal to Process +F$Icpt: RMB 1 Set Signal Intercept +F$Sleep: RMB 1 Suspend Process +F$SSpd: RMB 1 Suspend Process +F$ID: RMB 1 Return Process ID +F$SPrior: RMB 1 Set Process Priority +F$SSWI: RMB 1 Set Software Interrupt +F$PErr: RMB 1 Print Error +F$PrsNam: RMB 1 Parse Pathlist Name +F$CmpNam: RMB 1 Compare Two Names +F$SchBit: RMB 1 Search Bit Map +F$AllBit: RMB 1 Allocate in Bit Map +F$DelBit: RMB 1 Deallocate in Bit Map +F$Time: RMB 1 Get Current Time +F$STime: RMB 1 Set Current Time +F$CRC: RMB 1 Generate CRC ($17) + + IFGT Level-1 + +* NitrOS-9 Level 2 system calls +F$GPrDsc: RMB 1 Get Process Descriptor copy ($18) +F$GBlkMp: RMB 1 Get System Block Map copy ($19) +F$GModDr: RMB 1 Get Module Directory copy ($1A) +F$CpyMem: RMB 1 Copy External Memory ($1B) +F$SUser: RMB 1 Set User ID number ($1C) +F$UnLoad: RMB 1 Unlink Module by name ($1D) +F$Alarm: RMB 1 Color Computer 3 Alarm Call ($1E) + RMB 2 Reserved - For overlap of other systems ($1F) +F$NMLink: RMB 1 Color Computer 3 Non-Mapping Link ($21) +F$NMLoad: RMB 1 Color Computer 3 Non-Mapping Load ($22) + + ELSE + +* NitrOS-9 Level 1 system call padding + RMB 11 + + ENDC + +F$Debug: RMB 1 Drop the system into the debugger ($23) + + IFGT Level-1 + + RMB $25-* +F$TPS: RMB 1 Return System's Ticks Per Second +F$TimAlm: RMB 1 CoCo individual process alarm call + + ENDC + + RMB $27-* Beginning of System Reserved Calls +* NitrOS-9 common system calls +F$VIRQ: RMB 1 Install/Delete Virtual IRQ +F$SRqMem: RMB 1 System Memory Request +F$SRtMem: RMB 1 System Memory Return +F$IRQ: RMB 1 Enter IRQ Polling Table +F$IOQu: RMB 1 Enter I/O Queue +F$AProc: RMB 1 Enter Active Process Queue +F$NProc: RMB 1 Start Next Process +F$VModul: RMB 1 Validate Module +F$Find64: RMB 1 Find Process/Path Descriptor +F$All64: RMB 1 Allocate Process/Path Descriptor +F$Ret64: RMB 1 Return Process/Path Descriptor +F$SSvc: RMB 1 Service Request Table Initialization +F$IODel: RMB 1 Delete I/O Module + + IFGT Level-1 + +F$SLink: RMB 1 System Link +F$Boot: RMB 1 Bootstrap System +F$BtMem: RMB 1 Bootstrap Memory Request +F$GProcP: RMB 1 Get Process ptr +F$Move: RMB 1 Move Data (low bound first) +F$AllRAM: RMB 1 Allocate RAM blocks +F$AllImg: RMB 1 Allocate Image RAM blocks +F$DelImg: RMB 1 Deallocate Image RAM blocks +F$SetImg: RMB 1 Set Process DAT Image +F$FreeLB: RMB 1 Get Free Low Block +F$FreeHB: RMB 1 Get Free High Block +F$AllTsk: RMB 1 Allocate Process Task number +F$DelTsk: RMB 1 Deallocate Process Task number +F$SetTsk: RMB 1 Set Process Task DAT registers +F$ResTsk: RMB 1 Reserve Task number +F$RelTsk: RMB 1 Release Task number +F$DATLog: RMB 1 Convert DAT Block/Offset to Logical +F$DATTmp: RMB 1 Make temporary DAT image (Obsolete) +F$LDAXY: RMB 1 Load A [X,[Y]] +F$LDAXYP: RMB 1 Load A [X+,[Y]] +F$LDDDXY: RMB 1 Load D [D+X,[Y]] +F$LDABX: RMB 1 Load A from 0,X in task B +F$STABX: RMB 1 Store A at 0,X in task B +F$AllPrc: RMB 1 Allocate Process Descriptor +F$DelPrc: RMB 1 Deallocate Process Descriptor +F$ELink: RMB 1 Link using Module Directory Entry +F$FModul: RMB 1 Find Module Directory Entry +F$MapBlk: RMB 1 Map Specific Block +F$ClrBlk: RMB 1 Clear Specific Block +F$DelRAM: RMB 1 Deallocate RAM blocks +F$GCMDir: RMB 1 Pack module directory +F$AlHRAM: RMB 1 Allocate HIGH RAM Blocks + +* Alan DeKok additions +F$ReBoot: RMB 1 Reboot machine (reload OS9Boot) or drop to RSDOS +F$CRCMod: RMB 1 CRC mode, toggle or report current status +F$XTime: RMB 1 Get Extended time packet from RTC (fractions of second) +F$VBlock: RMB 1 Verify modules in a block of memory, add to module directory + + ENDC + +* +* Numbers $70 through $7F are reserved for user definitions +* + RMB $70-* + + IFEQ Level-1 + + RMB 16 Reserved for user definition + + ELSE + +F$RegDmp: RMB 1 Ron Lammardo's debugging register dump +F$NVRAM: RMB 1 Non Volatile RAM (RTC battery backed static) read/write + + RMB $80-* Reserved for user definitions + ENDC + endsect + + PAG +************************************** +* I/O Service Request Code Definitions +* + section _constant + RMB $80 +I$Attach: RMB 1 Attach I/O Device +I$Detach: RMB 1 Detach I/O Device +I$Dup: RMB 1 Duplicate Path +I$Create: RMB 1 Create New File +I$Open: RMB 1 Open Existing File +I$MakDir: RMB 1 Make Directory File +I$ChgDir: RMB 1 Change Default Directory +I$Delete: RMB 1 Delete File +I$Seek: RMB 1 Change Current Position +I$Read: RMB 1 Read Data +I$Write: RMB 1 Write Data +I$ReadLn: RMB 1 Read Line of ASCII Data +I$WritLn: RMB 1 Write Line of ASCII Data +I$GetStt: RMB 1 Get Path Status +I$SetStt: RMB 1 Set Path Status +I$Close: RMB 1 Close Path +I$DeletX: RMB 1 Delete from current exec dir + endsect + +******************* +* File Access Modes +* +READ.: EQU %00000001 +WRITE.: EQU %00000010 +UPDAT.: EQU READ.+WRITE. +EXEC.: EQU %00000100 +PREAD.: EQU %00001000 +PWRIT.: EQU %00010000 +PEXEC.: EQU %00100000 +SHARE.: EQU %01000000 +DIR.: EQU %10000000 +ISIZ.: EQU %00100000 + +************** +* Signal Codes +* + section _constant +S$Kill: RMB 1 Non-Interceptable Abort +S$Wake: RMB 1 Wake-up Sleeping Process +S$Abort: RMB 1 Keyboard Abort +S$Intrpt: RMB 1 Keyboard Interrupt +S$Window: RMB 1 Window Change +S$HUP: EQU S$Window Hang up +S$Alarm: RMB 1 CoCo individual process' alarm signal + endsect + + PAG +********************************** +* Status Codes for GetStat/GetStat +* + section _constant +SS.Opt: RMB 1 Read/Write PD Options +SS.Ready: RMB 1 Check for Device Ready +SS.Size: RMB 1 Read/Write File Size +SS.Reset: RMB 1 Device Restore +SS.WTrk: RMB 1 Device Write Track +SS.Pos: RMB 1 Get File Current Position +SS.EOF: RMB 1 Test for End of File +SS.Link: RMB 1 Link to Status routines +SS.ULink: RMB 1 Unlink Status routines +SS.Feed: RMB 1 Issue form feed +SS.Frz: RMB 1 Freeze DD. information +SS.SPT: RMB 1 Set DD.TKS to given value +SS.SQD: RMB 1 Sequence down hard disk +SS.DCmd: RMB 1 Send direct command to disk +SS.DevNm: RMB 1 Return Device name (32-bytes at [X]) +SS.FD: RMB 1 Return File Descriptor (Y-bytes at [X]) +SS.Ticks: RMB 1 Set Lockout honor duration +SS.Lock: RMB 1 Lock/Release record +SS.DStat: RMB 1 Return Display Status (CoCo) +SS.Joy: RMB 1 Return Joystick Value (CoCo) +SS.BlkRd: RMB 1 Block Read +SS.BlkWr: RMB 1 Block Write +SS.Reten: RMB 1 Retension cycle +SS.WFM: RMB 1 Write File Mark +SS.RFM: RMB 1 Read past File Mark +SS.ELog: RMB 1 Read Error Log +SS.SSig: RMB 1 Send signal on data ready +SS.Relea: RMB 1 Release device +SS.AlfaS: RMB 1 Return Alfa Display Status (CoCo, SCF/GetStat) +SS.Attr: EQU SS.AlfaS To serve 68K/RBF/SetStat only, thru NET +SS.Break: RMB 1 Send break signal out acia +SS.RsBit: RMB 1 Reserve bitmap sector (do not allocate in) LSB(X)=sct# + RMB 1 Reserved +SS.FDInf: EQU $20 To serve 68K/RBF/GetStat only, thru NET + RMB 4 Reserve $20-$23 for Japanese version (Hoshi) +SS.SetMF: RMB 1 Reserve $24 for Gimix G68 (Flex compatability?) +SS.Cursr: RMB 1 Cursor information for COCO +SS.ScSiz: RMB 1 Return screen size for COCO +SS.KySns: RMB 1 Getstat/SetStat for COCO keyboard +SS.ComSt: RMB 1 Getstat/SetStat for Baud/Parity +SS.Open: RMB 1 SetStat to tell driver a path was opened +SS.Close: RMB 1 SetStat to tell driver a path was closed +SS.HngUp: RMB 1 SetStat to tell driver to hangup phone +SS.FSig: RMB 1 New signal for temp locked files +SS.DSize: EQU SS.ScSiz Return disk size (RBF GetStat) +SS.VarSect: EQU SS.DStat Variable Sector Size (RBF GetStat) + +* System Specific and User defined codes above $80 + RMB $80-* +SS.AAGBf: RMB 1 SetStat to Allocate Additional Graphic Buffer +SS.SLGBf: RMB 1 SetStat to Select a different Graphic Buffer +SS.Mount: RMB 1 Network 4 Mount Setstat +SS.RdNet: RMB 1 Read Raw Sector from Network 4 Omnidrive +SS.MpGPB: RMB 1 SetStat to request a Get/Put Buffer be mapped in workspace +SS.Slots: RMB 1 Network 4 slots? getstat + + IFGT Level-1 + +* Level 2 Windowing +SS.WnSet: RMB 1 Set up High Level Windowing Information +SS.MnSel: RMB 1 Request High level Menu Handler take determine next event +SS.SBar: RMB 1 SetStat to set position block on Window scroll bars +SS.Mouse: RMB 1 Return Mouse information packet (COCO) +SS.MsSig: RMB 1 SetStat to tell driver to send signal on mouse event +SS.AScrn: RMB 1 Allocate a screen for application poking +SS.DScrn: RMB 1 Display a screen allocated by SS.AScrn +SS.FScrn: RMB 1 Free a screen allocated by SS.AScrn +SS.PScrn: RMB 1 Polymorph Screen into different screen type +SS.ScInf: RMB 1 Get Current screen info for direct writes + RMB 1 Reserved +SS.Palet: RMB 1 Return palette information +SS.Montr: RMB 1 Get and Set Monitor Type +SS.ScTyp: RMB 1 Get screen type information +SS.GIP: RMB 1 Global Input Parameters (SetStat) +SS.UMBar: RMB 1 update menu bar (SetStat) +SS.FBRgs: RMB 1 return color registers (GetStat) +SS.DfPal: RMB 1 set/return default palette registers (Getstat/Setstat) +SS.Tone: RMB 1 Generate a tone using 6 bit sound +SS.GIP2: RMB 1 Global Input Params #2 (L2V3) +SS.AnPal: RMB 1 Animate palettes (L2V3) +SS.FndBf: RMB 1 Find named buffer (L2V3) + +* sc6551 defined +SS.CDSta: EQU SS.GIP2 +SS.CDSig: EQU SS.AnPal +SS.CDRel: EQU SS.FndBf + ELSE +* These are wide open in Level 1 + RMB 19 + +* sc6551 defined +SS.CDSta: RMB 1 +SS.CDSig: RMB 1 +SS.CDRel: RMB 1 + ENDC + + RMB $A0-* +* +* New Default SCF input buffer Set status call +SS.Fill: RMB 1 Pre-load SCF device input buffer +SS.Hist: RMB 1 Enable command-line history easily + + RMB $B0-* +* +* New WDDisk get/set status calls +SS.ECC: RMB 1 ECC corrected data error enable/disable (GetStat/SetStat) + endsect + +* + IFGT Level-1 + +* VRN get/set status calls. Named by Alan DeKok. +SS.VCtr: EQU $80 Return FS2 total VIRQ counter +SS.VSig: EQU $81 Return FS2 number of signals sent + +SS.FClr: EQU $81 Set/clear FS2 VIRQ +SS.FSet: EQU $C7 Set FS2+ VIRQ +SS.KSet: EQU $C8 Set KQ3 VIRQ +SS.KClr: EQU $C9 Clr KQ3 VIRQ +SS.ARAM: EQU $CA Allocate RAM blocks +SS.DRAM: EQU $CB De-allocate RAM blocks + +* SDisk 3 Definition Equates +SS.DRead: EQU SS.AAGBf SDisk3 Direct Sector Read ($80) +SS.DWrit: EQU SS.DRead SDisk3 Direct sector Write ($80) +SS.UnFrz: EQU SS.SLGBf SDisk3 UNFreeze DD info ($81) +SS.MOFF: EQU SS.Mount SDisk3 fast motor off call ($82) +SS.MoTim: EQU SS.RdNet SDisk3 Set motor shut off time ($83) +SS.SDRD: EQU SS.MpGPB SDisk3 System direct read ($84) +SS.SDWRT: EQU SS.SDRD SDisk3 System direct writes ($84) +SS.Sleep: EQU SS.Slots SDisk3 (DMC ONLY) Enable/disable F$Sleep calls in read/write 1773 I/O ($85) +SS.DrvCh: EQU SS.WnSet SDisk3 (DMC ONLY) Set drive number to cache, or return drive number being cached ($86) + + ENDC + + TTL Direct Page Definitions + PAG + +********************************** +* Direct Page Variable Definitions +* + section _constant +D.WDAddr: RMB 2 FHL/Isted WD1002-05 interface base address +D.WDBtDr: RMB 1 FHL/Isted WD1002-05 boot physical device drive num. +D.SWPage: RMB 1 SmartWatch page # (see clock2_smart) + RMB 5 +D.COCOXT: RMB 1 Busy flag for CoCo-XT driver (one drive at a time) +D.DbgMem: RMB 2 Debug memory pointer +D.DWSubAddr: RMB 2 DriveWire subroutine module pointer +D.DWStat: RMB 2 DriveWire statics page + + RMB $20-* + + IFEQ Level-1 + +* Level 1 DP vars +D.FMBM: RMB 4 Free memory bit map pointers +D.MLIM: RMB 2 Memory limit $24 +D.ModDir: RMB 4 Module directory $26 +D.Init: RMB 2 Rom base address $2A +D.SWI3: RMB 2 Swi3 vector $2C +D.SWI2: RMB 2 Swi2 vector $2E +D.FIRQ: RMB 2 Firq vector $30 +D.IRQ: RMB 2 Irq vector $32 +D.SWI: RMB 2 Swi vector $34 +D.NMI: RMB 2 Nmi vector $36 +D.SvcIRQ: RMB 2 Interrupt service entry $38 +D.Poll: RMB 2 Interrupt polling routine $3A +D.UsrIRQ: RMB 2 User irq routine $3C +D.SysIRQ: RMB 2 System irq routine $3E +D.UsrSvc: RMB 2 User service request routine $40 +D.SysSvc: RMB 2 System service request routine $42 +D.UsrDis: RMB 2 User service request dispatch table +D.SysDis: RMB 2 System service reuest dispatch table +D.Slice: RMB 1 Process time slice count $48 +D.PrcDBT: RMB 2 Process descriptor block address $49 +D.Proc: RMB 2 Process descriptor address $4B +D.AProcQ: RMB 2 Active process queue $4D +D.WProcQ: RMB 2 Waiting process queue $4F +D.SProcQ: RMB 2 Sleeping process queue $51 +D.Time: EQU * Time +D.Year: RMB 1 $53 +D.Month: RMB 1 $54 +D.Day: RMB 1 $55 +D.Hour: RMB 1 $56 +D.Min: RMB 1 $57 +D.Sec: RMB 1 $58 +D.Tick: RMB 1 $59 +D.TSec: RMB 1 Ticks / second $5A +D.TSlice: RMB 1 Ticks / time-slice $5B +D.IOML: RMB 2 I/O mgr free memory low bound $5C +D.IOMH: RMB 2 I/O mgr free memory hi bound $5E +D.DevTbl: RMB 2 Device driver table addr $60 +D.PolTbl: RMB 2 Irq polling table addr $62 +D.PthDBT: RMB 2 Path descriptor block table addr $64 +D.BTLO: RMB 2 Bootstrap low address $66 +D.BTHI: RMB 2 Bootstrap hi address $68 +D.DMAReq: RMB 1 DMA in use flag $6A +D.AltIRQ: RMB 2 Alternate IRQ vector (CC) $6B +D.KbdSta: RMB 2 Keyboard scanner static storage (CC) $6D +D.DskTmr: RMB 2 Disk Motor Timer (CC) $6F +D.CBStrt: RMB 16 reserved for CC warmstart ($71) +D.Clock: RMB 2 Address of Clock Tick Routine (CC) $81 +D.Boot: RMB 1 Bootstrap attempted flag +D.URtoSs: RMB 2 address of user to system routine (VIRQ) $84 +D.CLTb: RMB 2 Pointer to clock interrupt table (VIRQ) $86 +D.MDREG: RMB 1 6309 MD (mode) shadow register $88 (added in V2.01.00) +D.CRC: RMB 1 CRC checking mode flag $89 (added in V2.01.00) +D.Clock2: RMB 2 CC Clock2 entry address + + RMB $100-* +D.XSWI3: RMB 3 +D.XSWI2: RMB 3 +D.XSWI: RMB 3 +D.XNMI: RMB 3 +D.XIRQ: RMB 3 +D.XFIRQ: RMB 3 + +* Table Sizes +BMAPSZ: EQU 32 Bitmap table size +SVCTNM: EQU 2 Number of service request tables +SVCTSZ: EQU (256-BMAPSZ)/SVCTNM-2 Service request table size + + ELSE + +* Level 2 DP vars +D.Tasks: RMB 2 Task User Table +D.TmpDAT: RMB 2 Temporary DAT Image stack +D.Init: RMB 2 Initialization Module ptr +D.Poll: RMB 2 Interrupt Polling Routine ptr +D.Time: EQU * System Time +D.Year: RMB 1 +D.Month: RMB 1 +D.Day: RMB 1 +D.Hour: RMB 1 +D.Min: RMB 1 +D.Sec: RMB 1 +D.Tick: RMB 1 +D.Slice: RMB 1 current slice remaining +D.TSlice: RMB 1 Ticks per Slice +D.Boot: RMB 1 Bootstrap attempted flag +D.MotOn: RMB 1 Floppy Disk Motor-On time out +D.ErrCod: RMB 1 Reset Error Code +D.Daywk: RMB 1 day of week, com-trol clock +D.TkCnt: RMB 1 Tick Counter +D.BtPtr: RMB 2 Address of Boot in System Address space +D.BtSz: RMB 2 Size of Boot + + IFNE H6309 +D.MDREG: RMB 1 6309 MD (mode) shadow register + ELSE + RMB 1 Currently unused in NitrOS-9/6809 + ENDC + +D.CRC: RMB 1 CRC checking mode flag + +D.Tenths: RMB 1 Tenths and hundredths of second for F$Xtime +D.Task1N: RMB 1 Map type 1 task number*2 - offset into [D.TskIPt] +D.Quick: RMB 1 Quick system call return flag - 0 =stack is at $FEE1 +D.QIRQ: RMB 1 Quick IRQ flag - 0 =IRQ wasn't clock, so quick return + + RMB $40-* +D.BlkMap: RMB 4 Memory Block Map ptr +D.ModDir: RMB 4 Module Directory ptrs +D.PrcDBT: RMB 2 Process Descriptor Block Table ptr +D.SysPrc: RMB 2 System Process Descriptor ptr +D.SysDAT: RMB 2 System DAT Image ptr +D.SysMem: RMB 2 System Memory Map ptr +D.Proc: RMB 2 Current Process ptr +D.AProcQ: RMB 2 Active Process Queue +D.WProcQ: RMB 2 Waiting Process Queue +D.SProcQ: RMB 2 Sleeping Process Queue +D.ModEnd: RMB 2 Module Directory end ptr +D.ModDAT: RMB 2 Module Dir DAT image end ptr +D.CldRes: RMB 2 Cold Restart vector +D.BtBug: RMB 3 Boot debug information +D.Pipe: RMB 2 + + RMB $6B-* +D.Crash: RMB 6 Pointer to CC Crash Routine +D.CBStrt: RMB $B Reserved for CC warmstart ($71) +D.QCnt: RMB 1 Count of number of quick system calls performed + + RMB $80-* +D.DevTbl: RMB 2 I/O Device Table +D.PolTbl: RMB 2 I/O Polling Table + RMB 4 reserved +D.PthDBT: RMB 2 Path Descriptor Block Table ptr +D.DMAReq: RMB 1 DMA Request flag + +******** +* CoCo 3 STUFF COMES NEXT +* This area is used for the CoCo Hardware Registers +* + RMB $90-* +D.HINIT: RMB 1 GIME INIT0 register (hardware setup $FF90) +D.TINIT: RMB 1 GIME INIT1 register (timer/task register $FF91) +D.IRQER: RMB 1 Interrupt enable regsiter ($FF92) +D.FRQER: RMB 1 Fast Interrupt enable register ($FF93) +D.TIMMS: RMB 1 Timer most significant nibble ($FF94) +D.TIMLS: RMB 1 Timer least significant byte ($FF95) +D.RESV1: RMB 1 reserved register ($FF96) +D.RESV2: RMB 1 reserved register ($FF97) +D.VIDMD: RMB 1 video mode register ($FF98) +D.VIDRS: RMB 1 video resolution register ($FF99) +D.BORDR: RMB 1 border register ($FF9A) +D.RESV3: RMB 1 reserved register ($FF9B) +D.VOFF2: RMB 1 vertical scroll/offset 2 register ($FF9C) +D.VOFF1: RMB 1 vertical offset 1 register ($FF9D) +D.VOFF0: RMB 1 vertical offset 0 register ($FF9E) +D.HOFF0: RMB 1 horizontal offset 0 register ($FF9F) +D.Speed: RMB 1 Speed of COCO CPU 0=slow,1=fast ($A0) +D.TskIPt: RMB 2 Task image Pointer table (CC) ($A1) +D.MemSz: RMB 1 128/512K memory flag (CC) ($A3) +D.SSTskN: RMB 1 System State Task Number (COCO) ($A4) +D.CCMem: RMB 2 Pointer to beginning of CC Memory ($A5) +D.CCStk: RMB 2 Pointer to top of CC Memory ($A7) +D.Flip0: RMB 2 Change to Task 0 ($A9) +D.Flip1: RMB 2 Change to reserved Task 1 ($AB) +D.VIRQ: RMB 2 VIRQ Polling routine ($AD) +D.IRQS: RMB 1 IRQ shadow register (CC Temporary) ($AF) +D.CLTb: RMB 2 VIRQ Table address ($B0) +D.AltIRQ: RMB 2 Alternate IRQ Vector (CC) ($B2) +D.GPoll: RMB 2 CC GIME IRQ enable/disable toggle +D.Clock2: RMB 2 CC Clock2 entry address + RMB $C0-* +D.SysSvc: RMB 2 System Service Routine entry +D.SysDis: RMB 2 System Service Dispatch Table ptr +D.SysIRQ: RMB 2 System IRQ Routine entry +D.UsrSvc: RMB 2 User Service Routine entry +D.UsrDis: RMB 2 User Service Dispatch Table ptr +D.UsrIRQ: RMB 2 User IRQ Routine entry +D.SysStk: RMB 2 System stack +D.SvcIRQ: RMB 2 In-System IRQ service +D.SysTsk: RMB 1 System Task number + RMB $E0-* +D.Clock: RMB 2 +D.XSWI3: RMB 2 +D.XSWI2: RMB 2 +D.XFIRQ: RMB 2 +D.XIRQ: RMB 2 +D.XSWI: RMB 2 +D.XNMI: RMB 2 +D.ErrRst: RMB 2 +D.SysVec: RMB 2 F$xxx system call vector for NitrOS-9 Level 3 +D.SWI3: RMB 2 +D.SWI2: RMB 2 +D.FIRQ: RMB 2 +D.IRQ: RMB 2 +D.SWI: RMB 2 +D.NMI: RMB 2 + +************************* +* Level 2 Block Map flags +* +NotRAM: EQU %10000000 Block Not RAM flag +VidRAM: EQU %00000100 Block is being used as Video RAM +ModBlock: EQU %00000010 Module in Block +RAMinUse: EQU %00000001 RAM Block in use flag +* +* Service Dispatch Table special entries +* +IOEntry: EQU 254 + + ENDC + endsect + + TTL Structure Formats + PAG +************************************ +* Module Directory Entry Definitions +* + section _constant + IFGT Level-1 +MD$MPDAT: RMB 2 Module DAT Image ptr +MD$MBSiz: RMB 2 Memory Block size + ENDC +MD$MPtr: RMB 2 Module ptr +MD$Link: RMB 2 Module Link count +MD$ESize: EQU * Module Directory Entry size + endsect + +************************************ +* Module Definitions +* +* Universal Module Offsets +* + section _constant +M$ID: RMB 2 ID Code +M$Size: RMB 2 Module Size +M$Name: RMB 2 Module Name +M$Type: RMB 1 Type / Language +M$Revs: RMB 1 Attributes / Revision Level +M$Parity: RMB 1 Header Parity +M$IDSize: EQU * Module ID Size + endsect + + section _constant +* +* Type-Dependent Module Offsets +* +* System, File Manager, Device Driver, Program Module +* + RMB M$IDSize +M$Exec: RMB 2 Execution Entry Offset +* +* Device Driver, Program Module +* +M$Mem: RMB 2 Stack Requirement +* +* Device Driver, Device Descriptor Module +* +M$Mode: RMB 1 Device Driver Mode Capabilities + endsect + + section _constant +* +* Device Descriptor Module +* + RMB M$IDSize +M$FMgr: RMB 2 File Manager Name Offset +M$PDev: RMB 2 Device Driver Name Offset + RMB 1 M$Mode (defined above) +M$Port: RMB 3 Port Address +M$Opt: RMB 1 Device Default Options +M$DTyp: RMB 1 Device Type +IT.DTP: EQU M$DTyp Descriptor type offset + endsect + + section _constant +* +* Configuration Module Entry Offsets +* + RMB M$IDSize +MaxMem: RMB 3 Maximum Free Memory +PollCnt: RMB 1 Entries in Interrupt Polling Table +DevCnt: RMB 1 Entries in Device Table +InitStr: RMB 2 Initial Module Name +SysStr: RMB 2 System Device Name +StdStr: RMB 2 Standard I/O Pathlist +BootStr: RMB 2 Bootstrap Module name +ProtFlag: RMB 1 Write protect enable flag + +OSLevel: RMB 1 OS level +OSVer: RMB 1 OS version +OSMajor: RMB 1 OS major +OSMinor: RMB 1 OS minor +Feature1: RMB 1 feature byte 1 +Feature2: RMB 1 feature byte 2 +OSName: RMB 2 OS revision name string (nul terminated) +InstallName: RMB 2 installation name string (nul terminated) + RMB 4 reserved for future use + + IFGT Level-1 +* -- VTIO area -- (NitrOS-9 Level 2 and above) * +MonType: RMB 1 Monitor type (0=CMP,1=RGB,2=MONO) +MouseInf: RMB 2 Mouse resolution/Mouse port; was 1, major error RG. +KeyRptS: RMB 1 Key repeat start constant +KeyRptD: RMB 1 Key repeat delay constant + ENDC + endsect + +* Feature1 byte definitions +CRCOn: EQU %00000001 CRC checking on +CRCOff: EQU %00000000 CRC checking off +Proc6809: EQU %00000000 6809 procesor +Proc6309: EQU %00000010 6309 procesor + + PAG +************************** +* Module Field Definitions +* +* ID Field - First two bytes of a NitrOS-9 module +* +M$ID1: EQU $87 Module ID code byte one +M$ID2: EQU $CD Module ID code byte two +M$ID12: EQU M$ID1*256+M$ID2 + +* +* Module Type/Language Field Masks +* +TypeMask: EQU %11110000 Type Field +LangMask: EQU %00001111 Language Field + +* +* Module Type Values +* +Devic: EQU $F0 Device Descriptor Module +Drivr: EQU $E0 Physical Device Driver +FlMgr: EQU $D0 File Manager +Systm: EQU $C0 System Module +ShellSub: EQU $50 Shell+ shell sub module +Data: EQU $40 Data Module +Multi: EQU $30 Multi-Module +Sbrtn: EQU $20 Subroutine Module +Prgrm: EQU $10 Program Module + +* +* Module Language Values +* +Objct: EQU 1 6809 Object Code Module +ICode: EQU 2 Basic09 I-code +PCode: EQU 3 Pascal P-code +CCode: EQU 4 C I-code +CblCode: EQU 5 Cobol I-code +FrtnCode: EQU 6 Fortran I-code +Obj6309: EQU 7 6309 object code +* +* Module Attributes / Revision byte +* +* Field Masks +* +AttrMask: EQU %11110000 Attributes Field +RevsMask: EQU %00001111 Revision Level Field +* +* Attribute Flags +* +ReEnt: EQU %10000000 Re-Entrant Module +ModProt: EQU %01000000 Gimix Module protect bit (0=protected, 1=write enable) +ModNat: EQU %00100000 6309 native mode attribute + +******************** +* Device Type Values +* +* These values define various classes of devices, which are +* managed by a file manager module. The Device Type is embedded +* in a device's device descriptor. +* +DT.SCF: EQU 0 Sequential Character File Manager +DT.RBF: EQU 1 Random Block File Manager +DT.Pipe: EQU 2 Pipe File Manager +DT.SBF: EQU 3 Sequential Block File Manager +DT.NFM: EQU 4 Network File Manager +DT.CDFM: EQU 5 CD-ROM File Manager + + +********************* +* CRC Result Constant +* +CRCCon1: EQU $80 +CRCCon23: EQU $0FE3 + + TTL Process Information + PAG +******************************** +* Process Descriptor Definitions +* + IFEQ Level-1 + +* Level 1 process descriptor defs +DefIOSiz: EQU 12 +NumPaths: EQU 16 Number of Local Paths + + section _constant +P$ID: RMB 1 Process ID +P$PID: RMB 1 Parent's ID +P$SID: RMB 1 Sibling's ID +P$CID: RMB 1 Child's ID +P$SP: RMB 2 Stack ptr +P$CHAP: RMB 1 process chapter number +P$ADDR: RMB 1 user address beginning page number +P$PagCnt: RMB 1 Memory Page Count +P$User: RMB 2 User Index $09 +P$Prior: RMB 1 Priority $0B +P$Age: RMB 1 Age $0C +P$State: RMB 1 Status +P$Queue: RMB 2 Queue Link (Process ptr) $0E +P$IOQP: RMB 1 Previous I/O Queue Link (Process ID) $10 +P$IOQN: RMB 1 Next I/O Queue Link (Process ID) +P$PModul: RMB 2 Primary Module +P$SWI: RMB 2 SWI Entry Point +P$SWI2: RMB 2 SWI2 Entry Point +P$SWI3: RMB 2 SWI3 Entry Point $18 +P$DIO: RMB DefIOSiz default I/O ptrs $1A +P$PATH: RMB NumPaths I/O path table $26 +P$Signal: RMB 1 Signal Code $36 +P$SigVec: RMB 2 Signal Intercept Vector +P$SigDat: RMB 2 Signal Intercept Data Address +P$NIO: RMB 4 additional dio pointers for net + RMB $40-* unused +P$Size: EQU * Size of Process Descriptor + endsect + +* +* Process State Flags +* +SysState: EQU %10000000 +TimSleep: EQU %01000000 +TimOut: EQU %00100000 +ImgChg: EQU %00010000 +Condem: EQU %00000010 +Dead: EQU %00000001 + + ELSE + +* Level 2 process descriptor defs +DefIOSiz: EQU 16 Default I/O Data Length +NefIOSiz: EQU 12 On-Net Default I/O Data Length +NumPaths: EQU 16 Number of Local Paths + + section _constant +P$ID: RMB 1 Process ID +P$PID: RMB 1 Parent's ID +P$SID: RMB 1 Sibling's ID +P$CID: RMB 1 Child's ID +P$SP: RMB 2 Stack ptr +P$Task: RMB 1 Task Number +P$PagCnt: RMB 1 Memory Page Count +P$User: RMB 2 User Index +P$Prior: RMB 1 Priority +P$Age: RMB 1 Age +P$State: RMB 1 Status +P$Queue: RMB 2 Queue Link (Process ptr) +P$IOQP: RMB 1 Previous I/O Queue Link (Process ID) +P$IOQN: RMB 1 Next I/O Queue Link (Process ID) +P$PModul: RMB 2 Primary Module +P$SWI: RMB 2 SWI Entry Point +P$SWI2: RMB 2 SWI2 Entry Point +P$SWI3: RMB 2 SWI3 Entry Point +P$Signal: RMB 1 Signal Code +P$SigVec: RMB 2 Signal Intercept Vector +P$SigDat: RMB 2 Signal Intercept Data Address +P$DeadLk: RMB 1 Dominant proc ID if I/O locked + RMB $20-* unused +P$DIO: RMB DefIOSiz Default I/O ptrs +P$Path: RMB NumPaths I/O Path Table +P$DATImg: RMB 64 DAT Image +P$Links: RMB 32 Block Link counts +P$NIO: RMB 6*2 additional DIO ptrs for net, compatible with 68k +P$SelP: RMB 1 Selected Path for COCO Windows (Default 0) +P$UTicks: RMB 4 proc User Tick counter (L2V3) +P$STicks: RMB 4 proc System Tick counter (L2V3) +P$FCalls: RMB 4 proc F$ call counter (L2V3) +P$ICalls: RMB 4 proc I$ call counter (L2V3) +P$DatBeg: RMB 3 proc Date of creation (Y/M/D) (L2V3) +P$TimBeg: RMB 3 proc Time of creation (H/M/S) (L2V3) +P$Alarm: RMB 6 + RMB $200-* Local stack +P$Stack: EQU * Top of Stack +P$Size: EQU * Size of Process Descriptor + endsect + +* +* Process State Flags +* +SysState: EQU %10000000 +TimSleep: EQU %01000000 +TimOut: EQU %00100000 +ImgChg: EQU %00010000 +Suspend: EQU %00001000 +Condem: EQU %00000010 +Dead: EQU %00000001 + + ENDC + + TTL NitrOS-9 I/O Symbolic Definitions + PAG +************************* +* Path Descriptor Offsets +* + section _constant +PD.PD: RMB 1 Path Number +PD.MOD: RMB 1 Mode (Read/Write/Update) +PD.CNT: RMB 1 Number of Open Images +PD.DEV: RMB 2 Device Table Entry Address +PD.CPR: RMB 1 Current Process +PD.RGS: RMB 2 Caller's Register Stack +PD.BUF: RMB 2 Buffer Address +PD.FST: RMB 32-* File Manager's Storage +PD.OPT: EQU * PD GetSts(0) Options +PD.DTP: RMB 1 Device Type + RMB 64-* Path options +PDSIZE: EQU * + endsect + +* +* Pathlist Special Symbols +* +PDELIM: EQU '/ Pathlist Name Separator +PDIR: EQU '. Directory +PENTIR: EQU '@ Entire Device + + PAG +**************************** +* File Manager Entry Offsets +* + section _constant +FMCREA: RMB 3 Create (Open New) File +FMOPEN: RMB 3 Open File +FMMDIR: RMB 3 Make Directory +FMCDIR: RMB 3 Change Directory +FMDLET: RMB 3 Delete File +FMSEEK: RMB 3 Position File +FMREAD: RMB 3 Read from File +FMWRIT: RMB 3 Write to File +FMRDLN: RMB 3 ReadLn +FMWRLN: RMB 3 WritLn +FMGSTA: RMB 3 Get File Status +FMSSTA: RMB 3 Set File Status +FMCLOS: RMB 3 Close File + endsect + +***************************** +* Device Driver Entry Offsets +* + section _constant +D$INIT: RMB 3 Device Initialization +D$READ: RMB 3 Read from Device +D$WRIT: RMB 3 Write to Device +D$GSTA: RMB 3 Get Device Status +D$PSTA: RMB 3 Put Device Status +D$TERM: RMB 3 Device Termination + endsect + +********************* +* Device Table Format +* + section _constant +V$DRIV: RMB 2 Device Driver module +V$STAT: RMB 2 Device Driver Static storage +V$DESC: RMB 2 Device Descriptor module +V$FMGR: RMB 2 File Manager module +V$USRS: RMB 1 use count + IFGT Level-1 +V$DRIVEX: RMB 2 Device Driver execution address +V$FMGREX: RMB 2 File Manager execution address + ENDC +DEVSIZ: EQU * + endsect + +******************************* +* Device Static Storage Offsets +* + section _constant +V.PAGE: RMB 1 Port Extended Address +V.PORT: RMB 2 Device 'Base' Port Address +V.LPRC: RMB 1 Last Active Process ID +V.BUSY: RMB 1 Active Process ID (0=UnBusy) +V.WAKE: RMB 1 Active PD if Driver MUST Wake-up +V.USER EQU * Driver Allocation Origin + endsect + +******************************** +* Interrupt Polling Table Format +* + section _constant +Q$POLL: RMB 2 Absolute Polling Address +Q$FLIP: RMB 1 Flip (EOR) Byte ..normally Zero +Q$MASK: RMB 1 Polling Mask (after Flip) +Q$SERV: RMB 2 Absolute Service routine Address +Q$STAT: RMB 2 Static Storage Address +Q$PRTY: RMB 1 Priority (Low Numbers=Top Priority) + IFGT Level-1 +Q$MAP: RMB 2 NitrOS-9 Level 2 and above + ENDC +POLSIZ: EQU * + endsect + +******************** +* VIRQ packet format +* + section _constant +Vi.Cnt: RMB 2 count down counter +Vi.Rst: RMB 2 reset value for counter +Vi.Stat: RMB 1 status byte +Vi.PkSz: EQU * + endsect + +Vi.IFlag: EQU %00000001 status byte virq flag + + PAG +************************************* +* Machine Characteristics Definitions +* +R$CC: EQU 0 Condition Codes register +R$A: EQU 1 A Accumulator +R$B: EQU 2 B Accumulator +R$D: EQU R$A Combined A:B Accumulator + IFNE H6309 +R$E: EQU 3 E Accumulator +R$F: EQU 4 F Accumulator +R$W: EQU R$E Combined E:F Accumulator +R$Q: EQU R$A Combined A:B:E:F Accumulator +R$DP: EQU 5 Direct Page register +R$X: EQU 6 X Index register +R$Y: EQU 8 Y Index register +R$U: EQU 10 User Stack register +R$PC: EQU 12 Program Counter register +R$Size: EQU 14 Total register package size + ELSE +R$DP: EQU 3 Direct Page register +R$X: EQU 4 X Index register +R$Y: EQU 6 Y Index register +R$U: EQU 8 User Stack register +R$PC: EQU 10 Program Counter register +R$Size: EQU 12 Total register package size + ENDC + +* MD register masks +* 6309 definitions +DIV0: EQU %10000000 division by 0 trap flag : 1 = trap occured +badinstr: EQU %01000000 illegal instruction trap flag : 1 = trap occured + +Entire: EQU %10000000 Full Register Stack flag +FIRQMask: EQU %01000000 Fast-Interrupt Mask bit +HalfCrry: EQU %00100000 Half Carry flag +IRQMask: EQU %00010000 Interrupt Mask bit +Negative: EQU %00001000 Negative flag +Zero: EQU %00000100 Zero flag +TwosOvfl: EQU %00000010 Two's Comp Overflow flag +Carry: EQU %00000001 Carry bit +IntMasks: EQU IRQMask+FIRQMask +Sign: EQU %10000000 sign bit + + TTL Error Code Definitions + PAG +************************ +* Error Code Definitions +* +* Basic09 Error Codes +* + section _constant +E$UnkSym: RMB 1 Unknown symbol +E$ExcVrb: RMB 1 Excessive verbage +E$IllStC: RMB 1 Illegal statement construction +E$ICOvf: RMB 1 I-code overflow +E$IChRef: RMB 1 Illegal channel reference +E$IllMod: RMB 1 Illegal mode +E$IllNum: RMB 1 Illegal number +E$IllPrf: RMB 1 Illegal prefix +E$IllOpd: RMB 1 Illegal operand +E$IllOpr: RMB 1 Illegal operator +E$IllRFN: RMB 1 Illegal record field name +E$IllDim: RMB 1 Illegal dimension +E$IllLit: RMB 1 Illegal literal +E$IllRet: RMB 1 Illegal relational +E$IllSfx: RMB 1 Illegal type suffix +E$DimLrg: RMB 1 Dimension too large +E$LinLrg: RMB 1 Line number too large +E$NoAssg: RMB 1 Missing assignment statement +E$NoPath: RMB 1 Missing path number +E$NoComa: RMB 1 Missing coma +E$NoDim: RMB 1 Missing dimension +E$NoDO: RMB 1 Missing DO statement +E$MFull: RMB 1 Memory full +E$NoGoto: RMB 1 Missing GOTO +E$NoLPar: RMB 1 Missing left parenthesis +E$NoLRef: RMB 1 Missing line reference +E$NoOprd: RMB 1 Missing operand +E$NoRPar: RMB 1 Missing right parenthesis +E$NoTHEN: RMB 1 Missing THEN statement +E$NoTO: RMB 1 Missing TO statement +E$NoVRef: RMB 1 Missing variable reference +E$EndQou: RMB 1 Missing end quote +E$SubLrg: RMB 1 Too many subscripts +E$UnkPrc: RMB 1 Unknown procedure +E$MulPrc: RMB 1 Multiply defined procedure +E$DivZer: RMB 1 Divice by zero +E$TypMis: RMB 1 Operand type mismatch +E$StrOvf: RMB 1 String stack overflow +E$NoRout: RMB 1 Unimplemented routine +E$UndVar: RMB 1 Undefined variable +E$FltOvf: RMB 1 Floating Overflow +E$LnComp: RMB 1 Line with compiler error +E$ValRng: RMB 1 Value out of range for destination +E$SubOvf: RMB 1 Subroutine stack overflow +E$SubUnd: RMB 1 Subroutine stack underflow +E$SubRng: RMB 1 Subscript out of range +E$ParmEr: RMB 1 Paraemter error +E$SysOvf: RMB 1 System stack overflow +E$IOMism: RMB 1 I/O type mismatch +E$IONum: RMB 1 I/O numeric input format bad +E$IOConv: RMB 1 I/O conversion: number out of range +E$IllInp: RMB 1 Illegal input format +E$IOFRpt: RMB 1 I/O format repeat error +E$IOFSyn: RMB 1 I/O format syntax error +E$IllPNm: RMB 1 Illegal path number +E$WrSub: RMB 1 Wrong number of subscripts +E$NonRcO: RMB 1 Non-record type operand +E$IllA: RMB 1 Illegal argument +E$IllCnt: RMB 1 Illegal control structure +E$UnmCnt: RMB 1 Unmatched control structure +E$IllFOR: RMB 1 Illegal FOR variable +E$IllExp: RMB 1 Illegal expression type +E$IllDec: RMB 1 Illegal declarative statement +E$ArrOvf: RMB 1 Array size overflow +E$UndLin: RMB 1 Undefined line number +E$MltLin: RMB 1 Multiply defined line number +E$MltVar: RMB 1 Multiply defined variable +E$IllIVr: RMB 1 Illegal input variable +E$SeekRg: RMB 1 Seek out of range +E$NoData: RMB 1 Missing data statement + +* +* System Dependent Error Codes +* + +* Level 2 windowing error codes + RMB 183-* +E$IWTyp: RMB 1 Illegal window type +E$WADef: RMB 1 Window already defined +E$NFont: RMB 1 Font not found +E$StkOvf: RMB 1 Stack overflow +E$IllArg: RMB 1 Illegal argument + RMB 1 reserved +E$ICoord: RMB 1 Illegal coordinates +E$Bug: RMB 1 Bug (should never be returned) +E$BufSiz: RMB 1 Buffer size is too small +E$IllCmd: RMB 1 Illegal command +E$TblFul: RMB 1 Screen or window table is full +E$BadBuf: RMB 1 Bad/Undefined buffer number +E$IWDef: RMB 1 Illegal window definition +E$WUndef: RMB 1 Window undefined + +E$Up: RMB 1 Up arrow pressed on SCF I$ReadLn with PD.UP enabled +E$Dn: RMB 1 Down arrow pressed on SCF I$ReadLn with PD.DOWN enabled +E$Alias: RMB 1 + + +* +* Standard NitrOS-9 Error Codes +* + RMB 200-* +E$PthFul: RMB 1 Path Table full +E$BPNum: RMB 1 Bad Path Number +E$Poll: RMB 1 Polling Table Full +E$BMode: RMB 1 Bad Mode +E$DevOvf: RMB 1 Device Table Overflow +E$BMID: RMB 1 Bad Module ID +E$DirFul: RMB 1 Module Directory Full +E$MemFul: RMB 1 Process Memory Full +E$UnkSvc: RMB 1 Unknown Service Code +E$ModBsy: RMB 1 Module Busy +E$BPAddr: RMB 1 Bad Page Address +E$EOF: RMB 1 End of File + RMB 1 +E$NES: RMB 1 Non-Existing Segment +E$FNA: RMB 1 File Not Accesible +E$BPNam: RMB 1 Bad Path Name +E$PNNF: RMB 1 Path Name Not Found +E$SLF: RMB 1 Segment List Full +E$CEF: RMB 1 Creating Existing File +E$IBA: RMB 1 Illegal Block Address +E$HangUp: RMB 1 Carrier Detect Lost +E$MNF: RMB 1 Module Not Found + RMB 1 +E$DelSP: RMB 1 Deleting Stack Pointer memory +E$IPrcID: RMB 1 Illegal Process ID +E$BPrcID: EQU E$IPrcID Bad Process ID (formerly #238) + RMB 1 +E$NoChld: RMB 1 No Children +E$ISWI: RMB 1 Illegal SWI code +E$PrcAbt: RMB 1 Process Aborted +E$PrcFul: RMB 1 Process Table Full +E$IForkP: RMB 1 Illegal Fork Parameter +E$KwnMod: RMB 1 Known Module +E$BMCRC: RMB 1 Bad Module CRC +E$USigP: RMB 1 Unprocessed Signal Pending +E$NEMod: RMB 1 Non Existing Module +E$BNam: RMB 1 Bad Name +E$BMHP: RMB 1 (bad module header parity) +E$NoRAM: RMB 1 No (System) RAM Available +E$DNE: RMB 1 Directory not empty +E$NoTask: RMB 1 No available Task number + RMB $F0-* reserved +E$Unit: RMB 1 Illegal Unit (drive) +E$Sect: RMB 1 Bad Sector number +E$WP: RMB 1 Write Protect +E$CRC: RMB 1 Bad Check Sum +E$Read: RMB 1 Read Error +E$Write: RMB 1 Write Error +E$NotRdy: RMB 1 Device Not Ready +E$Seek: RMB 1 Seek Error +E$Full: RMB 1 Media Full +E$BTyp: RMB 1 Bad Type (incompatable) media +E$DevBsy: RMB 1 Device Busy +E$DIDC: RMB 1 Disk ID Change +E$Lock: RMB 1 Record is busy (locked out) +E$Share: RMB 1 Non-sharable file busy +E$DeadLk: RMB 1 I/O Deadlock error + endsect + + + IFEQ Level-1 + +******************************** +* Boot defs for NitrOS-9 Level 1 +* +* These defs are not strictly for 'Boot', but are for booting the +* system. +* +Bt.Start: EQU $EE00 Start address of the boot track in memory + +* Boot area size on Dragon is only 16 sectors=4K + IFNE DRAGON +Bt.Size: EQU $1000 Max size of boot file + ELSE +Bt.Size: EQU $1080 Maximum size of bootfile + ENDC + + ELSE + +****************************************** +* Boot defs for NitrOS-9 Level 2 and above +* +* These defs are not strictly for 'Boot', but are for booting the +* system. +* +Bt.Block: EQU $3B Block to map in for the 'OS9BOOT' screen +Bt.Flag: EQU $8A34 Flag in Bt.Block to verify that it's unchanged +Bt.Offst: EQU 2 Offset into the screen where the current ptr is +Bt.Start: EQU $ED00 Start address of the boot track in memory + + ENDC + +* Boot area on the Dragon starts on track 0 sector 2, imediatly +* after the blockmap. +* On the CoCo, the boot track is all of track 34 + + IFNE DRAGON +Bt.Track: EQU 0 Boot track +Bt.Sec: EQU 2 Start LSN of boot area on boot track + ELSE +Bt.Track: EQU 34 Boot track +Bt.Sec: EQU 0 Start LSN of boot area on boot track + ENDC + + + IFGT Level-2 +*************************** +* Level 3 Defs +* +* These definitions apply to NitrOS-9 Level 3 +* +L3.Start: EQU $2000 Start off at slot 1 +L3.Size: EQU $40 Go for 64 pages: 2 slots total +L3.Blks: EQU L3.Size/$20 Number of slots +L3.End: EQU L3.Start+L3.Size*$0100 end of L3 memory +L3.SCF: EQU $0660 SCF block ptr +L3.RBF: EQU L3.SCF+1 RBF block ptr + ENDC
--- a/lib/os9defs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1306 +0,0 @@ -******************************************************************** -* OS9Defs - NitrOS-9 System Definitions -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1985/08/29 KMZ -* Fixed DT.SBF/NFM values to 3/4 -* -* 1985/09/01 KMZ -* Added SS.FDInf, SS.Attr to accept 68K request thru NET. -* -* 1985/09/03 KMZ/Robert F. Doggett -* Eliminated E$BPrcID, made Error #238 become E$DNE for -* 68000 compatability. -* -* 1986/04/15 Mark G. Hawkins -* F$AlHRAM System call added for COCO. -* -* 1986/09/08 Mark G. Hawkins -* F$Alarm for COCO Clock Module. -* -* 1986/09/17 Mark G. Hawkins -* SS.Tone For COCO. -* -* 1986/09/23 Mark G. Hawkins -* Added F$NMLink and F$NMLoad for COCO. -* -* 1986/09/30 Mark G. Hawkins -* Added Reserved User $70 to $7f in sytem calls. -* -* 1986/09/30 Mark G. Hawkins -* Created Color Computer 3 Version of OS9Defs. -* -* 1998/10/03 Boisy G. Pitre -* Consoldated Level 1/Level 2 os9defs. -* -* 2002/04/04 Boisy G. Pitre -* Consoldated Level 2/Level 2 V3 os9defs. -* -* 2002/04/30 Boisy G. Pitre -* Added NitrOS-9 definitions. -* -* 2003/05/30 Boisy G. Pitre -* Added WD1002 sys vars to Level One section. -* -* 2003/06/02 Boisy G. Pitre -* Fixed incorrectly ordered D.X*** system globals for OS-9 Level One and -* changed the sizes from 2 to 3 bytes. -* DT.NFM is now the same for both Level One and Level Two. -* Added DT.CDFM type for future CD-ROM file manager -* -* 2003/11/05 Robert Gault -* Fixed MouseInf. Made it rmb 2 as it should be. Also changes to init and cc3io. -* -* 2005/11/02 P.Harvey-Smith -* Added definitions for boot areas on Dragon computers. -* -* 2006/03/03 Boisy G. Pitre -* Added F$Debug and D.DbgMem areas, common to all levels of NitrOS-9 - - NAM OS9Defs - IFEQ Level-1 - TTL NitrOS-9 Level 1 System Symbol Definitions - ELSE - IFEQ Level-2 - TTL NitrOS-9 Level 2 System Symbol Definitions - ELSE - TTL NitrOS-9 Level 3 System Symbol Definitions - ENDC - ENDC - -* Common definitions -true: EQU 1 useful name -false: EQU 0 useful name - - PAG -***************************************** -* System Service Request Code Definitions -* - csect -F$Link: RMB 1 Link to Module -F$Load: RMB 1 Load Module from File -F$UnLink: RMB 1 Unlink Module -F$Fork: RMB 1 Start New Process -F$Wait: RMB 1 Wait for Child Process to Die -F$Chain: RMB 1 Chain Process to New Module -F$Exit: RMB 1 Terminate Process -F$Mem: RMB 1 Set Memory Size -F$Send: RMB 1 Send Signal to Process -F$Icpt: RMB 1 Set Signal Intercept -F$Sleep: RMB 1 Suspend Process -F$SSpd: RMB 1 Suspend Process -F$ID: RMB 1 Return Process ID -F$SPrior: RMB 1 Set Process Priority -F$SSWI: RMB 1 Set Software Interrupt -F$PErr: RMB 1 Print Error -F$PrsNam: RMB 1 Parse Pathlist Name -F$CmpNam: RMB 1 Compare Two Names -F$SchBit: RMB 1 Search Bit Map -F$AllBit: RMB 1 Allocate in Bit Map -F$DelBit: RMB 1 Deallocate in Bit Map -F$Time: RMB 1 Get Current Time -F$STime: RMB 1 Set Current Time -F$CRC: RMB 1 Generate CRC ($17) - - IFGT Level-1 - -* NitrOS-9 Level 2 system calls -F$GPrDsc: RMB 1 Get Process Descriptor copy ($18) -F$GBlkMp: RMB 1 Get System Block Map copy ($19) -F$GModDr: RMB 1 Get Module Directory copy ($1A) -F$CpyMem: RMB 1 Copy External Memory ($1B) -F$SUser: RMB 1 Set User ID number ($1C) -F$UnLoad: RMB 1 Unlink Module by name ($1D) -F$Alarm: RMB 1 Color Computer 3 Alarm Call ($1E) - RMB 2 Reserved - For overlap of other systems ($1F) -F$NMLink: RMB 1 Color Computer 3 Non-Mapping Link ($21) -F$NMLoad: RMB 1 Color Computer 3 Non-Mapping Load ($22) - - ELSE - -* NitrOS-9 Level 1 system call padding - RMB 11 - - ENDC - -F$Debug: RMB 1 Drop the system into the debugger ($23) - - IFGT Level-1 - - RMB $25-* -F$TPS: RMB 1 Return System's Ticks Per Second -F$TimAlm: RMB 1 CoCo individual process alarm call - - ENDC - - RMB $27-* Beginning of System Reserved Calls -* NitrOS-9 common system calls -F$VIRQ: RMB 1 Install/Delete Virtual IRQ -F$SRqMem: RMB 1 System Memory Request -F$SRtMem: RMB 1 System Memory Return -F$IRQ: RMB 1 Enter IRQ Polling Table -F$IOQu: RMB 1 Enter I/O Queue -F$AProc: RMB 1 Enter Active Process Queue -F$NProc: RMB 1 Start Next Process -F$VModul: RMB 1 Validate Module -F$Find64: RMB 1 Find Process/Path Descriptor -F$All64: RMB 1 Allocate Process/Path Descriptor -F$Ret64: RMB 1 Return Process/Path Descriptor -F$SSvc: RMB 1 Service Request Table Initialization -F$IODel: RMB 1 Delete I/O Module - - IFGT Level-1 - -F$SLink: RMB 1 System Link -F$Boot: RMB 1 Bootstrap System -F$BtMem: RMB 1 Bootstrap Memory Request -F$GProcP: RMB 1 Get Process ptr -F$Move: RMB 1 Move Data (low bound first) -F$AllRAM: RMB 1 Allocate RAM blocks -F$AllImg: RMB 1 Allocate Image RAM blocks -F$DelImg: RMB 1 Deallocate Image RAM blocks -F$SetImg: RMB 1 Set Process DAT Image -F$FreeLB: RMB 1 Get Free Low Block -F$FreeHB: RMB 1 Get Free High Block -F$AllTsk: RMB 1 Allocate Process Task number -F$DelTsk: RMB 1 Deallocate Process Task number -F$SetTsk: RMB 1 Set Process Task DAT registers -F$ResTsk: RMB 1 Reserve Task number -F$RelTsk: RMB 1 Release Task number -F$DATLog: RMB 1 Convert DAT Block/Offset to Logical -F$DATTmp: RMB 1 Make temporary DAT image (Obsolete) -F$LDAXY: RMB 1 Load A [X,[Y]] -F$LDAXYP: RMB 1 Load A [X+,[Y]] -F$LDDDXY: RMB 1 Load D [D+X,[Y]] -F$LDABX: RMB 1 Load A from 0,X in task B -F$STABX: RMB 1 Store A at 0,X in task B -F$AllPrc: RMB 1 Allocate Process Descriptor -F$DelPrc: RMB 1 Deallocate Process Descriptor -F$ELink: RMB 1 Link using Module Directory Entry -F$FModul: RMB 1 Find Module Directory Entry -F$MapBlk: RMB 1 Map Specific Block -F$ClrBlk: RMB 1 Clear Specific Block -F$DelRAM: RMB 1 Deallocate RAM blocks -F$GCMDir: RMB 1 Pack module directory -F$AlHRAM: RMB 1 Allocate HIGH RAM Blocks - -* Alan DeKok additions -F$ReBoot: RMB 1 Reboot machine (reload OS9Boot) or drop to RSDOS -F$CRCMod: RMB 1 CRC mode, toggle or report current status -F$XTime: RMB 1 Get Extended time packet from RTC (fractions of second) -F$VBlock: RMB 1 Verify modules in a block of memory, add to module directory - - ENDC - -* -* Numbers $70 through $7F are reserved for user definitions -* - RMB $70-* - - IFEQ Level-1 - - RMB 16 Reserved for user definition - - ELSE - -F$RegDmp: RMB 1 Ron Lammardo's debugging register dump -F$NVRAM: RMB 1 Non Volatile RAM (RTC battery backed static) read/write - - RMB $80-* Reserved for user definitions - ENDC - endsect - - PAG -************************************** -* I/O Service Request Code Definitions -* - csect - RMB $80 -I$Attach: RMB 1 Attach I/O Device -I$Detach: RMB 1 Detach I/O Device -I$Dup: RMB 1 Duplicate Path -I$Create: RMB 1 Create New File -I$Open: RMB 1 Open Existing File -I$MakDir: RMB 1 Make Directory File -I$ChgDir: RMB 1 Change Default Directory -I$Delete: RMB 1 Delete File -I$Seek: RMB 1 Change Current Position -I$Read: RMB 1 Read Data -I$Write: RMB 1 Write Data -I$ReadLn: RMB 1 Read Line of ASCII Data -I$WritLn: RMB 1 Write Line of ASCII Data -I$GetStt: RMB 1 Get Path Status -I$SetStt: RMB 1 Set Path Status -I$Close: RMB 1 Close Path -I$DeletX: RMB 1 Delete from current exec dir - endsect - -******************* -* File Access Modes -* -READ.: EQU %00000001 -WRITE.: EQU %00000010 -UPDAT.: EQU READ.+WRITE. -EXEC.: EQU %00000100 -PREAD.: EQU %00001000 -PWRIT.: EQU %00010000 -PEXEC.: EQU %00100000 -SHARE.: EQU %01000000 -DIR.: EQU %10000000 -ISIZ.: EQU %00100000 - -************** -* Signal Codes -* - csect -S$Kill: RMB 1 Non-Interceptable Abort -S$Wake: RMB 1 Wake-up Sleeping Process -S$Abort: RMB 1 Keyboard Abort -S$Intrpt: RMB 1 Keyboard Interrupt -S$Window: RMB 1 Window Change -S$HUP: EQU S$Window Hang up -S$Alarm: RMB 1 CoCo individual process' alarm signal - endsect - - PAG -********************************** -* Status Codes for GetStat/GetStat -* - csect -SS.Opt: RMB 1 Read/Write PD Options -SS.Ready: RMB 1 Check for Device Ready -SS.Size: RMB 1 Read/Write File Size -SS.Reset: RMB 1 Device Restore -SS.WTrk: RMB 1 Device Write Track -SS.Pos: RMB 1 Get File Current Position -SS.EOF: RMB 1 Test for End of File -SS.Link: RMB 1 Link to Status routines -SS.ULink: RMB 1 Unlink Status routines -SS.Feed: RMB 1 Issue form feed -SS.Frz: RMB 1 Freeze DD. information -SS.SPT: RMB 1 Set DD.TKS to given value -SS.SQD: RMB 1 Sequence down hard disk -SS.DCmd: RMB 1 Send direct command to disk -SS.DevNm: RMB 1 Return Device name (32-bytes at [X]) -SS.FD: RMB 1 Return File Descriptor (Y-bytes at [X]) -SS.Ticks: RMB 1 Set Lockout honor duration -SS.Lock: RMB 1 Lock/Release record -SS.DStat: RMB 1 Return Display Status (CoCo) -SS.Joy: RMB 1 Return Joystick Value (CoCo) -SS.BlkRd: RMB 1 Block Read -SS.BlkWr: RMB 1 Block Write -SS.Reten: RMB 1 Retension cycle -SS.WFM: RMB 1 Write File Mark -SS.RFM: RMB 1 Read past File Mark -SS.ELog: RMB 1 Read Error Log -SS.SSig: RMB 1 Send signal on data ready -SS.Relea: RMB 1 Release device -SS.AlfaS: RMB 1 Return Alfa Display Status (CoCo, SCF/GetStat) -SS.Attr: EQU SS.AlfaS To serve 68K/RBF/SetStat only, thru NET -SS.Break: RMB 1 Send break signal out acia -SS.RsBit: RMB 1 Reserve bitmap sector (do not allocate in) LSB(X)=sct# - RMB 1 Reserved -SS.FDInf: EQU $20 To serve 68K/RBF/GetStat only, thru NET - RMB 4 Reserve $20-$23 for Japanese version (Hoshi) -SS.SetMF: RMB 1 Reserve $24 for Gimix G68 (Flex compatability?) -SS.Cursr: RMB 1 Cursor information for COCO -SS.ScSiz: RMB 1 Return screen size for COCO -SS.KySns: RMB 1 Getstat/SetStat for COCO keyboard -SS.ComSt: RMB 1 Getstat/SetStat for Baud/Parity -SS.Open: RMB 1 SetStat to tell driver a path was opened -SS.Close: RMB 1 SetStat to tell driver a path was closed -SS.HngUp: RMB 1 SetStat to tell driver to hangup phone -SS.FSig: RMB 1 New signal for temp locked files -SS.DSize: EQU SS.ScSiz Return disk size (RBF GetStat) -SS.VarSect: EQU SS.DStat Variable Sector Size (RBF GetStat) - -* System Specific and User defined codes above $80 - RMB $80-* -SS.AAGBf: RMB 1 SetStat to Allocate Additional Graphic Buffer -SS.SLGBf: RMB 1 SetStat to Select a different Graphic Buffer -SS.Mount: RMB 1 Network 4 Mount Setstat -SS.RdNet: RMB 1 Read Raw Sector from Network 4 Omnidrive -SS.MpGPB: RMB 1 SetStat to request a Get/Put Buffer be mapped in workspace -SS.Slots: RMB 1 Network 4 slots? getstat - - IFGT Level-1 - -* Level 2 Windowing -SS.WnSet: RMB 1 Set up High Level Windowing Information -SS.MnSel: RMB 1 Request High level Menu Handler take determine next event -SS.SBar: RMB 1 SetStat to set position block on Window scroll bars -SS.Mouse: RMB 1 Return Mouse information packet (COCO) -SS.MsSig: RMB 1 SetStat to tell driver to send signal on mouse event -SS.AScrn: RMB 1 Allocate a screen for application poking -SS.DScrn: RMB 1 Display a screen allocated by SS.AScrn -SS.FScrn: RMB 1 Free a screen allocated by SS.AScrn -SS.PScrn: RMB 1 Polymorph Screen into different screen type -SS.ScInf: RMB 1 Get Current screen info for direct writes - RMB 1 Reserved -SS.Palet: RMB 1 Return palette information -SS.Montr: RMB 1 Get and Set Monitor Type -SS.ScTyp: RMB 1 Get screen type information -SS.GIP: RMB 1 Global Input Parameters (SetStat) -SS.UMBar: RMB 1 update menu bar (SetStat) -SS.FBRgs: RMB 1 return color registers (GetStat) -SS.DfPal: RMB 1 set/return default palette registers (Getstat/Setstat) -SS.Tone: RMB 1 Generate a tone using 6 bit sound -SS.GIP2: RMB 1 Global Input Params #2 (L2V3) -SS.AnPal: RMB 1 Animate palettes (L2V3) -SS.FndBf: RMB 1 Find named buffer (L2V3) - -* sc6551 defined -SS.CDSta: EQU SS.GIP2 -SS.CDSig: EQU SS.AnPal -SS.CDRel: EQU SS.FndBf - ELSE -* These are wide open in Level 1 - RMB 19 - -* sc6551 defined -SS.CDSta: RMB 1 -SS.CDSig: RMB 1 -SS.CDRel: RMB 1 - ENDC - - RMB $A0-* -* -* New Default SCF input buffer Set status call -SS.Fill: RMB 1 Pre-load SCF device input buffer -SS.Hist: RMB 1 Enable command-line history easily - - RMB $B0-* -* -* New WDDisk get/set status calls -SS.ECC: RMB 1 ECC corrected data error enable/disable (GetStat/SetStat) - endsect - -* - IFGT Level-1 - -* VRN get/set status calls. Named by Alan DeKok. -SS.VCtr: EQU $80 Return FS2 total VIRQ counter -SS.VSig: EQU $81 Return FS2 number of signals sent - -SS.FClr: EQU $81 Set/clear FS2 VIRQ -SS.FSet: EQU $C7 Set FS2+ VIRQ -SS.KSet: EQU $C8 Set KQ3 VIRQ -SS.KClr: EQU $C9 Clr KQ3 VIRQ -SS.ARAM: EQU $CA Allocate RAM blocks -SS.DRAM: EQU $CB De-allocate RAM blocks - -* SDisk 3 Definition Equates -SS.DRead: EQU SS.AAGBf SDisk3 Direct Sector Read ($80) -SS.DWrit: EQU SS.DRead SDisk3 Direct sector Write ($80) -SS.UnFrz: EQU SS.SLGBf SDisk3 UNFreeze DD info ($81) -SS.MOFF: EQU SS.Mount SDisk3 fast motor off call ($82) -SS.MoTim: EQU SS.RdNet SDisk3 Set motor shut off time ($83) -SS.SDRD: EQU SS.MpGPB SDisk3 System direct read ($84) -SS.SDWRT: EQU SS.SDRD SDisk3 System direct writes ($84) -SS.Sleep: EQU SS.Slots SDisk3 (DMC ONLY) Enable/disable F$Sleep calls in read/write 1773 I/O ($85) -SS.DrvCh: EQU SS.WnSet SDisk3 (DMC ONLY) Set drive number to cache, or return drive number being cached ($86) - - ENDC - - TTL Direct Page Definitions - PAG - -********************************** -* Direct Page Variable Definitions -* - csect -D.WDAddr: RMB 2 FHL/Isted WD1002-05 interface base address -D.WDBtDr: RMB 1 FHL/Isted WD1002-05 boot physical device drive num. -D.SWPage: RMB 1 SmartWatch page # (see clock2_smart) - RMB 5 -D.COCOXT: RMB 1 Busy flag for CoCo-XT driver (one drive at a time) -D.DbgMem: RMB 2 Debug memory pointer -D.DWSubAddr: RMB 2 DriveWire subroutine module pointer -D.DWStat: RMB 2 DriveWire statics page - - RMB $20-* - - IFEQ Level-1 - -* Level 1 DP vars -D.FMBM: RMB 4 Free memory bit map pointers -D.MLIM: RMB 2 Memory limit $24 -D.ModDir: RMB 4 Module directory $26 -D.Init: RMB 2 Rom base address $2A -D.SWI3: RMB 2 Swi3 vector $2C -D.SWI2: RMB 2 Swi2 vector $2E -D.FIRQ: RMB 2 Firq vector $30 -D.IRQ: RMB 2 Irq vector $32 -D.SWI: RMB 2 Swi vector $34 -D.NMI: RMB 2 Nmi vector $36 -D.SvcIRQ: RMB 2 Interrupt service entry $38 -D.Poll: RMB 2 Interrupt polling routine $3A -D.UsrIRQ: RMB 2 User irq routine $3C -D.SysIRQ: RMB 2 System irq routine $3E -D.UsrSvc: RMB 2 User service request routine $40 -D.SysSvc: RMB 2 System service request routine $42 -D.UsrDis: RMB 2 User service request dispatch table -D.SysDis: RMB 2 System service reuest dispatch table -D.Slice: RMB 1 Process time slice count $48 -D.PrcDBT: RMB 2 Process descriptor block address $49 -D.Proc: RMB 2 Process descriptor address $4B -D.AProcQ: RMB 2 Active process queue $4D -D.WProcQ: RMB 2 Waiting process queue $4F -D.SProcQ: RMB 2 Sleeping process queue $51 -D.Time: EQU * Time -D.Year: RMB 1 $53 -D.Month: RMB 1 $54 -D.Day: RMB 1 $55 -D.Hour: RMB 1 $56 -D.Min: RMB 1 $57 -D.Sec: RMB 1 $58 -D.Tick: RMB 1 $59 -D.TSec: RMB 1 Ticks / second $5A -D.TSlice: RMB 1 Ticks / time-slice $5B -D.IOML: RMB 2 I/O mgr free memory low bound $5C -D.IOMH: RMB 2 I/O mgr free memory hi bound $5E -D.DevTbl: RMB 2 Device driver table addr $60 -D.PolTbl: RMB 2 Irq polling table addr $62 -D.PthDBT: RMB 2 Path descriptor block table addr $64 -D.BTLO: RMB 2 Bootstrap low address $66 -D.BTHI: RMB 2 Bootstrap hi address $68 -D.DMAReq: RMB 1 DMA in use flag $6A -D.AltIRQ: RMB 2 Alternate IRQ vector (CC) $6B -D.KbdSta: RMB 2 Keyboard scanner static storage (CC) $6D -D.DskTmr: RMB 2 Disk Motor Timer (CC) $6F -D.CBStrt: RMB 16 reserved for CC warmstart ($71) -D.Clock: RMB 2 Address of Clock Tick Routine (CC) $81 -D.Boot: RMB 1 Bootstrap attempted flag -D.URtoSs: RMB 2 address of user to system routine (VIRQ) $84 -D.CLTb: RMB 2 Pointer to clock interrupt table (VIRQ) $86 -D.MDREG: RMB 1 6309 MD (mode) shadow register $88 (added in V2.01.00) -D.CRC: RMB 1 CRC checking mode flag $89 (added in V2.01.00) -D.Clock2: RMB 2 CC Clock2 entry address - - RMB $100-* -D.XSWI3: RMB 3 -D.XSWI2: RMB 3 -D.XSWI: RMB 3 -D.XNMI: RMB 3 -D.XIRQ: RMB 3 -D.XFIRQ: RMB 3 - -* Table Sizes -BMAPSZ: EQU 32 Bitmap table size -SVCTNM: EQU 2 Number of service request tables -SVCTSZ: EQU (256-BMAPSZ)/SVCTNM-2 Service request table size - - ELSE - -* Level 2 DP vars -D.Tasks: RMB 2 Task User Table -D.TmpDAT: RMB 2 Temporary DAT Image stack -D.Init: RMB 2 Initialization Module ptr -D.Poll: RMB 2 Interrupt Polling Routine ptr -D.Time: EQU * System Time -D.Year: RMB 1 -D.Month: RMB 1 -D.Day: RMB 1 -D.Hour: RMB 1 -D.Min: RMB 1 -D.Sec: RMB 1 -D.Tick: RMB 1 -D.Slice: RMB 1 current slice remaining -D.TSlice: RMB 1 Ticks per Slice -D.Boot: RMB 1 Bootstrap attempted flag -D.MotOn: RMB 1 Floppy Disk Motor-On time out -D.ErrCod: RMB 1 Reset Error Code -D.Daywk: RMB 1 day of week, com-trol clock -D.TkCnt: RMB 1 Tick Counter -D.BtPtr: RMB 2 Address of Boot in System Address space -D.BtSz: RMB 2 Size of Boot - - IFNE H6309 -D.MDREG: RMB 1 6309 MD (mode) shadow register - ELSE - RMB 1 Currently unused in NitrOS-9/6809 - ENDC - -D.CRC: RMB 1 CRC checking mode flag - -D.Tenths: RMB 1 Tenths and hundredths of second for F$Xtime -D.Task1N: RMB 1 Map type 1 task number*2 - offset into [D.TskIPt] -D.Quick: RMB 1 Quick system call return flag - 0 =stack is at $FEE1 -D.QIRQ: RMB 1 Quick IRQ flag - 0 =IRQ wasn't clock, so quick return - - RMB $40-* -D.BlkMap: RMB 4 Memory Block Map ptr -D.ModDir: RMB 4 Module Directory ptrs -D.PrcDBT: RMB 2 Process Descriptor Block Table ptr -D.SysPrc: RMB 2 System Process Descriptor ptr -D.SysDAT: RMB 2 System DAT Image ptr -D.SysMem: RMB 2 System Memory Map ptr -D.Proc: RMB 2 Current Process ptr -D.AProcQ: RMB 2 Active Process Queue -D.WProcQ: RMB 2 Waiting Process Queue -D.SProcQ: RMB 2 Sleeping Process Queue -D.ModEnd: RMB 2 Module Directory end ptr -D.ModDAT: RMB 2 Module Dir DAT image end ptr -D.CldRes: RMB 2 Cold Restart vector -D.BtBug: RMB 3 Boot debug information -D.Pipe: RMB 2 - - RMB $6B-* -D.Crash: RMB 6 Pointer to CC Crash Routine -D.CBStrt: RMB $B Reserved for CC warmstart ($71) -D.QCnt: RMB 1 Count of number of quick system calls performed - - RMB $80-* -D.DevTbl: RMB 2 I/O Device Table -D.PolTbl: RMB 2 I/O Polling Table - RMB 4 reserved -D.PthDBT: RMB 2 Path Descriptor Block Table ptr -D.DMAReq: RMB 1 DMA Request flag - -******** -* CoCo 3 STUFF COMES NEXT -* This area is used for the CoCo Hardware Registers -* - RMB $90-* -D.HINIT: RMB 1 GIME INIT0 register (hardware setup $FF90) -D.TINIT: RMB 1 GIME INIT1 register (timer/task register $FF91) -D.IRQER: RMB 1 Interrupt enable regsiter ($FF92) -D.FRQER: RMB 1 Fast Interrupt enable register ($FF93) -D.TIMMS: RMB 1 Timer most significant nibble ($FF94) -D.TIMLS: RMB 1 Timer least significant byte ($FF95) -D.RESV1: RMB 1 reserved register ($FF96) -D.RESV2: RMB 1 reserved register ($FF97) -D.VIDMD: RMB 1 video mode register ($FF98) -D.VIDRS: RMB 1 video resolution register ($FF99) -D.BORDR: RMB 1 border register ($FF9A) -D.RESV3: RMB 1 reserved register ($FF9B) -D.VOFF2: RMB 1 vertical scroll/offset 2 register ($FF9C) -D.VOFF1: RMB 1 vertical offset 1 register ($FF9D) -D.VOFF0: RMB 1 vertical offset 0 register ($FF9E) -D.HOFF0: RMB 1 horizontal offset 0 register ($FF9F) -D.Speed: RMB 1 Speed of COCO CPU 0=slow,1=fast ($A0) -D.TskIPt: RMB 2 Task image Pointer table (CC) ($A1) -D.MemSz: RMB 1 128/512K memory flag (CC) ($A3) -D.SSTskN: RMB 1 System State Task Number (COCO) ($A4) -D.CCMem: RMB 2 Pointer to beginning of CC Memory ($A5) -D.CCStk: RMB 2 Pointer to top of CC Memory ($A7) -D.Flip0: RMB 2 Change to Task 0 ($A9) -D.Flip1: RMB 2 Change to reserved Task 1 ($AB) -D.VIRQ: RMB 2 VIRQ Polling routine ($AD) -D.IRQS: RMB 1 IRQ shadow register (CC Temporary) ($AF) -D.CLTb: RMB 2 VIRQ Table address ($B0) -D.AltIRQ: RMB 2 Alternate IRQ Vector (CC) ($B2) -D.GPoll: RMB 2 CC GIME IRQ enable/disable toggle -D.Clock2: RMB 2 CC Clock2 entry address - RMB $C0-* -D.SysSvc: RMB 2 System Service Routine entry -D.SysDis: RMB 2 System Service Dispatch Table ptr -D.SysIRQ: RMB 2 System IRQ Routine entry -D.UsrSvc: RMB 2 User Service Routine entry -D.UsrDis: RMB 2 User Service Dispatch Table ptr -D.UsrIRQ: RMB 2 User IRQ Routine entry -D.SysStk: RMB 2 System stack -D.SvcIRQ: RMB 2 In-System IRQ service -D.SysTsk: RMB 1 System Task number - RMB $E0-* -D.Clock: RMB 2 -D.XSWI3: RMB 2 -D.XSWI2: RMB 2 -D.XFIRQ: RMB 2 -D.XIRQ: RMB 2 -D.XSWI: RMB 2 -D.XNMI: RMB 2 -D.ErrRst: RMB 2 -D.SysVec: RMB 2 F$xxx system call vector for NitrOS-9 Level 3 -D.SWI3: RMB 2 -D.SWI2: RMB 2 -D.FIRQ: RMB 2 -D.IRQ: RMB 2 -D.SWI: RMB 2 -D.NMI: RMB 2 - -************************* -* Level 2 Block Map flags -* -NotRAM: EQU %10000000 Block Not RAM flag -VidRAM: EQU %00000100 Block is being used as Video RAM -ModBlock: EQU %00000010 Module in Block -RAMinUse: EQU %00000001 RAM Block in use flag -* -* Service Dispatch Table special entries -* -IOEntry: EQU 254 - - ENDC - endsect - - TTL Structure Formats - PAG -************************************ -* Module Directory Entry Definitions -* - csect - IFGT Level-1 -MD$MPDAT: RMB 2 Module DAT Image ptr -MD$MBSiz: RMB 2 Memory Block size - ENDC -MD$MPtr: RMB 2 Module ptr -MD$Link: RMB 2 Module Link count -MD$ESize: EQU * Module Directory Entry size - endsect - -************************************ -* Module Definitions -* -* Universal Module Offsets -* - csect -M$ID: RMB 2 ID Code -M$Size: RMB 2 Module Size -M$Name: RMB 2 Module Name -M$Type: RMB 1 Type / Language -M$Revs: RMB 1 Attributes / Revision Level -M$Parity: RMB 1 Header Parity -M$IDSize: EQU * Module ID Size -* -* Type-Dependent Module Offsets -* -* System, File Manager, Device Driver, Program Module -* -M$Exec: RMB 2 Execution Entry Offset -* -* Device Driver, Program Module -* -M$Mem: RMB 2 Stack Requirement -* -* Device Driver, Device Descriptor Module -* -M$Mode: RMB 1 Device Driver Mode Capabilities -* -* Device Descriptor Module -* - - RMB M$IDSize-* -M$FMgr: RMB 2 File Manager Name Offset -M$PDev: RMB 2 Device Driver Name Offset - RMB 1 M$Mode (defined above) -M$Port: RMB 3 Port Address -M$Opt: RMB 1 Device Default Options -M$DTyp: RMB 1 Device Type -IT.DTP: EQU M$DTyp Descriptor type offset - -* -* Configuration Module Entry Offsets -* - RMB M$IDSize-* -MaxMem: RMB 3 Maximum Free Memory -PollCnt: RMB 1 Entries in Interrupt Polling Table -DevCnt: RMB 1 Entries in Device Table -InitStr: RMB 2 Initial Module Name -SysStr: RMB 2 System Device Name -StdStr: RMB 2 Standard I/O Pathlist -BootStr: RMB 2 Bootstrap Module name -ProtFlag: RMB 1 Write protect enable flag - -OSLevel: RMB 1 OS level -OSVer: RMB 1 OS version -OSMajor: RMB 1 OS major -OSMinor: RMB 1 OS minor -Feature1: RMB 1 feature byte 1 -Feature2: RMB 1 feature byte 2 -OSName: RMB 2 OS revision name string (nul terminated) -InstallName: RMB 2 installation name string (nul terminated) - RMB 4 reserved for future use - - IFGT Level-1 -* -- VTIO area -- (NitrOS-9 Level 2 and above) * -MonType: RMB 1 Monitor type (0=CMP,1=RGB,2=MONO) -MouseInf: RMB 2 Mouse resolution/Mouse port; was 1, major error RG. -KeyRptS: RMB 1 Key repeat start constant -KeyRptD: RMB 1 Key repeat delay constant - ENDC - endsect - -* Feature1 byte definitions -CRCOn: EQU %00000001 CRC checking on -CRCOff: EQU %00000000 CRC checking off -Proc6809: EQU %00000000 6809 procesor -Proc6309: EQU %00000010 6309 procesor - - PAG -************************** -* Module Field Definitions -* -* ID Field - First two bytes of a NitrOS-9 module -* -M$ID1: EQU $87 Module ID code byte one -M$ID2: EQU $CD Module ID code byte two -M$ID12: EQU M$ID1*256+M$ID2 - -* -* Module Type/Language Field Masks -* -TypeMask: EQU %11110000 Type Field -LangMask: EQU %00001111 Language Field - -* -* Module Type Values -* -Devic: EQU $F0 Device Descriptor Module -Drivr: EQU $E0 Physical Device Driver -FlMgr: EQU $D0 File Manager -Systm: EQU $C0 System Module -ShellSub: EQU $50 Shell+ shell sub module -Data: EQU $40 Data Module -Multi: EQU $30 Multi-Module -Sbrtn: EQU $20 Subroutine Module -Prgrm: EQU $10 Program Module - -* -* Module Language Values -* -Objct: EQU 1 6809 Object Code Module -ICode: EQU 2 Basic09 I-code -PCode: EQU 3 Pascal P-code -CCode: EQU 4 C I-code -CblCode: EQU 5 Cobol I-code -FrtnCode: EQU 6 Fortran I-code -Obj6309: EQU 7 6309 object code -* -* Module Attributes / Revision byte -* -* Field Masks -* -AttrMask: EQU %11110000 Attributes Field -RevsMask: EQU %00001111 Revision Level Field -* -* Attribute Flags -* -ReEnt: EQU %10000000 Re-Entrant Module -ModProt: EQU %01000000 Gimix Module protect bit (0=protected, 1=write enable) -ModNat: EQU %00100000 6309 native mode attribute - -******************** -* Device Type Values -* -* These values define various classes of devices, which are -* managed by a file manager module. The Device Type is embedded -* in a device's device descriptor. -* -DT.SCF: EQU 0 Sequential Character File Manager -DT.RBF: EQU 1 Random Block File Manager -DT.Pipe: EQU 2 Pipe File Manager -DT.SBF: EQU 3 Sequential Block File Manager -DT.NFM: EQU 4 Network File Manager -DT.CDFM: EQU 5 CD-ROM File Manager - - -********************* -* CRC Result Constant -* -CRCCon1: EQU $80 -CRCCon23: EQU $0FE3 - - TTL Process Information - PAG -******************************** -* Process Descriptor Definitions -* - IFEQ Level-1 - -* Level 1 process descriptor defs -DefIOSiz: EQU 12 -NumPaths: EQU 16 Number of Local Paths - - csect -P$ID: RMB 1 Process ID -P$PID: RMB 1 Parent's ID -P$SID: RMB 1 Sibling's ID -P$CID: RMB 1 Child's ID -P$SP: RMB 2 Stack ptr -P$CHAP: RMB 1 process chapter number -P$ADDR: RMB 1 user address beginning page number -P$PagCnt: RMB 1 Memory Page Count -P$User: RMB 2 User Index $09 -P$Prior: RMB 1 Priority $0B -P$Age: RMB 1 Age $0C -P$State: RMB 1 Status -P$Queue: RMB 2 Queue Link (Process ptr) $0E -P$IOQP: RMB 1 Previous I/O Queue Link (Process ID) $10 -P$IOQN: RMB 1 Next I/O Queue Link (Process ID) -P$PModul: RMB 2 Primary Module -P$SWI: RMB 2 SWI Entry Point -P$SWI2: RMB 2 SWI2 Entry Point -P$SWI3: RMB 2 SWI3 Entry Point $18 -P$DIO: RMB DefIOSiz default I/O ptrs $1A -P$PATH: RMB NumPaths I/O path table $26 -P$Signal: RMB 1 Signal Code $36 -P$SigVec: RMB 2 Signal Intercept Vector -P$SigDat: RMB 2 Signal Intercept Data Address -P$NIO: RMB 4 additional dio pointers for net - RMB $40-* unused -P$Size: EQU * Size of Process Descriptor - endsect - -* -* Process State Flags -* -SysState: EQU %10000000 -TimSleep: EQU %01000000 -TimOut: EQU %00100000 -ImgChg: EQU %00010000 -Condem: EQU %00000010 -Dead: EQU %00000001 - - ELSE - -* Level 2 process descriptor defs -DefIOSiz: EQU 16 Default I/O Data Length -NefIOSiz: EQU 12 On-Net Default I/O Data Length -NumPaths: EQU 16 Number of Local Paths - - csect -P$ID: RMB 1 Process ID -P$PID: RMB 1 Parent's ID -P$SID: RMB 1 Sibling's ID -P$CID: RMB 1 Child's ID -P$SP: RMB 2 Stack ptr -P$Task: RMB 1 Task Number -P$PagCnt: RMB 1 Memory Page Count -P$User: RMB 2 User Index -P$Prior: RMB 1 Priority -P$Age: RMB 1 Age -P$State: RMB 1 Status -P$Queue: RMB 2 Queue Link (Process ptr) -P$IOQP: RMB 1 Previous I/O Queue Link (Process ID) -P$IOQN: RMB 1 Next I/O Queue Link (Process ID) -P$PModul: RMB 2 Primary Module -P$SWI: RMB 2 SWI Entry Point -P$SWI2: RMB 2 SWI2 Entry Point -P$SWI3: RMB 2 SWI3 Entry Point -P$Signal: RMB 1 Signal Code -P$SigVec: RMB 2 Signal Intercept Vector -P$SigDat: RMB 2 Signal Intercept Data Address -P$DeadLk: RMB 1 Dominant proc ID if I/O locked - RMB $20-* unused -P$DIO: RMB DefIOSiz Default I/O ptrs -P$Path: RMB NumPaths I/O Path Table -P$DATImg: RMB 64 DAT Image -P$Links: RMB 32 Block Link counts -P$NIO: RMB 6*2 additional DIO ptrs for net, compatible with 68k -P$SelP: RMB 1 Selected Path for COCO Windows (Default 0) -P$UTicks: RMB 4 proc User Tick counter (L2V3) -P$STicks: RMB 4 proc System Tick counter (L2V3) -P$FCalls: RMB 4 proc F$ call counter (L2V3) -P$ICalls: RMB 4 proc I$ call counter (L2V3) -P$DatBeg: RMB 3 proc Date of creation (Y/M/D) (L2V3) -P$TimBeg: RMB 3 proc Time of creation (H/M/S) (L2V3) -P$Alarm: RMB 6 - RMB $200-* Local stack -P$Stack: EQU * Top of Stack -P$Size: EQU * Size of Process Descriptor - endsect - -* -* Process State Flags -* -SysState: EQU %10000000 -TimSleep: EQU %01000000 -TimOut: EQU %00100000 -ImgChg: EQU %00010000 -Suspend: EQU %00001000 -Condem: EQU %00000010 -Dead: EQU %00000001 - - ENDC - - TTL NitrOS-9 I/O Symbolic Definitions - PAG -************************* -* Path Descriptor Offsets -* - csect -PD.PD: RMB 1 Path Number -PD.MOD: RMB 1 Mode (Read/Write/Update) -PD.CNT: RMB 1 Number of Open Images -PD.DEV: RMB 2 Device Table Entry Address -PD.CPR: RMB 1 Current Process -PD.RGS: RMB 2 Caller's Register Stack -PD.BUF: RMB 2 Buffer Address -PD.FST: RMB 32-* File Manager's Storage -PD.OPT: EQU * PD GetSts(0) Options -PD.DTP: RMB 1 Device Type - RMB 64-* Path options -PDSIZE: EQU * - endsect - -* -* Pathlist Special Symbols -* -PDELIM: EQU '/ Pathlist Name Separator -PDIR: EQU '. Directory -PENTIR: EQU '@ Entire Device - - PAG -**************************** -* File Manager Entry Offsets -* - csect -FMCREA: RMB 3 Create (Open New) File -FMOPEN: RMB 3 Open File -FMMDIR: RMB 3 Make Directory -FMCDIR: RMB 3 Change Directory -FMDLET: RMB 3 Delete File -FMSEEK: RMB 3 Position File -FMREAD: RMB 3 Read from File -FMWRIT: RMB 3 Write to File -FMRDLN: RMB 3 ReadLn -FMWRLN: RMB 3 WritLn -FMGSTA: RMB 3 Get File Status -FMSSTA: RMB 3 Set File Status -FMCLOS: RMB 3 Close File - endsect - -***************************** -* Device Driver Entry Offsets -* - csect -D$INIT: RMB 3 Device Initialization -D$READ: RMB 3 Read from Device -D$WRIT: RMB 3 Write to Device -D$GSTA: RMB 3 Get Device Status -D$PSTA: RMB 3 Put Device Status -D$TERM: RMB 3 Device Termination - endsect - -********************* -* Device Table Format -* - csect -V$DRIV: RMB 2 Device Driver module -V$STAT: RMB 2 Device Driver Static storage -V$DESC: RMB 2 Device Descriptor module -V$FMGR: RMB 2 File Manager module -V$USRS: RMB 1 use count - IFGT Level-1 -V$DRIVEX: RMB 2 Device Driver execution address -V$FMGREX: RMB 2 File Manager execution address - ENDC -DEVSIZ: EQU * - endsect - -******************************* -* Device Static Storage Offsets -* - csect -V.PAGE: RMB 1 Port Extended Address -V.PORT: RMB 2 Device 'Base' Port Address -V.LPRC: RMB 1 Last Active Process ID -V.BUSY: RMB 1 Active Process ID (0=UnBusy) -V.WAKE: RMB 1 Active PD if Driver MUST Wake-up -V.USER EQU * Driver Allocation Origin - endsect - -******************************** -* Interrupt Polling Table Format -* - csect -Q$POLL: RMB 2 Absolute Polling Address -Q$FLIP: RMB 1 Flip (EOR) Byte ..normally Zero -Q$MASK: RMB 1 Polling Mask (after Flip) -Q$SERV: RMB 2 Absolute Service routine Address -Q$STAT: RMB 2 Static Storage Address -Q$PRTY: RMB 1 Priority (Low Numbers=Top Priority) - IFGT Level-1 -Q$MAP: RMB 2 NitrOS-9 Level 2 and above - ENDC -POLSIZ: EQU * - endsect - -******************** -* VIRQ packet format -* - csect -Vi.Cnt: RMB 2 count down counter -Vi.Rst: RMB 2 reset value for counter -Vi.Stat: RMB 1 status byte -Vi.PkSz: EQU * - endsect - -Vi.IFlag: EQU %00000001 status byte virq flag - - PAG -************************************* -* Machine Characteristics Definitions -* -R$CC: EQU 0 Condition Codes register -R$A: EQU 1 A Accumulator -R$B: EQU 2 B Accumulator -R$D: EQU R$A Combined A:B Accumulator - IFNE H6309 -R$E: EQU 3 E Accumulator -R$F: EQU 4 F Accumulator -R$W: EQU R$E Combined E:F Accumulator -R$Q: EQU R$A Combined A:B:E:F Accumulator -R$DP: EQU 5 Direct Page register -R$X: EQU 6 X Index register -R$Y: EQU 8 Y Index register -R$U: EQU 10 User Stack register -R$PC: EQU 12 Program Counter register -R$Size: EQU 14 Total register package size - ELSE -R$DP: EQU 3 Direct Page register -R$X: EQU 4 X Index register -R$Y: EQU 6 Y Index register -R$U: EQU 8 User Stack register -R$PC: EQU 10 Program Counter register -R$Size: EQU 12 Total register package size - ENDC - -* MD register masks -* 6309 definitions -DIV0: EQU %10000000 division by 0 trap flag : 1 = trap occured -badinstr: EQU %01000000 illegal instruction trap flag : 1 = trap occured - -Entire: EQU %10000000 Full Register Stack flag -FIRQMask: EQU %01000000 Fast-Interrupt Mask bit -HalfCrry: EQU %00100000 Half Carry flag -IRQMask: EQU %00010000 Interrupt Mask bit -Negative: EQU %00001000 Negative flag -Zero: EQU %00000100 Zero flag -TwosOvfl: EQU %00000010 Two's Comp Overflow flag -Carry: EQU %00000001 Carry bit -IntMasks: EQU IRQMask+FIRQMask -Sign: EQU %10000000 sign bit - - TTL Error Code Definitions - PAG -************************ -* Error Code Definitions -* -* Basic09 Error Codes -* - csect -E$UnkSym: RMB 1 Unknown symbol -E$ExcVrb: RMB 1 Excessive verbage -E$IllStC: RMB 1 Illegal statement construction -E$ICOvf: RMB 1 I-code overflow -E$IChRef: RMB 1 Illegal channel reference -E$IllMod: RMB 1 Illegal mode -E$IllNum: RMB 1 Illegal number -E$IllPrf: RMB 1 Illegal prefix -E$IllOpd: RMB 1 Illegal operand -E$IllOpr: RMB 1 Illegal operator -E$IllRFN: RMB 1 Illegal record field name -E$IllDim: RMB 1 Illegal dimension -E$IllLit: RMB 1 Illegal literal -E$IllRet: RMB 1 Illegal relational -E$IllSfx: RMB 1 Illegal type suffix -E$DimLrg: RMB 1 Dimension too large -E$LinLrg: RMB 1 Line number too large -E$NoAssg: RMB 1 Missing assignment statement -E$NoPath: RMB 1 Missing path number -E$NoComa: RMB 1 Missing coma -E$NoDim: RMB 1 Missing dimension -E$NoDO: RMB 1 Missing DO statement -E$MFull: RMB 1 Memory full -E$NoGoto: RMB 1 Missing GOTO -E$NoLPar: RMB 1 Missing left parenthesis -E$NoLRef: RMB 1 Missing line reference -E$NoOprd: RMB 1 Missing operand -E$NoRPar: RMB 1 Missing right parenthesis -E$NoTHEN: RMB 1 Missing THEN statement -E$NoTO: RMB 1 Missing TO statement -E$NoVRef: RMB 1 Missing variable reference -E$EndQou: RMB 1 Missing end quote -E$SubLrg: RMB 1 Too many subscripts -E$UnkPrc: RMB 1 Unknown procedure -E$MulPrc: RMB 1 Multiply defined procedure -E$DivZer: RMB 1 Divice by zero -E$TypMis: RMB 1 Operand type mismatch -E$StrOvf: RMB 1 String stack overflow -E$NoRout: RMB 1 Unimplemented routine -E$UndVar: RMB 1 Undefined variable -E$FltOvf: RMB 1 Floating Overflow -E$LnComp: RMB 1 Line with compiler error -E$ValRng: RMB 1 Value out of range for destination -E$SubOvf: RMB 1 Subroutine stack overflow -E$SubUnd: RMB 1 Subroutine stack underflow -E$SubRng: RMB 1 Subscript out of range -E$ParmEr: RMB 1 Paraemter error -E$SysOvf: RMB 1 System stack overflow -E$IOMism: RMB 1 I/O type mismatch -E$IONum: RMB 1 I/O numeric input format bad -E$IOConv: RMB 1 I/O conversion: number out of range -E$IllInp: RMB 1 Illegal input format -E$IOFRpt: RMB 1 I/O format repeat error -E$IOFSyn: RMB 1 I/O format syntax error -E$IllPNm: RMB 1 Illegal path number -E$WrSub: RMB 1 Wrong number of subscripts -E$NonRcO: RMB 1 Non-record type operand -E$IllA: RMB 1 Illegal argument -E$IllCnt: RMB 1 Illegal control structure -E$UnmCnt: RMB 1 Unmatched control structure -E$IllFOR: RMB 1 Illegal FOR variable -E$IllExp: RMB 1 Illegal expression type -E$IllDec: RMB 1 Illegal declarative statement -E$ArrOvf: RMB 1 Array size overflow -E$UndLin: RMB 1 Undefined line number -E$MltLin: RMB 1 Multiply defined line number -E$MltVar: RMB 1 Multiply defined variable -E$IllIVr: RMB 1 Illegal input variable -E$SeekRg: RMB 1 Seek out of range -E$NoData: RMB 1 Missing data statement - -* -* System Dependent Error Codes -* - -* Level 2 windowing error codes - RMB 183-* -E$IWTyp: RMB 1 Illegal window type -E$WADef: RMB 1 Window already defined -E$NFont: RMB 1 Font not found -E$StkOvf: RMB 1 Stack overflow -E$IllArg: RMB 1 Illegal argument - RMB 1 reserved -E$ICoord: RMB 1 Illegal coordinates -E$Bug: RMB 1 Bug (should never be returned) -E$BufSiz: RMB 1 Buffer size is too small -E$IllCmd: RMB 1 Illegal command -E$TblFul: RMB 1 Screen or window table is full -E$BadBuf: RMB 1 Bad/Undefined buffer number -E$IWDef: RMB 1 Illegal window definition -E$WUndef: RMB 1 Window undefined - -E$Up: RMB 1 Up arrow pressed on SCF I$ReadLn with PD.UP enabled -E$Dn: RMB 1 Down arrow pressed on SCF I$ReadLn with PD.DOWN enabled -E$Alias: RMB 1 - - -* -* Standard NitrOS-9 Error Codes -* - RMB 200-* -E$PthFul: RMB 1 Path Table full -E$BPNum: RMB 1 Bad Path Number -E$Poll: RMB 1 Polling Table Full -E$BMode: RMB 1 Bad Mode -E$DevOvf: RMB 1 Device Table Overflow -E$BMID: RMB 1 Bad Module ID -E$DirFul: RMB 1 Module Directory Full -E$MemFul: RMB 1 Process Memory Full -E$UnkSvc: RMB 1 Unknown Service Code -E$ModBsy: RMB 1 Module Busy -E$BPAddr: RMB 1 Bad Page Address -E$EOF: RMB 1 End of File - RMB 1 -E$NES: RMB 1 Non-Existing Segment -E$FNA: RMB 1 File Not Accesible -E$BPNam: RMB 1 Bad Path Name -E$PNNF: RMB 1 Path Name Not Found -E$SLF: RMB 1 Segment List Full -E$CEF: RMB 1 Creating Existing File -E$IBA: RMB 1 Illegal Block Address -E$HangUp: RMB 1 Carrier Detect Lost -E$MNF: RMB 1 Module Not Found - RMB 1 -E$DelSP: RMB 1 Deleting Stack Pointer memory -E$IPrcID: RMB 1 Illegal Process ID -E$BPrcID: EQU E$IPrcID Bad Process ID (formerly #238) - RMB 1 -E$NoChld: RMB 1 No Children -E$ISWI: RMB 1 Illegal SWI code -E$PrcAbt: RMB 1 Process Aborted -E$PrcFul: RMB 1 Process Table Full -E$IForkP: RMB 1 Illegal Fork Parameter -E$KwnMod: RMB 1 Known Module -E$BMCRC: RMB 1 Bad Module CRC -E$USigP: RMB 1 Unprocessed Signal Pending -E$NEMod: RMB 1 Non Existing Module -E$BNam: RMB 1 Bad Name -E$BMHP: RMB 1 (bad module header parity) -E$NoRAM: RMB 1 No (System) RAM Available -E$DNE: RMB 1 Directory not empty -E$NoTask: RMB 1 No available Task number - RMB $F0-* reserved -E$Unit: RMB 1 Illegal Unit (drive) -E$Sect: RMB 1 Bad Sector number -E$WP: RMB 1 Write Protect -E$CRC: RMB 1 Bad Check Sum -E$Read: RMB 1 Read Error -E$Write: RMB 1 Write Error -E$NotRdy: RMB 1 Device Not Ready -E$Seek: RMB 1 Seek Error -E$Full: RMB 1 Media Full -E$BTyp: RMB 1 Bad Type (incompatable) media -E$DevBsy: RMB 1 Device Busy -E$DIDC: RMB 1 Disk ID Change -E$Lock: RMB 1 Record is busy (locked out) -E$Share: RMB 1 Non-sharable file busy -E$DeadLk: RMB 1 I/O Deadlock error - endsect - - - IFEQ Level-1 - -******************************** -* Boot defs for NitrOS-9 Level 1 -* -* These defs are not strictly for 'Boot', but are for booting the -* system. -* -Bt.Start: EQU $EE00 Start address of the boot track in memory - -* Boot area size on Dragon is only 16 sectors=4K - IFNE DRAGON -Bt.Size: EQU $1000 Max size of boot file - ELSE -Bt.Size: EQU $1080 Maximum size of bootfile - ENDC - - ELSE - -****************************************** -* Boot defs for NitrOS-9 Level 2 and above -* -* These defs are not strictly for 'Boot', but are for booting the -* system. -* -Bt.Block: EQU $3B Block to map in for the 'OS9BOOT' screen -Bt.Flag: EQU $8A34 Flag in Bt.Block to verify that it's unchanged -Bt.Offst: EQU 2 Offset into the screen where the current ptr is -Bt.Start: EQU $ED00 Start address of the boot track in memory - - ENDC - -* Boot area on the Dragon starts on track 0 sector 2, imediatly -* after the blockmap. -* On the CoCo, the boot track is all of track 34 - - IFNE DRAGON -Bt.Track: EQU 0 Boot track -Bt.Sec: EQU 2 Start LSN of boot area on boot track - ELSE -Bt.Track: EQU 34 Boot track -Bt.Sec: EQU 0 Start LSN of boot area on boot track - ENDC - - - IFGT Level-2 -*************************** -* Level 3 Defs -* -* These definitions apply to NitrOS-9 Level 3 -* -L3.Start: EQU $2000 Start off at slot 1 -L3.Size: EQU $40 Go for 64 pages: 2 slots total -L3.Blks: EQU L3.Size/$20 Number of slots -L3.End: EQU L3.Start+L3.Size*$0100 end of L3 memory -L3.SCF: EQU $0660 SCF block ptr -L3.RBF: EQU L3.SCF+1 RBF block ptr - ENDC
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/pipe.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,97 @@ +******************************************************************** +* PipeDefs - Pipe File Manager Definitions +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1988/12/03 Chris J. Burke +* Coded from new PIPEMAN comments. + + NAM PipeDefs + TTL Pipe File Manager Definitions + +* +* IOMan equates duplicated for PipeMan use +* + +NPATHS: SET 16 ;Maximum local paths per task -- must match IOMan +NameMax: SET 29 ;Maximum length of a file name + +* +* Device Driver Static Storage Layout +* + section _constant + RMB V.USER +V.List: RMB 2 ;Pointer to 1st pipe's pipe buffer +PManMem: EQU * ;Device driver memory (drive table equivalent) + endsect + +* +* Pipe Buffer Data Structure +* + section _constant +PP.PD: RMB 2 ;Pointer to shared path descriptor +PP.Next: RMB 2 ;Pointer to next pipe buffer in system map +PP.Prev: RMB 2 ;Pointer to previous pipe buffer in system map +PP.Rsrv: RMB 2 ;Reserved +PP.Data: EQU * ;Data buffer begins at this offset + endsect + +* +* Unique Path Descriptor Variables +* + section _constant + RMB PD.FST +*** PP.Read must have bit 4 clear; PP.Writ must be PP.Read XOR 4 +PD.Read: EQU * +PD.RPID: RMB 1 ;Process ID of reader waiting on signal +PD.RCT: RMB 1 ;Number of blocked readers +PD.RSIG: RMB 1 ;Signal to send reader +PD.REOR: RMB 1 ;Read EOR character +PD.Writ: EQU * +PD.WPID: RMB 1 ;Process ID of writer waiting on signal +PD.WCT: RMB 1 ;Number of blocked writers +PD.WSIG: RMB 1 ;Signal to send writer +PD.WEOR: RMB 1 ;Write EOR character (dummy) +*** End of special section +PD.End: RMB 2 ;Pointer to end of pipe buffer +PD.NxtI: RMB 2 ;Next in pointer +PD.NxtO: RMB 2 ;Next out pointer +PD.RFlg: RMB 1 ;"Ready" flag +PD.Wrtn: RMB 1 ;"Written" flag +PD.BCnt: RMB 2 ;# queue elements currently bufered +PD.Own: RMB 1 ;Process ID of pipe original creator +PD.Keep: RMB 1 ;Non-zero if pipe has been kept open artificailly +PD.QSiz: RMB 2 ;Max. elements in queue (copied from OPT section) + endsect + +* +* Path descriptor option section +* +* Note that PD.Name overlaps with the last byte of PD.ECnt. +* PD.ECnt is copied to PD.QSiz as part of OPEN or CREATE, +* to make room for the pipe name. +* + section _constant + RMB (PD.OPT+1) +PD.ESiz: RMB 1 ;Size of each queue element +PD.ECnt: RMB 2 ;Max. elements in queue (initial position) + IFGT Level-1 + RMB *-(PD.OPT+3) +PD.Name: RMB NameMax + ENDC + endsect + +* +* Device Descriptor definitions +* +IT.PDC: EQU $12 ;Pipe device class (like IT.DTP, IT.DVC) + section _constant + RMB IT.PDC + RMB 1 ;Leave room for device class +IT.ESiz: RMB 1 ;Size of each queue element +IT.ECnt: RMB 2 ;Max. elements in queue (initial position) + endsect +
--- a/lib/pipedefs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -******************************************************************** -* PipeDefs - Pipe File Manager Definitions -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1988/12/03 Chris J. Burke -* Coded from new PIPEMAN comments. - - NAM PipeDefs - TTL Pipe File Manager Definitions - -* -* IOMan equates duplicated for PipeMan use -* - -NPATHS: SET 16 ;Maximum local paths per task -- must match IOMan -NameMax: SET 29 ;Maximum length of a file name - -* -* Device Driver Static Storage Layout -* - csect - RMB V.USER -V.List: RMB 2 ;Pointer to 1st pipe's pipe buffer -PManMem: EQU * ;Device driver memory (drive table equivalent) - endsect - -* -* Pipe Buffer Data Structure -* - csect -PP.PD: RMB 2 ;Pointer to shared path descriptor -PP.Next: RMB 2 ;Pointer to next pipe buffer in system map -PP.Prev: RMB 2 ;Pointer to previous pipe buffer in system map -PP.Rsrv: RMB 2 ;Reserved -PP.Data: EQU * ;Data buffer begins at this offset - endsect - -* -* Unique Path Descriptor Variables -* - csect - RMB PD.FST -*** PP.Read must have bit 4 clear; PP.Writ must be PP.Read XOR 4 -PD.Read: EQU * -PD.RPID: RMB 1 ;Process ID of reader waiting on signal -PD.RCT: RMB 1 ;Number of blocked readers -PD.RSIG: RMB 1 ;Signal to send reader -PD.REOR: RMB 1 ;Read EOR character -PD.Writ: EQU * -PD.WPID: RMB 1 ;Process ID of writer waiting on signal -PD.WCT: RMB 1 ;Number of blocked writers -PD.WSIG: RMB 1 ;Signal to send writer -PD.WEOR: RMB 1 ;Write EOR character (dummy) -*** End of special section -PD.End: RMB 2 ;Pointer to end of pipe buffer -PD.NxtI: RMB 2 ;Next in pointer -PD.NxtO: RMB 2 ;Next out pointer -PD.RFlg: RMB 1 ;"Ready" flag -PD.Wrtn: RMB 1 ;"Written" flag -PD.BCnt: RMB 2 ;# queue elements currently bufered -PD.Own: RMB 1 ;Process ID of pipe original creator -PD.Keep: RMB 1 ;Non-zero if pipe has been kept open artificailly -PD.QSiz: RMB 2 ;Max. elements in queue (copied from OPT section) - endsect - -* -* Path descriptor option section -* -* Note that PD.Name overlaps with the last byte of PD.ECnt. -* PD.ECnt is copied to PD.QSiz as part of OPEN or CREATE, -* to make room for the pipe name. -* - csect - RMB (PD.OPT+1) -PD.ESiz: RMB 1 ;Size of each queue element -PD.ECnt: RMB 2 ;Max. elements in queue (initial position) - IFGT Level-1 - RMB (PD.OPT+3)-* -PD.Name: RMB NameMax - ENDC - endsect - -* -* Device Descriptor definitions -* -IT.PDC: EQU $12 ;Pipe device class (like IT.DTP, IT.DVC) - csect - RMB IT.PDC - RMB 1 ;Leave room for device class -IT.ESiz: RMB 1 ;Size of each queue element -IT.ECnt: RMB 2 ;Max. elements in queue (initial position) - endsect -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/rbf.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,374 @@ + IFNE RBFDEFS-1 + +RBFDEFS SET 1 + +******************************************************************** +* RBFDefs - Random Block File Manager Definitions +* +* $Id$ +* +* RBF stands for 'Random Block Filemanager' and is a package of subroutines +* that define the logical structure of a disk and allows access to the files +* in that structure. +* +* The data structures in this file give RBF its 'personality' and are used +* by RBF itself, as well as applications that will require disk I/O. +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1982/07/13 Robert F. Doggett +* PD.Exten added to path descriptor and PE Entries defined. +* +* 1982/07/15 Robert F. Doggett +* V.FileHd inserted in driver static storage. +* +* 1982/09/10 WGP +* Level One/Level Two condionals added. +* +* 1982/09/17 WGP +* +* 1982/09/17 Robert F. Doggett +* PD.SLE renamed to PD.Creat. +* +* 1982/09/17 Robert F. Doggett +* V.DiskID, V.BMapSz, V.MapSct added for smart multi-sector bitmap searching. +* +* 1982/09/20 Robert F. Doggett +* Reserved areas added in static storage. + +* 1983/06/07 Robert F. Doggett +* Added InDriver flag in PD.SMF. +* +* 1983/06/13 Robert F. Doggett +* Added PE.Req tmp save for PE.Lock. +* +* 1983/08/08 Robert F. Doggett +* Reserved PD.SToff for Japanese. +* +* 1983/11/19 Robert F. Doggett +* Added V.ResBit in drive tables. +* +* 1983/12/12 Robert F. Doggett +* Added PE.Prior to save process priority. +* +* 1983/12/13 Robert F. Doggett +* Added BufBusy bit in state flag (PD.SMF). +* +* 1984/07/06 Mark G. Hawkins +* Added Bit Definitions for DD.FMT. +* +* 1987/06/23 Kevin K. Darling +* Updated with Dev Desc Info +* +* 2003/06/02 Boisy G. Pitre +* Updated comments for clarity. +* Added TYP.256-TYP.2048 definitions for future expansion. +* +* 2004/04/14 Boisy G. Pitre +* Added new entries to device descriptor as per OS-9 Level One V2.00.00 +* addendum. Pointed out by Rodney Hamilton. +* +* 2005/05/31 P.Harvey-Smith. +* Added defines for bit 2 of IT.DNS, which the format command uses to +* determine if a drive should have it's track 0 as single or double density +* +* 2005/11/23 Robert Gault +* Added IT.MPI giving it duplicate location with IT.TFM. This will not be +* transferred to the path descriptor, thus the equ * rahter than rmb 1. +* +* 2005/12/11 Boisy G. Pitre +* Added IT.SOFF1-ITSOFF3 and IT.LLDRV for SuperDrivers. + + NAM RBFDefs + TTL Random Block File Manager Definitions + + PAG +******************************* +* RBF Device Descriptor Offsets +* +* These definitions are for RBF device descriptors. + + section _constant + FCB M$DTyp + FCB 1 Device type (DT.RBF) +IT.DRV: FCB 1 Drive number +IT.STP: FCB 1 Step rate +IT.TYP: FCB 1 Disk device type information +IT.DNS: FCB 1 Density capability +IT.CYL: FCB 2 Number of cylinders +IT.SID: FCB 1 Number of surfaces +IT.VFY: FCB 1 Verify disk writes (0 = verify, 1 = don't) +IT.SCT: FCB 2 Default sectors/track +IT.T0S: FCB 2 Default sectors/track for track 0 sector 0 +IT.ILV: FCB 1 Sector interleave offset +IT.SAS: FCB 1 Segment allocation size +* The following fields are from the OS-9 Level One V2.00.00 Addendum +IT.TFM: FCB 1 DMA Transfer Mode +IT.Exten: FCB 2 Path Extension (PE) for record locking +IT.SToff: FCB 1 Sector/Track offsets (for "foreign" disk formats) +* The following fields are not copied to the path descriptor +IT.WPC: FCB 1 Write precomp cyl/4 (HD) +IT.OFS: FCB 2 Starting cylinder offset (HD) +IT.RWC: FCB 2 Reduced write current cylinder (HD) +* These fields have been added because of SuperDriver. They probably +* can be used in other drivers + ORG IT.WPC +IT.SOFF1: RMB 1 +IT.SOFF2: RMB 1 +IT.SOFF3: RMB 1 +IT.LLDRV: RMB 2 +IT.MPI: RMB 1 + endsect + +* IT.TYP Definitions +* +TYP.HARD: EQU %10000000 Hard disk +TYP.FLP: EQU %00000000 Floppy disk +TYP.NSF: EQU %01000000 Non-standard format +TYP.SOF: EQU %00000000 Standard NitrOS-9 format + +* IT.TYP bit definitions if bit 7 of IT.TYP is set (hard disk) +TYPH.256: EQU %00000000 256 byte sector media +TYPH.512: EQU %00000001 512 byte sector media +TYPH.1024: EQU %00000010 1024 byte sector media +TYPH.2048: EQU %00000011 2048 byte sector media +TYPH.SSM: EQU %00000011 Sector size mask +TYPH.DRSV: EQU %00001100 Driver-reserved bits +TYPH.DSQ: EQU %00010000 Drive size query flag + +* IT.TYP bit definitions if bit 7 of IT.TYP is clear (floppy disk) +TYP.5: EQU %00000000 5" media +TYP.3: EQU %00000001 3.5" media +TYP.SBO: EQU %00000010 Sector base offset (clear = 0; sect = 1) +TYP.256: EQU %00000000 256 byte sector media +TYP.512: EQU %00000100 512 byte sector media +TYP.CCF: EQU %00100000 CoCo format +TYP.NCCF: EQU %00000000 Non-CoCo format + +* IT.DNS Definitions +* + +* If bit 7 of IT.TYP is set, IT.DNS is driver-dependent + +* IT.DNS bit definitions if bit 7 of IT.TYP is clear (floppy disk) +DNS.FM: EQU %00000000 Single-density (FM) +DNS.MFM: EQU %00000001 Double-density (MFM) +DNS.STD: EQU %00000000 Single track distance (48/135 tpi) +DNS.DTD: EQU %00000010 Double track distance (96 tpi) + +* Added PHS,2005-05-31, as format seems to use these +DNS.FM0: EQU %00000000 Single density track 0 +DNS.MFM0: EQU %00000100 Double density track 0 + +* Floppy disk step rate definitions +STP.30ms: EQU 0 30ms step rate +STP.20ms: EQU 1 20ms step rate +STP.12ms: EQU 2 12ms step rate +STP.6ms: EQU 3 6ms step rate + + PAG +************************************* +* Random Block Path Descriptor Format +* +* A path descriptor is created for every new path that is open +* via the I$Open system call (processed by IOMan). Process +* descriptors track state information of a path. +* + section _constant + RMB PD.FST +PD.SMF: RMB 1 State flags +PD.CP: RMB 4 Current logical byte position +PD.SIZ: RMB 4 File size +PD.SBL: RMB 3 Segment beginning lsn +PD.SBP: RMB 3 Segment beginning psn +PD.SSZ: RMB 3 Segment size +PD.DSK: RMB 2 Disk id +PD.DTB: RMB 2 Drive table ptr + RMB PD.OPT-* + RMB 1 Device type +PD.DRV: RMB 1 Drive number +PD.STP: RMB 1 Step rate +PD.TYP: RMB 1 Disk device type (5" 8" other) +PD.DNS: RMB 1 Density capability +PD.CYL: RMB 2 Number of cylinders +PD.SID: RMB 1 Number of surfaces +PD.VFY: RMB 1 0=verify disk writes +PD.SCT: RMB 2 Default sectors/track +PD.T0S: RMB 2 Default sectors/track tr00,s0 +PD.ILV: RMB 1 Sector interleave offset +PD.SAS: RMB 1 Segment allocation size +PD.TFM: RMB 1 DMA Transfer Mode +PD.Exten: RMB 2 Path Extension (PE) for record locking +PD.SToff: RMB 1 Sector/Track offsets (for "foreign" disk formats) +PD.ATT: RMB 1 File attributes +PD.FD: RMB 3 File descriptor psn +PD.DFD: RMB 3 Directory file descriptor psn +PD.DCP: RMB 4 File directory entry ptr +PD.DVT: RMB 2 User readable dev tbl ptr + endsect + +* State Flags +BUFMOD: EQU $01 Buffer modified +SINBUF: EQU $02 Sector in buffer +FDBUF: EQU $04 File descriptor in buffer +*EOFSEC:equ $08 End of file sector +*EOF:equ $10 End of file +InDriver: EQU $20 Currently in Disk Driver, or queued +BufBusy: EQU $40 Buffer is currently busy + + IFNE Level-1 +************************************ +* Random Block Path Extension Format +* +* RBF paths under Level Two have additional information that +* is referenced by the path extension area. +* + section _constant +PE.PE: RMB 1 PE path number +PE.PDptr: RMB 2 Back ptr to this PE's Path Descriptor +PE.NxFil: RMB 2 Drive Open-File list ptr +PE.Confl: RMB 2 Circular File Conflict list +PE.Lock: RMB 1 Path lockout status +PE.LoLck: RMB 4 Low Locked Logical addr +PE.HiLck: RMB 4 High Locked Logical addr +PE.Wait: RMB 2 PE ptr to (next) locked-out PE +PE.TmOut: RMB 2 Max ticks to wait for locked segment +PE.Owner: RMB 1 Process ID of owner of locked segment +PE.Req: RMB 1 Temp for PE.Lock in GAIN when LockSeg fails +PE.Prior: RMB 1 Temp for process priority while in driver +PE.SigSg: RMB 1 Signal code to send +PE.SigID: RMB 1 Process ID to send the signal to + RMB 32-* Reserved +PE.FilNm: RMB 32 Temp for filename during directory search + endsect + +* PE.Lock status codes +Unlocked: EQU 0 No portion of file is locked +RcdLock: EQU 1 Record from LoLck to HiLck locked +FileLock: EQU 2 Entire file locked +EofLock: EQU 4 End of file is locked + ENDC + + + PAG +*********************** +* LSN0 Disk Data Format +* +* Logical Sector Number 0 is the first sector on an RBF formatted device +* and contains information about the device's size and format. +* + section _constant +DD.TOT: RMB 3 Total number of sectors +DD.TKS: RMB 1 Track size in sectors +DD.MAP: RMB 2 Number of bytes in allocation bit map +DD.BIT: RMB 2 Number of sectors/bit +DD.DIR: RMB 3 Address of root directory fd +DD.OWN: RMB 2 Owner +DD.ATT: RMB 1 Attributes +DD.DSK: RMB 2 Disk ID +DD.FMT: RMB 1 Disk format; density/sides +DD.SPT: RMB 2 Sectors/track +DD.RES: RMB 2 Reserved for future use +DD.SIZ: EQU . Device descriptor minimum size +DD.BT: RMB 3 System bootstrap sector +DD.BSZ: RMB 2 Size of system bootstrap +DD.DAT: RMB 5 Creation date +DD.NAM: RMB 32 Volume name +DD.OPT: RMB 32 Option area + endsect + +* DD.FMT Bit Definitions - valid only if device is a floppy disk +FMT.SIDE: EQU %00000001 Single Sided=0, Double Sided=1 +FMT.DNS: EQU %00000010 Single Density=0, Double Density=1 +FMT.TDNS: EQU %00000100 Track Density: 48/135 TPI=0, 96 TPI=1 +FMT.T0DN: EQU %00100000 Track 0 Density, see FMT.DNS + + + PAG +************************ +* File Descriptor Format +* +* The file descriptor is a sector that is present for every file +* on an RBF device. It contains attributes, modification dates, +* and segment information on a file. +* + section _constant +FD.ATT: FCB 1 Attributes +FD.OWN: FCB 2 Owner +FD.DAT: FCB 5 Date last modified +FD.LNK: FCB 1 Link count +FD.SIZ: FCB 4 File size +FD.Creat: FCB 3 File creation date (YY/MM/DD) +FD.SEG: EQU * Beginning of segment list + endsect + +* Segment List Entry Format + section _constant +FDSL.A: FCB 3 Segment beginning physical sector number +FDSL.B: FCB 2 Segment size + endsect + +FDSL.S: EQU FD.SEG Segment list entry size +FD.LS1: EQU FD.SEG+((256-FD.SEG)/FDSL.S-1)*FDSL.S +FD.LS2: EQU (256/FDSL.S-1)*FDSL.S +MINSEC: SET 16 + + + PAG +************************ +* Directory Entry Format +* +* Directory entries are part of a directory and define the name +* of the file, as well as a pointer to its file descriptor. +* + section _constant +DIR.NM: RMB 29 File name +DIR.FD: RMB 3 File descriptor physical sector number +DIR.SZ: EQU * Directory record size + endsect + + + PAG +******************** +* RBF Static Storage +* +* Overall Disk Static Storage +* +* Note: This does not reserve any memory for drive tables. Each +* driver is responsible for reserving sufficient memory for +* the appropriate number of tables. +* + section _constant + RMB V.USER Reserve required ($06) +V.NDRV: RMB 1 Number of drives ($07) + RMB 8 reserved ($08) +DRVBEG: EQU * Beginning of drive tables ($10) + endsect + + PAG +**************** +* Global Storage For Disk Drive Tables +* +* Each table contains the first 'DD.SIZ' bytes from +* LSN 0, and the current track, stepping rate, +* bitmap use flag, and disk type. +* + section _constant + RMB DD.SIZ Device descriptor, LSN 0 +V.TRAK: RMB 2 Current track +V.BMB: RMB 1 Bit-map use flag +V.FileHd: RMB 2 Open file list for this drive +V.DiskID: RMB 2 Disk ID +V.BMapSz: RMB 1 Bitmap Size +V.MapSct: RMB 1 Lowest reasonable bitmap sector +V.ResBit: RMB 1 Reserved bitmap sector (for compaction) +V.ScTkOf: RMB 1 Sector/Track byte (Combined from descriptor) +V.ScOfst: RMB 1 Sector offset split from byte above +V.TkOfst: RMB 1 Track offset split from byte above + RMB 4 Reserved +DRVMEM: EQU * + endsect + + ENDC +
--- a/lib/rbfdefs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,374 +0,0 @@ - IFNE RBFDEFS-1 - -RBFDEFS SET 1 - -******************************************************************** -* RBFDefs - Random Block File Manager Definitions -* -* $Id$ -* -* RBF stands for 'Random Block Filemanager' and is a package of subroutines -* that define the logical structure of a disk and allows access to the files -* in that structure. -* -* The data structures in this file give RBF its 'personality' and are used -* by RBF itself, as well as applications that will require disk I/O. -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1982/07/13 Robert F. Doggett -* PD.Exten added to path descriptor and PE Entries defined. -* -* 1982/07/15 Robert F. Doggett -* V.FileHd inserted in driver static storage. -* -* 1982/09/10 WGP -* Level One/Level Two condionals added. -* -* 1982/09/17 WGP -* -* 1982/09/17 Robert F. Doggett -* PD.SLE renamed to PD.Creat. -* -* 1982/09/17 Robert F. Doggett -* V.DiskID, V.BMapSz, V.MapSct added for smart multi-sector bitmap searching. -* -* 1982/09/20 Robert F. Doggett -* Reserved areas added in static storage. - -* 1983/06/07 Robert F. Doggett -* Added InDriver flag in PD.SMF. -* -* 1983/06/13 Robert F. Doggett -* Added PE.Req tmp save for PE.Lock. -* -* 1983/08/08 Robert F. Doggett -* Reserved PD.SToff for Japanese. -* -* 1983/11/19 Robert F. Doggett -* Added V.ResBit in drive tables. -* -* 1983/12/12 Robert F. Doggett -* Added PE.Prior to save process priority. -* -* 1983/12/13 Robert F. Doggett -* Added BufBusy bit in state flag (PD.SMF). -* -* 1984/07/06 Mark G. Hawkins -* Added Bit Definitions for DD.FMT. -* -* 1987/06/23 Kevin K. Darling -* Updated with Dev Desc Info -* -* 2003/06/02 Boisy G. Pitre -* Updated comments for clarity. -* Added TYP.256-TYP.2048 definitions for future expansion. -* -* 2004/04/14 Boisy G. Pitre -* Added new entries to device descriptor as per OS-9 Level One V2.00.00 -* addendum. Pointed out by Rodney Hamilton. -* -* 2005/05/31 P.Harvey-Smith. -* Added defines for bit 2 of IT.DNS, which the format command uses to -* determine if a drive should have it's track 0 as single or double density -* -* 2005/11/23 Robert Gault -* Added IT.MPI giving it duplicate location with IT.TFM. This will not be -* transferred to the path descriptor, thus the equ * rahter than rmb 1. -* -* 2005/12/11 Boisy G. Pitre -* Added IT.SOFF1-ITSOFF3 and IT.LLDRV for SuperDrivers. - - NAM RBFDefs - TTL Random Block File Manager Definitions - - PAG -******************************* -* RBF Device Descriptor Offsets -* -* These definitions are for RBF device descriptors. - - csect - RMB M$DTyp - RMB 1 Device type (DT.RBF) -IT.DRV: RMB 1 Drive number -IT.STP: RMB 1 Step rate -IT.TYP: RMB 1 Disk device type information -IT.DNS: RMB 1 Density capability -IT.CYL: RMB 2 Number of cylinders -IT.SID: RMB 1 Number of surfaces -IT.VFY: RMB 1 Verify disk writes (0 = verify, 1 = don't) -IT.SCT: RMB 2 Default sectors/track -IT.T0S: RMB 2 Default sectors/track for track 0 sector 0 -IT.ILV: RMB 1 Sector interleave offset -IT.SAS: RMB 1 Segment allocation size -* The following fields are from the OS-9 Level One V2.00.00 Addendum -IT.TFM: RMB 1 DMA Transfer Mode -IT.Exten: RMB 2 Path Extension (PE) for record locking -IT.SToff: RMB 1 Sector/Track offsets (for "foreign" disk formats) -* The following fields are not copied to the path descriptor -IT.WPC: RMB 1 Write precomp cyl/4 (HD) -IT.OFS: RMB 2 Starting cylinder offset (HD) -IT.RWC: RMB 2 Reduced write current cylinder (HD) -* These fields have been added because of SuperDriver. They probably -* can be used in other drivers - ORG IT.WPC -IT.SOFF1: RMB 1 -IT.SOFF2: RMB 1 -IT.SOFF3: RMB 1 -IT.LLDRV: RMB 2 -IT.MPI: RMB 1 - endsect - -* IT.TYP Definitions -* -TYP.HARD: EQU %10000000 Hard disk -TYP.FLP: EQU %00000000 Floppy disk -TYP.NSF: EQU %01000000 Non-standard format -TYP.SOF: EQU %00000000 Standard NitrOS-9 format - -* IT.TYP bit definitions if bit 7 of IT.TYP is set (hard disk) -TYPH.256: EQU %00000000 256 byte sector media -TYPH.512: EQU %00000001 512 byte sector media -TYPH.1024: EQU %00000010 1024 byte sector media -TYPH.2048: EQU %00000011 2048 byte sector media -TYPH.SSM: EQU %00000011 Sector size mask -TYPH.DRSV: EQU %00001100 Driver-reserved bits -TYPH.DSQ: EQU %00010000 Drive size query flag - -* IT.TYP bit definitions if bit 7 of IT.TYP is clear (floppy disk) -TYP.5: EQU %00000000 5" media -TYP.3: EQU %00000001 3.5" media -TYP.SBO: EQU %00000010 Sector base offset (clear = 0; sect = 1) -TYP.256: EQU %00000000 256 byte sector media -TYP.512: EQU %00000100 512 byte sector media -TYP.CCF: EQU %00100000 CoCo format -TYP.NCCF: EQU %00000000 Non-CoCo format - -* IT.DNS Definitions -* - -* If bit 7 of IT.TYP is set, IT.DNS is driver-dependent - -* IT.DNS bit definitions if bit 7 of IT.TYP is clear (floppy disk) -DNS.FM: EQU %00000000 Single-density (FM) -DNS.MFM: EQU %00000001 Double-density (MFM) -DNS.STD: EQU %00000000 Single track distance (48/135 tpi) -DNS.DTD: EQU %00000010 Double track distance (96 tpi) - -* Added PHS,2005-05-31, as format seems to use these -DNS.FM0: EQU %00000000 Single density track 0 -DNS.MFM0: EQU %00000100 Double density track 0 - -* Floppy disk step rate definitions -STP.30ms: EQU 0 30ms step rate -STP.20ms: EQU 1 20ms step rate -STP.12ms: EQU 2 12ms step rate -STP.6ms: EQU 3 6ms step rate - - PAG -************************************* -* Random Block Path Descriptor Format -* -* A path descriptor is created for every new path that is open -* via the I$Open system call (processed by IOMan). Process -* descriptors track state information of a path. -* - csect - RMB PD.FST -PD.SMF: RMB 1 State flags -PD.CP: RMB 4 Current logical byte position -PD.SIZ: RMB 4 File size -PD.SBL: RMB 3 Segment beginning lsn -PD.SBP: RMB 3 Segment beginning psn -PD.SSZ: RMB 3 Segment size -PD.DSK: RMB 2 Disk id -PD.DTB: RMB 2 Drive table ptr - RMB PD.OPT-* - RMB 1 Device type -PD.DRV: RMB 1 Drive number -PD.STP: RMB 1 Step rate -PD.TYP: RMB 1 Disk device type (5" 8" other) -PD.DNS: RMB 1 Density capability -PD.CYL: RMB 2 Number of cylinders -PD.SID: RMB 1 Number of surfaces -PD.VFY: RMB 1 0=verify disk writes -PD.SCT: RMB 2 Default sectors/track -PD.T0S: RMB 2 Default sectors/track tr00,s0 -PD.ILV: RMB 1 Sector interleave offset -PD.SAS: RMB 1 Segment allocation size -PD.TFM: RMB 1 DMA Transfer Mode -PD.Exten: RMB 2 Path Extension (PE) for record locking -PD.SToff: RMB 1 Sector/Track offsets (for "foreign" disk formats) -PD.ATT: RMB 1 File attributes -PD.FD: RMB 3 File descriptor psn -PD.DFD: RMB 3 Directory file descriptor psn -PD.DCP: RMB 4 File directory entry ptr -PD.DVT: RMB 2 User readable dev tbl ptr - endsect - -* State Flags -BUFMOD: EQU $01 Buffer modified -SINBUF: EQU $02 Sector in buffer -FDBUF: EQU $04 File descriptor in buffer -*EOFSEC:equ $08 End of file sector -*EOF:equ $10 End of file -InDriver: EQU $20 Currently in Disk Driver, or queued -BufBusy: EQU $40 Buffer is currently busy - - IFNE Level-1 -************************************ -* Random Block Path Extension Format -* -* RBF paths under Level Two have additional information that -* is referenced by the path extension area. -* - csect -PE.PE: RMB 1 PE path number -PE.PDptr: RMB 2 Back ptr to this PE's Path Descriptor -PE.NxFil: RMB 2 Drive Open-File list ptr -PE.Confl: RMB 2 Circular File Conflict list -PE.Lock: RMB 1 Path lockout status -PE.LoLck: RMB 4 Low Locked Logical addr -PE.HiLck: RMB 4 High Locked Logical addr -PE.Wait: RMB 2 PE ptr to (next) locked-out PE -PE.TmOut: RMB 2 Max ticks to wait for locked segment -PE.Owner: RMB 1 Process ID of owner of locked segment -PE.Req: RMB 1 Temp for PE.Lock in GAIN when LockSeg fails -PE.Prior: RMB 1 Temp for process priority while in driver -PE.SigSg: RMB 1 Signal code to send -PE.SigID: RMB 1 Process ID to send the signal to - RMB 32-* Reserved -PE.FilNm: RMB 32 Temp for filename during directory search - endsect - -* PE.Lock status codes -Unlocked: EQU 0 No portion of file is locked -RcdLock: EQU 1 Record from LoLck to HiLck locked -FileLock: EQU 2 Entire file locked -EofLock: EQU 4 End of file is locked - ENDC - - - PAG -*********************** -* LSN0 Disk Data Format -* -* Logical Sector Number 0 is the first sector on an RBF formatted device -* and contains information about the device's size and format. -* - csect -DD.TOT: RMB 3 Total number of sectors -DD.TKS: RMB 1 Track size in sectors -DD.MAP: RMB 2 Number of bytes in allocation bit map -DD.BIT: RMB 2 Number of sectors/bit -DD.DIR: RMB 3 Address of root directory fd -DD.OWN: RMB 2 Owner -DD.ATT: RMB 1 Attributes -DD.DSK: RMB 2 Disk ID -DD.FMT: RMB 1 Disk format; density/sides -DD.SPT: RMB 2 Sectors/track -DD.RES: RMB 2 Reserved for future use -DD.SIZ: EQU . Device descriptor minimum size -DD.BT: RMB 3 System bootstrap sector -DD.BSZ: RMB 2 Size of system bootstrap -DD.DAT: RMB 5 Creation date -DD.NAM: RMB 32 Volume name -DD.OPT: RMB 32 Option area - endsect - -* DD.FMT Bit Definitions - valid only if device is a floppy disk -FMT.SIDE: EQU %00000001 Single Sided=0, Double Sided=1 -FMT.DNS: EQU %00000010 Single Density=0, Double Density=1 -FMT.TDNS: EQU %00000100 Track Density: 48/135 TPI=0, 96 TPI=1 -FMT.T0DN: EQU %00100000 Track 0 Density, see FMT.DNS - - - PAG -************************ -* File Descriptor Format -* -* The file descriptor is a sector that is present for every file -* on an RBF device. It contains attributes, modification dates, -* and segment information on a file. -* - csect -FD.ATT: RMB 1 Attributes -FD.OWN: RMB 2 Owner -FD.DAT: RMB 5 Date last modified -FD.LNK: RMB 1 Link count -FD.SIZ: RMB 4 File size -FD.Creat: RMB 3 File creation date (YY/MM/DD) -FD.SEG: EQU * Beginning of segment list - endsect - -* Segment List Entry Format - csect -FDSL.A: RMB 3 Segment beginning physical sector number -FDSL.B: RMB 2 Segment size - endsect - -FDSL.S: EQU . Segment list entry size -FD.LS1: EQU FD.SEG+((256-FD.SEG)/FDSL.S-1)*FDSL.S -FD.LS2: EQU (256/FDSL.S-1)*FDSL.S -MINSEC: SET 16 - - - PAG -************************ -* Directory Entry Format -* -* Directory entries are part of a directory and define the name -* of the file, as well as a pointer to its file descriptor. -* - csect -DIR.NM: RMB 29 File name -DIR.FD: RMB 3 File descriptor physical sector number -DIR.SZ: EQU * Directory record size - endsect - - - PAG -******************** -* RBF Static Storage -* -* Overall Disk Static Storage -* -* Note: This does not reserve any memory for drive tables. Each -* driver is responsible for reserving sufficient memory for -* the appropriate number of tables. -* - csect - RMB V.USER Reserve required ($06) -V.NDRV: RMB 1 Number of drives ($07) - RMB 8 reserved ($08) -DRVBEG: EQU * Beginning of drive tables ($10) - endsect - - PAG -**************** -* Global Storage For Disk Drive Tables -* -* Each table contains the first 'DD.SIZ' bytes from -* LSN 0, and the current track, stepping rate, -* bitmap use flag, and disk type. -* - csect - RMB DD.SIZ Device descriptor, LSN 0 -V.TRAK: RMB 2 Current track -V.BMB: RMB 1 Bit-map use flag -V.FileHd: RMB 2 Open file list for this drive -V.DiskID: RMB 2 Disk ID -V.BMapSz: RMB 1 Bitmap Size -V.MapSct: RMB 1 Lowest reasonable bitmap sector -V.ResBit: RMB 1 Reserved bitmap sector (for compaction) -V.ScTkOf: RMB 1 Sector/Track byte (Combined from descriptor) -V.ScOfst: RMB 1 Sector offset split from byte above -V.TkOfst: RMB 1 Track offset split from byte above - RMB 4 Reserved -DRVMEM: EQU * - endsect - - ENDC -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/scf.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,244 @@ +******************************************************************** +* SCFDefs - Sequential Character File Manager Definitions +* +* $Id$ +* +* SCF stands for 'Sequential Character Filemanager' and is a package of subroutines +* that define the logical structure of a serial device. +* +* The data structures in this file give SCF its 'personality' and are used +* by SCF itself, as well as applications that will require disk I/O. +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1984/01/11 YO +* Added V.KANJI, V.KBUF, V.MODADR for new kanji input process. +* +* 1985/04/20 Mark G. Hawkins +* Added V.PDLHd Path Descriptor List Head. +* +* 1985/04/21 Mark G. Hawkins +* Added PD.PLP and PD.PST for modem handling. +* +* 1987/06/23 Kevin K. Darling +* Updated with Dev Desc info. +* +* 1998/10/03 Boisy G. Pitre +* Consolidated L1/L2 scfdefs. +* +* 2003/01/21 Boisy G. Pitre +* Added symbolics for enhanced SCF line editing. +* +* 2003/06/02 Boisy G. Pitre +* Updated comments for clarity. +* +* 2004/05/17 Boisy G. Pitre +* Added higher baud rates. + + NAM SCFDefs + TTL Sequential File Manager Definitions + + PAG +******************************* +* SCF Device Descriptor Offsets +* +* These definitions are for SCF device descriptors. + + section constant + RMB M$DTyp +IT.DVC: RMB 1 Device type (DT.SCF) +IT.UPC: RMB 1 Uppercase flag +IT.BSO: RMB 1 Backspace behavior +IT.DLO: RMB 1 Delete behavior +IT.EKO: RMB 1 Echo flag +IT.ALF: RMB 1 Auto linefeed flag +IT.NUL: RMB 1 End-of-line null count +IT.PAU: RMB 1 Page pause flag +IT.PAG: RMB 1 Number of lines per page +IT.BSP: RMB 1 Backspace character +IT.DEL: RMB 1 Delete-line character +IT.EOR: RMB 1 End-of-record character +IT.EOF: RMB 1 End-of-file character +IT.RPR: RMB 1 Reprint-line character +IT.DUP: RMB 1 Duplicate-last-line character +IT.PSC: RMB 1 Pause character +IT.INT: RMB 1 Interrupt character +IT.QUT: RMB 1 Quit character +IT.BSE: RMB 1 Backspace echo character +IT.OVF: RMB 1 Bell character +IT.PAR: RMB 1 Parity +IT.BAU: RMB 1 Baud rate +IT.D2P: RMB 2 Attached device name string offset +IT.XON: RMB 1 X-ON character +IT.XOF: RMB 1 X-OFF character +IT.COL: RMB 1 Number of columns for display +IT.ROW: RMB 1 Number of rows for display +IT.XTYP: RMB 1 Extended type (added by BRI) + +* IFGT Level-1 +* Window Descriptor Additions +* For CoCo window, where IT.PAR = $80 +* RMB IT.ROW+1 +IT.WND: RMB 1 Window number (matches device name) ($2E) +IT.VAL: RMB 1 Use defaults on Init (0=no, 1=yes) +IT.STY: RMB 1 Screen type default +IT.CPX: RMB 1 Column start default +IT.CPY: RMB 1 Row start default +IT.FGC: RMB 1 Foreground color default +IT.BGC: RMB 1 Background color default +IT.BDC: RMB 1 Border color default +* ENDC + endsect + + PAG +******************** +* SCF Static Storage +* +* SCF devices must reserve this space for SCF +* + section constant + RMB V.USER +V.TYPE: RMB 1 Device type or parity +V.LINE: RMB 1 Lines left until end of page +V.PAUS: RMB 1 Immediate Pause request +V.DEV2: RMB 2 Attached device's static +V.INTR: RMB 1 Interrupt char +V.QUIT: RMB 1 Quit char +V.PCHR: RMB 1 Pause char +V.ERR: RMB 1 Accumulated errors +V.XON: RMB 1 X-On char +V.XOFF: RMB 1 X-Off char +V.KANJI: RMB 1 Kanji mode flag +V.KBUF: RMB 2 Kana - Kanji convert routine work address +V.MODADR: RMB 2 Kana - Kanji convert module address +V.PDLHd: RMB 2 Open path descriptor list head pointer +V.RSV: RMB 5 Reserve bytes for future expansion +V.SCF: EQU * Total SCF manager static overhead + endsect + + PAG +*********************** +* Character Definitions +* +C$NULL: SET 0 Null char +C$RPET: SET $01 (CTRL-A - SOH) Repeat last input line +C$INTR: SET $03 (CTRL-C - ETX) Keyboard interrupt +C$RPRT: SET $04 (CTRL-D - EOT) Reprint current input line +C$QUIT: SET $05 (CTRL-E - ENQ) Keyboard Abort +C$BELL: SET $07 (CTRL-G - BEL) Line overflow warning +C$BSP: SET $08 (CTRL-H - BS ) Back space +C$RARR: SET $09 Right Arrow +C$EL: SET $05 Erase Line +C$LF: SET $0A Line feed +C$HOME: SET $0B Home position Code +C$Clsgr: SET $15 Graphic screen clear (use FM-11) +C$Clsall: SET $16 Graphic & character clear (use FM-11) +C$CR: SET $0D Carriage return +C$FORM: SET $0C (CTRL-L - FF ) Form Feed ... screen clear +C$SI: SET $0F Shift IN Code +C$SO: SET $0E Shift OUT Code +C$DELETE: SET $10 Delete char (for SCF enhanced line editing) +C$XON: SET $11 (CTRL-Q - DC1) Transmit Enable +C$INSERT: SET C$XON Insert char (for SCF enhanced line editing) +C$XOFF: SET $13 (CTRL-S - DC3) Transmit Disable +C$PLINE: SET C$XOFF Print remaining line (for SCF enhanced line editing) +C$PAUS: SET $17 (CTRL-W - ETB) Pause character +C$DEL: SET $18 (CTRL-X - CAN) Delete line +C$SHRARR: SET $19 Shift Right-Arrow +C$EOF: SET $1B (CTRL-[ - ESC) END of file +C$RGT: SET $1C Cursor right +C$LFT: SET $1D Cursor left +C$UP: SET $1E Cursor up +C$DWN: SET $1F Cursor down +C$SPAC: SET $20 Space +C$PERD: SET '. +C$COMA: SET ', + + + PAG +********************************************* +* Sequential Character Path Descriptor Format +* +* A path descriptor is created for every new path that is open +* via the I$Open system call (processed by IOMan). Process +* descriptors track state information of a path. +* + section constant + RMB PD.FST +PD.DV2: RMB 2 Output device table pointer +PD.RAW: RMB 1 Read/Write or ReadLn/WritLn mode +PD.MAX: RMB 2 ReadLn high byte count +PD.MIN: RMB 1 Devices are "mine" if clear +PD.STS: RMB 2 Status routine module addr +PD.STM: RMB 2 Reserved for status routine + endsect + + section constant + RMB PD.OPT + RMB 1 Device type +PD.UPC: RMB 1 Case (0=both, 1=upper only) +PD.BSO: RMB 1 Backspace (0=BSE, 1=BSE,SP,BSE) +PD.DLO: RMB 1 Delete (0=BSE over line, 1=CRLF) +PD.EKO: RMB 1 Echo (0=No Echo) +PD.ALF: RMB 1 Auto linefeed (0=No auto LF) +PD.NUL: RMB 1 End of Line null count +PD.PAU: RMB 1 Page pause (0=No end of page pause) +PD.PAG: RMB 1 Lines per page +PD.BSP: RMB 1 Backspace character +PD.DEL: RMB 1 Delete Line character +PD.EOR: RMB 1 End of Record character (read only) +PD.EOF: RMB 1 End of File character +PD.RPR: RMB 1 Repront Line character +PD.DUP: RMB 1 Dup Last Line character +PD.PSC: RMB 1 Pause character +PD.INT: RMB 1 Keyboard interrupt character (CTRL-C) +PD.QUT: RMB 1 Keyboard quit character (CTRL-E) +PD.BSE: RMB 1 Backspace echo character +PD.OVF: RMB 1 Line overflow character (BELL) +PD.PAR: RMB 1 Parity code +PD.BAU: RMB 1 ACIA baud rate (Color Computer) +PD.D2P: RMB 2 Offset of DEV2 name +PD.XON: RMB 1 ACIA X-ON character +PD.XOFF: RMB 1 ACIA X-OFF character +OPTCNT EQU *-PD.OPT Total user settable options +PD.ERR: RMB 1 Most recent I/O error status +PD.TBL: RMB 2 Device table addr (copy) +PD.PLP: RMB 2 Path Descriptor List Pointer +PD.PST: RMB 1 Current path status + endsect + +* PD.PST values Path Descriptor Status byte +* +PST.DCD: EQU %00000001 Set if DCD is lost on Serial port + + +* PD.PAR definitions +* +* Parity +PARNONE: EQU %00000000 +PARODD: EQU %00100000 +PAREVEN: EQU %01100000 +PARMARK: EQU %10100000 +PARSPACE: EQU %11100000 + +* PD.BAU definitions +* +* Baud rate +B110: EQU %00000000 +B300: EQU %00000001 +B600: EQU %00000010 +B1200: EQU %00000011 +B2400: EQU %00000100 +B4800: EQU %00000101 +B9600: EQU %00000110 +B19200: EQU %00000111 +B38400: EQU %00001000 +B57600: EQU %00001001 +B115200: EQU %00001010 +* Word size +WORD8: EQU %00000000 +WORD7: EQU %00100000 +* Stop bits +STOP1: EQU %00000000 +STOP2: EQU %00010000
--- a/lib/scfdefs.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,244 +0,0 @@ -******************************************************************** -* SCFDefs - Sequential Character File Manager Definitions -* -* $Id$ -* -* SCF stands for 'Sequential Character Filemanager' and is a package of subroutines -* that define the logical structure of a serial device. -* -* The data structures in this file give SCF its 'personality' and are used -* by SCF itself, as well as applications that will require disk I/O. -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1984/01/11 YO -* Added V.KANJI, V.KBUF, V.MODADR for new kanji input process. -* -* 1985/04/20 Mark G. Hawkins -* Added V.PDLHd Path Descriptor List Head. -* -* 1985/04/21 Mark G. Hawkins -* Added PD.PLP and PD.PST for modem handling. -* -* 1987/06/23 Kevin K. Darling -* Updated with Dev Desc info. -* -* 1998/10/03 Boisy G. Pitre -* Consolidated L1/L2 scfdefs. -* -* 2003/01/21 Boisy G. Pitre -* Added symbolics for enhanced SCF line editing. -* -* 2003/06/02 Boisy G. Pitre -* Updated comments for clarity. -* -* 2004/05/17 Boisy G. Pitre -* Added higher baud rates. - - NAM SCFDefs - TTL Sequential File Manager Definitions - - PAG -******************************* -* SCF Device Descriptor Offsets -* -* These definitions are for SCF device descriptors. - - csect - RMB M$DTyp -IT.DVC: RMB 1 Device type (DT.SCF) -IT.UPC: RMB 1 Uppercase flag -IT.BSO: RMB 1 Backspace behavior -IT.DLO: RMB 1 Delete behavior -IT.EKO: RMB 1 Echo flag -IT.ALF: RMB 1 Auto linefeed flag -IT.NUL: RMB 1 End-of-line null count -IT.PAU: RMB 1 Page pause flag -IT.PAG: RMB 1 Number of lines per page -IT.BSP: RMB 1 Backspace character -IT.DEL: RMB 1 Delete-line character -IT.EOR: RMB 1 End-of-record character -IT.EOF: RMB 1 End-of-file character -IT.RPR: RMB 1 Reprint-line character -IT.DUP: RMB 1 Duplicate-last-line character -IT.PSC: RMB 1 Pause character -IT.INT: RMB 1 Interrupt character -IT.QUT: RMB 1 Quit character -IT.BSE: RMB 1 Backspace echo character -IT.OVF: RMB 1 Bell character -IT.PAR: RMB 1 Parity -IT.BAU: RMB 1 Baud rate -IT.D2P: RMB 2 Attached device name string offset -IT.XON: RMB 1 X-ON character -IT.XOF: RMB 1 X-OFF character -IT.COL: RMB 1 Number of columns for display -IT.ROW: RMB 1 Number of rows for display -IT.XTYP: RMB 1 Extended type (added by BRI) - -* IFGT Level-1 -* Window Descriptor Additions -* For CoCo window, where IT.PAR = $80 - RMB IT.ROW+1 -IT.WND: RMB 1 Window number (matches device name) ($2E) -IT.VAL: RMB 1 Use defaults on Init (0=no, 1=yes) -IT.STY: RMB 1 Screen type default -IT.CPX: RMB 1 Column start default -IT.CPY: RMB 1 Row start default -IT.FGC: RMB 1 Foreground color default -IT.BGC: RMB 1 Background color default -IT.BDC: RMB 1 Border color default -* ENDC - endsect - - PAG -******************** -* SCF Static Storage -* -* SCF devices must reserve this space for SCF -* - csect - RMB V.USER -V.TYPE: RMB 1 Device type or parity -V.LINE: RMB 1 Lines left until end of page -V.PAUS: RMB 1 Immediate Pause request -V.DEV2: RMB 2 Attached device's static -V.INTR: RMB 1 Interrupt char -V.QUIT: RMB 1 Quit char -V.PCHR: RMB 1 Pause char -V.ERR: RMB 1 Accumulated errors -V.XON: RMB 1 X-On char -V.XOFF: RMB 1 X-Off char -V.KANJI: RMB 1 Kanji mode flag -V.KBUF: RMB 2 Kana - Kanji convert routine work address -V.MODADR: RMB 2 Kana - Kanji convert module address -V.PDLHd: RMB 2 Open path descriptor list head pointer -V.RSV: RMB 5 Reserve bytes for future expansion -V.SCF: EQU * Total SCF manager static overhead - endsect - - PAG -*********************** -* Character Definitions -* -C$NULL: SET 0 Null char -C$RPET: SET $01 (CTRL-A - SOH) Repeat last input line -C$INTR: SET $03 (CTRL-C - ETX) Keyboard interrupt -C$RPRT: SET $04 (CTRL-D - EOT) Reprint current input line -C$QUIT: SET $05 (CTRL-E - ENQ) Keyboard Abort -C$BELL: SET $07 (CTRL-G - BEL) Line overflow warning -C$BSP: SET $08 (CTRL-H - BS ) Back space -C$RARR: SET $09 Right Arrow -C$EL: SET $05 Erase Line -C$LF: SET $0A Line feed -C$HOME: SET $0B Home position Code -C$Clsgr: SET $15 Graphic screen clear (use FM-11) -C$Clsall: SET $16 Graphic & character clear (use FM-11) -C$CR: SET $0D Carriage return -C$FORM: SET $0C (CTRL-L - FF ) Form Feed ... screen clear -C$SI: SET $0F Shift IN Code -C$SO: SET $0E Shift OUT Code -C$DELETE: SET $10 Delete char (for SCF enhanced line editing) -C$XON: SET $11 (CTRL-Q - DC1) Transmit Enable -C$INSERT: SET C$XON Insert char (for SCF enhanced line editing) -C$XOFF: SET $13 (CTRL-S - DC3) Transmit Disable -C$PLINE: SET C$XOFF Print remaining line (for SCF enhanced line editing) -C$PAUS: SET $17 (CTRL-W - ETB) Pause character -C$DEL: SET $18 (CTRL-X - CAN) Delete line -C$SHRARR: SET $19 Shift Right-Arrow -C$EOF: SET $1B (CTRL-[ - ESC) END of file -C$RGT: SET $1C Cursor right -C$LFT: SET $1D Cursor left -C$UP: SET $1E Cursor up -C$DWN: SET $1F Cursor down -C$SPAC: SET $20 Space -C$PERD: SET '. -C$COMA: SET ', - - - PAG -********************************************* -* Sequential Character Path Descriptor Format -* -* A path descriptor is created for every new path that is open -* via the I$Open system call (processed by IOMan). Process -* descriptors track state information of a path. -* - csect - RMB PD.FST -PD.DV2: RMB 2 Output device table pointer -PD.RAW: RMB 1 Read/Write or ReadLn/WritLn mode -PD.MAX: RMB 2 ReadLn high byte count -PD.MIN: RMB 1 Devices are "mine" if clear -PD.STS: RMB 2 Status routine module addr -PD.STM: RMB 2 Reserved for status routine - endsect - - csect - RMB PD.OPT - RMB 1 Device type -PD.UPC: RMB 1 Case (0=both, 1=upper only) -PD.BSO: RMB 1 Backspace (0=BSE, 1=BSE,SP,BSE) -PD.DLO: RMB 1 Delete (0=BSE over line, 1=CRLF) -PD.EKO: RMB 1 Echo (0=No Echo) -PD.ALF: RMB 1 Auto linefeed (0=No auto LF) -PD.NUL: RMB 1 End of Line null count -PD.PAU: RMB 1 Page pause (0=No end of page pause) -PD.PAG: RMB 1 Lines per page -PD.BSP: RMB 1 Backspace character -PD.DEL: RMB 1 Delete Line character -PD.EOR: RMB 1 End of Record character (read only) -PD.EOF: RMB 1 End of File character -PD.RPR: RMB 1 Repront Line character -PD.DUP: RMB 1 Dup Last Line character -PD.PSC: RMB 1 Pause character -PD.INT: RMB 1 Keyboard interrupt character (CTRL-C) -PD.QUT: RMB 1 Keyboard quit character (CTRL-E) -PD.BSE: RMB 1 Backspace echo character -PD.OVF: RMB 1 Line overflow character (BELL) -PD.PAR: RMB 1 Parity code -PD.BAU: RMB 1 ACIA baud rate (Color Computer) -PD.D2P: RMB 2 Offset of DEV2 name -PD.XON: RMB 1 ACIA X-ON character -PD.XOFF: RMB 1 ACIA X-OFF character -OPTCNT EQU *-PD.OPT Total user settable options -PD.ERR: RMB 1 Most recent I/O error status -PD.TBL: RMB 2 Device table addr (copy) -PD.PLP: RMB 2 Path Descriptor List Pointer -PD.PST: RMB 1 Current path status - endsect - -* PD.PST values Path Descriptor Status byte -* -PST.DCD: EQU %00000001 Set if DCD is lost on Serial port - - -* PD.PAR definitions -* -* Parity -PARNONE: EQU %00000000 -PARODD: EQU %00100000 -PAREVEN: EQU %01100000 -PARMARK: EQU %10100000 -PARSPACE: EQU %11100000 - -* PD.BAU definitions -* -* Baud rate -B110: EQU %00000000 -B300: EQU %00000001 -B600: EQU %00000010 -B1200: EQU %00000011 -B2400: EQU %00000100 -B4800: EQU %00000101 -B9600: EQU %00000110 -B19200: EQU %00000111 -B38400: EQU %00001000 -B57600: EQU %00001001 -B115200: EQU %00001010 -* Word size -WORD8: EQU %00000000 -WORD7: EQU %00100000 -* Stop bits -STOP1: EQU %00000000 -STOP2: EQU %00010000
--- a/lib/sys6309l2.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -DRAGON equ 0 -Level equ 2 -H6309 equ 1 - - use os9.a - use rbf.a - use scf.a - use pipe.a - use systype.a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/sys6309l2.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,9 @@ +DRAGON equ 0 +Level equ 2 +H6309 equ 1 + + use os9.as + use rbf.as + use scf.as + use pipe.as + use systype.as
--- a/lib/sys6809l1.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -DRAGON equ 0 -Level equ 1 -H6309 equ 0 - - use os9.a - use rbf.a - use scf.a - use pipe.a - use systype.a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/sys6809l1.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,9 @@ +DRAGON equ 0 +Level equ 1 +H6309 equ 0 + + use os9.as + use rbf.as + use scf.as + use pipe.as + use systype.as
--- a/lib/sys6809l2.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -DRAGON equ 0 -Level equ 2 -H6309 equ 0 - - use os9.a - use rbf.a - use scf.a - use pipe.a - use systype.a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/sys6809l2.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,9 @@ +DRAGON equ 0 +Level equ 2 +H6309 equ 0 + + use os9.as + use rbf.as + use scf.as + use pipe.as + use systype.as
--- a/lib/systype.a Sat Jan 26 08:26:31 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ -******************************************************************** -* SysType - NitrOS-9 System Specific Definitions -* -* $Id$ -* -* Edt/Rev YYYY/MM/DD Modified by -* Comment -* ------------------------------------------------------------------ -* 1998/10/13 Boisy G. Pitre -* Added defs by Bruce Isted from his Eliminator archive. -* -* 1998/10/31 Boisy G. Pitre -* Merged cc3global.defs into this file. -* -* 2002/04/30 Boisy G. Pitre -* Merged Level One and Level Two sysdefs. -* -* 2002/06/22 Boisy G. Pitre -* Removed PIA.U4 and PIA.U8, improved comments -* -* 2003/11/05 Robert Gault -* Made changes in window globals and grfdrv memory to handle regW -* in 6809 systems. -* -* 2003/11/30 Boisy G. Pitre -* Statics now are prefaced with V. to identify them easier in source. -* -* 2004/07/18 Boisy G. Pitre -* Moved CoCo 3 Window stuff into cc3iodefs - - NAM SysType - IFEQ Level-1 - TTL NitrOS-9 Level 1 System Type Definitions - ELSE - IFEQ Level-2 - TTL NitrOS-9 Level 2 System Type Definitions - ENDC - IFEQ Level-3 - TTL NitrOS-9 Level 3 System Type Definitions - ENDC - ENDC - - -********************** -* CPU Type Definitions -* -Color: SET 1 -Color3: SET 2 - IFEQ Level-1 -CPUType: SET Color - ELSE -CPUType: SET Color3 - ENDC - - -****************************** -* Clock Speed Type Definitions -* -OneMHz: EQU 1 -TwoMHz: EQU 2 - IFEQ CPUType-Color -CPUSpeed: SET OneMHz - ELSE -CPUSpeed: SET TwoMHz - ENDC - - -********************************** -* Power Line Frequency Definitions -* -Hz50: EQU 1 Assemble clock for 50 hz power -Hz60: EQU 2 Assemble clock for 60 hz power -PwrLnFrq: SET Hz60 Set to Appropriate freq - - -********************************** -* Ticks per second -* - IFEQ PwrLnFrq-Hz50 -TkPerSec: SET 50 - ELSE -TkPerSec: SET 60 - ENDC - - -****************** -* ACIA type set up -* - section .data -ACIA6850: RMB 1 MC6850 acia. -ACIA6551: RMB 1 SY6551 acia. -ACIA2661: RMB 1 SC2661 acia. -ACIATYPE: SET ACIA6551 - endsect - - -**************************************** -* Special character Bit position equates -* -SHIFTBIT: EQU %00000001 -CNTRLBIT: EQU %00000010 -ALTERBIT: EQU %00000100 -UPBIT: EQU %00001000 -DOWNBIT: EQU %00010000 -LEFTBIT: EQU %00100000 -RIGHTBIT: EQU %01000000 -SPACEBIT: EQU %10000000 - - -****************** -* Device addresses for miscellaneous hardware -* -A.AciaP: SET $FF68 Aciapak Address -A.ModP: SET $FF6C ModPak Address -DPort: SET $FF40 Disk controller base address -MPI.Slct: SET $FF7F Multi-Pak slot select -MPI.Slot: SET $03 Multi-Pak default slot -PIA0Base: EQU $FF00 -PIA1Base: EQU $FF20 - - -****************** -* VDG Devices -* -A.TermV: SET $FFC0 VDG Term -A.V1: SET $FFC1 Possible additional VDG Devices -A.V2: SET $FFC2 -A.V3: SET $FFC3 -A.V4: SET $FFC4 -A.V5: SET $FFC5 -A.V6: SET $FFC6 -A.V7: SET $FFC7 - - - IFEQ Level-1 - -************************************************* -* -* NitrOS-9 Level 1 Section -* -************************************************* - -HW.Page: SET $FF Device descriptor hardware page - - ELSE - -************************************************* -* -* NitrOS-9 Level 2 Section -* -************************************************* - -**************************************** -* Dynamic Address Translator Definitions -* -DAT.BlCt: EQU 8 D.A.T. blocks/address space -DAT.BlSz: EQU (256/DAT.BlCt)*256 D.A.T. block size -DAT.ImSz: EQU DAT.BlCt*2 D.A.T. Image size -DAT.Addr: EQU -(DAT.BlSz/256) D.A.T. MSB Address bits -DAT.Task: EQU $FF91 Task Register address -DAT.TkCt: EQU 32 Number of DAT Tasks -DAT.Regs: EQU $FFA0 DAT Block Registers base address -DAT.Free: EQU $333E Free Block Number -DAT.BlMx: EQU $3F Maximum Block number -DAT.BMSz: EQU $40 Memory Block Map size -DAT.WrPr: EQU 0 no write protect -DAT.WrEn: EQU 0 no write enable -SysTask: EQU 0 Coco System Task number -IOBlock: EQU $3F -ROMBlock: EQU $3F -IOAddr: EQU $7F -ROMCount: EQU 1 number of blocks of ROM (High RAM Block) -RAMCount: EQU 1 initial blocks of RAM -MoveBlks: EQU DAT.BlCt-ROMCount-2 Block numbers used for copies -BlockTyp: EQU 1 chk only first bytes of RAM block -ByteType: EQU 2 chk entire block of RAM -Limited: EQU 1 chk only upper memory for ROM modules -UnLimitd: EQU 2 chk all NotRAM for modules -* NOTE: this check assumes any NotRAM with a module will -* always start with $87CD in first two bytes of block -RAMCheck: EQU BlockTyp chk only beg bytes of block -ROMCheck: EQU Limited chk only upper few blocks for ROM -LastRAM: EQU IOBlock maximum RAM block number - -*************************** -* Color Computer 3 Specific -* -MappedIO: EQU true (Actually False but it works better this way) - -******************** -* Hardware addresses -* -GIMERegs: EQU $FF00 Base address of GIME registers -IrqEnR: EQU $FF92 GIME IRQ enable/status register -BordReg: EQU $FF9A Border color register -PalAdr: EQU $FFB0 Palette registers - -HW.Page: SET $07 Device descriptor hardware page - - ENDC -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/systype.as Sat Jan 26 17:18:24 2013 -0600 @@ -0,0 +1,201 @@ +******************************************************************** +* SysType - NitrOS-9 System Specific Definitions +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 1998/10/13 Boisy G. Pitre +* Added defs by Bruce Isted from his Eliminator archive. +* +* 1998/10/31 Boisy G. Pitre +* Merged cc3global.defs into this file. +* +* 2002/04/30 Boisy G. Pitre +* Merged Level One and Level Two sysdefs. +* +* 2002/06/22 Boisy G. Pitre +* Removed PIA.U4 and PIA.U8, improved comments +* +* 2003/11/05 Robert Gault +* Made changes in window globals and grfdrv memory to handle regW +* in 6809 systems. +* +* 2003/11/30 Boisy G. Pitre +* Statics now are prefaced with V. to identify them easier in source. +* +* 2004/07/18 Boisy G. Pitre +* Moved CoCo 3 Window stuff into cc3iodefs + + NAM SysType + IFEQ Level-1 + TTL NitrOS-9 Level 1 System Type Definitions + ELSE + IFEQ Level-2 + TTL NitrOS-9 Level 2 System Type Definitions + ENDC + IFEQ Level-3 + TTL NitrOS-9 Level 3 System Type Definitions + ENDC + ENDC + + +********************** +* CPU Type Definitions +* +Color: SET 1 +Color3: SET 2 + IFEQ Level-1 +CPUType: SET Color + ELSE +CPUType: SET Color3 + ENDC + + +****************************** +* Clock Speed Type Definitions +* +OneMHz: EQU 1 +TwoMHz: EQU 2 + IFEQ CPUType-Color +CPUSpeed: SET OneMHz + ELSE +CPUSpeed: SET TwoMHz + ENDC + + +********************************** +* Power Line Frequency Definitions +* +Hz50: EQU 1 Assemble clock for 50 hz power +Hz60: EQU 2 Assemble clock for 60 hz power +PwrLnFrq: SET Hz60 Set to Appropriate freq + + +********************************** +* Ticks per second +* + IFEQ PwrLnFrq-Hz50 +TkPerSec: SET 50 + ELSE +TkPerSec: SET 60 + ENDC + + +****************** +* ACIA type set up +* + section .data +ACIA6850: RMB 1 MC6850 acia. +ACIA6551: RMB 1 SY6551 acia. +ACIA2661: RMB 1 SC2661 acia. +ACIATYPE: SET ACIA6551 + endsect + + +**************************************** +* Special character Bit position equates +* +SHIFTBIT: EQU %00000001 +CNTRLBIT: EQU %00000010 +ALTERBIT: EQU %00000100 +UPBIT: EQU %00001000 +DOWNBIT: EQU %00010000 +LEFTBIT: EQU %00100000 +RIGHTBIT: EQU %01000000 +SPACEBIT: EQU %10000000 + + +****************** +* Device addresses for miscellaneous hardware +* +A.AciaP: SET $FF68 Aciapak Address +A.ModP: SET $FF6C ModPak Address +DPort: SET $FF40 Disk controller base address +MPI.Slct: SET $FF7F Multi-Pak slot select +MPI.Slot: SET $03 Multi-Pak default slot +PIA0Base: EQU $FF00 +PIA1Base: EQU $FF20 + + +****************** +* VDG Devices +* +A.TermV: SET $FFC0 VDG Term +A.V1: SET $FFC1 Possible additional VDG Devices +A.V2: SET $FFC2 +A.V3: SET $FFC3 +A.V4: SET $FFC4 +A.V5: SET $FFC5 +A.V6: SET $FFC6 +A.V7: SET $FFC7 + + + IFEQ Level-1 + +************************************************* +* +* NitrOS-9 Level 1 Section +* +************************************************* + +HW.Page: SET $FF Device descriptor hardware page + + ELSE + +************************************************* +* +* NitrOS-9 Level 2 Section +* +************************************************* + +**************************************** +* Dynamic Address Translator Definitions +* +DAT.BlCt: EQU 8 D.A.T. blocks/address space +DAT.BlSz: EQU (256/DAT.BlCt)*256 D.A.T. block size +DAT.ImSz: EQU DAT.BlCt*2 D.A.T. Image size +DAT.Addr: EQU -(DAT.BlSz/256) D.A.T. MSB Address bits +DAT.Task: EQU $FF91 Task Register address +DAT.TkCt: EQU 32 Number of DAT Tasks +DAT.Regs: EQU $FFA0 DAT Block Registers base address +DAT.Free: EQU $333E Free Block Number +DAT.BlMx: EQU $3F Maximum Block number +DAT.BMSz: EQU $40 Memory Block Map size +DAT.WrPr: EQU 0 no write protect +DAT.WrEn: EQU 0 no write enable +SysTask: EQU 0 Coco System Task number +IOBlock: EQU $3F +ROMBlock: EQU $3F +IOAddr: EQU $7F +ROMCount: EQU 1 number of blocks of ROM (High RAM Block) +RAMCount: EQU 1 initial blocks of RAM +MoveBlks: EQU DAT.BlCt-ROMCount-2 Block numbers used for copies +BlockTyp: EQU 1 chk only first bytes of RAM block +ByteType: EQU 2 chk entire block of RAM +Limited: EQU 1 chk only upper memory for ROM modules +UnLimitd: EQU 2 chk all NotRAM for modules +* NOTE: this check assumes any NotRAM with a module will +* always start with $87CD in first two bytes of block +RAMCheck: EQU BlockTyp chk only beg bytes of block +ROMCheck: EQU Limited chk only upper few blocks for ROM +LastRAM: EQU IOBlock maximum RAM block number + +*************************** +* Color Computer 3 Specific +* +MappedIO: EQU true (Actually False but it works better this way) + +******************** +* Hardware addresses +* +GIMERegs: EQU $FF00 Base address of GIME registers +IrqEnR: EQU $FF92 GIME IRQ enable/status register +BordReg: EQU $FF9A Border color register +PalAdr: EQU $FFB0 Palette registers + +HW.Page: SET $07 Device descriptor hardware page + + ENDC +
--- a/rules.mak Sat Jan 26 08:26:31 2013 -0600 +++ b/rules.mak Sat Jan 26 17:18:24 2013 -0600 @@ -103,16 +103,16 @@ CC363L3 = $(LEVEL3)/coco3_6309 # C-Cubed Rules -%.r: %.c +%.o: %.c $(CC) $(CFLAGS) $< -r -%.l: %.r +%.a: %.o lwar -c $@ $? -%: %.r +%: %.a $(LINKER) $(LFLAGS) $^ -o$@ -%.r: %.a +%.o: %.as $(ASM) $< -o$@ # File managers