Mercurial > hg > Members > kono > nitros9-code
changeset 963:7cecd837bcab
Added new commands as part of standard CMDS distribution
author | boisy |
---|---|
date | Fri, 31 Jan 2003 17:37:19 +0000 |
parents | 8a0993b04c8a |
children | 4f56e6891d94 |
files | level1/cmds/cputype.asm level1/cmds/devs.asm level1/cmds/dmode.asm level1/cmds/irqs.asm level1/cmds/makefile level1/cmds/xmode.asm |
diffstat | 6 files changed, 2023 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/cputype.asm Fri Jan 31 17:37:19 2003 +0000 @@ -0,0 +1,91 @@ +******************************************************************** +* CPUType - Identify 6809 or 6309 +* +* $Id$ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 1 Started ADK ??/??/?? + + nam CPUType + ttl Identify 6809 or 6309 + + ifp1 + use defsfile + endc + +tylg set Prgrm+Objct +atrv set Reent+Rev +rev set 1 +edition set 1 + + org 0 + rmb $0100 for the stack +size equ . + + mod eom,name,tylg,atrv,start,size + +name fcs /CPUType/ + fcb edition + +Start ldd #$FFFF make sure it's non-zero +* clrd executes as a pseudo-NOP ($10), and a CLRA + fdb $104F + tstb + bne is.6809 + leax c.6309,pc + bra save.1 + +c.6309 fcc /CPU: 6309, / +c.6809 fcc /CPU: 6809, / + +is.6809 leax c.6809,pc +save.1 ldy #11 + lda #1 to STDOUT + OS9 I$Write dump it out + +* if it's a 6809, we don't need to do the next part, as we KNOW it's +* running in 6809 emulation mode! + +* this is harder.... are we in native mode? + pshs cc,dp,x,y,u save all registers but D +* pshsw a NOP on a 6809 + fdb $1038 + + leay native,pc native mode PC + leax emulate,pc emulation mode PC + pshs x,y save them + pshs cc,d,dp,x,y,u and the rest of the registers, too. + orcc #Entire set the entire bit in CC + rti + +emulate leas 2,s emulation mode: kill native mode PC + clrb we're in emulation mode + fcb $8C skip 2 bytes +native ldb #1 in native mode + puls u restore W +* tfr u,w a PULSW is an RTS on a 6809 + fdb $1F36 + puls cc,dp,x,y,u restore all of our other registers + + leax m.6809,pc default to 6809 + tstb are we in native mode? + beq print no + leax m.6309,pc get the 6309 message + +print ldy #$0100 a lot + lda #1 to STDOUT + OS9 I$WritLn + clrb no errors + OS9 F$Exit + +m.6809 fcc /running in 6809 mode./ + fcb C$CR + +m.6309 fcc /running in 6309 native mode./ + fcb C$CR + + emod +eom equ * + end +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/devs.asm Fri Jan 31 17:37:19 2003 +0000 @@ -0,0 +1,363 @@ +******************************************************************** +* devs - Show device table entries +* +* $Id$ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 2 Original version +* 3 Reworked AD +* 4 Renamed to devs ala OS-9/68K, reworked BGP 03/01/07 + + nam devs + ttl Show device table entries + + 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 + +MaxEnts set 64 maximmum entries we display + + org 0 +memstrt rmb 2 +outptr rmb 2 +counter rmb 1 +narrow rmb 1 +curdte rmb 2 +ddevtbl rmb 2 device table pointer +devcount rmb 1 +descptr rmb 2 +numbytes rmb 1 +lnbuff rmb 80 + IFGT Level-1 +datimg rmb 4 +devtbcpy rmb MaxEnts*DEVSIZ +descrip rmb 256 +syspdesc rmb P$Size + ENDC +stack rmb 200 +size equ . + +name fcs /devs/ + fcb edition + +Header1 fcc /Device Table at: / +x12Len equ *-Header1 +NHeader fcc /Dv Desc Drvr Stat File Usr/ + fcb C$CR +NHeaderL equ *-NHeader +NHeader2 fcc /Nm Port Name Mem Mgr Cnt/ + fcb C$CR +NHeader2L equ *-NHeader2 +NUndln fcc /------- ----------- ---- ---/ + fcb C$CR +NUndlnL equ *-NUndln +Header fcc /Device Desc Driver Static File Usr/ + fcb C$CR +HeaderL equ *-Header +Header2 fcc /Name Port Name Mem Manager Cnt/ + fcb C$CR +Header2L equ *-Header2 +Undln fcc /----------- ------------- ------- ---/ +MyCR fcb C$CR +UndlnL equ *-Undln +Init fcs /Init/ + +start ldd ,x get parameter bytes + cmpd #$2D3F -? + lbeq Help + lda #MaxEnts get maximum entries we support + sta <devcount and save as count + leax Init,pcr + clra + pshs u + os9 F$Link + bcs Exit + lda <DevCnt,u get device count + os9 F$UnLink unlink module + puls u restore static pointer + cmpa <devcount is table same or larger than our default? + bge cont branch if so + sta <devcount else store smaller count +cont stu <memstrt + clr <narrow assume wide + lda #$01 + ldb #SS.ScSiz + os9 I$GetStt + bcs cont2 + cmpx #HeaderL+1 + bge cont2 + sta <narrow +cont2 leax >MyCR,pcr + ldy #$0001 + os9 I$WritLn output a CR + lbcs Exit + leax >Header1,pcr dump out header + ldy #x12Len + os9 I$Write + lbcs Exit + IFGT Level-1 + lda #$01 + leax >syspdesc,u + os9 F$GPrDsc get system process descriptor + bcs Exit + leax <P$DATImg,x + stx <datimg save address of system's DAT image + ENDC + bra L00D3 + +ClnExit clrb +Exit os9 F$Exit + +L00D3 equ * + IFGT Level-1 + ldu <memstrt + leau <ddevtbl,u + ldd <datimg + ldx #D.DevTbl I/O device table + ldy #$0002 size of the pointer + os9 F$CpyMem + lbcs Exit + ldu <memstrt + ldd <ddevtbl + ELSE + ldd >D.DevTbl + std <ddevtbl + ENDC + leay <lnbuff,u + sty <outptr + lbsr HexWord output D as hex word + lbsr PrintBuf + + lda #$01 + leax >MyCR,pcr dump out another CR + ldy #$0001 + os9 I$WritLn + lbcs Exit + + leax >Header,pcr + ldy #HeaderL + tst <narrow + beq branch1 + leax >NHeader,pcr + ldy #NHeaderL +branch1 os9 I$WritLn + lbcs Exit + + leax >Header2,pcr + ldy #Header2L + tst <narrow + beq branch2 + leax >NHeader2,pcr + ldy #NHeader2L +branch2 os9 I$WritLn + lbcs Exit + leax >Undln,pcr + ldy #UndlnL + tst <narrow + beq branch3 + leax >NUndln,pcr + ldy #NUndlnL +branch3 os9 I$WritLn + lbcs Exit + + IFGT Level-1 + ldu <memstrt + lda <devcount + ldb #DEVSIZ + mul + tfr d,y + leau >devtbcpy,u + ldx <ddevtbl + ldd <datimg + os9 F$CpyMem copy the device table over + lbcs Exit + stu <curdte save pointer to start of DevTbl + ELSE + ldd <ddevtbl + std <curdte + ENDC + ldb <devcount + stb <counter total number of entries to get + +L0155 bsr L0165 + dec <counter + lbeq ClnExit if done them all, exit + + ldx <curdte get current pointer + leax DEVSIZ,x go to the next one + stx <curdte save the pointer again + bra L0155 and loop back + +L0165 ldu <memstrt get static pointer + leay <lnbuff,u point to line buffer + sty <outptr save as ptr + lda #C$SPAC space + ldb #5 assume this length + tst <narrow are we narrow? + beq L0171 branch if not + ldb #3 else load new size +L0171 sta ,y+ save spaces + decb + bne L0171 + + ldx <curdte get the current pointer + ldx V$DESC,x descriptor? + bne L017D if exists, go do it + rts otherwise exit + +L017D equ * + IFGT Level-1 + pshs u + leau >descrip,u to another buffer + ldd <datimg system DAT image + ldy #256 + os9 F$CpyMem + puls u + lbcs Exit + + leax >descrip,u point to the start of the buffer + ELSE + stx <descptr save descriptor pointer + ENDC + ldd M$Name,x pointer to the name + leax d,x + lda #5 assume this size + tst <narrow are we narrow? + beq branch4 branch if not + lda #3 else get new size +branch4 bsr Str2Buf dump out the first few bytes of the name + + IFGT Level-1 + leax >descrip,u + ELSE + ldx <descptr + ENDC + tst <narrow + bne skip1 + lda M$Port,x port address of the device + lbsr HexByte + ldy <outptr + leay -1,y + sty <outptr +skip1 ldd M$Port+1,x + lbsr HexWord + lbsr Space +* IFGT Level-1 +* leax >descrip,u +* ELSE +* ldx <descptr +* ENDC + ldd M$PDev,x device driver name offset + leax d,x + lda #9 + tst <narrow + beq branch5 + lda #7 +branch5 bsr Str2Buf dump out bytes of the driver name + ldx <curdte + ldd V$STAT,x + lbsr HexWord + lbsr Space + IFGT Level-1 + leax >descrip,u + ELSE + ldx <descptr + ENDC + ldd M$FMGr,x file manager name offset + leax d,x point to it + lda #9 + tst <narrow + beq branch6 + lda #7 +branch6 bsr Str2Buf dump out bytes of the file manager's name + ldx <curdte + lda V$USRS,x use count + lbsr HexByte print it + ldx <outptr + leax -1,x + bra L01E8 + +PrintBuf ldx <outptr +L01E8 lda #C$CR save a CR in memory + sta ,x + ldu <memstrt + leax <lnbuff,u to the buffer + ldy #80 80 characters max. + lda #1 + os9 I$WritLn dump the buffer out + lbcs Exit + rts + +* Entry: +* A = number of bytes to write buffer +* X = ptr to string to write to buffer +Str2Buf sta <numbytes dump out A bytes at X + clrb + bra L0207 + +L0204 lbsr Put2Buf +L0207 incb increment B + cmpb <numbytes equal to number of bytes? + bcc NSpaces branch if so + lda ,x+ else get byte at X + bpl L0204 branch if hi bit clear + anda #$7F else clear it + lbsr Put2Buf dump it out + cmpb <numbytes compare against num bytes + bcc L0221 branch if equal + +* Fill the rest with spaces +NSpaces lbsr Space + incb + cmpb <numbytes + bcs NSpaces +L0221 rts + +HexWord pshs b + bsr MakeHex + puls a +HexByte bsr MakeHex +Space lda #C$SPAC output a space + bra Put2Buf + +MakeHex tfr a,b + lsra + lsra + lsra + lsra + bsr L0238 + tfr b,a +L0238 anda #$0F get the number + cmpa #$0A >10? + bcs L0240 no, make it a number + adda #$07 if so, make it A-F +L0240 adda #$30 +* Entry: A = char to put in buffer +Put2Buf pshs x save X + ldx <outptr get buffer pointer + sta ,x+ store char and in X + stx <outptr save new outptr + puls pc,x and return + +Help lda #1 to STDOUT + leax HMsg,pcr + ldy #HLen + os9 I$Write + clrb + os9 F$Exit + +HMsg fcc /devs: show devices in device table/ + fdb C$CR,C$LF +HLen equ *-HMsg + + emod +eom equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/dmode.asm Fri Jan 31 17:37:19 2003 +0000 @@ -0,0 +1,514 @@ + nam dmode + +* DMode by Kevin K. Darling +* Disk descriptor utility. +* +* This version will do desc file on disk also. +* 23 Sept 86, 1 Oct 86, 2 Oct 86 + +* Modified by Roger A. Krupski (HARDWAREHACK) +* Fixes "lower case bug", allows "$" prefix for hex +* Last updated: 08-24-89 RAK + +* Oversized and kludgy, but works. +* Apologies for lack of comments. +************************************************ +* RBF descriptor utility similar to xmode. +* Use: dmode </devicename> [options] +* dmode -<filename> [options] +* (allows dmode use on a saved desc) +* (-filename will use data dir for default) +* dmode -? will give bit definitions +* If no options given, just returns desc info. +* All numbers must be in HEX. +* dmode +* dmode /h0 cyl=0200 sas=8 ilv=4 +* dmode /d0 +* dmode -? +* dmode -/d1/modules/d2.dd cyl=0028 + + ifp1 + use defsfile use defsfile + use rbfdefs + endc + + mod size,name,$11,$81,entry,msiz + + org 0 +desc rmb $40 dev desc copy +dsize rmb 2 desc size +path rmb 1 file path +parmptr rmb 2 next name dataptr +module rmb 2 desc address +dataptr rmb 2 current option ptr +buffptr rmb 2 buffer address +txtptr rmb 2 option name ptr +hexin rmb 2 2 byte hex number +hexcnt rmb 1 number of option bytes +buffer rmb 10 output buffer +stack rmb 200 +params rmb 150 +msiz equ . + +************************************************ +name fcs "Dmode" + fcb 8 version + +helpmsg + fcb C$CR,C$LF + fcc "drv Drive Number 0...n" + fcb C$CR,C$LF + fcc "stp Step Rate 0=30, 1=20, 2=12, 3=6ms" + fcb C$CR,C$LF + fcb C$CR,C$LF + fcc 'typ Device Type bit0- 0=5" 1=8"' + fcb C$CR,C$LF + fcc " $20 bit5- 0=non 1=coco" + fcb C$CR,C$LF + fcc " $40 bit6- 0=std 1=non" + fcb C$CR,C$LF + fcc " $80 bit7- 0=flop 1=hard" + fcb C$CR,C$LF + fcb C$CR,C$LF + fcc "dns Density bit0- 0=SD 1=DD" + fcb C$CR,C$LF + fcc " bit1- 0=48 1=96 tpi" + fcb C$CR,C$LF + fcb C$CR,C$LF + fcc "cyl Cylinders (tracks) (in hex)" + fcb C$CR,C$LF + fcc "sid Sides (heads) (in hex)" + fcb C$CR,C$LF + fcc "vfy Verify (0=yes)" + fcb C$CR,C$LF + fcc "sct Sectors/Track (in hex)" + fcb C$CR,C$LF + fcc "tos Sectors/Track on track 0 (in hex)" + fcb C$CR,C$LF + fcc "ilv Interleave (in hex)" + fcb C$CR,C$LF + fcc "sas Minimum segment allocation (in hex)" + fcb C$CR,C$LF +helplen equ *-helpmsg + +errmsg + fcb C$CR,C$LF + fcc "Use Dmode /<dev_name> [options...]" + fcb C$CR,C$LF + fcc " or Dmode -<filename> [options...]" + fcb C$CR,C$LF + fcc " or Dmode -? for options help" + fcb C$CR,C$LF + fcb C$CR,C$LF + fcc " NOTE: specify options in hex." +cr fcb C$CR,C$LF +msglen equ *-errmsg + +synmsg + fcb C$CR,C$LF + fcc "Syntax Error: " +synlen equ *-synmsg + + +muchhelp + leax helpmsg,pc + ldy #helplen + bra helpprnt + +rbfmsg + fcb C$CR,C$LF + fcc "NOT an RBF descriptor!" + fcb C$CR,C$LF +rbflen equ *-rbfmsg + +notrbf + leax rbfmsg,pc + ldy #rbflen + lda #2 + os9 I$Write + +help + leax errmsg,pc + ldy #msglen + +helpprnt + lda #2 + os9 I$Write + lbra okayend2 + +************************************************ +entry + ldd #0 + std module zero mod flag + sta path 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 desc file + os9 I$Open + bcs error + stx parmptr + sta path save path number + + ldy #$40 max size + leax desc,u desc buff + os9 I$Read get it + bcc use10 + cmpb #E$EOF + bne error + +use10 + sty dsize save desc size + bra gotit + +link + cmpa #PDELIM else must be /<devicename> + bne help + pshs u + lda #Devic + os9 F$Link link to descriptor + bcs error + stx parmptr update after name + tfr u,x + puls u + stx module + ldd M$Size,x get desc size + std dsize + leay desc,u + +mloop + lda ,x+ + sta ,y+ + decb + bne mloop + +gotit + leax desc,u + lda $12,x test device type + cmpa #1 RBF? + bne notrbf + + leax $13,x point to drive # + stx dataptr save mod option ptr + + ldx parmptr point to input parms + +skip + lda ,x+ + cmpa #$20 skip blanks + beq skip + + leax -1,x + cmpa #$0D no options? + lbeq info ..yes, give info + lbra findtxt else find options + +okayend + lbsr outcr +okayend2 + clrb okay +error + pshs b,cc + ldu module + beq bye + os9 F$UnLink +bye + puls b,cc + os9 F$Exit end dmode. + +table + fcc " drv" option name + fcb IT.DRV,1 option offset & byte count + fcc " stp" + fcb IT.STP,1 + fcc " typ" + fcb IT.TYP,1 + fcc " dns" + fcb IT.DNS,1 + fcc " cyl" + fcb IT.CYL,2 + fcc " sid" + fcb IT.SID,1 + fcc " vfy" + fcb IT.VFY,1 + fcc " sct" + fcb IT.SCT,2 + fcc " tos" + fcb IT.T0S,2 + fcc " ilv" + fcb IT.ILV,1 + fcc " sas" + fcb IT.SAS,1 + fcc " t0s" extra so it parses, but doesn't print! + fcb IT.T0S,2 + fcb $80 end of table + +info equ * Output Current Desc Info: + ldb #11 eleven entries (we won't print #12) + pshs b + leax table,pc point to text table + stx txtptr +ilup + bsr outtext print label and = + lbsr outnum print value + ldx txtptr + leax 6,x + stx txtptr + dec ,s + lbeq okayend ..end of info + ldb ,s + cmpb #5 <cr> after 6th option + bne ilup + bsr outcr <cr> + bra ilup ..loop + +outcr equ * Print a <CR/LF>: + leax cr,pc + ldy #2 byte count + +output equ * Print generic + lda #1 std out + os9 I$Write + bcc okay + leas 2,s purge return + lbra error error +okay rts + + +* ----------------------- +equal fcc "=$" +outtext equ * Print Option Name: + ldx txtptr + ldy #4 + bsr output print option name + leax equal,pc + ldy #2 + bsr output sorry, must be a bsr + rts return + +* ----------------------- +outnum equ * Print Hex Option Values: + ldx txtptr + ldb 5,x get # of digits + stb hexcnt +numlup + bsr outhex + dec hexcnt + bne numlup + rts + +outhex equ * Print One Byte: + ldx dataptr + lda ,x+ + stx dataptr + pshs a + lsra + lsra + lsra + lsra + bsr outone + puls a + anda #$0F + +outone equ * Print 1/2 Byte Hex Char: + cmpa #10 + bcs number + adda #$11-10 make alpha +number + adda #$30 make ASCII + sta buffer + leax buffer,u + ldy #1 + lbra output + +skipspc equ * Skip Spaces: + lda ,x+ + cmpa #C$SPAC + beq skipspc + rts + +************************************************ +* X=parmptr + +findtxt equ * Find and Set Options: + +flup10 + bsr skipspc get next input param + stx parmptr save for syntax error use + cmpa #C$CR end? + lbeq verify ..yes, update desc CRC + + ora #$20 force lower case first char + leay table-6,pc ready option table ptr + pshs d,u + ldd ,x++ get next two chars + ora #$20 force lower case + orb #$20 -ditto- + tfr d,u place two chars in U + puls d restore A&B (u is still pushed) + +flup20 + leay 6,y next option entry + tst ,y last entry? + lbmi syntax ..yes, bad option + cmpa 1,y + bne flup20 same name? + cmpu 2,y + bne flup20 ..no, loop + +* Found Option + puls u + sty txtptr + lda ,x+ must be followed by "=" + cmpa #'= + lbne syntax + + bsr setnum set that option + bra flup10 + +* ------------- +setnum equ * Get Hex Input and Set Option: + ldb 5,y get # of bytes + stb hexcnt + clr hexin zero hex input bytes + clr hexin+1 + +setloop + lda ,x+ get next # + cmpa #'$ optional hex $? + beq setloop yes, ignore + cmpa #C$SPAC end of number? + beq setnum2 ..yes, set option, rts + cmpa #C$CR end of line? + beq setnum1 + bsr hexcnvt else, get next num + bra setloop ..loop + +setnum1 + leax -1,x reset so can find <cr> +setnum2 + ldb 4,y get option offset + leay desc,u point to desc + leay b,y point to option + ldd hexin pick up hex input + dec hexcnt + beq setone + std ,y set two byte option + rts +setone + tsta + lbne syntax + stb ,y set one byte option + rts + +hexcnvt equ * Convert ASCII Hex-->Byte: + suba #$30 make number from ASCII + lbmi syntax + cmpa #10 is it number? + bcs num + anda #$5F make uppercase + suba #$11-$0a make hex $A-$F + cmpa #$0A + lbcs syntax + cmpa #$10 not hex char? + lbcc 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,pc drop temp, rts. + +verify equ * Update Descriptor CRC: + pshs u save data ptr + leau desc,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 path was it file? + beq memmod ..no, in memory + ldx #0 + tfr x,u + os9 I$Seek go back to file begin + lbcs error + puls u + leax desc,u + ldy dsize + os9 I$Write update desc file + lbra okayend + +memmod + puls u + leax desc,u + ldb dsize+1 + ldy module + +move + lda ,x+ + sta ,y+ + decb + bne move + + lbra okayend2 + + +syntax equ * + leax synmsg,pc + ldy #synlen + lda #2 + os9 I$Write + + ldx parmptr + leax -1,x + pshs x + ldy #0 + +slup + leay 1,y + lda ,x+ + cmpa #C$CR + beq synsay + cmpa #C$SPAC + bne slup + +synsay + puls x + lda #2 + os9 I$Write output err + lbra okayend + + emod +size equ * + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/irqs.asm Fri Jan 31 17:37:19 2003 +0000 @@ -0,0 +1,368 @@ +******************************************************************** +* irqs - Show interrupt polling table +* +* $Id$ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 1 Created KKD +* 2 Modified GH +* 3 Streamlined and fixed problems BGP 03/01/07 + + nam irqs + ttl Show interrupt polling table + + ifp1 + use defsfile + endc + +rev set $01 +edition set 3 + +MaxDEnts set 32 max device entries we will display +MaxPEnts set 32 max polling entries we will display + + mod emod,name,prgrm+objct,reent+rev,start,endmem + + org 0 +usaver rmb 2 +narrow rmb 1 +polcount rmb 1 number of polling entries in polling table +devcount rmb 1 number of device entries in device table +datptr rmb 2 pointer to DAT image in system proc descriptor +notuse rmb 2 +outptr rmb 2 points to next available char in buffer +counter rmb 1 +devptr rmb 2 +tblptr rmb 2 +dpvars rmb 9 +rptbuf rmb 80 +ddevtbl rmb 2 copy of D.DevTbl in globals +dpoltbl rmb 2 copy of D.PolTbl in globals + IFGT Level-1 +poltable rmb 32*POLSIZ +devtable rmb 32*DEVSIZ +modulep rmb 256 +syspdesc rmb P$Size + ENDC +sstack rmb 200 +endmem equ . + +name fcs "irqs" + fcb edition + +PollHdr fcc "Polling Table at: " +PollHdrL equ *-PollHdr +Device fcc " Device Table at: " +DeviceL equ *-Device +NTopline fcc " Device Drvr IRQ Flip" + fcb C$CR +NToplineL equ *-NTopline +NLine2 fcc "Port Mem Name Vect Mask Pr" + fcb C$CR +NLine2L equ *-NLine2 +NLine3 fcc "---- ---- ----------- ---- --" + fcb C$CR +NLine3L equ *-NLine3 +Topline fcc " Device Driver IRQ Flip " + fcb C$CR +ToplineL equ *-Topline +Line2 fcc "Port Mem Name Vector &Mask Pty" + fcb C$CR +Line2L equ *-Line2 +Line3 fcc "---- ---- ------------ ----- ---" +crtn fcb C$CR +Line3L equ *-Line3 +Init fcs /Init/ + +start stu <usaver at 0000 in direct page +* First things first: get Polling Table and Device Table counts in the +* Init module + lda #MaxDEnts get max dev ents + sta <devcount + lda #MaxPEnts get max poll ents + sta <polcount + clra module type/lang byte + leax Init,pcr point to name + os9 F$Link link to it + bcs errexit branch if error + ldd PollCnt,u get poll count in A, dev count in B + os9 F$UnLink unlink it + ldu <usaver + cmpa <polcount is actual size greater or equal than our max? + bge chkdev branch if so + sta <polcount +chkdev cmpb <devcount is actual size greater or equal than our max? + bge cont branch if so + stb <devcount +cont clr <narrow + lda #$01 + ldb #SS.ScSiz + os9 I$GetStt + bcs cont2 + cmpx #Line3L+1 + bge cont2 + sta <narrow we're narrow +cont2 leax >crtn,pcr + ldy #$0001 + os9 I$WritLn write a carriage return + bcs errexit + leax >PollHdr,pc + ldy #PollHdrL + os9 I$Write write polling table header + bcs errexit + IFGT Level-1 + lda #$01 process ID #1 - system process + leax syspdesc,u point to buffer + os9 F$GPrDsc get a copy of it + bcs errexit + leax P$DatImg,x point to DAT image + stx <datptr save off pointer for later + ENDC + bra z00C5 +okexit clrb +errexit os9 F$Exit +z00C5 leay rptbuf,u + sty <outptr + IFGT Level-1 + leau ddevtbl,u + ldd <datptr get ptr P$datimg + ldx #D.DevTbl + ldy #$0004 include D.Poltbl 4 bytes to copy + os9 F$CpyMem get the two globals + bcs errexit + ldu <usaver restore u + ELSE + ldd >D.DevTbl + std <ddevtbl + ldd >D.PolTbl + std <dpoltbl + ENDC + ldd <dpoltbl + lbsr OutHex cnvrt 4 dgts of poll tbl addr + lbsr z01B1 output poll tbl address in ASCII +* troubleshooting printout + leax >Device,pcr + ldy #DeviceL + lda #1 + os9 I$Write + leax rptbuf,u + stx <outptr + ldd <ddevtbl + lbsr OutHex + lbsr z01B1 +* to here + lda #1 + leax >crtn,pcr stick another \n on it + ldy #$0001 + os9 I$WritLn + bcs errexit + leax >Topline,pcr + ldy #ToplineL + tst <narrow + beq branch1 + leax >NTopline,pcr + ldy #NToplineL +branch1 os9 I$WritLn + bcs errexit + leax >Line2,pcr + ldy #Line2L + tst <narrow + beq branch2 + leax >NLine2,pcr + ldy #NLine2L +branch2 os9 I$WritLn + bcs errexit + leax >Line3,pcr + ldy #Line3L + tst <narrow + beq branch3 + leax >NLine3,pcr + ldy #NLine3L +branch3 os9 I$WritLn + lbcs errexit + IFGT Level-1 +* Copy polling table + lda <polcount + ldb #POLSIZ + mul + tfr d,y + ldx <dpoltbl + ldd <datptr + leau poltable,u + os9 F$CpyMem + ldu <usaver + lbcs errexit +* Copy device table + lda <devcount + ldb #DEVSIZ + mul + tfr d,y + ldx <ddevtbl + ldd <datptr + leau devtable,u + os9 F$CpyMem + ldu <usaver + lbcs errexit + ENDC + +* Go through IRQ polling table until we find a non-empty slot or the end + ldb <polcount get polling count + stb <counter save off in our counter variable + IFGT Level-1 + leax poltable,u point X to polling table we copied + ELSE + ldx <dpoltbl + ENDC +z0165 ldd Q$STAT,x get static pointer + beq z016B branch if empty + bsr ShowIRQ else process it +z016B dec <counter decrement couunter + lbeq okexit exit if end + leax POLSIZ,x else advance X + bra z0165 and get some more + +* Here we process the IRQ polling entry at X +ShowIRQ leay rptbuf,u + sty <outptr reset output buffer pointer + ldd Q$POLL,x + lbsr OutHex convert 2 bytes port addr->ascii + ldd Q$STAT,x + lbsr OutHex convert 2 bytes memsiz->ascii + lbsr OutSpace extra space in line + bsr z01CA now do name + ldd Q$SERV,x get irq vector + lbsr OutHex convert it to ascii + lbsr OutSpace extra space + lda Q$FLIP,x get flip + lbsr z0247 convert 1 byte + tst <narrow + bne branch4 + lbsr OutSpace space +branch4 lda Q$MASK,x get mask + lbsr z0241 convert 1 byte + space + tst <narrow + bne branch5 + lbsr OutSpace extra space +branch5 lda Q$PRTY,x get priority byte + lbsr z0247 convert 1 byte +z01B1 pshs x + ldx <outptr + lda #C$CR terminate this line + sta ,x + leax rptbuf,u ptr to outbuff + ldy #80 max 80 chars + lda #$01 stdout + os9 I$WritLn + lbcs errexit + puls x,pc + +z01CA pshs x + IFGT Level-1 + leax poltable,u + ELSE + ldx <dpoltbl + ENDC + ldb <devcount + pshs b +* now we make an assumption that data +* areas for the same driver will be +* in the same page of memory, so compare +* only the high bytes of the address + ldb Q$STAT,x get irq dat addr + IFGT Level-1 + leax devtable,u devtbl buffer + ELSE + ldx <ddevtbl + ENDC +z01D6 cmpb V$STAT,x + beq Match if match, found device + leax DEVSIZ,x else inc to next tbl entry + dec ,s and decrement coounter + bne z01D6 continue if more + leas $01,s get rid of stack data + ldy <outptr + leay 8,y this leaves name visible + sty <outptr until new one found + puls x,pc + +z01E9 ldy <outptr + ldb #08 + lda #C$SPAC a space +z01EA sta ,y+ + decb + bne z01EA + sty <outptr + rts + +Match puls b fix stack + ldx V$DRIV,x get driver module pointer + beq z01E9 branch if none + IFGT Level-1 + pshs u + leau modulep,u + ldd <datptr +* hopefully the driver name is in the 1st 256 bytes + ldy #256 + os9 F$CpyMem + puls u + lbcs errexit + leax modulep,u + ENDC + ldd M$Name,x + leax d,x + lda #8 + tst <narrow + beq storeit + lda #7 +storeit sta <counter + clrb + bra z0220 +z021D bsr z025B +z0220 incb + cmpb <counter + bcc z0232 + lda ,x+ + bpl z021D + anda #$7F + bsr z025B + cmpb <counter + bcc z023A +z0232 bsr OutSpace + incb + cmpb <counter + bcs z0232 +z023A puls x,pc + +* HexCvt +* Entry: +* D = number to convert to hex +* X = pointer to buffer where hex string is stored +* Exit +OutHex pshs b convert to ascii + bsr z0247 make 2 digits + puls a +z0241 bsr z0247 make 2 more +OutSpace lda #C$SPAC + bra z025B +z0247 tfr a,b + lsra + lsra + lsra + lsra + bsr z0251 + tfr b,a +z0251 anda #$0F + cmpa #$0A + bcs z0259 + adda #$07 +z0259 adda #$30 +z025B pshs x + ldx <outptr get outbuf ptr + sta ,x+ + stx <outptr + puls pc,x + + emod +emod equ * + end
--- a/level1/cmds/makefile Fri Jan 31 17:35:49 2003 +0000 +++ b/level1/cmds/makefile Fri Jan 31 17:37:19 2003 +0000 @@ -4,10 +4,10 @@ BASIC09FILES = runb.asm gfx.asm inkey.asm syscall.asm COCOCMDS = asm attr backup binex build cmp cobbler config copy date \ - dcheck debug deiniz del deldir dir display dsave dump \ - echo edit error exbin format free grfo help ident iniz link \ - list load login makdir mdir merge mfree \ - os9gen park printerr procs pwd pxd \ + dcheck debug deiniz del deldir devs dir disasm display dmode \ + dsave dump echo edit error exbin exmode format free grfo \ + help ident iniz irqs link list load login makdir mdir merge \ + mfree os9gen park printerr procs pwd pxd \ rename runb save setime shell sleep tee tmode touch tsmon \ tuneport unlink verify xmode gfx inkey syscall DRAGONCMDS = cobbler_d64 format_d64 os9gen_d64 drvr51.dr go51
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/xmode.asm Fri Jan 31 17:37:19 2003 +0000 @@ -0,0 +1,683 @@ +******************************************************************** +* EXMode - Extended SCF device descriptor utility +* +* $Id$ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 1 Bruce Isted version released to PD BRI 89/06/21 + + nam EXMode + ttl Extended SCF device descriptor utility + + 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 "EXMode" + 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 + IFGT Level-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 + ENDC +TablOpts equ (*-OptTable)/6 number of table entries + fcb $80 end of option table + +UseMsg + fcb C$LF + fcc "Usage: EXMode [/<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: exmode /t2" + fcb C$LF + fcc " Prints the current option settings of the /T2 descriptor" + fcb C$LF + fcc " in memory." + fcb C$LF + fcc " exmode -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 " exmode -?" + 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 +