Upgrading Mterm

80 Column Output

I have been using Mterm II and the 2050 modem to communicate with my factory in Florida. It was necessary for me to be able to send Tasword files, reports, etc., and also to have full size hard copy of the screen or buffer. It then became a challenge to make the program work with my Gemini 10X, especially since I do not have a 2040 printer.

By disassembling the program, I located the print routines for the 2040 and patched them to drive the 10X and an Aerco/Oliger printer port. The code is located from E4FAh to E5D1h, which is 216 bytes including a RET for a 2040 routine to make a 32 character blank line.

The end of the listing contains the control codes for the 10X, but you can install your own printer’s codes there. This will give your output Tasword graphic control codes and print as such.

The beginning of the patch initializes the printer to center the text depending on the line width that you set in the terminal for video width. If there is no carriage return (such as, in Tasword files) this value will automatically send a <CR> for the correct line width.

Some printers require a line feed <LF> after a <CR>. The 10X does not, but you can poke a <LF> with a POKE 58777,10 (E599h,0Ah). Received Tasword graphic codes (80h to 8Fh) are pointed to the table located at the end of the listing (E5A2h to E5D1h) to get the three byte translation, which is then sent to the printer. If your printer requires only one code, and you wish to change the given values, then preceed that code with two “nulls” or zeroes.

This routine won’t give an Llist print-out of a Basic program, because there was not enough room to clear all of the keyword tokens.

The screen dump routine is loaded to 5F00h. Before calling the dump routine, the routine at E570h checks (Oliger port) to see if the printer is turned on. Any BREAK will hang the terminal program. You must restore the AF register with a POP AF and RET to get back into the program.

Finally, there are three POKEs into Mterm in order to start and enable the printer routine, and these are given in line 115 of the Basic listing. This bootstrap loader is available from me for $6.95 if you have any trouble. These are also epromable as an Aros program as well. Lots of Luck!

LISTING FOR MTERM II PRINTER CHANGES FOR GEMINI 10X
by Tom Kalogerson

*** CHANGE ***
D8D1 FROM: CALL Z,DE71 TO: JP Z,E4FA
55505 CCh 204d CAh 202d
55506 71h 113d FAh 250d
55507 DEh 222d E4h 228d

