.Title TSMUNG - Mung TSX for additional mapped devices. .Nlist bex,toc .Enabl lc .Sbttl V1a 23-Sep-86 ; Make /U for DU so can do DY alone if desired .Sbttl V1 18-May-86 .if eq 1 This horrible programme is made necessary by the fact that TSX version 6 refuses to allow the DU and DY handlers to be mapped. This would be reasonable as the DEC handlers must not be mapped, but makes it impossible for those of us who would weave our own. It would be appreciated if S & H would be so kind as to include an "override" bit in their device tables, allowing default options to be ignored - albeit at the user's peril. This programme allows the DU and DY handlers to be mapped if desired. This allows the use of handlers for these devices by the same author, allowing more low memory! To map DU, add /U to the filename. To map DY, add /Y to the filename. No switches at all imply /U. .endc .psect tsmung .psect data .psect mesage con vermes: .asciz /Tsmung V1a 23-Sep-86/ .psect data limit: .limit ;Job low & high limits hlimit: 0 ;High limit during working hours buffer: 0 ;Pointer to input buffer bufbli: 0 ;Initial buffer size, in blocks bufblk: 0 ;Buffer size, in blocks bufwrd: 0 ;ibid, in words block: 0 ;Starting block in present buffer line: .blkb 100. ;General purpose input line. area: .blkw 7 ;EMT area stack: 0 ;Initial stack value defext: .rad50 /sav / string: .rad50 /du dw dx dy dz / ;Search string (null terminated) okdu: 0 ;Non-zero to map DU okdy: 0 ;Non-zero if he wants DY mapped also. .Sbttl Macros .macro type arg ;Type a string .save .psect mesage con $$$=. .ascii arg .restore mov r0,-(sp) mov #$$$,r0 emt ^o351 mov (sp)+,r0 .endm type .macro tx arg ;Extend TYPE string .save .psect mesage con $$$=. .ascii arg .restore .endm tx .macro movs string,loc ;Obtain a string address .save .psect mesage con $$$=. .ascii string .restore mov #$$$,loc .endm movs .macro ref string ;Place an address of a string .save .psect mesage con $$$=. .ascii string .restore .word $$$ .endm ref .macro gtlin prompt,buffer ;Use .gtlin effectively .save .psect mesage con $$$=. .ascii prompt .restore .gtlin buffer,#$$$ .endm gtlin .Sbttl Various Parameters jsw=44 uswap$=100000 ttlc$=40000 rstrt$=20000 ttspc$=10000 chnif$=4000 virt$=2000 ovly$=1000 chain$=400 hlter$=200 tcbit$=100 spxit$=40 edit$=20 gtlin$=10 errbyt=52 userrb=53 succs$=1 warn$=2 error$=4 sever$=10 ufatal$=20 con.c=3 bel=7 bs=10 tab=11 lf=12 vt=13 ff=14 cr=15 esc=33 rub=177 .mcall .sreset,.csigen,.rctrlo,.print,.ttyou,.ttyin,.exit,.gtlin,.settop .mcall .readw,.writw,.wait,.close .Sbttl Programme .psect tsmung .Enabl lsb Badrun:: bisb #error$,@#userrb br rerun Start:: mov sp,stack Rerun:: mov stack,sp .sreset .rctrlo .csigen limit+2,#defext,,#line mov r0,hlimit tstb line bne 10$ .print #vermes br rerun 10$: clr okdu ;Don't assume he wants DU mapped. clr okdy ;Assume leave DY alone unless instructed mov (sp)+,r5 ;# of switches bne nexswt ;If no switches specified, inc okdu ; assume he wants DU mapped. nexswt: dec r5 bmi endswt clr r2 ;For value (none used at present) mov (sp)+,r1 ;Switch + flags bpl 20$ mov (sp)+,r2 20$: bisb #40,r1 ;Make lower case cmpb r1,#'h bne 30$ .print #vermes .print #hmes br rerun 30$: cmpb r1,#'u ;/U = allow DU to be mapped bne 40$ inc okdu br nexswt 40$: cmpb r1,#'y ;/Y = allow DY to be mapped also. bne illswt inc okdy br nexswt illswt: type <%?Tsmung-E-Illegal Switch /%<200>> .ttyou r1 type <%Type /H for help.%<0>> br badrun endswt: .wait #3 ;Need an input file. bcc 50$ type > br badrun 50$: .settop #-2 ;Get big buffer. sub hlimit,r0 ;Number of bytes bic #377,r0 swab r0 ;Number of blocks. cmp r0,#63. blos 60$ mov #63.,r0 ;Restrict to 63 blocks so don't get read 60$: mov r0,bufblk ; transmuted into write. mov r0,bufbli ;Keep initial size. swab r0 ;Now in words. mov r0,bufwrd clr block ;Start at block zero .Dsabl lsb .Enabl lsb read: .readw #area,#3,hlimit,bufwrd,block bcc 10$ tstb @#errbyt beq endin ;End of input file. type > jmp badrun 10$: mov r0,bufwrd ;If differs, at last bit of file add #377,r0 bic #377,r0 swab r0 mov r0,bufblk ;Keep track of number of blocks also. mov bufwrd,r5 ;Number of words to search mov hlimit,r4 ;Start of buffer 20$: mov #string,r3 ;String of device names cmp (r4),(r3) ;See if first match. bne 40$ ;No. mov r5,r1 ;Keep track of words available for comparison. mov r4,r2 ;Point in buffer where we are up to. tst (r3)+ ;Next device in string 30$: add #4,r2 ;Next device name to test tst (r3) ;Next in search string beq match ;If hit null, found it. sub #2,r1 ;Two words at a time, as skip details. ble nexbuf ;Whoops - end of this buffer cmp (r3)+,(r2) beq 30$ ;Continuing match. 40$: dec r5 ;Another word checked & found wanting. beq nexbuf tst (r4)+ ;Try the next. br 20$ .Dsabl lsb Nexbuf: cmp bufblk,bufbli ;Truncated read means end of file. bne endin add bufblk,block ;Move on to next block, but dec block ; allow for overlap across one block boundary. br read Endin: type > jmp badrun .Enabl lsb Match: ;On a match, 2(r4) points to the DU defaults tst okdu ; and +16 to the DY defaults word. beq 10$ mov #501, 2(r4) 10$: tst okdy beq 20$ mov #501,16(r4) ;Only mung DY if requested. 20$: mov #1,r1 ;Number of blocks to write. sub hlimit,r4 ;Byte offset from start of buffer to data clc ;Convert to ror r4 ; word offset. cmpb r4,#<756/2> ;See if spread over two blocks blos 30$ inc r1 30$: bic #377,r4 mov r4,r3 swab r4 ;Block offset in which data starts add block,r4 asl r3 ;Calculate address of start of block add hlimit,r3 swab r1 ;Number of words to write .writw #area,#3,r3,r1,r4 bcc 40$ type > jmp badrun 40$: .close #3 type > jmp rerun .Dsabl lsb .Sbttl Help Message .psect mesage Hmes:: .ascii .ascii %Tsmung is designed to mung a copy of TSX.SAV to allow% .ascii %the DU handler and/or the DY handler to be mapped.% .ascii %This requires special handlers - THE S & H OR DEC ONES% .ascii %WILL NOT WORK AND ARE LIKELY TO CRASH THE SYSTEM!% .ascii %Specify the name of the TSX.SAV file you wish modified.% .ascii %To map the DU handler, append a /U to the filename% .ascii %To map the DY handler, append a /Y to the filename% .ascii %[No switches implies /U]% .ascii %This programme was written for TSX version 6.01%<0> .end start