Mercurial > hg > Members > kono > nitros9-code
changeset 330:e0679d0d5abc
These commands are either gathered from level1/CMDS or have been moved to
3rdparty/utils/enhanced
author | boisy |
---|---|
date | Wed, 24 Jul 2002 05:22:59 +0000 |
parents | 65a11be4f1e7 |
children | 2a7bfa7ce709 |
files | level2/cmds/cobbler.asm level2/cmds/copy.asm level2/cmds/display.asm level2/cmds/makdir.asm level2/cmds/xmode.asm |
diffstat | 5 files changed, 0 insertions(+), 1741 deletions(-) [+] |
line wrap: on
line diff
--- a/level2/cmds/cobbler.asm Wed Jul 24 05:14:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,416 +0,0 @@ -******************************************************************** -* Cobbler - Boot generation utility -* -* $Id$ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 7 Reworked AD -* 8 Fixed error where $40+C$CR should have been BGP 98/10/20 -* $40*256+C$CR - - nam Cobbler - ttl Boot generation utility - -* Disassembled 94/10/23 11:19:48 by Alan DeKok - -* WARNING: This is a LEVEL II Cobbler only! - - ifp1 - use os9defs - use scfdefs - use rbfdefs - endc - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $01 -edition set 8 - - mod eom,name,tylg,atrv,start,size -u0000 rmb 3 -u0003 rmb 1 -u0004 rmb 12 -u0010 rmb 5 - -u0015 rmb 1 -u0016 rmb 2 -u0018 rmb 2 -* Everything before here is the DD.foo equivalent -PathO rmb 1 path output to OS9boot file -Path rmb 3 path to /DEVICE@ -KernelF rmb 1 0=write kernel track, 1= don't -BootF rmb 1 0=write boot track, 1=don't -FileNm rmb 20 /DEVICE/OS9Boot memory - rmb 16 -SysDAT rmb 16 copy of the system DAT image -FileDesc rmb $20 room for first bit of file descriptor -AllMap rmb 1024 allocation map is entirely too large... -Buffer rmb $2000 only copy 8k at a time - rmb 200 room for the stack -size equ . - -name fcs /Cobbler/ - fcb edition my version of cobbler - -L0015 fdb $0000 minimal DAT image for checking out the system. - -OS9Boot fcs '/OS9Boot' -Rel fcc /Rel/ - -start clr <KernelF force a write of the kernel track - clr <BootF force a write of the boot track -skip ldd ,x+ - cmpa #C$SPAC space? - beq skip - cmpa #'- hyphen? - bne s.001 - - andb #$DF make it uppercase - cmpb #'K force no write of kernel track? - bne check.b no, check for the boot track stuff - stb <KernelF save the kernel flag - bra s.000 - -check.b cmpb #'B don't write boot? - bne go.help no, print out help message - stb <BootF save the boot flag - -s.000 leax 1,x skip the character - lda ,x++ get the next character, and point to the next one - cmpa #$20 space? - bne go.help no, print out a help message - -s.001 leax -1,x - lda #'/ - cmpa ,x is the first character a slash? -Go.help lbne Help not a device name, error out - os9 F$PrsNam parse the name - lbcs Exit exit on error - lda #'/ is the next character a slash? - cmpa ,y check it - lbeq Help yes, dump out a help message - ldy #FileNm point to the filename buffer -L013C sta ,y+ make first character a slash - lda ,x+ copy the name over - decb - bpl L013C - ldd #$40*256+C$CR '@+CR' - std ,y save in the buffer - ldx #FileNm point to the filename again - lda #UPDAT. - os9 I$Open open /DEVICE@ - sta <Path save the path to the file - lbcs Exit dump out help on an error - leax ,y point to end of '/DEVICE' name - leay >OS9Boot,pcr point to the OS9Boot name -L0162 lda ,y+ get a byte from the name - sta ,x+ save in my buffer - bpl L0162 copy it over - - leax ,u both are zero in a level II system - lda <Path - os9 I$Seek seek to LSN0 - lbcs Exit dump out error if encountered - -* X is implicitely zero from the call above - ldy #DD.BSZ+2 read everything up to the boot size - lda <Path - os9 I$Read get it - lbcs Exit - - tst <BootF replace OS9Boot? - lbne no.boot no, go write the kernel track - - ldd <DD.BSZ get the boot size - lbeq L019F if non-existent, don't delete it - ldx #FileNm point to /DEVICE/OS9boot - os9 I$Delete delete it, if it exists - clra - clrb - sta <DD.BT NO OS9boot file on this disk - std <DD.BT+1 - std <DD.BSZ - lbsr L045A dump out LSN0 information again - -L019F ldd #(UPDAT.*256)+UPDAT. - ldx #FileNm create a /DEVICE/OS9Boot file - os9 I$Create - lbcs Exit - sta <PathO - - leax >L0015,pcr temporary DAT image - tfr x,d - ldx #$0000 get copy of direct page - ldy #$0090 first $90 bytes - ldu #Buffer to a buffer - os9 F$CpyMem copy memory - lbcs Exit - - leax >L0015,pcr - tfr x,d use it as temporary DAT image - ldx >Buffer+D.SysDAT get pointer to system DAT image - ldy #$0010 get a copy of it - ldu #SysDAT point to room for the system DAT image - os9 F$CpyMem get the system DAT image - lbcs Exit - ldx #Buffer - ldd <D.BtPtr,x address of boot in system memory - pshs d save a copy of it - ldd <D.BtSz,x size of the OS9Boot file in system memory - std <DD.BSZ save in the boot size info for LSN0 - pshs d save the size -L01F7 ldy #$2000 only do 8k at a time - cmpy ,s default to one block??? - bls L0203 - ldy ,s get the actual boot size -L0203 pshs y save a copy of it - ldx #SysDAT get dat image - tfr x,d save it - ldx $04,s get start of boot in memory - ldu #Buffer - os9 F$CpyMem copy one block at a time - lbcs Exit - ldy ,s get how much we're copying - ldx #Buffer point to the buffer - lda <PathO dump it to /DEVICE/OS9Boot file - os9 I$Write - lbcs Exit - puls d get size of what we're copying - ldy $02,s get start address of boot file in system memory - leay d,y go to the next group of data - sty $02,s save new start a address - nega - negb - sbca #$00 - ldy ,s get size of boot file left - leay d,y take out what we've done - sty ,s save it - bne L01F7 if not done, continue - leas $04,s remove start,size from the stack - - lda <PathO path to OS9Boot - ldb #SS.FD get FD information - ldx #FileDesc read the file descriptor sector - ldy #$0020 only get the first 32 bytes of it - os9 I$GetStt - lbcs Exit - - os9 I$Close close the path - lbcs Exit - - ldd <FD.SEG+3+2+3,x get size of SECOND segment in file - lbne L0488 if not zero, the file is fragmented - ldb <FD.SEG,x get first byte of address - stb <DD.BT save starting sector of the bootstrap file - ldd <FD.SEG+1,x - std <DD.BT+1 save the rest of the LSN# - lbsr L045A seek to LSN0 and dump out this information, too - - lda <KernelF do we do a kernel track? - bne ClnExit no, don't even check for floppy stuff - - lda <DD.FMT is it a HD? (Bit 7 set) - bpl Floppy if bit 7 is clear, go do track 34 stuff. - -ClnExit clrb no error -Exit1 OS9 F$Exit and exit - -no.boot lda <DD.FMT is it a HD? (bit 7 set) - bpl Floppy if OK, go write it - coma set carry - ldb #E$BTyp bad media type - bra Exit1 - -Floppy ldd #$0001 track 0, sector 1: LSN 1 - lbsr L0440 seek to it - - ldx #AllMap point to the allocation map buffer - ldy <DD.MAP get the size of the map - lda <Path - os9 I$Read read in the allocation map - bcs Exit1 - - ldd <DD.MAP get number of bytes in the map - leau d,x point to the END of the map - ldd #$2200 track 34, sector 0 - lbsr Tk2LSN get LSN of this in D - pshs d save it for later - ldy #0018 force the boot track to be 18 sectors long - OS9 F$SchBit search for 18 free sectors at D,X: ending at U - cmpd ,s++ did we find bits at the starting bit number? - bne Check no, check for REL on the disk - cmpy #0018 if found at the right spot, did we find 18 bits? - beq AllClr if so, go allocate them - -Check ldd #$2200 track 34, sector 0 - lbsr L0440 seek to it - - ldx #Buffer - ldy #$0100 read one sector - lda <Path - os9 I$Read get the first sector of the boot track - lbcs Exit - - ldd ,x++ get the first 2 bytes - cmpd #$4F53 is it 'OS'? - lbne L0496 files present on track 34, give error - ldd ,x++ - cmpa #$20 is it a BRA? - lbne L0496 - ldd ,x get some bytes from the sector - cmpd #M$ID12 is it a module header? - beq map.blk yes, go write out the kernel track - leax 2,x skip the $1205 sync bytes - ldd ,x grab the header - cmpd #M$ID12 is there a module here? - lbne L0496 no, error out - bra map.blk don't allocate track 34, REL already exists on it - -* We've found 18 bytes at D,X in the allocation bit map -* D,X,Y are set up from above -AllClr OS9 F$AllBit allocate the bits in the bitmap - -* possible problems here, as the r/w of the allocation bitmap is NOT atomic. -* some other process may come along and grab the sectors we want. -L0315 ldd #$0001 track 0, sector 1 - bsr L0440 seek to it - ldx #AllMap - ldy <DD.MAP - lda <Path - os9 I$Write dump out the allocation map again - lbcs Exit - -* Do a F$Link to REL? -map.blk ldx #$003F the boot track is in block 63 - ldb #1 one block - OS9 F$MapBlk map the block in - lbcs L049D error finding boot track in memory - - ldd #$2200 track 34, sector 0 - bsr L0440 seek to it - lda <Path - leax $0D00,u the boot track starts out at $ED00 - ldy #$1200 dump out 18 sectors - os9 I$Write dump out REL, Boot, OS9p1 - pshs cc,b - ldb #1 - OS9 F$ClrBlk un-map block $3F - puls cc,b restore possible error code - bcs L048F if there was an error, print it out and exit - os9 I$Close close the path - clrb no erros - bra Exit - -****************************** -* Convert track,sector to LSN -* -* Entry: A = track number -* B = sector number -* Exit : D = LSN# of that sector -Tk2LSN pshs b - ldb <DD.FMT - andb #$01 - beq L037F - ldb #$02 disk is 2-sided - bra L0381 - -L037F ldb #$01 disk is 1-sided -L0381 mul multiply sides by tracks - lda <DD.TKS track size in sectors - mul get LSN of the track - addb ,s add in the sector - adca #$00 make it 16-bit - leas $01,s dumb dumb dumb people... - rts - -L0440 pshs u,y,x,d - bsr Tk2LSN convert track,sector to LSN - pshs a - tfr b,a - clrb shuffle so 16-bit LSN goes to - tfr d,u 32-bit address, with the lower - puls b 16 bits all zero - clra - tfr d,x - lda <Path - os9 I$Seek seek to it - bcs L048F - puls pc,u,y,x,d - -L045A clra - clrb - tfr d,x - tfr d,u go to LSN0 - - lda <Path - os9 I$Seek seek to LSN0 - - ldy #DD.DAT X=$0000 already... - lda <Path - os9 I$Write dump it out - bcs Exit - rts - -Help leax <HelpMsg,pcr - clrb - -Print pshs b,cc - lda #$02 - ldy #$0200 - os9 I$WritLn - comb - puls b,cc - -Exit os9 F$Exit - -L0488 leax >L00D1,pcr - clrb - bra Print - -L048F leax >L0051,pcr - clrb - bra Print - -L0496 leax >L008E,pcr - clrb - bra Print - -L049D leax >L00F2,pcr - bra Print - -HelpMsg fcb C$LF - fcc 'Use: COBBLER [-k] [-b] </devname>' - fcb C$LF - fcc / to create a new system disk by writing an OS9Boot file/ - fcb C$LF - fcc / and a boot (kernel) track to the specified drive./ - fcb C$LF,C$LF - fcc / -k = don't write the kernel track/ - fcb C$LF - fcc / Hard disk drives never have the kernel track written./ - fcb C$LF - fcc / -b = don't write the OS9Boot file/ - fcb C$CR - -L0051 fcb C$LF - fcc /Error writing kernel track or LSN0./ - fcb C$CR - -L008E fcb C$LF - fcc /Warning - file(s) present on track 34/ - fcb C$LF - fcc / - this track not rewritten./ - fcb C$CR - -L00D1 fcb C$LF - fcc /Error - OS9boot file fragmented/ - fcb C$CR - -L00F2 fcb C$LF - fcc /Error - can't find boot track in memory/ - fcb C$CR - - emod -eom equ * - end
--- a/level2/cmds/copy.asm Wed Jul 24 05:14:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,320 +0,0 @@ -******************************************************************** -* Copy - File copy utility -* -* $Id$ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 10 Reworked RML - - nam Copy - ttl File copy utility - -* Edition 10 rewrite 10/28/88 - RML - - ifp1 - use defsfile - endc - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $01 -edition set 10 - - mod eom,name,tylg,atrv,start,size - -inpath rmb 1 input path number -outpath rmb 1 output path number -indevtyp rmb 1 input device type (1 = RBF) -verify rmb 1 verify on/off (1=on) -bufsize rmb 2 read/write buffer size -fsizemsb rmb 2 msb's of file size -fsizelsb rmb 2 lsb's of file size -writemsb rmb 2 msb's of bytes written to output -writelsb rmb 2 lsb's of bytes written to output -single rmb 1 single drive copy flag (1=yes) -attribs rmb 1 file attributes -fdbuff rmb 16 File Descriptor buffer -optbuff rmb 32 Path Descriptor Options Buffer -stack rmb 448 stack storage -vfybuff rmb 256 verify buffer -buffer rmb $2000-. read/write buffer (minimum..will expand with mem mod) -size equ . - -name fcs /Copy/ - fcb edition - -start leas vfybuff,u set stack pointer to 512 - pshs u save u reg - leau <optbuff,u point u to 20th byte - -clearit clr ,-u clear byte - cmpu ,s done ? - bhi clearit loop back - tfr y,d move in top of mem (after param area) - subd ,s++ subtract current stack - subd #$0300 and back off variable storage - clrb round off to page bondary - std <bufsize buffer size - pshs x save x register - -getopt lda ,x+ get a char - cmpa #'- was it a '-'?? - beq chkopt yes..go check opt - cmpa #C$CR was it a <cr>?? - bne getopt no..check next char - bra openin else done..go finish processing - -chkopt ldd ,x+ get next 2 chars - eora #'S check if its an S - anda #$DF make upper case - lbne sndinstr not an s.. send instructions - cmpb #$30 else check if next char is number or letter - lbhs sndinstr yup...send instructions - inc <single set s option - bra getopt and check next char - -openin puls x restore line pointer - lda #READ. open first file - os9 I$Open - lbcs chkerr error..go see what it was - sta <inpath save path number - pshs x save second path name start - leax <fdbuff,u point to FD buffer - ldy #16 bytes to read - ldb #SS.FD get file descriptor - os9 I$GetStt - puls x restore line pointer - bcs getintyp skip this on eror - tst <single single drive copy ? - beq getintyp no..skip this stuff - lda ,x get first char of path name - ldb #E$BPNam load bad path name error message - cmpa #'/ was it a path separaor ? - bne errjump nope..error - -getintyp pshs x save out path name start - lda <inpath get path number - bsr getopts get option section - lda ,x get device type - sta <indevtyp save it - ldb #$0F default attributes...read,write,execute,public - cmpa #DT.RBF was device type RBF ? - bne openout nope...don't get file size/attributes - pshs u,x save registers - lda <inpath get path number - ldb #SS.Size Get File size - bsr getstat do the GetStt call..exit on error - stx <fsizemsb save 2 msb's of file size - stu <fsizelsb save 2 lsb's of file size - puls u,x restore registers - ldb <$13,x get file attributes - -openout stb <attribs save attributes - ldx ,s get start of second path name - lbsr destsnd send destination msg - lda #UPDAT. open file for update - ldb <attribs get attributes - os9 I$Create create the file - puls x restore x register - bcc open010 no error..skip this - inc <verify set verify off - lda #WRITE. open filein write only mode - ldb <attribs get atributes - os9 I$Create create the file - bcs errjump exit on error - -open010 sta <outpath save second path number - bsr getopts get option section - ldb ,x get device type - cmpb #DT.RBF was it RBF - beq setvfy yup...skip this - inc <verify set verify off - bra mainloop and skip all this - -errjump lbra errexit nope....error - -getopts leax <optbuff,u point to buffer - ldb #SS.Opt get option section of path descritor - -getstat os9 I$GetStt - bcs errjump exit on error - rts - -setvfy tst <verify do we want verify on - bne setsiz nope...dont set driver verify on - ldb #1 verify - stb 8,x turn verify on - ldb #SS.OPT set options - os9 I$SetStt - bcs errjump exit on error - -setsiz lda <indevtyp get device type - cmpa #DT.RBF is it an RBF file - bne mainloop nope...dont preset file size - pshs u save register - lda <outpath get out path number - ldb #SS.Size set file size - ldx <fsizemsb get 2 msb's of in file size - ldu <fsizelsb get 2 lsb's of in file size - os9 I$SetStt set the size - bcs errjump exit on error - puls u restore register - lda <outpath get out path number - leax <fdbuff,u point to FD buffer - ldy #16 number of bytes to write - ldb #SS.FD write out the FD (for dates,etc.) - os9 I$SetStt - -mainloop leax buffer,u point to buffer - clra source drive code - lbsr chkdrive send source switch msg - lda <inpath get in path number - ldy <bufsize get buffer size - os9 I$Read read a block - bcs chkeof2 if error..go check which one - lbsr destsnd send destination switch msg - lda <outpath get out path number - os9 I$Write write the block out - bcs errjump exit on error - tst <verify are we verifying ? - bne chkeof skip this - pshs u,y save registers - ldx <writemsb get 2 msb's of last write - ldu <writelsb get 2 lsb's of last write - lda <outpath get out path number - os9 I$Seek - bcs errjump exit on error - ldu 2,s get original u back - leau buffer,u point to buffer start - ldd ,s get bytes written - addd <writelsb add on to current 2 lsb positions - std <writelsb save them - ldd ,s get bytes written - bcc vfy000 skip if no carry - leax 1,x bump up 2 msb's - stx <writemsb and save them - -vfy000 ldy #$0100 chars to read for verify - std ,s save it - tsta did we write more than 255 bytes ? - bne vfy010 yes...only read 256 - tfr d,y else xfer amount we did write - -vfy010 ldx 2,s get u register - leax $200,x point to start of verify buffer - lda <outpath get output path number - os9 I$Read read a block in - bcs errexit exit on error - -vfy020 lda ,u+ get char from in buffer - cmpa ,x+ get char from out buffer - bne snderr1 not equal...send write verfiy msg - leay -1,y decrement read count - bne vfy020 if more..loop back - ldd ,s get write count back - subd #$0100 subtract verify buffer size - bhi vfy000 if more left...loop back - puls u,y else restore registers - -chkeof lda <inpath get in path number - ldb #SS.EOF check for end of file - os9 I$GetStt - bcc mainloop nope...loop back - cmpb #E$EOF are we at end of file ? - beq closeout yes...close file - - -chkeof2 cmpb #E$EOF check for end of file - bne errexit nope...error exit - bsr destsnd send msg for disk switch - -closeout lda <outpath get out path number - os9 I$Close close the file - bcc exitok exit w/o error if o.k. - bra errexit else error exit - -errmsg1 fcb $07 - fcc /Error - write verification failed./ - fcb $0D - -snderr1 leax errmsg1,pcr address of 'write verify failed' msg - bsr sndline send it - comb set carry - ldb #$01 set error - bra errexit exit - -chkerr cmpb #E$BPNam was it bad path name - bne errexit error exit - -sndinstr leax Help,pcr get instructions - bsr sndline send them -exitok clrb -errexit os9 F$Exit - -sndline ldy #256 max chars to send - lda #1 std out - os9 I$WritLn write the line - rts - -* Send message and wait for disk switch for single drive copy - -destsnd lda #1 set flag for destination message - -chkdrive tst <single are we doing single drive copy - beq msgrts nope..just exit - pshs y,x else save registers - -sndsrc pshs a save drive flag - tsta do we want source drive ? - bne snddst nope..do destination message - leax srcmsg,pcr point to 'source' msg - ldy #srcmsgsz chars to send - bra msgsnd go send it - -srcmsg fcc /Ready SOURCE/ -srcmsgsz equ *-srcmsg - -dstmsg fcc /Ready DESTINATION/ -dstmsgsz equ *-dstmsg - -cntmsg fcc /, hit C to continue: / -cntmsgsz equ *-cntmsg - - -snddst leax dstmsg,pcr point to 'destination' msg - ldy #dstmsgsz chars to send - -msgsnd lda #1 std out - os9 I$Write write it - leax cntmsg,pcr point to 'hit C ...' - ldy #cntmsgsz get size of message - os9 I$Write write it - leax ,-s back up for dummy buffer - ldy #1 chars to read - clra std in - os9 I$Read read one char - lda ,s+ - pshs y,x,a save registers - leax crmsg,pcr point to <cr> - bsr sndline write it - puls y,x,a restore registers - eora #'C check if its a C - anda #$DF make it upper case - puls a restore drive status - bne sndsrc loop back & send message - puls y,x restore registers -msgrts rts - -Help fcc /Use: Copy <Path1> <Path2> [-s]/ - fcb C$LF - fcc / -s = single drive copy/ - fcc / (Path2 must be complete pathlist)/ - fcb C$CR - -crmsg - fcb C$CR - - emod -eom equ * - end
--- a/level2/cmds/display.asm Wed Jul 24 05:14:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -******************************************************************** -* Display - Character display utility -* -* $Id$ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 2 Original Tandy/Microware version -* 3 Added decimal, text features AD - - nam Display - ttl Character display utility - -* Disassembled 94/12/10 12:27:37 by Alan DeKok - - ifp1 - use defsfile - endc - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $01 -edition set 3 - - mod eom,name,tylg,atrv,start,size - - org 0 -T.Delim rmb 1 text delimiter -D.Len rmb 1 length of decimal bytes: 0=1 byte, 1=2 bytes -D.Word rmb 2 decimal byte to output - rmb 200 room for the stack -size equ . - -name fcs /Display/ - fcb edition - -Start pshs x save start address of text to output - leay ,x destination buffer=input buffer (always shrinks it) - leau Hex,pcr point to routine to ouput hex characters - -Loop jsr ,u grab a character - bcs S.01 if error, dump it - stb ,x+ save character in internal buffer - bra Loop and get another one - -S.01 tfr x,d get current pointer into D - subd ,s take out start address - tfr d,y length of the data to print - puls x restore start address - - lda #$01 to STDOUT - os9 I$Write dump it out - bcs Exit exit if error - -ClnExit clrb no error -Exit os9 F$Exit and exit - -Do.Hex leau <Hex,pcr point to main hex routine -Hex ldb ,y+ grab a character - cmpb #', comma? - bne Hex.2 nope, do more checks - -Hex.1 ldb ,y+ grab another character -Hex.2 cmpb #C$SPAC space? - beq Hex.1 yup, skip it - - cmpb #'/ slash? - beq Do.Text yes, go output straight text - cmpb #'\ back-slash? - beq Do.Text yes, output straight text - cmpb #'" double-quote? - beq Do.Text yes, output straight text - - cmpb #'. period? - beq Decimal yes, do a one-time output of decimal byte(s) - - leay -1,y - bsr Nibble turn character in B into a nibble - bcs OK.2 - pshs b save high nibble - bsr Nibble get current character - bcs Hex.3 skip move if next character is not a number - lsl ,s move low nibble into high nibble - lsl ,s - lsl ,s - can't do it before now, because hex number - lsl ,s might be 1 digit long - - addb ,s add high nibble to low nibble - stb ,s save it -Hex.3 clrb no error - puls b,pc restore byte to output, and exit - -Nibble ldb ,y get the current character - cmpb #C$CR end of parameters? - beq Error yes, exit - - cmpb #'0 error if B<'0' - blo Error - - cmpb #'9 - bls OK allow '0' to '9' inclusive - - cmpb #'A error if B<'A' - blo Error - - andb #$DF make the character lowercase - cmpb #'F - bhi Error error if B>'F' - - subb #$07 map 'A' down to $0A -OK subb #$30 take out ascii zero, now B=nibble 0-F - -OK.0 leay 1,y -OK.1 clra set to no error -OK.2 rts - -Error comb set carry - rts - -Do.Text leau <Text,pcr - stb <T.Delim save text delimiter -Text ldb ,y+ grab a character - cmpb <T.Delim text delimiter again? - beq T.Check check for some stuff - cmpb #C$CR end of text? - beq Error yes, signal it - bra OK.1 otherwise allow the character - -T.Check lda ,y get the next character after the delimiter - cmpa <T.Delim is it the same, i.e. 2 delimiters in a row? - beq OK.0 yes, skip the second and output the first - bra Do.Hex otherwise go to hex mode again - -Decimal lda ,y get next character - anda #$DF make it uppercase - cmpa #'W force a word? - bne D.One no, do a straight decimal conversion - leay 1,y skip the 'w' character - lda #1 force 2 bytes - fcb $21 skip the 'clra' following - -D.One clra force 1 byte (may expand to 2) - sta <D.Len save length of the decimal character - - clra start off at zero - clrb - std <D.Word sav starting value of the decimal word to output - -D.Read lda ,y+ grab a decimal digit - cmpa #C$CR done the list? - beq D.CR yes, output the characters and then exit - - cmpa #'0 smaller than zero? - bls D.Done0 yes, we're done this decimal digit - cmpa #'9 - bhi Error - suba #'0 convert ascii to number - - pshs a save the character for later - ldd <D.Word get the current word - aslb - rola N*2 - aslb - rola N*4 - aslb - rola N*8 - addd <D.Word N*8+N=N*9 - addd <D.Word N*9+N=N*10 - addb ,s+ add in our latest character - adca #0 make it 16-bit - std <D.Word - bra D.Read go get another character - -D.Done0 leay -1,y point to character we've tried to convert to dec. -D.Done ldd <D.Word get the byte(s) to output - tst <D.Len check length flag - bne D.Two if forcing 2 bytes, output them - tst <D.Word is high byte zero? - beq D.Exit yes, only output low order byte - -D.Two sta ,x+ save high byte in the output buffer -D.Exit clra - rts - -D.CR leau Error,pcr point to error routine: no more characters - bra D.Done output these characters, and the exit - - emod -eom equ * - end -
--- a/level2/cmds/makdir.asm Wed Jul 24 05:14:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -******************************************************************** -* MakDir - create directories -* -* $Id$ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 5 Makes multiple directories from a single ADK -* pathlist (i.e. foo/bar/bar2) - - nam Makdir - ttl program module - -* Disassembled 94/12/08 21:42:56 by Alan DeKok - - ifp1 - use defsfile - endc - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $01 -edition set 5 - - mod eom,name,tylg,atrv,start,size - -Param rmb 2 parameter area -MFlag rmb 1 made a directory yet from this pathlist? - rmb 200 stack space -size equ . - -name fcs /MakDir/ - fcb edition - -Sk.1 leax 1,x go on to the next character -Skip lda ,x get a character - cmpa #C$SPAC space? - beq Sk.1 if so, skip it - rts - -* Any pathnames at all? -* Exit with error if none -Start bsr Skip skip the first bit, if applicable - cmpa #C$SPAC is it a CR? - bne start2 no, go ahead and make directories - comb set carry - ldb #E$BPNam a CR is a bad pathname... - bra Exit and go exit - -* skip leading spaces or '/' and setup pointers -start1 bsr Skip skip any non-zero characters, if applicable -start2 ldb #$FF a non-zero value - stb <MFlag we haven't made a directory from this pathname yet - stx <Param save in the parameter area - cmpa #PDELIM leading slash? - bne S.020 if not, go get the name - -* find the pseudo-end of the pathname, stopping at space, cr, '/' -S.010 leax 1,x -S.020 lda ,x - cmpa #C$SPAC space? - beq S.030 - cmpa #C$CR cr? - beq S.030 - cmpa #PDELIM slash? - bne S.010 if none of these, then skip this character - -* force the pathname to be a subset of the full pathname -S.030 pshs a,x save byte found, where we found it - lda #C$CR force it to be a CR - sta ,x - -*try to open it for reading, i.e. does it already exists? - ldx <Param get the start address of this pathname - lda #DIR.+READ. open the directory for reading - os9 I$Open check if the directory already exists - bcs S.040 if there was an error opening it, go make it - OS9 I$Close close the path to the file - bra S.050 skip making this directory - -* The partial pathname doesn't exist, so create it -S.040 ldx <Param get the start address of this pathname - ldb #^SHARE. everything but SHARE. - os9 I$MakDir - bcs Error - clr <MFlag clear the flag: we've successfully made a directory - -* make pathname full again, and continue -S.050 puls a,x restore byte, address - sta ,x restore it - cmpa #PDELIM was it a slash? - beq S.010 yes, make pathname full again, and find next one - -* searched this pathname, have we made a directory from it? - tst <MFlag have we made a directory? - bne CEF if not, error out with fake E$CEF - -* check for end/continue flag - cmpa #C$SPAC was it a space? - beq start1 yup, go get another pathname to create - -ClnExit clrb no error -Exit OS9 F$Exit and exit - -CEF comb set carry - ldb #E$CEF we've just tried to create an existing file -Error pshs b,cc save error code - - lda #2 to STDERR - leax EMsg,pc to error found string - ldy #Elen - OS9 I$Write - - ldx <param get pathname we're trying to open - ldy #200 a _very_ long pathname - OS9 I$WritLn we're sure that the name ends in a CR... - puls b,cc restore error code, condition - bra Exit - -EMsg fcc /makdir: error creating / -ELen equ *-EMsg - - emod -eom equ * - end
--- a/level2/cmds/xmode.asm Wed Jul 24 05:14:25 2002 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,689 +0,0 @@ -******************************************************************** -* XMode - Modify device descriptors -* -* $Id$ -* -* -* XMode by Bruce Isted -* based on "DMode", a program by Kevin K. Darling -* -* XMode is an SCF device descriptor utility similar to the original XMode, -* intended to replace the original utility. This utility works on SCF -* descriptors in memory or on disk in single module files. -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 1 Release to public domain BRI 89/06/21 - - nam XMode - ttl Modify device descriptors - - ifp1 - use defsfile - endc - -BuffSize equ 10 max. CHAR string length -Edtn equ 1 -MaxSize equ $80 maximum module size -NameSize equ 4 maximum module name length -Vrsn equ 1 - - org 0 -Count rmb 1 number of option bytes -DataPtr rmb 2 current option ptr -HexIn rmb 2 2 byte hex number -ModAddr rmb 2 module address -ModSize rmb 2 module size -OptEnd rmb 2 option table end offset -ParmPtr rmb 2 next name DataPtr -PathNmbr rmb 1 file path -TxtPtr rmb 2 option name ptr -Buffer rmb BuffSize miscellaneous output buffer -ModBuff rmb MaxSize module work copy buffer -stack rmb $0200 stack and parameter space -MemSize equ . - - mod Size,Name,Prgrm+Objct,ReEnt+Vrsn,Entry,MemSize - -Name fcs "XMode" - fcb Edtn edition number - -OptTable - fcc " nam" option name - fcb Sign+M$Name,NameSize offset to string offset & max. byte count to change - fcc " mgr" - fcb Sign+M$FMgr,0 offset to string offset & no changes allowed - fcc " ddr" - fcb Sign+M$PDev,0 - fcc " hpn" - fcb M$Port,1 option offset & byte count - fcc " hpa" - fcb M$Port+1,2 - fcc " upc" - fcb IT.UPC,1 - fcc " bso" - fcb IT.BSO,1 - fcc " dlo" - fcb IT.DLO,1 - fcc " eko" - fcb IT.EKO,1 - fcc " alf" - fcb IT.ALF,1 - fcc " nul" - fcb IT.NUL,1 - fcc " pau" - fcb IT.PAU,1 - fcc " pag" - fcb IT.PAG,1 - fcc " bsp" - fcb IT.BSP,1 - fcc " del" - fcb IT.DEL,1 - fcc " eor" - fcb IT.EOR,1 - fcc " eof" - fcb IT.EOF,1 - fcc " rpr" - fcb IT.RPR,1 - fcc " dup" - fcb IT.DUP,1 - fcc " psc" - fcb IT.PSC,1 - fcc " int" - fcb IT.INT,1 - fcc " qut" - fcb IT.QUT,1 - fcc " bse" - fcb IT.BSE,1 - fcc " ovf" - fcb IT.OVF,1 - fcc " par" - fcb IT.PAR,1 - fcc " bau" - fcb IT.BAU,1 - fcc " xon" - fcb IT.XON,1 - fcc " xof" - fcb IT.XOFF,1 - fcc " col" - fcb IT.COL,1 - fcc " row" - fcb IT.ROW,1 - fcc " xtp" - fcb IT.XTYP,1 - fcc " wnd" - fcb IT.WND,1 - fcc " val" - fcb IT.VAL,1 - fcc " sty" - fcb IT.STY,1 - fcc " cpx" - fcb IT.CPX,1 - fcc " cpy" - fcb IT.CPY,1 - fcc " fgc" - fcb IT.FGC,1 - fcc " bgc" - fcb IT.BGC,1 - fcc " bdc" - fcb IT.BDC,1 -TablOpts equ (*-OptTable)/6 number of table entries - fcb $80 end of option table - -UseMsg - fcb C$LF - fcc "Usage: XMode [/<device> || -<pathlist> || -?] [option] [option] [...]" - fcb C$LF,C$LF - fcc "Purpose: To report or alter current option settings of SCF device" - fcb C$LF - fcc " descriptors in memory or on disk in single module files." - fcb C$LF,C$LF - fcc "Options: nam, mgr, ddr, hpn, hpa, upc, bso, dlo, eko, alf, nul, pau," - fcb C$LF - fcc " pag, bsp, del, eor, eof, rpr, dup, psc, int, qut, bse, ovf," - fcb C$LF - fcc " par, bau, xon, xof, col, row, xtp, wnd, val, sty, cpx, cpy," - fcb C$LF - fcc " fgc, bgc, bdc" - fcb C$LF,C$LF - fcc "Examples: xmode /t2" - fcb C$LF - fcc " Prints the current option settings of the /T2 descriptor" - fcb C$LF - fcc " in memory." - fcb C$LF - fcc " xmode -modules/t4.dd nam=T2 bau=6 hpa=ff6c eof=1B" - fcb C$LF - fcc " Changes the module name in the MODULES/T4.dd file to T2," - fcb C$LF - fcc " sets the baud rate code to 6, the hardware port address" - fcb C$LF - fcc " to $FF6C, and the end of file character to $1B." - fcb C$LF - fcc " xmode -?" - fcb C$LF - fcc " Prints more complete information on all of the options." - fcb C$CR -UseLen equ *-UseMsg - -HelpMsg - fcb C$LF - fcc "The NAM option accepts only a legal OS-9 module name with a maximum of" - fcb C$LF - fcc "4 characters. It is up to the user to ensure that there is adequate" - fcb C$LF - fcc "room for the module name, and if required to rename the disk file to" - fcb C$LF - fcc "suit the new module name. The MGR and DDR options can't be changed." - fcb C$LF - fcc "All other options require hexadecimal numbers (0 through FFFF). XTP is" - fcb C$LF - fcc "for certain ACIA descriptors only. WND, VAL, STY, CPX, CPY, FGC, BGC," - fcb C$LF - fcc "and BDC are for window descriptors only." - fcb C$LF,C$LF - fcc "nam Device Name mgr File Manager Name ddr Device Driver Name" - fcb C$LF - fcc "hpn H'ware Page Number hpa H'ware Port Address upc Case Lock Flag" - fcb C$LF - fcc "bso Backspace Method dlo Delete Line Method eko Screen Echo Flag" - fcb C$LF - fcc "alf Auto Linefeed Flag nul End Of Line Nulls pau Page Pause Flag" - fcb C$LF - fcc "pag Page Length bsp Backspace Character del Delete Line Char" - fcb C$LF - fcc "eor End Of Record Char eof End Of File Char rpr Reprint Line Char" - fcb C$LF - fcc "dup Duplicate Line Char psc Pause Character int Interrupt Character" - fcb C$LF - fcc "qut Quit Character bse Backspace Echo Char ovf Overflow Character" - fcb C$LF - fcc "par Type (Parity) Code bau Baud Rate Code xon XON Character" - fcb C$LF - fcc "xof XOFF Character col Display Columns row Display Rows" - fcb C$LF - fcc "xtp Extended Type Code wnd Window Number val Valid Window Flag" - fcb C$LF - fcc "sty Window Screen Type cpx X Corner Position cpy Y Corner Position" - fcb C$LF - fcc "fgc Foreground Colour bgc Background Colour bdc Border Colour" - fcb C$CR -HelpLen equ *-HelpMsg - -Equal fcc "=" - -TypeMsg - fcb C$LF - fcc "Not an SCF descriptor!" -CR fcb C$CR -TypeLen equ *-TypeMsg - -Sizemsg - fcb C$LF - fcc "Module size out of range!" - fcb C$CR -Sizelen equ *-Sizemsg - -SynMsg - fcb C$LF - fcc "Syntax error: " -SynLen equ *-SynMsg - -**************** -* miscellaneous error and help routines - -MuchHelp - leax HelpMsg,pc - ldy #HelpLen - bra Helpprnt - -BadSize - leax Sizemsg,pc - ldy #Sizelen - bra AddHelp - -BadType - leax TypeMsg,pc - ldy #TypeLen -AddHelp - lda #2 - os9 I$WritLn -Help - leax UseMsg,pc - ldy #UseLen -Helpprnt - lda #2 - os9 I$WritLn - lbra OkayEnd2 - -**************** -Entry - ldd #0 - std <ModAddr zero mod flag - sta <PathNmbr zero file flag - ldd ,x+ check for device name - cmpa #'- file option? - bne Link - cmpb #'? help option? - beq MuchHelp -* Use Filename to Get Desc: - lda #Updat. open path to module file - os9 I$Open - bcs Help - stx <ParmPtr - sta <PathNmbr save path number - ldy #MaxSize max size - leax ModBuff,u module buff - os9 I$Read get it - lbcs Error - ldb M$Opt,x - clra [D] = option table size - addd #M$DTyp add options start offset - std <OptEnd save options end offset - ldd M$Size,x get module size - cmpd #MaxSize module size OK? - bhi BadSize no, go return error... - std <ModSize - bra GotIt - -Link - cmpa #'/ else must be /<devicename> - bne Help - pshs u - lda #Devic - os9 F$Link link to module - bcs Help - stx <ParmPtr update after name - tfr u,x - puls u - stx <ModAddr - ldb M$Opt,x - clra [D] = option table size - addd #M$DTyp add options start offset - std <OptEnd save options end offset - ldd M$Size,x get module size - cmpd #MaxSize module size OK? - lbhi BadSize no, go report error... - std <ModSize - tfr d,y copy module size... - pshs u save data area pointer - leau ModBuff,u - -GetModLp - lda ,x+ - sta ,u+ - leay -1,y - bne GetModLp - puls u recover data area pointer - -GotIt - ldd <OptEnd get option table end offset - cmpd <ModSize is option table size OK? - lbhs BadSize no, go report error... - leax ModBuff,u - lda M$DTyp,x get device type - lbne BadType SCF = $00 - ldx <ParmPtr point to input parms - lbsr SkipSpac go skip leading spaces... - cmpa #C$CR no options? - lbeq Info ..yes, give info - leax -1,x - -**************** -* X=ParmPtr -* Find and Set Options: - -FindLp10 - lbsr SkipSpac get next input param - stx <ParmPtr save for syntax error use - cmpa #C$CR end? - lbeq Verify ..yes, update module CRC - leay OptTable-6,pc ready option table ptr - pshs u - ldu ,x++ get next two chars - ora #$20 convert 1st param char to lower case - exg d,u move [U] where we can convert param chars - ora #$20 convert 2nd param char... - orb #$20 convert 3rd... - exg d,u move back again - -FindLp20 - leay 6,y next option entry - tst ,y last entry? - bmi Syntax ..yes, bad option - cmpa 1,y - bne FindLp20 same name? - cmpu 2,y - bne FindLp20 ..no, loop -* Found Option - puls u - sty <TxtPtr - ldd ,x+ must be followed by "=", leave [X] pointing at char after "=" - cmpa #'= - bne Syntax - cmpb #C$CR rest of option missing? - beq Syntax yes, go report error - cmpb #C$SPAC rest of option missing? - beq Syntax yes, go report error - ldb 5,y get # of bytes - beq Syntax 0 bytes, not allowed to change this option - stb <Count - ldb 4,y get option offset or offset to option offset - bpl NumOpt option offset, go set hexadecimal option -* Get CHAR input and set option: - andb #^Sign clear sign bit of offset to string offset - clra [D] = offset to string offset within module - cmpd <ModSize is it OK? - bhs Syntax no, go report error... - leay ModBuff,u point to module - ldd b,y get offset to string - cmpd <ModSize is it OK? - bhs Syntax no, go report error... - leay d,y point to option - pshs y save option pointer - os9 F$PrsNam valid OS-9 name? - puls y recover option pointer (end of name pointer lost) - bcs Syntax no, go report error - cmpa #C$SPAC space delimiter char? - beq ChkLen yes, go check name length... - cmpa #C$CR <CR> delimiter char? - bne Syntax no, go report error - -ChkLen - cmpb <Count name length OK? - bhi Syntax no, go report error... - -SetChrLp - lda ,x+ get character - sta ,y+ save it to module copy - decb done yet? - bne SetChrLp no, go copy another char... - lda -1,y get last char - ora #Sign set sign bit - sta -1,y save last char - lbra FindLp10 go do next... - -* Syntax Error: -Syntax - leax SynMsg,pc - ldy #SynLen - lda #2 - os9 I$Write - ldx <ParmPtr - leax -1,x - pshs x - ldy #0 - -CntLoop - leay 1,y - lda ,x+ - cmpa #C$CR - beq SynSay - cmpa #C$SPAC - bne CntLoop - -SynSay - puls x - lda #2 - os9 I$Write output err - lbra OkayEnd - -* Get Hex Input and Set Option: -NumOpt - clra [D] = option offset within module - cmpd <OptEnd is it OK? - bhs Syntax no, go report error... - clr <HexIn zero hex input bytes - clr <HexIn+1 - -SetNumLp - lda ,x+ get next # - cmpa #C$SPAC end of number? - beq SetNum2 ..yes, set option - cmpa #C$CR end of line? - beq SetNum1 ..yes, set option -* Convert ASCII Hex-->Byte: - suba #$30 make number from ASCII - bmi Syntax - cmpa #10 is it number? - bcs Num - anda #$5F make uppercase - suba #$11-$0A make hex $A-$F - cmpa #$0A - bcs Syntax - cmpa #$10 not hex char? - bcc Syntax - -Num - ldb #16 fancy asl *4 - mul - pshs b save top 4 bits - ldd <HexIn - rol ,s - rolb - rola - rol ,s - rolb - rola - rol ,s - rolb - rola - rol ,s - rolb - rola - std <HexIn - puls b drop temp - bra SetNumLp ..loop - -SetNum1 - leax -1,x reset so can find <CR> - -SetNum2 - ldb 4,y get option offset - leay ModBuff,u point to module - leay b,y point to option - ldd <HexIn pick up hex input - dec <Count - beq SetOne - std ,y set two byte option - lbra FindLp10 - -SetOne - tsta - lbne Syntax - stb ,y set one byte option - -SetNDone - lbra FindLp10 - -* -------------- -* Skip Spaces: -SkipSpac - lda ,x+ - cmpa #C$SPAC - beq SkipSpac - rts - -* -------------- -* Update Module CRC: -Verify - pshs u save data ptr - leau ModBuff,u - tfr u,x X is mod address - ldy M$Size,x Y is mod size - leay -3,y beginning of chksum - tfr y,d Y is byte count - leau d,u set U to chksum - lda #$FF init chksum - sta ,u - sta 1,u - sta 2,u - pshs u - os9 F$CRC calc new crc - puls u - com ,u+ fix it up right - com ,u+ - com ,u - lda <PathNmbr was it file? - beq MemMod ..no, in memory - ldx #0 - tfr x,u - os9 I$Seek go back to file begin - bcs Error - puls u - leax ModBuff,u - ldy <ModSize - os9 I$Write update module file - bra OkayEnd - -MemMod - ldu ,s get data area pointer - leax ModBuff,u - ldy <ModSize - ldu <ModAddr - -PutModLp - lda ,x+ - sta ,u+ - leay -1,y - bne PutModLp - puls u recover data area pointer - bra OkayEnd2 - -OkayEnd - bsr OutCR - -OkayEnd2 - clrb okay - -Error - pshs b,cc - ldu <ModAddr - beq Bye - os9 F$UnLink - -Bye - puls b,cc - os9 F$Exit we're done... - -* -------------- -* Print a <CR>: -OutCR - leax CR,pc - ldy #1 - lda #1 - os9 I$WritLn - rts - -**************** -* Output Current Desc Info: -Info - bsr OutCR do a <CR> - ldb #TablOpts number of table entries - pshs b save counter - leax OptTable,pc point to text table - stx <TxtPtr - -InfoLoop - ldx <TxtPtr - ldy #4 - lbsr OutPut print option name - leax Equal,pc - ldy #1 - lbsr OutPut print = - ldx <TxtPtr - ldb 4,x get offset to HEX option; if minus, offset to option offset - bpl PrintHex go do simple offset to HEX option - andb #^Sign clear sign bit - clra [D] = offset to string offset within module - cmpd <ModSize is it OK? - bhs MovePtr no, skip this option... - leay ModBuff,u point [Y] to module work copy - ldd b,y get string offset within module - cmpd <ModSize is string offset OK? - bhs MovePtr no, skip this option... - leay d,y point [Y] to CHAR string - lda #BuffSize get max. chars to print - leax Buffer,u point [X] to CHAR string buffer - clr <Count init counter - -CharCopy ldb ,y+ get char - bpl NotLast sign bit clear so not last, go on... - andb #^Sign clear sign bit - lda #1 set up as last char - -NotLast stb ,x+ - inc <Count count chars in string - deca done yet? - bne CharCopy no, go do another char... - ldb <Count get chars in string ([A]=0, so [D]=char count) - tfr d,y module name length into [Y] - leax Buffer,u point [X] to CHAR string copy - bsr OutPut print CHAR string - bra MovePtr skip HEX output routine - -* Print Hex Option Values: -PrintHex - ldx <TxtPtr - ldb 5,x get # of digits - stb <Count - ldb 4,x get option offset in module - clra [D] = option offset within module - cmpd <OptEnd is option offset OK? - bhs MovePtr no, skip this option... - leax ModBuff,u point [X] to module work copy - abx point [X] to option - stx <DataPtr - -* Print One Byte: -NumLoop - ldx <DataPtr - lda ,x+ - stx <DataPtr - pshs a - lsra - lsra - lsra - lsra - bsr OutOne - puls a - anda #$0F - bsr OutOne - dec <Count - bne NumLoop - -MovePtr - ldx <TxtPtr - leax 6,x - stx <TxtPtr - dec ,s - lbeq OkayEnd done... - ldb ,s - bitb #$07 # of options remaining evenly divisible by eight? - lbne InfoLoop no, go print next option on same line - lbsr OutCR <CR> after every 8th option - lbra InfoLoop ..loop - -* -------------- -* Print 1/2 Byte Hex Char: -OutOne - cmpa #10 - bcs Number - adda #$11-10 make alpha - -Number - adda #$30 make ASCII - sta <Buffer - leax Buffer,u - ldy #1 - -OutPut - lda #1 std out - os9 I$Write - lbcs Error - rts - - emod -Size equ * - end -