Buffer Print-out Routine Starts Here - - at 58618d
E4FA 3E1B LD A,1B ;Set prnt code 27d
E4FC CD2BE5 CALL PRTA ;Send to printer
E4FF 3E4D LD A,4D ;Set prnt code 77d
E501 CD2BE5 CALL PRTA ;Send to printer
E504 ED5B05F1 LD DE,(F105);Get "video width"
E508 3E50 LD A,50 ;Ld A with 80d columns
E50A 93 SUB E ;Subtract video width
E50B 1F RRA ;Divide by 2 for tab
E50C CD2BE5 CALL PRTA ;Send to printer
E50F 010000 STRT LD BC,0000 ;Line lgth counter=0
E512 2AECEE LD HL,(EEEC);Get end of buffer
E515 ED5BE8EE LD DE,(EEE8);Get start of buffer
E519 ED52 SBC HL,DE ;Lgth of buffer
E51B EB EX DE,HL ;HL=Buf strt,DE=length
E51C 7E LD A,(HL) ;Get first buffer char
E51D FE00 CP 00 ;Is buffer basic type?
E51F 2025 JR NZ,LP-3 ;If not, continue
E521 C5 SKIP PUSH BC ;Save line lgth cntr
E522 0605 LD B,05 ;Set counter to 5
E524 23 INC HL ;Skip next token
E525 1B DEC DE ;Dec prog count
E526 10FC DJNZ,E524 ;Do it 5 times
E528 C1 POP BC ;Restore counter
E529 1816 JR LP-2 ;Now continue
E52B F5 PRTA PUSH AF ;Save code to send
E52C CD0920 BRK? CALL brek ;Test break key
E52F 3805 JR C,E536 ;Continue if no break
E531 F1 POP AF ;Restore register and
E532 110100 LD DE,0001 ;Set buf count to one
E535 C9 RET ;Return to term prog
E536 DB7F IN A,(7F) ;Get printer status
E538 CB67 BIT 4,A ;Ready?
E53A 20F0 JR NZ,E52C ;Loop until ready
E53C F1 POP AF ;Restore code to send
E53D D37F OUT (7F),A ;Send it to printer
E53F C9 RET ;Return to caller
E540 23 LP-1 INC HL ;Next character
E541 7E LP-2 LD A,(HL) ;Put character in A
E542 FE00 CP 00 ;Check for type prog
E544 28DB JR Z,SKIP ;If basic skip next 5
E546 FE80 LP-3 CP 80 ;Is it a graphics char
E548 381C JR C,SNDA ;If not, print it
E54A E5 PUSH HL ;Save buf register
E54B C5 PUSH BC ;Save line lgth cntr
E54C 2111E5 LD HL E511 ;Begin table set-up
E54F 4F LD C,A ;Put graphics cd in C
E550 85 ADD A,L ;Add L to A
E551 17 RLA ;Times two
E552 81 ADD A,C ;Plus graphics code
E553 6F LD L,A ;HL now points to tble
E554 0603 LD B,03 ;Counter to 3
E556 7E LD A,(HL) ;Get contr code number
E557 CD2BE5 CALL PRTA ;Send to printer
E55A 23 INC HL ;Next control code
E55B 10F9 DJNZ,E556 ;Loop three times
E55D 1801 JR E560 ;Jump over RET
E55F C9 RET ;USED ONLY FOR MTERM
E560 C1 POP BC ;Restore counter
E561 E1 POP HL ;Restore buf register
E562 04 INC B ;Inc line lgth counter
E563 1B DEC DE ;Dec buffer counter
E564 18DA JR LP-1 ;Go get next character
E566 CD2BE5 SNDA CALL PRTA ;Print it
E569 04 INC B ;Inc line lgth counter
E56A 1B DEC DE ;Dec buffer counter
E56B F5 PUSH AF ;Save character
E56C 7A LD A,D ;Buffer count D into A
E56D B3 OR E ;Or E
E56E 1809 JR E579 ;Jp over "screen dump"
Screen Print-out Routine Starts Here - - at 58736d
E570 DB7F IN A,(7F) ;Check printer,
E572 FEEF CP EF ;Is it turned on?
E574 C0 RET NZ ;If not, ret to MTERM
E575 CD005F CALL 5F00 ;Call "screen dump"
E578 C9 RET ;Done, ret to MTERM
End of Screen Print-out
E579 200C JR NZ,E587 ;Cont if counter not 0
E57B F1 POP AF ;Restore stack
E57C 3E1B LD A,1B ;Set printer code 27d
E57E CD2BE5 CALL PRTA ;Send to printer
E581 3E40 LD A,40 ;Prtr reset code 64d
E583 CD2BE5 CALL PRTA ;Send to printer
E586 C9 RET ;Done, return to MTERM
E587 F1 POP AF ;Restore character
E588 FE0D CP 0D ;Was it a CR?
E58A 280C JR Z,E598 ;If not,
E58C 3A05F1 LD A,(F105) ;Check video width,
E58F 3D DEC A ;Less one,
E590 B8 CP B ;With line lgth count
E591 30AD JR NC,LP-1 ;Next char, not at EOL
E593 3E0D LD A,0D ;Load A with CR
E595 CD2BE5 CALL PRTA ;Send to printer
E598 3E00 LD A,00 ;Null (00) or LF (0A)
E59A CD2BE5 CALL PRTA ;Send to printer
E59D 0600 LD B,00 ;Reset line lgth ctr
E59F 189F JR LP-1 ;Go get next character
E5A1 00 NOP

Control Code Translation Table
Three bytes/graphic code

REGISTER HEX DEC GRAPHIC CODE PRINTER FUNCTION
E5A2 58786 00 00
E5A3 58787 00 00 80h 128d on - Form feed
E5A4 58788 0C 12

E5A5 58789 00 00
E5A6 58790 00 00 81h 129d off - Enlarged
E5A7 58791 14 20

E5A8 58792 00 00
E5A9 58793 00 00 82h 130d off - Compressed
E5AA 58794 12 18

E5AB 58795 1B 27
E5AC 58796 2D 45 83h 131d off - Underline
E5AD 58797 00 00

E5AE 58798 00 00
E5AF 58799 1B 27 84h 132d off - Italics
E5B0 58800 35 53

