Mercurial > hg > Members > kono > nitros9-code
changeset 2977:2e740da2088e
3rdparty/utils: Add disk with Gene's bootlink and vfy utilities
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sat, 05 Apr 2014 01:01:32 +0200 |
parents | 0e5881ce0d31 |
children | 683a924462c8 |
files | 3rdparty/utils/gene/bootlink.asm 3rdparty/utils/gene/bootlink.doc 3rdparty/utils/gene/defsfile 3rdparty/utils/gene/makefile 3rdparty/utils/gene/vfy.asm 3rdparty/utils/gene/vfy.doc 3rdparty/utils/makefile |
diffstat | 7 files changed, 2695 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/utils/gene/bootlink.asm Sat Apr 05 01:01:32 2014 +0200 @@ -0,0 +1,971 @@ +* bootlink.asm, boot selection utility +* Copyright (C) 2012-2014 Gene Heskett +* License: GPLv2 +* See bootlink.doc for more licensing information +* +* A utility to facilitate using different boot vdisk images on +* a hard drive as the next default vdisk to boot from. +* +* REQUIRES: +* HDB-DOS 1.1a or I assume newer. +* The boot sequence is this: +* load the boottrack from the default vdisk 128 image coded into +* HDB-DOS. +* +* That tracks boot module, if a boot from the hard drive module +* will then interogate LSN0 of the selected disk, and will +* then use that data to locate the selected OS9Boot file +* from anyplace on the disk, well beyond the basic partitions +* end address if it is one of the 256 HDB-DOS vdisks. +* +* The only reason to change this boottrack is if one wanted to +* change the rel module to change the default boot screen from +* what is being used in the default vdisk 128. I like rel_80 +* myself. +* +* Getting LSN0 from that drive, reading DD.BT, and DD.SIZ, it knows +* where on the disks surface to get, and how much to get, to fetch +* the OS9Boot file from ANYPLACE on the hard drive. This means +* that by re-writing the DD.BT and DD.SIZ values in the selected by +* the boot module drive, we can effectively do exactly the same as +* I believe that LINK.BAS is doing but which is hard to get to without +* doing a full reset into rsdos. Something I rarely do. +* +* The intention is to be able to do something like: +* >bootlink 129;reboot +* choose 1 or let it time out and it will reboot using the boottrack +* from HDB-DOS vdisk 128, but then get the OS9Boot file from vdisk 129 +* instead of the default 128. Repeat the selection of which OS9Boot +* for any HDB-DOS vdisk. +* +* Caveat: be sure there is an OS9Boot file on that vdisk, else you will +* need to find that LINK.BAS and rerun it to restore your boot drives +* LSN0 DD.BT and DD.SIZ to valid values. +* +* The code for bootlink follows: +* various bits of the code can be traced by setting the debug level +* IF the machine has a 6309 in it, I use those registers to mark where +* the dump came from. +* DEBUG set 1 traces the LSN0 file creation process for the boot device +* DEBUG set 2 traces the LSN0 file creation process for the stp selected vdisk +* DEBUG set 3 will trace the offset calcs +* DEBUG set 4 traces new boot address additions +* DEBUG set 5 traces LSN0 edits +* DEBUG set 6 traces the decimal or ascii to hex conversions +* DEBUG set 7 traces the math for the $276*HEXB function +* DEBUG set 8 will check last coded display lines exit +* Any non-zero traces entry state +DEBUG set 0 + ttl bootlink - method of effecting reboots to different bootfiles + IFP1 + use os9.d + use rbf.d + ENDC +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set 1 +ed set 1 +srchcli set 8 amount of cli to search +shdeflt set $80 +MkUpper set $DF + + mod eom,name,tylg,atrv,start,msiz + +name fcs /bootlink/ + fcb ed +* All internally used strings here +DNAME fcc '/DD@' + fdb $0d +SHNAME fcc '/SH@' + fdb $0d +SHDIR fcc '/sh' + fdb $0d +SHMOD fcc 'SH' + fdb $0d +SHBoot fcc '/sh/OS9Boot' have that file? + fdb $0d +LSN0Sav fcc '/DD/SRC/bootlink.LSN0' + fdb $0d +LSN0tar fcc '/DD/SRC/targetlink.LSN0' + fdb $0d +bootmin fcb $60 only check high byte +hextbll fcb $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F +hextblh fcb $00,$10,$20,$30,$40,$50,$60,$70,$80,$90,$A0,$B0,$C0,$D0,$E0,$F0 + +vdpream fcc 'next, will do the equ of ' +vdmode$ fcc 'dmode' a printable string +dmodpar fcc ' /sh stp=$' +dmodevd fcc '00' + fcb $0a +dmodend fcb $0d + +* all allocated memory here +DBUF1 rmb 256 at 0,u drives base LSN0 when read in +DBUF2 rmb 256 at 256,u drives target LSN0 +CMDL rmb 2 READONLY pointer to command line args +OSID rmb 2 holds 1st two bytes of OS9Boot +HEXB rmb 1 scratchpad +STPHEX rmb 3 storage for $276*HEXB +BFADR rmb 3 size DD.BT +BFSIZ rmb 2 size DD.SIZ +NBFADR rmb 3 size new HDB-DOS DD.BT +NEWBTAD rmb 3 final addr move so 5 byte move works, is absolute addr +NBFSIZ rmb 2 size new DD.SIZ +PATHN rmb 1 pathnx I$Open returns +PATH2 rmb 1 pathno to sh@ +DPRTSZ rmb 3 size of device root part +OLDBTAD rmb 3 addr old boot file from LSN0 DD.BT +HEXASC rmb 1 controls treatment of input, dec or hex +DLRPTR rmb 2 save pointer to $ sign +ynumptr rmb 2 place to save x while getting input +stackp rmb 2 place to hold stack at launch +ParamD rmb 1 size of parameters passed at F$Fork that starts us +msiz equ . +* any other strings are defined within the code as needed +********************************************** +* We run everything from here +start sts stackp,u re-init the sp for exits! + stx CMDL,u save for whatever ;) + stb ParamD,u assume never over 256 bytes! + sta HEXASC,u assume always 0 here + clra + clrb + std DLRPTR,u zero these + lda ,x what char is x pointed at right now? +* Ok, we have an argument, handle it +whatgot cmpa #'$ what sort of an argument do we have? +* is it a hex value, or a decimal, no leading $ sign? + bne not$ + lbsr itshex + bra GotHEX +not$ lbsr numconv +GotHEX lbsr shomd got it show it + clrb + pshs u,y,x + lbsr domode Link and UnLink screw with lots of stuff + puls u,y,x + lbcs nodevic + clrb + lbsr GetLSNs works + lbcs baddat + clrb + lbsr GetDin + lbcs baddat + clrb + lbsr cklgimg + lbcs baddat + clrb + lbsr CalOfst + lbcs baddat + clrb + lbsr ShoRslt + clrb + bsr Cmitit actually do it! + lbra end All done folks! + +****SUBROUTINE**** +Cmitit leax DBUF1,u + leax DD.BT,u + leay NEWBTAD,u + ldb #5 bytes to move +Comit lda ,y+ + sta ,x+ + decb + bne Comit + leax DNAME,pcr point at /sh@ + lda #WRITE. + os9 I$Open + ifeq DEBUG-5 + pshs cc + lde #'O + ldf #'P + os9 F$RegDmp + puls cc + endc + bcs Comitnd + sta PATHN,u + clrb + ldy #256 one sector + leax DBUF1,u + lda PATHN,u + os9 I$Write put the sector back + ifeq DEBUG-5 + pshs cc + lde #'W + ldf #'R + os9 F$RegDmp + puls cc + endc + bcs Comitnd + lda PATHN,u + os9 I$Close + ifeq DEBUG-5 + pshs cc + lde #'C + ldf #'L + os9 F$RegDmp + puls cc + endc +Comitnd rts +****SUBROUTINE**** +* we should have the HDBDOS disk number in HEXB now +* so show the equ dmode line but thats not how we'll do it +shomd lda HEXB,u + lbsr hxb2asc + leax dmodevd,pcr + std ,x + leax vdpream,pcr + lda #1 + ldy #1+dmodend-vdpream + os9 I$Write should show it on screen + clrb + rts + +*****SUBROUTINE***** +* now, set to fork dmode but crashes above +domode clrb clr any carry + leax SHMOD,pcr point at /sh\r string + lda #$f1 + pshs u save it + os9 F$Link + ifeq DEBUG-9 + lde #'F + ldf #'L + pshs cc + os9 F$RegDmp + puls cc + endc + +* U now points at Header absolute address, but may not exist! + lbcs nodevic and this didn't work! +* now, lets play here a bit + tfr u,y so we can use it + puls u which should clean the stack + lda HEXB,u + sta IT.STP,y which should do it but screws the crc. do we care? + rts done here, works! + +GetLSNs lbsr BaseLSN Get LSN0 from /DD@ + lbcs end nothing on stack here + lbsr SHLSN0 Get LSN0 from /sh@ + lbcs end nothing on stack + ifne DEBUG if no debug, don't create check files + lbsr Creat1 make test files that can be dumped + lbcs end nothing on stack if we are here + lbsr Creat2 ditto + lbcs end stack s/b ok + endc + rts + +**********CalOfst********************* +* we have all the data, so we need to calculate +* the additional LSN offset for the HEXB (stp) value we should have +* this will be $276*HEXB, and will store the result in STPHEX,u +* First, clear var holder & make some space on stack +CalOfst clra + sta STPHEX,u + sta STPHEX+1,u + sta STPHEX+2,u + leas -4,s + lda HEXB,u + ldb #$76 + mul + std 2,s + lda HEXB,u + ldb #$02 + mul + std ,s + clrb + lda 1,s + addd 2,s + std 2,s + bcc missinc + inc ,s +missinc lda ,s + sta 1,s + ldd 2,s + addd STPHEX+1,u + std STPHEX+1,u + lda 1,s + adca STPHEX,u + sta STPHEX,u + leas 4,s restore stack + ifeq DEBUG-3 + ldd HEXB,u + ldw STPHEX+1,u + pshs cc + os9 F$RegDmp + puls cc + endc +* here we do straight additions with carry for 3 bytes + clra + ldb DPRTSZ+2,u get low byte of partition end + addb STPHEX+2,u add low byte of calculated vdisk + adca #0 handle carry if + addb NBFADR+2,u + adca #0 handle any carry's + stb NEWBTAD+2,u + tfr a,b do 2nd byte of 3, carry added above, now in b + clra + addb NBFADR+1,u very slim chance of carry, but not 0 + adca #0 transfer the carry to a + addb STPHEX+1,u + adca #0 chance of carry, handle + addb DPRTSZ+1,u + adca #0 chance of carry, handle + stb NEWBTAD+1,u + tfr a,b potential carry's in b now + clra + addb NBFADR,u add to potential carry + addb STPHEX,u astronomical chance of carry here + addb DPRTSZ,u or here, no place to put it anyway + stb NEWBTAD,u + ifeq DEBUG-4 + ldw NEWBTAD+1,u + pshs cc + os9 F$RegDmp + puls cc + endc + rts All done!! + +*********SUBROUTINES*********** +* support strings for ShoRslt + +Shopart fcc 'Disk has an os9 partition size of = $' +partsiz fcc '000000' + fdb $0a0d works +Shoddbt fcc 'Original OS9Boot file location = $' +Oldd.bt fcc '000000' + fdb $0a0d works +Shorsiz fcc 'Original OS9Boot file size is = $' +Oldbsiz fcc '0000' + fdb $0a0d works +Shonbad fcc 'The new bootfile location in /sh is = $' +nblocat fcc '000000' + fdb $0a0d works +Shabslo fcc 'This will be at actual $' +absolut fcc '000000' + fcc ' sector on the drive' + fdb $0a0d works +Shnbsiz fcc 'The new OS9Boot file size is = $' +nbsize fcc '0000' + fdb $0a0d +Shhdbvd fcc 'Which is located in HDB-DOS disk $' +Shdbdos fcc '00' + fdb $0a0d +Sendstr equ * need ending data marker +ShoRslt leax partsiz,pcr + lda DPRTSZ,u + lbsr hxb2asc + std ,x++ first 2 ascii digits + lda DPRTSZ+1,u + lbsr hxb2asc + std ,x++ next 2 ascii digits + lda DPRTSZ+2,u + lbsr hxb2asc + std ,x last 2 ascii digits + leax Shopart,pcr now print it + ldy #Shoddbt-Shopart + lda #1 + os9 I$Write + clrb +ShDD.BT leax Oldd.bt,pcr + lda OLDBTAD,u + lbsr hxb2asc + std ,x++ + lda OLDBTAD+1,u + lbsr hxb2asc + std ,x++ + lda OLDBTAD+2,u + lbsr hxb2asc + std ,x + leax Shoddbt,pcr + ldy #Shorsiz-Shoddbt + lda #1 + os9 I$Write + clrb +oldbtsz leax Oldbsiz,pcr + lda BFSIZ,u + lbsr hxb2asc + std ,x++ + lda BFSIZ+1,u + lbsr hxb2asc + std ,x + leax Shorsiz,pcr + ldy #Shonbad-Shorsiz + lda #1 stdout + os9 I$Write + clrb + leax nblocat,pcr + lda NBFADR,u + lbsr hxb2asc + std ,x++ + lda NBFADR+1,u + lbsr hxb2asc + std ,x++ + lda NBFADR+2,u + lbsr hxb2asc + std ,x last byte + leax Shonbad,pcr + ldy #Shabslo-Shonbad + lda #1 + os9 I$Write + clrb +* now show its size + leax nbsize,pcr + lda NBFSIZ,u + lbsr hxb2asc + std ,x++ + lda NBFSIZ+1,u + lbsr hxb2asc + std ,x + leax Shnbsiz,pcr + ldy #Shhdbvd-Shnbsiz + lda #1 + os9 I$Write + clrb +abslutA leax absolut,pcr + lda NEWBTAD,u + lbsr hxb2asc + std ,x++ + lda NEWBTAD+1,u + lbsr hxb2asc + std ,x++ + lda NEWBTAD+2,u + lbsr hxb2asc + std ,x + leax Shabslo,pcr + ldy #Shnbsiz-Shabslo + lda #1 + os9 I$Write + clrb + leax Shdbdos,pcr + lda HEXB,u + lbsr hxb2asc + std ,x + leax Shhdbvd,pcr + ldy #Sendstr-Shhdbvd + lda #1 + os9 I$Write + clrb +ShoEnd rts + +* Get the LSN0 data from /DD +* arrive here with 1 bsr on stack +BaseLSN lda #READ. Read mode + leax DNAME,pcr point at device name + os9 I$Open open it raw + bcs Basend report the error + sta PATHN,u Save path# + leax DBUF1,u point x at DBUF,u + ldy #256 size of buffer + lda PATHN,u get path# back in case regs.a wrong + os9 I$Read and read 256 byte of /dd@ LSN0 + bcs Basend report the error +* got the sector, save the interesting data + pshs x + leax DD.BT,x + ifeq DEBUG-1 + pshs cc + lde #'O + ldf #'A + os9 F$RegDmp look at x + puls cc + endc + ldd ,x++ + std OLDBTAD,u + ldb ,x+ + stb OLDBTAD+2,u + ldd ,x + std BFSIZ,u + ldd DBUF1,u get partition size + std DPRTSZ,u + lda DBUF1+2,u last byte + sta DPRTSZ+2,u + ifeq DEBUG-1 + ldf #'B + pshs cc + os9 F$RegDmp + puls cc + endc + puls x clean up the stack & restore x + lda PATHN,u restore regs.a in case + os9 I$Close and close path to /dd@ + bcs Basend + clrb +Basend rts + +****************************************** +* Get the LSN0 data from /sh@ +* should arrive here with 1 bsr on stack +SHLSN0 lda #READ. read mode + leax SHNAME,pcr + os9 I$Open open it raw + bcs SHCKend report the error + sta PATH2,u save the path number + leax DBUF2,u + ldy #256 + lda PATH2,u get our pathno back + os9 I$Read and read the 256 bytes of /sh@ + bcs SHCKend report the error + pshs x + leax DBUF2,u get the location & size of this bootfile + leax DD.BT,x + ldd ,x++ + std NBFADR,u + lda ,x+ + sta NBFADR+2,u + ldd ,x + std NBFSIZ,u + ifeq DEBUG-1 + pshs cc + lde #'2 + ldf #'A + os9 F$RegDmp + puls cc + endc + puls x + lda PATH2,u + os9 I$Close +* we have added nothing to the stack +SHCKend rts if err, report + +***************************************** +* now create trace dumps +* this could be removed in final +* should arrive here with 1 bsr on stack +Creat1 leax LSN0Sav,pcr point x at filename to save LSN0 in + ldb #UPDAT.+PREAD.+PWRIT. global read+write attr's + lda #UPDAT.+PREAD.+PWRIT. real attr's go in regs.b dummy + os9 I$Create and create it, s/b empty file + bcs Cr1fix +cont1 sta PATHN,u save the path# returned + lda PATHN,u + leax DBUF1,u point x at buffer we read from /dd@ + ldy #256 amount to write + os9 I$Write and write it to the file + bcs Cr1end + lda PATHN,u it could be played with, get it back + clrb just in case + os9 I$Close + clrb +Cr1end rts should clean up the bsr on stack + +Cr1fix leax LSN0Sav,pcr + os9 I$Delete + bcs Cr1end can't fix, some other error + bra Creat1 go back and try again + +Creat2 equ * lets go make the 2nd file + ifeq DEBUG-2 +* Tally we got here + lde #'C + ldf #'2 + pshs cc + os9 F$RegDmp + puls cc + endc + leax LSN0tar,pcr + lda #UPDAT.+PREAD.+PWRIT. + ldb #UPDAT.+PREAD.+PWRIT. + os9 I$Create s/b empty file + bcs Cr2fix +cont2 sta PATH2,u + leax DBUF2,u + ldy #256 + os9 I$Write + bcs Cr2end + lda PATH2,u + clrb + os9 I$Close + clrb successful, no? +Cr2end rts should clean stack + +Cr2fix leax LSN0tar,pcr + clrb clr error? + os9 I$Delete + bcs Cr2end some other error, report + bra Creat2 else go back and try again +* eventually these fixes need to check the return err +* and if not 218, bail plumb out +****************************************** +* check legal image, do we have an os9 +* spec LSN0 in DBUF2,u? +* should arrive here with 1 bsr on stack +cklgimg leax DBUF2,u + clrb our error counter + lda ,x+ sets z flag if $00 + ifeq DEBUG-9 + tfr pc,w + pshs cc + os9 F$RegDmp + puls cc + endc + beq badbuf1 + incb +badbuf1 lda ,x+ get next byte, better be a $02 + cmpa #$02 + ifeq DEBUG-9 + pshs cc + tfr pc,w + os9 F$RegDmp + puls cc + endc + beq badbuf2 + incb +badbuf2 lda ,x+ better be a $76 + cmpa #$76 + ifeq DEBUG-9 + pshs cc + tfr pc,w + os9 F$RegDmp + puls cc + endc + beq badbuf3 + incb +badbuf3 leax DBUF2,u reset x + leax DD.BT,x point x at DD.BT + lda ,x+ first byte of DD.BT + beq bt1 + incb +bt1 lda ,x+ 2nd byte of DD.BT s/b a $00 too + beq bt2 + incb +bt2 lda ,x+ last byte of DD.BT s/b non-zero + bne bt3 got something, skip the incb + incb +bt3 tstb non zero? error! + ifeq DEBUG-9 + pshs cc + tfr pc,w + os9 F$RegDmp + puls cc + endc + lbne baddat +* got this far, what size is it? + lda ,x+ get 1st byte of DD.BSZ +* now here, this is subjective, I've not seen a boot file +* that wasn't at least #$5000 long + cmpa bootmin,pcr abs minn length IMO + ifeq DEBUG-9 + pshs cc + tfr pc,w + os9 F$RegDmp + puls cc + endc + bcc noBinc + incb +* no illegal value to 2nd byte, don't bother + +********************************* +* now check the DD.DIR & regs.b is still $00 if got here +noBinc leax DBUF2,u point x at sh's buffer + leax DD.DIR,x now point at 1st byte of DD.dir + lda ,x+ /sb $00, no floppy can be non-zero + beq dir1 + incb opps, really bad data +dir1 lda ,x+ 2nd byte, for floppy s/b $00 if mb made the disk + beq dir2 is legal + incb not zero, tally as bad +dir2 lda ,x+ get 3rd byte, s/b a $02 + cmpa #$02 as it should be for a valid floppy + beq dir3 + incb not a $02, tally it as bad +dir3 tstb + ifeq DEBUG-9 + pshs cc + tfr pc,w + os9 F$RegDmp + puls cc + endc + beq getdrsh + incb +getdrsh lda #READ.+DIR. open for read only + leax SHDIR,pcr + os9 I$Open see if is has a dir + ifeq DEBUG-9 + pshs cc + tfr pc,w + os9 F$RegDmp + puls cc + endc + bcc scapinc + incb +scapinc os9 I$Close clean up the path table +************************************************ +* got here ok, can we open the OS9Boot file? +chkboot leax SHBoot,pcr + lda #READ. + os9 I$Open + ifeq DEBUG-9 + pshs cc + tfr pc,w + os9 F$RegDmp + puls cc + endc + bcc scipinc + incb +scipinc sta PATH2,u file must exist + leax OSID,u + ldy #0002 bytes to read + os9 I$Read + ifeq DEBUG-9 + pshs cc + tfr pc,w + os9 F$RegDmp + puls cc + endc + bcc skpinc + incb +skpinc pshs d + ldd OSID,u + cmpd #$87CD header bytes? + ifeq DEBUG-9 + pshs cc + lde #'B + ldf #'F + os9 F$RegDmp + puls cc + endc + puls d + beq closeup + incb +closeup lda PATH2,u + os9 I$Close clean up path table +* image looks good, we even have an OS9Boot file +* that looks good, so + tstb + lbne baddat + clrb +BadImg rts We've weeded it out to about a -8.0000-21 chance of bad=good + +************************************ +* got data, copy goodies to work buffers +GetDin lda ,u get first byte of part size + sta DPRTSZ,u + ldd 1,u get other 2 bytes + std DPRTSZ+1,u Should now have devices size + ldd DD.SIZ,u current os9boot files size + std BFSIZ,u and save it + ldd DD.BT,u get 2 byte of its location + std BFADR,u and save that for later + lda DD.BT+2,u get last byte of addr + sta BFADR+2,u and save it + rts + +************subroutines************** +* hxb2asc +* this routine was written up in the +* Rainbow (11/92) by Tim Kientzle. +* it will convert the value passed +* in the A register to a pair of +* ascii characters in A:B which +* are the directly printable ASCII +* representations of the original +* contents of regs.a. Load regs.A +* with byte of source number, call, +* store A nd B in order in the +* printable string on return. + +hxb2asc tfr a,b Make copy of a in b + anda #$0f mask off lower digit + adda #$90 generates carry if a>9 + daa in this operation + adca #$40 bring in the carry + daa make final character + exg a,b stash that in b, get a back + lsra getting high nibble + lsra into position to + lsra convert it + lsra + adda #$90 and repeat for high nibble + daa and generate carry from a>9 + adca #$40 + daa + rts returns with a:b=two hexidecimal characters + +********************************************* +* a2h make 1 hex byte from two ascii chars +a2h ldx CMDL,u get arg pointer back + lda ,x+ get the left hex char + stx CMDL,u save for next byte + suba #'0 reduce for decimal entries + cmpa #$0A + blo znine its 0-9 + anda #MkUpper + suba #$07 else sub 7 more for A-F values +znine pshs x + leax hextblh,pcr + ldb a,x + stb HEXB,u write high nibble + puls x restore it + ifeq DEBUG-6 + lde #'a + ldf #'h + pshs cc + os9 F$RegDmp + puls cc + endc +* now check, is there a high nibble? + lda ,x x already inc'd + suba #'0 reduce to decimal + cmpa #$0A + blo ninez + anda #MkUpper + suba #$07 else sub 7 more for A-F inputs +ninez pshs x + leax hextbll,pcr + ldb a,x + puls x + orb HEXB,u +nineex stb HEXB,u + ifeq DEBUG-6 + lde #'A + ldf #'H + pshs cc + os9 F$RegDmp + puls cc + endc + rts + +itshex leax 1,x throw away the $ sign + ifeq DEBUG-6 + pshs cc + lde #'n + ldf #'c + os9 F$RegDmp + puls cc + endc + stx CMDL,u for a2h use + lbsr a2h and convert to a hex byte + rts + +*********************************** +* we supposedly have found the cr without unzeroing HEXASC,u +* so we use this conversion. +numconv ldx CMDL,u s/b first char of arg value +* find the end + clrb find out how many chars we have +findeod lda ,x+ + ifeq DEBUG-6 + lde #'f + ldf #'s + pshs cc + os9 F$RegDmp + puls cc + endc + incb + cmpa #$0D + bne findeod +* we have the cr, so +foundcr leax -3,x back to data? + ldd ,x get 2 bytes of decimal cli + ifeq DEBUG-6 + lde #'c + ldf #'r found cr + pshs cc + os9 F$RegDmp lets see the data in A:B + puls cc + endc +decmode cmpa #'9 make a hex digit out of regs.a + ble gigo1 + lda #$30 load a zero +gigo1 cmpa #'0 + bhi gigo2 + lda #$30 load a zero +gigo2 subb #'0 leave a hex nibble + suba #'0 leave a hex nibble + blo add00 garbage, go + cmpa #'9 + bhi add00 garbage, go + ifeq DEBUG-6 + lde #'d + ldf #'r + pshs cc + os9 F$RegDmp check A[2]:B[8] again good + puls cc + endc + stb HEXB,u save lsnibble + ldb #$0A + mul multiply a:b + daa + addb HEXB,u + stb HEXB,u +* now lets see what we have in B + ifeq DEBUG-6 + ldf #'1 low nibble in B? + pshs cc + os9 F$RegDmp is $10 for a 28 input + puls cc + endc +* but we're not done, need to handle 1st digit if + leax -1,x + lda ,x + ifeq DEBUG-6 + lde #'d + ldf #'2 + pshs cc + os9 F$RegDmp wft am I getting? + puls cc + endc + cmpa #'2 + beq add200 + cmpa #'1 can we get garbage here? yes + beq add100 else add 200 + bra add00 else garbage, add nothing +add200 addb #$64 +add100 addb #$64 +add00 stb HEXB,u + ifeq DEBUG-6 + lde #'d + ldf #'e + pshs cc + os9 F$RegDmp show HEXB in b + puls cc + endc + clrb kill false error +numdone rts + +**************************************************** +* exit messages +FMTSTR fcc 'Something is wrong, either with the hdb-dos disk chosen' + fdb $0a0d + fcc ' and set into the /sh descriptor' + fdb $0a0d + fcc ' or the format of the argument.' + fdb $0a0d + fcc /bootlink needs a fixed size vdisk number argument/ + fdb $0a0d + fcc /in a 3 digit format. If first char is a $ sign,/ + fdb $0a0d + fcc /the next 2 nums are hex, else all 3 are decimal./ + fdb $0a0d + fcc /example: $80 or 128. Result will be used to control/ + fdb $0a0d + fcc 'as in "dmode /sh stp=hex of above number.' + fdb $0a0d +ENDSTR bra forker1 +ndevmsg fcc 'Named device /sh is not in memory.' +enddvmg fdb $0a0d +nodevic leax ndevmsg,pcr + ldy #enddvmg-ndevmsg + lda #1 stdout + os9 I$Write + bra forker1 +numdun equ * +baddat leax FMTSTR,pcr + ldy #ENDSTR-FMTSTR + lda #1 stdout + os9 I$Write +forker1 clrb we just reported the error folks +* arriving here with possible bsr on stack - restore +* but make sure U is correct, a Link call screws it! +* and this sp reload with U fucked is my crash just like +* little green apples. GIGO of the hidden sort. So... + ldu #$0000 this seems to be where we started + lds stackp,u clear it for exit, leave b, cc as is +bigdec equ * +end os9 F$Exit + emod +eom equ * +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/utils/gene/bootlink.doc Sat Apr 05 01:01:32 2014 +0200 @@ -0,0 +1,97 @@ + bootlink + +A utility to facilitate using different boot vdisk images on a hard drive +as the next default vdisk to boot from. + +I'm an owner with both the superdriver, and HDB-DOS, the combination of which +seems to be at least as good as sliced bread or bottled beer. +HDB-DOS opens up so many possibilities for os9 that I can't see a good +reason not to have it. + +One of the possibilities is being able to use the superdrivers /sh descriptor +to handle 99.9% of the bootup differences you can envision, like booting to +a bootfile composed so as to be a web server, and another one more designed +to develop programs in, and another just to run driverwire, or ultimuseIII, +and the list probably includes all the os9 games ever written for level 2 +also. + +Generally the default HDB-DOS disk it boots from is disk 128, aka $80 when +set into your /sh.dd descriptor. Generally it should look similar to this: + +{t2|03}/DD/SRC:dmode /sh + + nam=SH mgr=RBF ddr=rbsuper + hpn=07 hpa=FF74 drv=07 stp=80 typ=81 dns=08 cyl=0023 sid=01 + vfy=01 sct=0012 t0s=0012 ilv=00 sas=08 wpc=1D ofs=BB90 rwc= + +Where the 'stp' value, in hex, is the same as HDB=DOS's disk 128. + +Couple of things to note here. + +1. dos128 only does one thing that is guaranteed to come from that actual +virtual disk, and that is to load the boottrack from its track 34. + +2. Once that is loaded, and the stuff moved around so its located at the +proper place in memory by relXX, then the boot module is entered. Its +a bit dumb and has no clue about the os9 file system or its directory +stucture. So it does the next best thing, it goes and reads the first +sector of the drive specified in the last byte of the boot module -4 bytes. +I have not done this, but it follows that one could even get the OS9Boot +file FROM A DIFFERENT HARD DRIVE if you wanted to. + +Anyway, having read the LSN0 of the specified drive, it then looks at the +5 bytes of where the file is in its absolute address on the drive, and how +big it is. These are the 3 bytes of offset DD.BT, and the 2 bytes that +follow which are DD.BSZ, its size. Then the boot module seeks to the DD.BT +specified location in the drive, and loads DD.BSZ worth of data, which it +hopes is the OS9Boot file. + +Because there is no absolute certainty that it is an os9boot file, my +offering here, bootlink, goes to extraordinary lengths to assure that +the address you pass it as the argument, actually IS an os9 formatted +35 track SS floppy image that was generated by os9gen, and has valid data +for its DD.BT and DD.BSZ entries and that a file named OS9Boot with an +$87CD as the first 2 bytes actually exists in this image. Failing any +one of those tests results in an error message and an exit without doing +anythng. + +Since you'll want to store some of your game disks, say using the first +50 HDB-DOS 'disks', in that case you could have 205 (talk about overkill) +different OS9Boot files to choose from just by running "bootlink xxx" or +$xx, it works with either format of input, and rebooting. It will get +the boottrack from the default drive, but then finish the custom boot +from any drive that has a valid bootable image backed up to it from a +floppy, best done with the HDB-DOS driveoff:backup0toxxx command. I +think I'd wind up with post-it notes all over so I could recall which +was which, but however you solve the record keeping is up to you. Some, +or many of the games will have a custom boottrack, so you will probably +need to use the link.bas program to run those. Say you have DoD on +disk 33, you will probably need to run bootlink 033, reboot, chose H +after the green screen comes up, and then a "dos33" to run it. + +One final note, bootlink absolutely must have a 3 digit input argument. +So it can be in the range of 000-255, or $00-$ff. + +I hope this is a useful tool. + +Cheers, Gene + + +A utility to facilitate using different boot vdisk images on a hard drive +as the next default vdisk to boot from. +Copyright (C) 2014 Gene Heskett + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/utils/gene/defsfile Sat Apr 05 01:01:32 2014 +0200 @@ -0,0 +1,4 @@ + + use os9.d + use rbf.d + use coco.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/utils/gene/makefile Sat Apr 05 01:01:32 2014 +0200 @@ -0,0 +1,47 @@ +# OS-9 Commands/Utilities + +include ../../../rules.mak + +AFLAGS = -DLevel=1 + +DEPENDS = ./makefile + +CMDS = bootlink vfy + +ALLOBJS = $(CMDS) + +DSKGENEUTILS = gene_utils.dsk + +DSKS = $(DSKGENEUTILS) + +all: banner $(ALLOBJS) $(DEPENDS) + +banner: + @$(ECHO) "**************************************************" + @$(ECHO) "* *" + @$(ECHO) "* Gene Heskett's Utilities *" + @$(ECHO) "* *" + @$(ECHO) "**************************************************" + +$(DSKGENEUTILS): $(CMDS) + $(RM) $@ + $(OS9FORMAT) $@ + $(MAKDIR) $@,CMDS + $(OS9COPY) $(CMDS) $@,CMDS + $(OS9ATTR_EXEC) $(foreach file,$(CMDS),$@,CMDS/$(file)) + +dsk: all $(DSKS) + +dskcopy: dsk + $(CP) $(DSKS) $(DSKDIR) + +dskclean: + $(RM) $(DSKS) + +clean: dskclean + $(RM) $(ALLOBJS) + +info: + @echo "*** Gene Heskett's Utilities ***" + @$(foreach dsk, $(DSKS), $(ECHO) $(dsk);) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/utils/gene/vfy.asm Sat Apr 05 01:01:32 2014 +0200 @@ -0,0 +1,1407 @@ +* vfy.asm, module file verification tool +* Copyright (C) 1993-2014 Gene Heskett +* License: GPLv2 +* See vfy.doc for more licensing information + + opt w 86 + nam vfy Edition 17 + ttl A new verify, finds, fixes modules in files +************************************************* +* This verify will search thru any file to find a +* valid module header in the $87CD format, get that +* modules size, do a header parity/crc check on it, +* and if the -f option is on, will update the header +* parity and CRC bytes in the file too. It then +* resumes the search of the named file for more +* modules and loops till <eof>. If it finds <eof> +* while doing the crc, the error is reported as such. +* 2/18/93 version 7 +* The housekeeping was pretty well complete, so it +* wasn't very much trouble to add the file split +* ability to this, now we can even split out the +* kernal track modules, plus head and tail too! Ver 8 +* 11.24.93 GH Ver 9Adding some stuffs from "fixmod" here +* Now have total control over its vebosity 11/24/93 GH Ver 10 +* 11/24/93 GH, -ua,-ur,-ut,-ul=$hexval installed +* 11/26-27/93 GH fine tuning the above GH Ver 11 +* 01/25/94 GH another minor mod so it doesn't complain +* if the header parity is correct even if told to fix GH Ver 12 +* 11/11/94 GH Ver 13. bug smashing, didn't update datasize +* if header parity was ok. Wrong branch at hdr parity check, +* if good it skipped the header update! Shame on me. :-( +* 11/14/94 GH Now it beeps and updates the header even if +* theres nothing wrong if the -f option is on. It doesn't +* hurt anything except the speed, but looking to fix +* it anyway. Now it does a header/datasize update +* independantly of the crc fixes, fixing only the +* header of the named file for one of the header +* fix variables, and the crc of that named file. +* If the -f option is on, it will fix the crc's +* and headers all thru the file. A good way to +* clean up after ded when working on hand patches +* in the kernal track. +* 05/04/95 GH, wasn't showing the correct info from the +* INIT module. Several minor changes there. Now ed #15 +* 05/10/95 GH, adding the ability to change one module +* in a file via the name match, -n=modname +* also put verbose control in (finally), now edition 16 +* Seeing if its possible to make it split a $62CD library +* after looking over the header format for an ROF file, +* it might be better to do a whole new "libsplit" + ifp1 + use os9.d + endc +ver set 17 +atrev set reent+1 +* + mod len,name,prgrm+objct,atrev,entry,dsiz + +crcacc rmb 1 for new crc's +crcac2 rmb 1 +crcac3 rmb 1 +filecrc1 rmb 1 for the actual crc +filecrc2 rmb 1 +filecrc3 rmb 1 +numptr rmb 2 ptr to src +linptr rmb 2 ptr to linbuff +linbuff rmb 8 max len for printables + +**** the modules header directly loaded **** +modid1 rmb 1 the $87 +modid2 rmb 1 the $CD +modlen rmb 2 for the modules length +modname rmb 2 offset ptr to module name +typelang rmb 1 +modatrev rmb 1 +checksum rmb 1 +execptr1 rmb 1 the exec offset in the header +execptr2 rmb 1 more exec address +pdatasz1 rmb 1 the permanent data size from the header +pdatasz2 rmb 1 more data size or IRQ Poll count +dvtblent rmb 1 the device table entries value for INIT +***** the above loaded directly from the file **** + +modhstrt rmb 2 set by sethead at start of +modlstrt rmb 2 module being checked +lmnscrc rmb 2 length minus crc for seeks +flenms16 rmb 2 overall file size ms16 +flenls16 rmb 2 ditto ls16 +filesiz rmb 2 size of individual module +modpos rmb 2 where in module now +seekms16 rmb 2 for seeks +seekls16 rmb 2 ditto +moddone rmb 1 flag for last read +seperat rmb 1 flag for seperations +kernal rmb 1 flag to save it all +kbptrms rmb 1 msb of int +kbptr rmb 1 ptr to krnlbuf location +exdir rmb 1 for defining the access attributes +inpath rmb 1 for pathnum +outpath rmb 1 flag and output paths +kpath rmb 1 for kernal extras path +fixit rmb 1 tally for fix it +fixname rmb 1 fix only this name +fixty rmb 1 tally for individual fix +fixla rmb 1 ditto +fixat rmb 1 ditto +fixrv rmb 1 ditto +sizyet rmb 1 size not displayed yet if set +exectyp rmb 1 is executable +lftnbbl rmb 1 controls left-right nibble processing +verbose rmb 1 do we wanta see the results +updtrv rmb 1 update revision nibble +updtat rmb 1 update the attr nibble +updtty rmb 1 update the modules type nibble +updtla rmb 1 update the modules language nibble +updtdtsz rmb 2 update modules memsize integer +updthead rmb 1 controls the re-write of the header +cmpname rmb 32 to hold wanted name +datsiz equ . memory from 0 to here gets cleared +mdlname rmb 32 room for name +krnlbuf rmb 64 enough for what I've seen +buffer rmb 256 save the disk buffer +params rmb 200 +stack rmb 200 +dsiz equ . +* +name fcs /VFY/ + fcb ver +helpmsg fcb $0D,$0A + fcc 'Syntax: vfy [-options] [-options] /path/filename' + fcb $0D,$0A + fcc / Options -> -f =fix (whole file) IF CRC is bad./ + fcb $0D,$0A + fcc / -> -v =work silently./ + fcb $0D,$0A + fcc / -> -n=name fix or adjust only "name" module./ + fcb $0D,$0A + fcc / -> -x =file is in EXEC dir./ + fcb $0D,$0A + fcc / -> -s =seperate MERGED file./ + fcb $0D,$0A + fcc / -> -sk =seperate KERNAL file./ + fcb $0D,$0A + fcc / -> -ua=$hexchar -ur=$hexchar -ut=$hexchar -ul=$hexchar/ + fcb $0D,$0A + fcc / a=att nibl, r=rev nibl, t=type nibl, l=lang nibl, "$" required/ + fcb $0D,$0A + fcc / -> -ud=$hexint to add (modulo $10000) data size./ + fcb $0D,$0A + fcc / if -u, -f is enabled for first file encountered./ + fcb $0D,$0A + fcc / if -n, -f is enabled for named file encountered./ + fcb $0D,$0A +cpyrit fcc / VFY (c) 1993, 1994, 1995 by Maurice E.(Gene) Heskett/ + fcb $0D,$0A +msgsiz equ * +advise0 fcc /A header file called / +kernal0 fcc /KernalHead/ + fcb $0D put cr on name +krnlhsz equ * +advise1 fcc /A tail file called / +kernal1 fcc /KernalTail/ + fcb $0D put cr on name +krnltsz equ * +advlen fcc / with a length of $/ +advend fcc / has been made./ +hednamsg fcc /Header for : / +hedckmsg fcc /Header parity : $/ +ckbadsiz equ * +fixxmsg fcc / Repaired to: $/ +newln fcb $0d,$0a +hdgdsiz equ * +modlnmsg fcc /Module size : $/ +crcmsg fcc /Module CRC is : $/ +crcmsiz equ * +gdmsg fcc / (good)/ + fcb $0d,$0a +gdsiz equ * +shdabeen fcc ' S/B $' +badmsg fcc / (bad)/ + fcb $07,$07,$07,$07,$07 +badsiz equ * +mdoffset fcc /Module found at offset $/ +mdoffend fcc / in this file/ +mdoffnln fcb $0d,$0a +ftopmem fcc /Top of free ram $/ +ftopsiz equ *-ftopmem +ptabent fcc /, IRQ poll table entries $/ +ptabsiz equ *-ptabent +dvtabent fcc /, Device table entries $/ +dvtabsiz equ *-dvtabent +flenmsg fcc /Length of file: $/ +howmany fcc /Bytes read : $/ +execoff fcc /Exec. off : $/ +datasiz fcc /Data Size : $/ +vertion fcc /Edition : $/ +tplgatrv fcc 'Ty/La At/Rv : $' + +******** The lookup table for TYPE +typelook equ * +typunksz fdb sstmod-unktyp zero is not defined +typunkst fdb unktyp-* +typprgsz fdb sbrutn-prgtyp 1 is program +typprgst fdb prgtyp-* +typsubsz fdb mltmod-sbrutn 2 is subroutine +typsubst fdb sbrutn-* +typmltsz fdb dtmtyp-mltmod 3 is multi-mod +typmltst fdb mltmod-* whatever that is +typdatsz fdb unktyp-dtmtyp +typdatst fdb dtmtyp-* +typ5siz fdb sstmod-unktyp +typ5str fdb unktyp-* +typ6siz fdb sstmod-unktyp +typ6str fdb unktyp-* +typ7siz fdb sstmod-unktyp +typ7str fdb unktyp-* +typ8siz fdb sstmod-unktyp +typ8str fdb unktyp-* +typ9siz fdb sstmod-unktyp +typ9str fdb unktyp-* +typAsiz fdb sstmod-unktyp +typAstr fdb unktyp-* +typBsiz fdb sstmod-unktyp +typBstr fdb unktyp-* +typCsiz fdb fmntyp-sstmod +typCstr fdb sstmod-* +typDsiz fdb ddrtyp-fmntyp +typDstr fdb fmntyp-* +typEsiz fdb ddstyp-ddrtyp +typEstr fdb ddrtyp-* +typFsiz fdb ddssiz-ddstyp +typFstr fdb ddstyp-* + +*********** The type defines *********** +typstrs equ * +prgtyp fcc /Program module/ +sbrutn fcc /Subroutine/ +mltmod fcc /Multi-Mod/ +dtmtyp fcc /Data module/ +unktyp fcc /Unknown type/ from 5 to B +sstmod fcc /System module/ +fmntyp fcc /File manager/ +ddrtyp fcc /Device driver/ +ddstyp fcc /Device descriptor/ +ddssiz equ * + +*********** The lookup table for LANG +langlook equ * +lan0siz fdb std809-sysdat 0 is data +lan0str fdb sysdat-* +lan1siz fdb b09typ-std809 1 is 6809 object +lan1str fdb std809-* +lan2siz fdb pastyp-b09typ 2 is Basic09 I-code +lan2str fdb b09typ-* +lan3siz fdb ftntyp-pastyp 3 is Pascal P-code +lan3str fdb pastyp-* +lan4siz fdb ccityp-ftntyp 4 is Fortran I-code +lan4str fdb ftntyp-* +lan5siz fdb cbltyp-ccityp 5 is C I-code, in .r mods maybe +lan5str fdb ccityp-* +lan6siz fdb obj309-cbltyp 6 is Cobol I-code +lan6str fdb cbltyp-* +lan7siz fdb unklan-obj309 7 is 6309 object (NATIVE mode) +lan7str fdb obj309-* +lan8siz fdb unklsz-unklan 8 undefined +lan8str fdb unklan-* +lan9siz fdb unklsz-unklan 9 undefined +lan9str fdb unklan-* +lanAsiz fdb unklsz-unklan 10 undefined +lanAstr fdb unklan-* +lanBsiz fdb unklsz-unklan 11 undefined +lanBstr fdb unklan-* +lanCsiz fdb unklsz-unklan 12 undefined +lanCstr fdb unklan-* +lanDsiz fdb unklsz-unklan 13 undefined +lanDstr fdb unklan-* +lanEsiz fdb unklsz-unklan 14 undefined +lanEstr fdb unklan-* +lanFsiz fdb unklsz-unklan 15 undefined +lanFstr fdb unklan-* + +*********** The language defines ********* +lanstrs equ * +sysdat fcc /, Data/ +std809 fcc /, 6809 object/ +b09typ fcc /, Basic09 I-code/ +pastyp fcc /, Pascal P-code/ +ftntyp fcc /, Fortran I-code/ +ccityp fcc /, C I-code/ +cbltyp fcc /, Cobol I-code/ +obj309 fcc /, 6309 object/ +unklan fcc /, Unknown language/ +unklsz equ * + +********** The attr defines ************ +rent1 fcc /, Re-enterable/ +rdonly fcc ', R/O' +rwattr fcc ', R/W' +ntv309 fcc /, NATIVE MODE!/ +ntvend equ * + +******* Beginning of some subroutines ******* +* SKEQDLR - skip the = and $ +* or detect a cmndline error +skeqdlr lda ,x+ + decb + cmpa #'= + lbne help + lda ,x+ + decb + cmpa #'$ + lbne help + lda ,x+ get next char as value to use + decb + rts and return to sender + +*********************************** +* A switchable showit routine +showit pshs a,cc + tst <verbose + beq showend + lda #$02 stderr + os9 I$Write +showend puls a,cc + rts + +********************************** +* A switchable newlnfd, exits thru showend +newlnfd pshs a,cc + tst <verbose + beq showend + lda #$02 + os9 I$Writln + bra showend + +****** the display subroutine ****** +* entry - offset into lookup table in B +* entry - address of lookup table in X +tylandis clra just in case + abx 1st string location in x, add only! + ldy ,x++ get size to print + ldd ,x get offset to object itself + pshs x save pointer + addd ,s++ add offset & puls x + tfr d,x back to x + bsr showit + rts thats all for now folks + +********************************* +* dfinemd - a subroutine to display +* the modules header defined data +* first, set the tallies as to what it is +dfinemd leax exectyp,u + clra + ldb #verbose-exectyp +dfinclr sta ,x+ + decb + bne dfinclr + ldb <typelang + andb #$F0 get type define + lsrb b/2 + lsrb b/4 so increment thru list=4 bytes + leax typelook,pcr top of type string list + bsr tylandis + ldb <typelang + andb #$0F + beq dfn1 + inc <exectyp +dfn1 aslb b*2 + aslb b*4 see reason above on b/4 + leax langlook,pcr top of language string list + bsr tylandis +att0 ldb <modatrev + bitb #$80 + beq att1 + leax rent1,pcr + ldy #rdonly-rent1 + bsr showit + ldb <modatrev +att1 bitb #$40 gimix module write protect + bne att2 + leax rdonly,pcr + ldy #rwattr-rdonly + bsr showit + ldb <modatrev + bra att3 +att2 leax rwattr,pcr + ldy #ntv309-rwattr + lbsr showit + ldb <modatrev +att3 bitb #$20 + beq dis0 + leax ntv309,pcr + ldy #ntvend-ntv309 + lbsr showit +dis0 leax newln,pcr + ldy #2 + lbsr newlnfd + tst <exectyp + beq dis2 not executable code! + ldb <typelang testing for DESCR module + cmpb #$F1 a device descriptor? + beq dis3 no, skip the Exec,Data reports + leax execoff,pcr to msg + ldy #datasiz-execoff + lbsr showit 'Exec offset :$' + leax execptr1,u + stx <numptr + ldb #$02 + lbsr printit show num + leax newln,pcr + ldy #2 + lbsr newlnfd +* numptr pointing at data size in module +skdatup leax datasiz,pcr + ldy #vertion-datasiz + lbsr showit 'Data size :$' + ldb #$02 + lbsr printit perm data size + leax newln,pcr + lbsr newlnfd newline it + bra dis3 +dis2 ldb <typelang testing for INIT module + cmpb #$C0 is it system+data=INIT? + bne dis3 no, go + leax execptr1,u get it started at the right place + stx <numptr + leax ftopmem,pcr + ldy #ftopsiz + lbsr showit + ldb #$03 + lbsr printit + leax ptabent,pcr + ldy #ptabsiz + lbsr showit + ldb #$01 + lbsr printit + leax dvtabent,pcr + ldy #dvtabsiz + lbsr showit + ldb #$01 + lbsr printit + leax newln,pcr + lbsr newlnfd +dis3 clr <sizyet + rts + +******************************* +* A routine to make ascii->hex +* ENTRY: valid data in a +* EXIT : hex in a +ascihex cmpa #'0 + lblo help wrong! + cmpa #'9 + bls ascinum +** no numbers get thru here ** + cmpa #'Z + blo asciup + anda #$DF +asciup cmpa #'F + lbhi help + suba #$07 +ascinum suba #'0 ok sub the first $30 +shiftit tst <lftnbbl + beq asciret + lsla + lsla + lsla + lsla if lftnbbl shift it to left nibble +asciret rts should be ok, but Murphy is watching! + +******************************** +* The REAL start of this program! +* ENTRY: a command line full of data +* pointed to by regs.x +entry pshs d,x,y save possible params + leax crcacc,u clear some memory + ldb #datsiz out for us. + clra +clrloop sta ,x+ + decb + bne clrloop + lda #READ. setup for data dir + sta <exdir + sta <verbose to enable it unless shut off + puls d,x,y + decb arguments? + lbeq help no,go + incb back to right count! + +* and fall thru to setup, my command line checker with +* syntax relaxations, can take vfy -x -f filename, +* or vfy -fx (-xf) filename, also -s, -sk, -k alone illegal +* also -v now works to shut it up GH +setup lda ,x+ get a char from cmnd line + decb track cmndline chars left + lbeq help +setret cmpa #$20 a space? + beq setup yup, go get next char + cmpa #'- is "-"? + beq setup1 yup, go do the options + leax -1,x not space or -, rtn ptr + incb to restore count + lbra openit godoit, our other exit from here + +setup1 lda ,x+ + decb + cmpa #$41 is regs.a<#'A alpha char? + bmi setret wasn't, go + anda #$df else make uppercase + +***** Edition 16 addition ***** + cmpa #'V + bne setfix + clr <verbose shut it up + bra setup1 + +setfix cmpa #'F + bne setx nope, go + sta <fixit to nz it + lda #UPDAT.+SHARE. we don't wanna share +setatts ora <exdir if we're fixing it + sta <exdir + bra setup1 +setx cmpa #'X + bne setsepU + lda #EXEC. + bra setatts + +************ setsepU ************ +* added to pick up args for "fixmod" +* like operations +setsepU cmpa #'U + lbne setsepS + lda ,x+ get next char to tell us what to do + decb track data + lbeq help can't be out here + anda #$DF make uppercase + cmpa #'A change attr nibble? + bne setsepR +setSepA lbsr skeqdlr checks errs, returns good char + sta <lftnbbl to nz it so ascihex will shift + sta <fixat to tally new data avail + lbsr ascihex go make it a hexval + sta <updtat + clr <lftnbbl cancel the order + inc <updthead + bra setup + +setsepR cmpa #'R change rev nibble? + bne setsepT nope, maybe its Type + lbsr skeqdlr + sta <fixrv to tally new data avail + lbsr ascihex + sta <updtrv + inc <updthead + bra setup + +setsepT cmpa #'T + bne setsepL maybe its Language nibble? + lbsr skeqdlr + sta <lftnbbl to nz it + sta <fixty to tally new data avail + lbsr ascihex + sta <updtty new Type value in left nibble + clr <lftnbbl shut down the shifter + inc <updthead + lbra setup + +setsepL cmpa #'L is it change lang nibble? + bne setsepD might be data size + lbsr skeqdlr + sta <fixla to tally new data avail + lbsr ascihex + sta <updtla + inc <updthead + lbra setup + +*************** setsepD *************** +* if more than 4 valid hex digits are entered +* on cmnd line, it will keep on looping, +* keeping the last 4 in updtdtsz. You can add +* as little as one byte with this retriever or +* subtract since the addition is modulo $8000, +* use -ud=$FFFE to subtract one byte! +setsepD lbsr skeqdlr see if right syntax used +setdtsz lbsr ascihex returns val in reg.a + pshs b we want this order on the stack + pshs a save the nibble on the stack + ldd <updtdtsz + lslb + rola times 2 now + lslb + rola times 4 now + lslb + rola times 8 now + lslb + rola updtdtsz now *16 + orb ,s+ least sig nibble dummy! + std <updtdtsz + puls b thats why we wanted this order + lda ,x+ + decb tryin to track cmdln data used + lbeq help better be more data here! + cmpa #$20 + lbeq setup oops, out of data but ok + lbmi help real probs, no filename! + inc <updthead + bra setdtsz + +************** setsepS *************** +* sets it up to seperate a merged file, +* the kernal to be specific, but works +* on os9boot files too. +setsepS cmpa #'S + bne SetName this was to help + sta <seperat make nz to enable + lda ,x+ + decb obscure bug fixing + anda #$DF + cmpa #'K + bne setsep1 + lda #$30 a zero + sta <kernal to nz it and furnish number + lbra setup1 +setsep1 leax -1,x + incb bug fixing + lbra setup1 + +****** Edition 16 addition ****** +SetName cmpa #'N + lbne help + lda ,x+ + cmpa #'= + lbne help + pshs y we're gonna diddle it, save it + leay cmpname,u +NameSave lda ,x+ + cmpa #32 + bls EndNmSv must be done, back out + cmpa #'9 + bls noupcase + anda #$DF name uppercase +* ok, lets see what its doing +noupcase sta ,y+ and save it + bra NameSave +EndNmSv clr ,y zero mark end of name + inc <fixname + puls y + bra setsep1 + +**** end of setup, openit start **** +openit decb filename there yet? + lbeq help no, go squawk + lda <fixat + adda <fixrv + adda <fixla + adda <fixty + adda <fixname + adda <updthead + beq openatok + lda #UPDAT.+SHARE. + ora <exdir + sta <exdir +* first, if named, get rid of updthead silliness +openatok tst <fixname did we name a module? + beq openit1 no, skip this + clr <updthead one or the other bud! +openit1 lda <exdir get attributes + os9 I$Open + lbcs help oh-oh, file not avail + sta <inpath + lbsr getsiz get overall size + lbsr seekmod start at 0, old readit lbl +readit lbsr readabyt opens head/tail files too + lda ,x +readit1 cmpa #$87 look for 1st byte + bne readit + sta <modid1 +readit2 lbsr readabyt updates filepos via addseek + lda ,x + cmpa #$CD + bne readit1 + sta <modid2 we found a file! + ldx #$0002 we've got 2 bytes of + stx <modpos a module, record it + dec <kbptr cancel 2 outa non-mod buf + dec <kbptr + beq readit3 no use if zero + tst <kernal are we saving all + beq readit3 + lbsr openkern makes filepath + lbsr clskrnl writes kbptr size buffer and closes up +readit3 clr <kbptr so's it don't accumulate + lda <inpath get rest of header + leax modlen,u + ldy #$000C get dev table entries too + os9 I$read get those 12 bytes + lbsr addsect those 12 bytes to total len + ldd <modlen + subd #$03 + std <lmnscrc + lbsr sethead ->GETNAM->SEEKMOD + leax mdoffset,pcr + ldy #mdoffend-mdoffset + lbsr showit + leax modhstrt,u + stx <numptr + ldb #$04 + lbsr printit + leax mdoffend,pcr + ldy #ftopmem-mdoffend + lbsr showit +initcrc leax crcacc,u + ldb #6 + lda #$FF +psetcrc sta ,x+ + decb + bne psetcrc + lbsr chkhead go check/fix ty/la at/rv, parity, pdatasz + ldy #$0E (was $D)Because parity fixed in mem, + leax modid1,u crc displayed is right IF + os9 F$CRC we do crc of 1st 14 bytes in mem +* after chkhead! It should arrive here with modpos=14 + tst <seperat + beq docrc0 + lbsr openout +docrc0 inc <sizyet +docrc leax buffer,u + ldd <lmnscrc module length-crcbytes + subd <modpos + cmpd #$100 + bhi getmore + tfr d,y + inc <moddone + bra getlast +getmore ldy #$100 get a sectors worth +getlast lda <inpath + os9 I$Read + lbsr addsect doesn't chg x,y + tst <sizyet + beq getcont + pshs d,x,y save count + lbsr dfinemd + puls d,x,y +getcont leax buffer,u the data + pshs x,y save the pointer and quantity + os9 F$Crc U already points at crcacc! + puls x,y restore + lda <outpath + beq doneyet we're not spliting it + os9 I$Write + lbcs help report error and quit +doneyet tst <moddone + beq docrc + pshs y + ldd <crcacc now copy crc to filecrc + coma and make valid + comb + std <filecrc1 in case its bad + ldb <crcac3 ditto + comb + stb <filecrc3 ditto + bcc donyet2 + comb clear any carry +donyet2 tfr x,d + addd ,s++ puls the Y + tfr d,x x now=crc location in buffer + pshs x save it + lda <inpath + ldy #$03 the 3 crc bytes + os9 I$Read + lbsr addsect add to filepos + puls x retrieve crc addr, y still=3 + os9 F$CRC whole modules crc now in crcacc + lbsr chkcrc go check, correct it + lda <outpath + beq dunyet if zero, no path + leax filecrc1,u put good one out + ldy #3 + os9 I$Write + os9 I$Close + clr <outpath +dunyet clr <moddone + lbra readit see if more file + +************************************* +* The EOF is found, close up, go home +cleanup bcc cleanup1 + comb we get here with the carry set +cleanup1 pshs x,u save so's the tail is right + lda <inpath + ldu <flenls16 go back to real end of file + ldx <flenms16 + os9 I$Seek to end of file + puls x,u recover tail pointers + os9 I$Close and close up w/o len change + tst <kernal are we saveing a kernal? + beq cleanup2 if 0, nothing to write! + lbsr openkern go open a path + lbsr clskrnl write and close it + bcc cleanup2 + comb clear error flag +cleanup2 leax howmany,pcr + ldy #execoff-howmany + lbsr showit print the string + leax seekms16,u point at total length + stx numptr of file + ldb #$04 bytes to print + lbsr printit convert to ascii and print + leax newln,pcr hang a newline on it + lbsr newlnfd +alldun clrb + os9 F$Exit all done folks! + +************************************* +* CHKHEAD - checks, fixes header checksum +* entry: header in memory at modid1,u +chkhead leax hednamsg,pcr + ldy #hedckmsg-hednamsg + lbsr showit 'Header for: ' + leax mdlname,u + ldy #$20 maxlength + lbsr newlnfd show the filename with cr + leax hedckmsg,pcr + ldy #ckbadsiz-hedckmsg + lbsr showit Header parity : $ + ldb #$01 only one byte to convert + leax checksum,u pass address of checksum + stx <numptr + lbsr printit the parity byte + +*********************************** +* see if we got anything to fix +* check attr,rev,typ,lang,dsize +* and update the memory image + lda <updthead will be 1 if right module + adda <fixit + beq psetpar nothin to fix + tst <fixat else + beq revchk +atchk lda <modatrev + anda #$0F clear the attrib nibble + ora <updtat add in the attrib nibble + sta <modatrev + clr <fixat +revchk tst <fixrv + beq tychk + lda <modatrev + anda #$F0 leave at nibble alone + ora <updtrv + sta <modatrev + clr <fixrv +tychk tst <fixty + beq langchk + lda <typelang + anda #$0F clear out the type + ora <updtty + sta <typelang + clr <fixty +langchk tst <fixla + beq chkdtsz + lda <typelang + anda #$F0 leave upper nibble alone + ora <updtla + sta <typelang + clr <fixla +chkdtsz ldd <updtdtsz + cmpd #$0000 anything there? + beq psetpar + ldd <pdatasz1 + addd <updtdtsz we're not saveing the carry folks! + std <pdatasz1 + clra + clrb + std <updtdtsz to make it one time only! +psetpar lda #$FF pset parity accumulator + ldb #$08 + leax modid1,u +headchk eora ,x+ and check the checksum + decb + bne headchk + cmpa ,x s/b equal + beq fxittst go see if data needs updt + pshs a,x else save a few things + leax badmsg,pcr show its bad + ldy #badsiz-badmsg + lbsr showit ' (bad)' + puls a,x a had correct parity + sta ,x else fix in memory + stx <numptr point at it + leax shdabeen,pcr + ldy #badmsg-shdabeen + lbsr showit ' S/B $' + ldb #$01 only one byte to convert + lbsr printit numptr already has src +fxittst lda <updthead either will trigger fix + adda <fixit if neither one is on, go + beq okmsg leave it alone + +******************************************* +* enableing the files fix, its now good in memory + pshs u + ldx <modhstrt + ldu <modlstrt + lda <inpath + os9 I$Seek back up to $87CD bytes + puls u + leax modid1,u + ldy #$0D bytes to write + lda <inpath + os9 I$Write insert ty/la at/rv,parity,exec,pdatasz in file + lbcs help + lbsr seekmod to restore the file pointer + leax fixxmsg,pcr + ldy #newln-fixxmsg + lbsr showit ' Repaired to $' + leax checksum,u + stx <numptr + ldb #$01 numptr already set + lbsr printit +okmsg leax gdmsg,pcr + ldy #gdsiz-gdmsg + lbsr newlnfd ' (Good)\n' + lbsr seekmod to reset file ptr +headout leax modlnmsg,pcr + ldy #crcmsg-modlnmsg + lbsr showit 'Module size : $' + leax modlen,u point to size in header + stx <numptr + ldb #$02 + lbsr printit + leax newln,pcr + lbsr newlnfd finish this up + leax vertion,pcr + ldy #tplgatrv-vertion + lbsr showit 'Edition : $' + leax mdlname,u +fndend lda ,x+ + cmpa #$0D + bne fndend + stx <numptr is -> at edition now + ldb #$01 one hex byte only + lbsr printit show it + leax newln,pcr + ldy #hdgdsiz-newln + lbsr newlnfd + leax tplgatrv,pcr + ldy #typelook-tplgatrv + lbsr showit + leax typelang,u + stx <numptr + ldb #$01 + lbsr printit + ldx <linptr + lda #$20 space it out for the + sta ,x+ following atrev byte + sta ,x+ + sta ,x+ 3 spaces + lda #'$ and a $ sign + sta ,x + ldx <linptr + ldy #$04 + lbsr showit show ' $' + ldb #$01 the prev call inc'ed numptr + lbsr printit to the atrv byte! + leax newln,pcr + ldy #$02 + lbsr newlnfd + rts + +************************************* +* CHKCRC of module +* when called, it expects to see the $800FE3 +* (seed polynomial) in the crc accumulator +chkcrc pshs x save ptr to modules crc + leax crcmsg,pcr + ldy #crcmsiz-crcmsg + lbsr showit Modules CRC is: $ + puls x +* Now, x still points at the modules crc bytes! +* so we don't need a seperate number buffer + pshs x we need it later + stx <numptr + ldb #$03 three bytes to display + lbsr printit + puls x + ldd <crcacc now do the check + cmpd #$800F first two bytes + bne badcrc + lda <crcac3 + cmpa #$E3 third + bne badcrc + pshs x save it again +crcdun leax gdmsg,pcr + ldy #gdsiz-gdmsg + lbsr showit + leax newln,pcr extra linefeed + ldy #$02 to seperate reports + lbsr newlnfd + clr <updthead stop this silliness + puls x fergot it once, major crash! + rts + +************************************* +* BADCRC - display results, check for +* fixit orders and fixit if told +badcrc pshs x save that pointer! + leax badmsg,pcr + ldy #badsiz-badmsg + lbsr newlnfd + leax shdabeen,pcr + ldy #badmsg-shdabeen + lbsr showit Write ' S/B $' + leax filecrc1,u show actual crc + stx <numptr + ldb #$03 + lbsr printit + lda <fixit is valid whole file + adda <updthead one module only + beq crcdun wasn't told to fix it + +********* enabling the fix ********** +fixenbl leax seekls16,u we're gonna write + ldd ,x to the file, seek to + subd #$03 crc start again + std ,x + bcc msigok + ldx <seekms16 if borrow, dec hi int + leax -1,x of addrress + stx <seekms16 +msigok lbsr seekmod + leax filecrc1,u + stx <numptr for later printout + ldy #$03 + lda <inpath + os9 I$Write and update the file! + lbcs help + leax fixxmsg,pcr + ldy #newln-fixxmsg + lbsr showit + ldy #$03 + leax seekms16,u + bsr addseek to restore file ptr + ldb #$03 digits to print + lbsr printit numptr already set + clr <updthead to stop it at one module + lbra crcdun go clean up end of crc display + +************************************** +* ADDSECT - add reg.Y to length of module & file +* ENTRY Y bytes to add to present file size +* X location of 4 byte accumulator (seekms16,u) +addsect pshs y first inc modpos + ldd <modpos + addd ,s++ + std <modpos + +* and fall thru to ---- ADDSEEK +* ENTRY Y bytes to add to position in file +* EXIT updated seekms16-seekls16 accumulator +addseek pshs x save present buffer addr + pshs y updt passed file/seek pos + leax seekms16,u + ldd 2,x seekls16 + addd ,s++ + std 2,x + bcc addout + ldd ,x seekms16 works but cumbersome + adcb #$00 methodology + std ,x seekms16 + bcc addout + adca #$00 + std ,x seekms16 +addout puls x + rts + +*************************************************** +* SETHEAD - we've found an $87CD, reset modlstrt and +* modhstrt to offset 0000 of module for name finding +* also potential bugfixing. The previous usage of the +* leau -9,u didn't set a borrow if it occurred. +* This method does. Returning just to call getname +* was extra code, so now it falls thru since all we +* were doing is giving getname an anchor point. +sethead ldd <seekls16 + ldx <seekms16 + subd <modpos + std <modlstrt record starting pos + bcc noborw + leax -1,x +noborw stx <modhstrt so we can recover +* and fall thru to getname +getname ldd <modlstrt our reference location + pshs d this pshs and ,s++ + ldd <modname cancel + addd ,s++ each other + std <seekls16 + bcc nocari + leax 1,x add carry to hi int +nocari stx <seekms16 +getit bsr seekmod + leax mdlname,u +gtbyt lda <inpath + ldy #$01 + os9 I$Read + ldb ,x+ + bpl gtbyt + andb #$7F cancel set msb + stb -1,x + ldb #$0d add a cr + stb ,x+ to stop writln + lda <inpath and get edition byte! + ldy #$01 + os9 I$Read + +***** Edition 16 addition ******************** +* NAMECMP - controls middle of file +* fixit by name function +* Entry: nz in "fixname" +* module name in "cmpname" +* Exit: nz in updthead, zero in fixname if match +* match is toupper of input name and saved name +* till cr matches zero of saved name +* by zeroing fixname, once done, don't waste +* more time by continuing to look at following mods +namecmp tst <fixname if a name, it won't be zero + beq noname don't have a name to look for + pshs y save it + leay cmpname,u + leax mdlname,u +namecmp1 lda ,x+ get modules name + cmpa #$0D till the cr we stashed + beq chkmatch + cmpa #'9 this might not be the right cmp! + bls nocaseup + anda #$DF make upcase +nocaseup cmpa ,y+ against upcased saved name + bne nomatch ifne, no match found here + bra namecmp1 +chkmatch tst ,y ifeq, was end of saved name! + bne nomatch + inc <updthead + clr <fixname zero the snooper flag +nomatch puls y + +* continue on with the previous code +noname ldx <modhstrt now restore file ptr + ldd <modlstrt to byte after parity + pshs d in header + ldd <modpos + addd ,s++ + std <seekls16 + bcc ncri + leax 1,x +ncri stx <seekms16 +* and fall through to SEEKMOD + +************************************** +* SEEKMOD - positions file r/w pointer +* Entry = valid pathnum in inpath +* presumes valid size in seekls16,seekms16 +seekmod lda <inpath + pshs u + ldx <seekms16 + ldu <seekls16 + os9 I$Seek + puls u + bcs oops + rts + +************************************** +* READABYT get one byte from the file +readabyt lda <inpath + ldy #1 + leax buffer,u + os9 I$Read + bcs oops + pshs x + leax seekms16,u + lbsr addseek add y to file position +readout puls x but not to modpos just yet! + tst <kernal saving it all? + beq readrts no, go + pshs b,x else save in 64 byte buffer + leax krnlbuf,u + ldb <kbptr + leax b,x + lda buffer,u + sta ,x + incb + stb <kbptr + cmpb #buffer-krnlbuf + lbeq helpnbf + puls b,x and restore +readrts rts + +oops cmpb #E$EOF + lbeq cleanup + lbra help + +*************************************************** +* GETSIZ - function to get overall size of the file +* ENTRY valid pathum in 'inpath' +getsiz pshs u + lda <inpath + ldb #SS.Size + os9 I$Getstt + bcs help + stx <flenms16 + stu <flenls16 + leax flenmsg,pcr + ldy #howmany-flenmsg + lbsr showit +skppr20 puls u it needs U restored + leax flenms16,u so this works + stx <numptr + ldb #$04 + bsr printit + leax newln,pcr + ldy #$02 + lbsr newlnfd + lbsr newlnfd + rts + +************************************ +* PRINTIT - a front end for hextoasc +* ENTRY: address of src data in numptr +* regs.B=number of bytes to convert +printit pshs d,x,y + leax linbuff,u + pshs x + stx <linptr + tfr b,a save # to print + lsla dbl it + pshs a + clr ,-s so we can puls y later + bsr hextoasc + puls y get y back + puls x and linebuff-> + lbsr showit display the number + puls d,x,y + rts + +********************************************* +* HEXTOASC - routine to print hex numbers +* ENTRY regs.b:#of chars to print, +* variable location numptr set to src of data +* variable location linptr someplace in linbuff +hextoasc ldx <numptr defined in host routine + lda ,x+ + stx <numptr save new ptr to next byte + pshs b save your counter + bsr hxbtoasc + ldx <linptr also defined in host routine + std ,x++ + stx <linptr save new pos in output buffer + puls b + decb + bne hextoasc till hex num all converted! + rts and go print it + +************************************************************* +* routine written up in the Rainbow (11/92) by Tim Kientzle. +* It will convert the value passed in the A register to a +* pair of ascii characters in A:B which are the directly +* printable ASCII representations of the original contents +* of A. Load A with byte of src num, call, store A nd B in +* order in the print buffer on return. Neat routine Tim! +* I shrank it by 4 lines & 6 bytes though (GH). +hxbtoasc tfr a,b Make copy of a + anda #$0F mask off lower digit + bsr nbltoasc + exg a,b stash in b, get a back + lsra getting high nibble + lsra into position to + lsra convert it + lsra +nbltoasc adda #$90 repeat for high nibble + daa generate carry if a>9 + adca #$40 + daa + rts returns a:b=two hexidecimal characters + +wphlp comb + ldb #$D6 no permission to write to it + bra help +helpnbf comb + ldb #$BF E$BufferToDamnSmall! + +*********************************** +* HELP an error exit with prompting +* Entry error in B,carry set +help pshs b,cc save stats for exit + inc <verbose make sure the msg gets out + leax helpmsg,pcr + ldy #msgsiz-helpmsg + lbsr showit + puls b,cc recover error +out os9 F$Exit and report the error + +************************************* +* OPENOUT - opens path for std module +* +openout lda #READ.+WRITE. + ldb #READ.+WRITE. + leax mdlname,u point at name + os9 I$Create and attempt to make it + bcc outhead made it ok, go + cmpb #218 oops, what error + bne help nope, not already exist, go + lda #READ.+WRITE. + leax mdlname,u + os9 I$Open + bcs help +outhead sta <outpath save pathnum + leax modid1,u + ldy #14 write (repaired) module header w/exec & datsiz + os9 I$Write + bcs help + rts thats all for now, folks + +***************************************** +* OPENKERN - to open extra bytes files +* pretty much self-contained +openkern pshs cc,a,x + lda <kernal + beq kerrts + cmpa #$30 head or tail? + bne opentail + leax advise0,pcr + ldy #krnlhsz-advise0-1 + lbsr showit + ldb <kbptr + bls kerrts if zero or less, go + leax kernal0,pcr +kopen lda #UPDAT. + ldb #UPDAT. + os9 I$Create + bcc kcont + cmpb #218 if exists, its ok + bne help else go yelp + bcc kopen1 + comb to clear that damned error +kopen1 ldb #UPDAT. + os9 I$Open + bcs help +kcont sta <kpath +krts inc <kernal we been here, tally it +kerrts puls cc,a,x + rts + +opentail bcc opntail + comb carry set? +opntail cmpa #$31 skip boot, os9p1 + bne krts + leax advise1,pcr + ldy #krnltsz-advise1-1 + lbsr showit + leax kernal1,pcr + bra kopen + +*********************************** +* CLSKRNL - write & close extras +* valid size in kbptrms*256+kbptr +clskrnl pshs d,x,y + tst <kernal + beq clsoops shouldn't 'av come here + lda <kpath + ldy <kbptrms size to write + leax krnlbuf,u saved data + os9 I$Write + lbcs help + lda <kpath + ldb #$05 get file pos + pshs x,u + os9 I$GetStt + lbcs help + ldb #$02 set as new size + os9 I$SetStt + lbcs help + stu <kbptrms + puls x,u + os9 I$Close + lbcs help + leax kbptrms,u point at filesize data + stx <numptr save the filesize + leax advlen,pcr now point at "with a size of $" + ldy #advend-advlen get length to write + lbsr showit + ldb #$02 + lbsr printit + leax advend,pcr + ldy #hednamsg-advend + lbsr showit + leax newln,pcr + ldy #2 + lbsr newlnfd + clr <kpath kill pathnum + clr <kbptr reset + clr <kbptrms +clsoops puls d,x,y + rts + emod +len equ * + end +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/utils/gene/vfy.doc Sat Apr 05 01:01:32 2014 +0200 @@ -0,0 +1,168 @@ + VFY Edition 16 docs + +This utility is intended to be used as a replacement for the awkward to use +os9 utility "verify", but with the ability to do repairs and modifications to +the target file. These repairs/modifications are done 'insitu' to the named +file. It can also do the "split" operation on the named file, generating a +whole directory full of the individual modules of your merged files such as +"os9boot" or your boot time loaded "util" files. + + CAVEAT #1 + +Because it works on the named file, not a copy, be warned that this program +can also do a lot of damage if miss-used. If unsure of yourself in any way, +make a backup copy of the file and work on it. Or if its your bootdisk, back +it up first! Even though I wrote this, I do exactly that! I do test +everything in this before I upload it for public usage, and I have not had +it break for anything in the "released" version since Edition 12 or before. +Thats not to say it hasn't miss-behaved here, but the uploaded version is +solid, it will do exactly as you ask it to do! + +Oh Well, edition 15 lasted a week. Nothing wrong with it (that I know of), +but there were a couple more bells and whistles that were just begging to be +added. I had written it originally to have total control over its +verbosity, but had never actually added the command line option to control +it. Now it has it. A "-v" in the option area will shut all reporting off, +nary a squeek unless an error is returned which will make it spit out the +help screen on its way to the exit and the system which will report it as +usual. Edition is now 16, and the ty/rv byte is back to $81. As before, all +screen output is thru the stderr path, so redirect it ">>" if you want a +record file to be made. + +Edition 16's big change is that it now implements the ability to fix any one +"named on the command line" module in the whole file. If a name is given on +the command line, then each modules name is compared to the command line +name, case insensitive, and when the match is found, the options updates are +done to this named module only. It then reverts to a report only mode for +the rest of the file. As in earlier versions, if no name is given, the +first module only is fixed if one of the ty/la, at/rv or datasize is given +update/change status. + +Edition 15 fixed a long standing error in how the INIT module data was +displayed, and now skips the Exec and Data displays for device descriptors. + +For a quick syntax message, just type "vfy" with no options. + +To recap, if a -u(a,t,r,l,d)=$xx type entry is given on the cmnd line, the +first (or the named one if -n=name is used) module encountered in "file" +will be modified accordingly. Someone did squawk about the $ sign, but I +still left that requirement in because it reminds the user this IS hex data +it wants, not decimal or some other number base. + +The (-ua=$hexdata etc) header repairs will only be re-written if a change +has taken place, and only for the first (named module if -n=name used now) +module found in a file if the -f isn't in effect. The first (or named) ones +crc will also be updated. Modules further into the file will not be fixed +if the -f option isn't used unless the -n=name option is used. + +If the -f option is used, all of the modules in "file" will be repaired. +Only the first will be subjected to the header (-ua=$hexchar etc) fixes in +that event, the rest being only updated if there is in fact an error found. +I don't recommend including the -u stuffs without nameing the module they +are to be applied to as a matter of habitual usage. It might save a headache +someday! + +It will still print the S/B $xx (Good) message and the "Repaired to $xx" +message if -f, even if no actual changes were made. It will beep if any +changes were in fact made to the module currently being scanned. + +The -ud=$hexdata needs further clarification. The addition is modulo 65536, +a fancy way of saying it throws away the carry if the result of your +addition is >65536. In other words, to reduce the datasize in the module by +$100 bytes, add $FF00, not -$0100. It only keeps the last 4 digits you give +it on the command line too. Less than 4 default to $000yourdigit etc. + +Also in need of clarification are the -s and -sk options. + +The -s option causes it to split the target file (without inflicting any +damages other than the -u or -f might do to each module first) into +individual modules in the current working directory, a great way to take +your os9boot file apart. If a -u was used, the modified version is split to +disk file. + +If the -sk option is used, vfy ASSUMES you are naming a kernal track of a +bootable disk as the target file to read. This "filename" is best generated +by running my "krnl_to_dir" utility on the bootable diskette (which is not +write protected of course) which will look for an unused sector on the disk, +allocate it, enter the required file descriptor information describing the +kernel track (it assumes track 34 is the kernel) and make a directory entry +in the root directory of that disk, effectively converting the hidden kernel +track that only dcheck can find and report as 18 errors, into a normally +accessable file. That "krnl_to_dir" is in another archive I uploaded called +"krnlutils" in the delphi os9 database and on chestnut. + +Once that is done, then vfy's -sk option will split it up into its 5 component +files. + + Caveat #2 + +Please note however that this "krnl_to_dir" generated file is not one that +can be copied from one disk to another (and be expected to work) with *any* +known utility other than my own "krnlmvr" which requires the write target +disk to have the directory entry krnlmvr uses already installed by +krnl_to_dir. The 5 files it makes CAN be freely copied, merged, cpa'd, etc +to make up the replacement KERNAL to copy back with "krnlmvr". I'm not +saying there isn't another copier that overwrites, only that I haven't found +it after diligent searching. + +For more info, see the archive "krnlutils" by myself. I could not find a +copy util in the whole os9 world that actually would over-write the targeted +file insitu. So I wrote krnlmvr. Why? Because it was one heck of a lot +easier to use than the utils furnished to install kernel track patches for +the earlier releases of Nitros9. Its worked so well that I've not used the +Nitros9 furnished method since! + + Caveat #3 + +Don't *ever* delete that now visible 'KERNAL' file on your bootable diskette +if you want it to stay bootable after something else has been written to +this diskette! If you want to hide it again once you are done making mods, +use dEd to clear the name in the directory itself. I think the B&B "zap" +utility might also be safe to use but I haven't tried it. To totally +restore the disk so it doesn't show in the directory, find that allocated +for the FD sector using ded to look at the address in the last 3 bytes of +the directory entry and "bd" it. Or figure out which bit to clear in the +FAT. + + COPY RIGHTS and DISK CLAIMERS + +As usual, this is Copyright (c) 1993, 1994 and 1995 by Maurice E.(Gene) +Heskett. It may be freely copied and used provided no intended profit is +realized other than the cost of the media. As one of its functions (-sk) has +been a great help to me in upgrading the kernal track for the later versions +of the os9/6309 opsys commonly called "NITROS9", permission for it to be +included as part of that distribution is hereby given to Colin McKay and +Alan Dekok, a.k.a. Northern Xposure. The cost of that software may not be +adjusted upward just because this program is included unless that puts it +over into another diskette to contain the complete package. It may also be +included in the patch collections available for os9 under the same +limitations. The ONLY limitation being that this archive's contents must be +included without modification in such distributions so that this .doc file, +however verbose, remains intact to the end users site. + +I also make no claims about its suitability for the job. If your coffee +maker only makes bad bourbon after using this, I am not responsible, however +I would like an email message describing the exact circumstances under which +that error occured. Maybe I can fine tune it to make good bourbon! I seem to +be better at that than most. (Grin) + +Cheers all, WDTV5@delphi.com + + +An os9 utility for verifying module files +Copyright (C) 2014 Gene Heskett + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +