COMMENT|
..							---------!-------!-------!-------------!-------------------R
..------------------------------------------------------------!---!------------------------------------------------------------------!
.mt0
.mb2
.pl80
.fo SMX.ASM page # of 1 231114 FEB 85
.po0
0
This program accepts a parameter or asks for one with a
menu, converts it with a translation table to a series of
printer codes, and sends those codes to the printer.  The
printer beeps to acknowledge receipt.
END COMMENT |

PUBLIC   BEGIN,GO,GETPARM,GOTPARM,PRINTIT

CODE     SEGMENT PARA PUBLIC 'CODE'
         ASSUME CS:CODE,DS:CODE,ES:CODE
         ORG     100H

BEGIN:   JMP     GO

MENU     DB      16 DUP (' '),201,44 DUP (205),187,10,13
         DB      16 DUP (' '),186,'   0 - Reset          1B,40                 ',186,10,13
         DB      16 DUP (' '),186,'   1 - Double Strike  1B,47                 ',186,10,13
         DB      16 DUP (' '),186,'   2 - Set LF to 1/8" 1B,30                 ',186,10,13
         DB      16 DUP (' '),186,'   3 - Compressed     0F                    ',186,10,13
         DB      16 DUP (' '),186,'   4 - Comp 8 LPI     0F,1B,30              ',186,10,13
         DB      16 DUP (' '),186,'   5 - Squished       9B,53,80,0F,9B,33,12  ',186,10,13
         DB      16 DUP (' '),186,'   6 - Italics ON     1B,34                 ',186,10,13
         DB      16 DUP (' '),186,'   7 - Underline ON   1B,2D,1               ',186,10,13
         DB      16 DUP (' '),186,'   8 - Emphasize ON   1B,45                 ',186,10,13
         DB      16 DUP (' '),186,'   9 - Wide ON        0E                    ',186,10,13
         DB      16 DUP (' '),200,44 DUP (205),189
         DB      10,10,10,10,13,'$'
ASK1     DB      16 DUP (' '),'Enter Your Selection ->','$'
INPTPARM DB      '*'
NTRY_LEN DB      8
PRNTCODE DB      1BH,40H,00H,00H,00H,00H,00H,07H
         DB      1BH,47H,00H,00H,00H,00H,00H,07H
         DB      1BH,30H,00H,00H,00H,00H,00H,07H
         DB      0FH,00H,00H,00H,00H,00H,00H,07H
         DB      0FH,1BH,30H,00H,00H,00H,00H,07H
         DB      9BH,53H,80H,0FH,9BH,33H,12H,07H
         DB      1BH,34H,00H,00H,00H,00H,00H,07H
         DB      1BH,2DH,01H,00H,00H,00H,00H,07H
         DB      1BH,45H,00H,00H,00H,00H,00H,07H
         DB      0EH,00H,00H,00H,00H,00H,00H,07H 

SETMX    PROC    FAR

GO:      PUSH    DS      ;save psp segment address
         MOV     AX,0    ;word for far return
         PUSH    AX

         MOV     SI,80H  ;80H is where the input parameter
         MOV     DL,[SI] ;count is left by opening procedure
         CMP     DL,0    ;if there's a parm, move on
         JE      GETPARM
         MOV     SI,82H
         MOV     AL,[SI] ;mov immediate won't work
         JMP     GOTPARM

GETPARM: MOV     CX,0    ;Gene Plantz's screen scroll cls
         MOV     DX,2479H
         MOV     BH,7
         MOV     AX,0600H	
         INT     10H

         MOV     DH,3    ;row
         MOV     DL,0    ;column
         MOV     BH,0    ;active page
         MOV     AH,2    ;locate cursor
         INT     10H     
         LEA     DX,MENU
         MOV     AH,9    ;print string
         INT     21H

         LEA     DX,ASK1 ;point to query and print it 
         MOV     AH,9    ;with DOS
         INT     21H

         MOV     AH,1    ;keyboard input DOS p D-17
         INT     21H     ;char returned in AL

GOTPARM: SUB     AL,'0'  ;conv ASCII to byte
         MUL     NTRY_LEN ;find offset in table
         LEA     BX,PRNTCODE

         MOV     CX,8    ;output standard 8 chrs
PRINTIT: PUSH    AX      ;save for reuse (need AL)
         XLAT
         MOV     DL,AL   ;from table to DL
         MOV     AH,5    ;printer output
         INT     21H      
         POP     AX      ;get original back, increment it,
         INC     AL      ;save this, + xlat + send to print
         LOOP    PRINTIT

         RET     ;return to DOS
SETMX    ENDP    ;close procedure
CODE     ENDS    ;close segment
END      BEGIN   ;close assembly