E5B1 58801 00 00
E5B2 58802 1B 27 85h 133d off - Emphisised
E5B3 58803 46 70

E5B4 58804 00 00
E5B5 58805 1B 27 86h 134d off - DoubleStrike
E5B6 58806 48 72

E5B7 58807 1B 27
E5B8 58808 42 66 87h 135d off - Elite
E5B9 58809 01 01

E5BA 58810 1B 27
E5BB 58811 42 66 88h 136d on - Elite
E5BC 58812 02 02

E5BD 58813 00 00
E5BE 58814 1B 27 89h 137d on - DoubleStrike
E5BF 58815 47 71

E5C0 58816 00 00
E5C1 58817 1B 27 8Ah 138d on - Emphisised
E5C2 58818 45 69

E5C3 58819 00 00
E5C4 58820 1B 27 8Bh 139d on - Italics
E5C5 58821 34 52

E5C6 58822 1B 27
E5C7 58823 2D 45 8Ch 140d on - Underline
E5C8 58824 01 01

E5C9 58825 00 00
E5CA 58826 00 00 8Dh 141d on - Compressed
E5CB 58827 0F 15

E5CC 58828 00 00
E5CD 58829 00 00 8Eh 142 on - Enlarged
E5CE 58830 0E 14

E5CF 58831 00 00
E5D0 58832 00 00 8Fh 143 on - Form Feed
E5D1 58833 0C 12
   5 BORDER 0: INK 5: PAPER 0: CLS
7 PRINT " MTERM II Bootstrap Loader"
8 PRINT " by Tom Kalogerson"
10 PRINT AT 6,0;"This program will load MTERM II with correct code for Gemini 10Xprinter. This includes the Gemini screen dump at 24320."
15 PRINT AT 13,0;"For printers with different control codes, see instructions.This program should be loaded first."
20 PRINT AT 20,0;"Press <ENTER> to load."
80 PAUSE 4e4: CLS : FLASH 1: PRINT INK 2;AT 10,11;"LOADING"
115 POKE 55505,202: POKE 55506,250: POKE 55507,228
120 RESTORE 210: FOR b=24320 TO 24460: READ x: POKE b,x: NEXT b
125 RESTORE 220: FOR b=58618 TO 58834: READ x: POKE b,x: NEXT b
135 FLASH 0: CLS
137 PRINT AT 5,0;"MTERM is now loaded with new code."
140 PAUSE 4e4
145 BORDER 7: INK 0: PAPER 7: CLS
210 DATA 205,083,095,001,000,175,038,026,104,069,022,007,229,245,197,062,175,144,063,048,010,205,009,038,071,004,126,007,016,253,031,203,020,193,241,203,028,225,023,005,021,032,225,230,127,205,065,095,012,032,214,062,010,205,065,095,037,040,070,205,108,095,024,200,000,245,205,009,032,056,002,241,201,219,127,203,103,032,243,241,211,127,201,062,027,205,065,095,062,077,205,065,095,062,020,205,065,095,062,027,205,065,095,062,049,205,065,095,062,027,205,065,095,062,075,205,065,095,062,000,205,065,095,062,001,205,065,095,201,062,027,205,065,095,062,064,205,065,095,201
220 DATA 062,027,205,043,229,062,077,205,043,229,237,091,005,241,062,080,147,031,205,043,229,001,000,000,042,236,238,237,091,232,238,237,082,235,126,254,000,032,037,197,006,005,035,027,016,252,193,024,022,245,205,009,032,056,005,241,017,001,000,201,219,127,203,103,032,240,241,211,127,201,035,126,254,000,040,219,254,128,056,028,229,197,033,017,229,079,133,023,129,111,006,003,126,205,043,229,035,016,249,024,001,201,193,225,004,027,024,218
230 DATA 205,043,229,004,027,245,122,179,024,009,219,127,254,239,192,205,000,095,201,032,012,241,062,027,205,043,229,062,064,205,043,229,201,241,254,013,040,012,058,005,241,061,184,048,173,062,013,205,043,229,062,000,205,043,229,006,000,024,159,000,000,000,012,000,000,020,000,000,018,027,045,000,000,027,053,000,027,070,000,027,072,027,066,001,027,066,002,000,027,071,000,027,069,000,027,052,027,045,001,000,000,015,000,000,014,000,000,012
7999 STOP

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.