home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CDOSDSK4.ZIP / CDOSDSK4.TD0 / XIOS / LISTNAT.A86 < prev    next >
Encoding:
Text File  |  1989-01-26  |  11.0 KB  |  395 lines

  1. ;LISTNAT.A86  
  2. title 'National printer conversion'
  3. pagesize 60+11
  4. ; *--------------------------------------------------------------
  5. ; *
  6. ; *      Keyboard & Printer Driver for the National XIOS
  7. ; *      ===============================================
  8. ; *
  9. ; *    Date:        8th Oct 1986
  10. ; *      Author:        Glenn Stephens
  11. ; *
  12. ; *      This is the printer driver to be used with the national
  13. ; *    Version of the XIOS for CDOS 6.0
  14. ; *    Output is handled through standard driver in LISTAUX.A86
  15. ; *
  16. ; *--------------------------------------------------------------
  17. ; *
  18. ; *    Copyright (C) 1983-87 DIGITAL RESEARCH
  19. ; *                 P.O. Box 579
  20. ; *                  160 Central
  21. ; *            Pacific Grove, CA 93950
  22. ; *
  23. ; *--------------------------------------------------------------
  24. ; Major mods
  25. ; CDOS 6.0
  26. ;  4/AUG/87 -- allow printer numbers greater than 4        GMS
  27.  
  28. nolist
  29. include NAT.EQU
  30. include ASCII.EQU
  31. list
  32. ; include NAT.EQU
  33. ; include ASCII.EQU
  34.  
  35.  
  36.  
  37. public    io_list@                    ; for HEADER.A86
  38. public    io_list_normal@                    ; for KEYBOARD.A86
  39.  
  40.     dseg
  41.                             ; in NATDATA.A86
  42. extrn    NX_natnlmode$ :byte, NX_graph_esc$ :byte
  43. extrn    lv_table$ :word, NX_dead_ascii$ :word, NX_dead_set$ :word
  44. extrn    NX_eps_l$ :word, NX_eps_a$ :word, NX_spec_char$ :word
  45. extrn    NX_dw_special$ :byte, NX_eps_sp_a$ :byte, NX_eps_sp_l$ :byte
  46. extrn    NX_dw_l$ :word, NX_dw_a$ :word, NX_dw_dead$ :word
  47. extrn    NX_dw_esc1$ :word, NX_dw_esc2$ :word
  48. extrn    NX_n7to8tbl$ :word, NX_n7to8chr$ :byte 
  49.  
  50.     cseg
  51. extrn    io_list_org@ :near                ; in LISTAUX.A86
  52. extrn    NX_scanstr@:near                ; in KEYBOARD.A86
  53.  
  54.     cseg
  55.  
  56. ;========
  57. io_list@:
  58. ;========
  59. ;    entry:    cl = character to print
  60. ;        dl = printer number
  61. ;
  62.     cmp    dl,5            ; check if printer in range
  63.     jae    io_list_ret        ;   skip if it isn't
  64.  
  65.     sub    bx,bx            ; zero index register
  66.     mov    bl,dl            ; bx = list device number
  67.     shl    bx,1            ; point to pointer
  68.     mov    bx,lv_table$[bx]    ; bx -> lv_ [printer]
  69.     jmp    lv_escape        ; jump to list escape handler
  70.  
  71. io_list_ret:
  72.     jmp    io_list_org@        ; invoke original handler
  73.  
  74.  
  75. io_list_nxlt:        ; jump here on 1st call to IO_LIST if no translate
  76. ;------------
  77.     mov    lv_escape,offset io_list_phys
  78.     jmp    io_list_phys        ; never translate any thing
  79.  
  80.  
  81. io_list_normal@:        ; default output handler
  82. ;--------------
  83.     cmp    lv_ptype,NX_noxlat    ; no translation mode?
  84.     je    io_list_nxlt        ; never translate any thing
  85.  
  86.     cmp    cl,ESC            ; is this an ESCape sequence?
  87.     je    io_list_norm4        ;    skip if it is one
  88.  
  89.     cmp    NX_natnlmode$,3    ; Ctrl/Alt/F4 = 7 bit Ntnl Kbd+Scrn */
  90.     jne    io_list_norm1        ; this mode requires tranlation
  91.     call    NX_xlt_7to8        ; translate 7 to 8 bit
  92. io_list_norm1:
  93.     cmp    lv_ptype,NX_ibm    ; is this an IBM printer?
  94.     jne    io_list_norm3        ; no, print seven bit code
  95.  
  96.     cmp    cl,236            ; our 8-bit paragraph
  97.     jne    io_list_norm2        ; no then leap
  98.     mov    cl,15            ; else make it IBM's crazy ^U char
  99. io_list_norm2:
  100.     jmp    io_list_phys        ; print the character on IBM printer
  101.  
  102. io_list_norm3:
  103.     jmp    NX_lst_nibm        ; print on non-IBM printer
  104.  
  105.  
  106. io_list_norm4:
  107.     call    io_list_wait        ; send next char to escape handler
  108.  
  109. io_list_escape:                ; leap here after ESC was printed
  110. ;--------------
  111.     test    lv_cap,lv_cp_hasgraph    ; graphics supported?
  112.     jz    io_list_esc1        ; no, don't check for it
  113.  
  114.     mov    di,offset NX_graph_esc$
  115.     call    NX_scanstr@        ; is it a graphics sequence?
  116.     cmp    di,no_match        ; check result
  117.     je    io_list_esc1        ; leap if not graphics
  118.  
  119.     mov    lv_escape,offset io_list_g1
  120.     jmps    io_list_esc_done    ; continue with next character
  121.  
  122. io_list_esc1:
  123.     mov    di,offset NX_dw_esc1$    ; see if "ESC x n" type of sequence
  124.     call    NX_scanstr@        ; character in table?
  125.     cmp    di,no_match
  126.     je    io_list_esc2        ; leap if not
  127.  
  128.     mov    lv_escape,offset io_list_gr
  129.     mov    lv_graph,1        ; don't translate one character
  130.     jmps    io_list_esc_done    ; print this one
  131.  
  132. io_list_esc2:
  133.     mov    di,offset NX_dw_esc2$    ; see if "ESC x m n" type sequence
  134.     call    NX_scanstr@        ; character in table?
  135.     cmp    di,no_match
  136.     je    io_list_esc3        ; leap if not
  137.  
  138.     mov    lv_escape,offset io_list_gr
  139.     mov    lv_graph,2        ; don't translate 2 characters
  140.     jmps    io_list_esc_done    ; print this one
  141.  
  142. io_list_esc3:
  143.     mov    lv_escape,offset io_list_normal@
  144. io_list_esc_done:
  145.     jmp    io_list_phys
  146.  
  147.  
  148. io_list_g1:
  149. ;----------
  150.     mov    ch,0            ; zero hi byte of graphics count
  151.     mov    lv_graph,cx        ; initialize graphics count
  152.     call    io_list_wait        ; lv_escape=io_list_g2, jmp io_l_p
  153.  
  154.  
  155. io_list_g2:
  156. ;----------
  157.     mov    byte ptr lv_graph+1,cl    ; save hi byte
  158.     call    io_list_wait        ; lv_escape=io_list_gr, jmp io_l_p
  159.  
  160.  
  161. io_list_gr:
  162. ;----------
  163.     dec    lv_graph        ; decrement graphics count
  164.     jne    io_list_g_done        ; leap if more to come
  165.     mov    lv_escape,offset io_list_normal@ ; else back to normalcy
  166. io_list_g_done:
  167.     jmp    io_list_phys        ; print physical & return
  168.  
  169.  
  170. ;    procedure to select national character set
  171. ;           on EPSON MX-80/MX-100/FX-80
  172. ;
  173. NX_swtset:
  174. ;---------
  175. ;    entry:    bx -> lv_ structure
  176. ;        cl = new character set
  177. ;
  178.     test    lv_cap, lv_cp_hassets    ; can we switch character sets?
  179.     jz    NX_swt_set_done    ; no, forget it
  180.     cmp    lv_lang, cl        ; is desired set already select?
  181.     je    NX_swt_set_done    ; yes, done
  182.  
  183.     push    cx            ; save character set
  184.     mov    cl,ESC            ; send ESC character
  185.     call    io_list_phys
  186.     mov    cl,'R'            ; send "R" (EPSON printers)
  187.     call    io_list_phys
  188.     pop    cx            ; restore character set
  189.     mov    lv_lang, cl        ; save new character set
  190.     jmp    io_list_phys        ; select new character set
  191.  
  192. NX_swt_set_done:
  193.     ret
  194.  
  195.  
  196. NX_lst_nibm:
  197. ;-------------
  198. ;    entry:    bx -> lv_ structure
  199. ;        cl = character to print
  200. ;
  201.     cmp    cl,128            ; plain US ASCII ?
  202.     jae    NX_lst_nibm1        ; no, special handling req'd
  203.  
  204.     mov    lv_char,cl        ; don't modify anything
  205.     mov    lv_set,NX_l_us    ; select US character set
  206.     jmp    NX_lst_nibm_ok    ; print that character
  207.  
  208. NX_lst_nibm1:
  209.     cmp    cl,176            ; IBM european national code?
  210.     jae    NX_lst_nibm3        ; no, maybe special character
  211.  
  212.     cmp    lv_ptype,NX_daisy    ; is this a daisy wheel printer?
  213.     jne    NX_lst_nibm2        ; leap if not
  214.  
  215.     sub    cl,128            ; make it index into table
  216.     mov    al,cl
  217.     push    bx            ; save -> lv_
  218.     mov    bx,offset NX_dw_a$    ; get DAISY WHEEL ASCII
  219.     xlat    NX_dw_a$        ; translate via table
  220.     pop    bx            ; restore -> lv_
  221.     mov    lv_char,al        ; save remapped char
  222.     mov    al,cl            ; get the character
  223.     push    bx            ; save -> lv_
  224.     mov    bx,offset NX_dw_l$    ; get DAISY WHEEL LANGUAGE
  225.     xlat    NX_dw_l$        ; remap it
  226.     pop    bx            ; restore -> lv_
  227.     mov    lv_set,al        ; save new dead key
  228.     jmps    NX_lst_nibm6        ; print char (and overstrike key)
  229.  
  230. NX_lst_nibm2:                ; no daisy wheel printer
  231.     sub    cl,128            ; make it table index
  232.     mov    al,cl
  233.     push    bx            ; save -> lv_
  234.     mov    bx,offset NX_eps_a$    ; point to EPSON ASCII table
  235.     xlat    NX_eps_a$        ; get remapped ascii code
  236.     pop    bx            ; restore -> lv_
  237.     mov    lv_char,al        ; save the remapped character
  238.     mov    al,cl
  239.     push    bx            ; save -> lv_
  240.     mov    bx,offset NX_eps_l$    ; point to EPSON LANGUAGE
  241.     xlat    NX_eps_l$        ; get national character set
  242.     pop    bx            ; restore -> lv_
  243.     mov    lv_set,al        ; save remapped character set
  244.     jmps    NX_lst_nibm6        ; print character (from set)
  245.  
  246. NX_lst_nibm3:
  247.     mov    di,offset NX_spec_char$ ; see if special character
  248.     call    NX_scanstr@        ; look thru table
  249.     cmp    di,no_match        ; not in table?
  250.     je    NX_lst_nibm5        ; leap if not
  251.  
  252.     cmp    lv_ptype,NX_daisy    ; is it daisy wheel printer
  253.     jne    NX_lst_nibm4        ; leap if not
  254.  
  255.     mov    al,NX_dw_special$[di]    ; remap it for daisy wheel printer
  256.     mov    lv_char,al        ; ...and store away
  257.     mov    lv_set,NX_l_us    ; assume any character set (unused)
  258.     jmps    NX_lst_nibm_ok    ; ...and print character
  259.  
  260. NX_lst_nibm4:                ; see if EPSON and special character
  261.     mov    al,NX_eps_sp_a$[di]    ; get right EPSON SPECIAL ASCII
  262.     mov    lv_char,al        ; ...and save it
  263.     mov    al,NX_eps_sp_l$[di]    ; get right EPSON SPECIAL LANGUAGE
  264.     mov    lv_set,al        ; ...and save it
  265.     jmps    NX_lst_nibm_ok    ; print those characters
  266.  
  267. NX_lst_nibm5:
  268.     cmp    cl,0ffh            ; make BASIC + PrtSc happy
  269.     jne    NX_lst_nibm_bad    ; (by remapping 0xff -> ' ')
  270.  
  271.     mov    lv_char,' '        ; (yet another MS crime!)
  272.     mov    lv_set,NX_l_us    ; (the dirtier the better...)
  273.  
  274. NX_lst_nibm6:
  275.     cmp    lv_set,NX_l_no    ; remapped code ok?
  276.     jne    NX_lst_nibm_ok    ; leap if yes
  277.  
  278. NX_lst_nibm_bad:
  279.     mov    cl,BEL            ; sound the printer buzzer
  280.     call    io_list_phys        ; "BEEP"
  281.     mov    cl,'?'            ; print some visible garbage
  282.     jmp    io_list_phys        ; "?"
  283.  
  284. NX_lst_nibm_ok:
  285.     cmp    lv_set,NX_l_d0    ; see if overstrike required
  286.     jae    NX_lst_nibm_dkey    ; yes the leap
  287.  
  288.     mov    cl,lv_set        ; get new character set
  289.     call    NX_swtset        ; select it
  290.     mov    cl,lv_char        ; get translated character
  291.     jmp    io_list_phys        ; print it
  292.  
  293. NX_lst_nibm_dkey:
  294.     sub    lv_set,NX_l_d0    ; make it overstrike code
  295. ;    call    NX_lst_dkey        ; print with overstrike
  296. ;    ret
  297.  
  298.  
  299. NX_lst_dkey:    ; print character, back space, overstrike
  300. ;-------------
  301. ;    entry:    lv_char = ascii character
  302. ;        lv_set  = dead key index
  303.  
  304.     mov    cl,NX_l_us        ; switch to US character set
  305.     call    NX_swtset        ; select it
  306.     mov    cl,lv_char        ; print the national character
  307.     call    io_list_phys        ; display it
  308.  
  309.     test    lv_cap,lv_cp_hasbs    ; back space supported?
  310.     jz    NX_lst_dkey_done    ; no, forget it
  311.  
  312.     mov    cl,BS            ; print a back space
  313.     call    io_list_phys
  314.     test    lv_cap,lv_cp_hassets    ; do we have multiple character sets?
  315.     jnz    NX_lst_dkey1        ; yes, select overstrike set
  316.  
  317.     mov    al,lv_set        ; no, daisy wheel: get overstrike code
  318.     push    bx            ; save -> lv_
  319.     mov    bx,offset NX_dw_dead$    ; get "dead key" table
  320.     xlat    NX_dw_dead$        ; get overstrike character
  321.     pop    bx            ; restore -> lv_
  322.     mov    cl,al
  323.     call    io_list_phys        ; print overstrike character
  324.     jmps    NX_lst_dkey_done    ; done
  325.  
  326. NX_lst_dkey1:
  327.     mov    al,lv_set        ; get desired character set
  328.     push    bx            ; save -> lv_
  329.     mov    bx,offset NX_dead_set$    ; point to overstrike character set
  330.     xlat    NX_dead_set$        ; get overstrike set
  331.     pop    bx            ; restore -> lv_
  332.     mov    cl,al
  333.     call    NX_swtset        ; select new set
  334.     mov    al,lv_set        ; get overstrike code        
  335.     push    bx            ; save -> lv_
  336.     mov    bx,offset NX_dead_ascii$ ; point to DEAD key ASCII
  337.     xlat    NX_dead_ascii$        ; get ascii code of overstrike char
  338.     pop    bx            ; restore -> lv_
  339.     mov    cl,al            ; get overstrike ascii code
  340.     jmps    io_list_phys        ; print it
  341.  
  342. NX_lst_dkey_done:
  343.     ret
  344.  
  345.  
  346. io_list_wait:
  347. ;------------
  348.     pop    lv_escape        ; go to return address next time
  349. ;    jmps    io_list_phys        ;   and print character in cl
  350.  
  351.  
  352. io_list_phys:    ; print physical character
  353. ;-----------
  354. ;    entry:    cl = character to print
  355. ;        bx -> lv_ structure
  356.  
  357.     push    bx                ; keep lv_ structure safe
  358.     mov    dl,lv_pnum            ; get back printer number
  359.     call    io_list_org@            ; invoke original handler
  360.     pop    bx                ; restore lv_ structure
  361.     ret
  362.  
  363.  
  364. NX_xlt_7to8:        ; translate 7 to 8 bit code
  365. ;-------------
  366. ;    entry:    cl = character to translate
  367. ;    exit:    cl = translated character
  368.  
  369.     push    bx                ; keep every register safe
  370.     cmp    NX_natnlmode$,3        ; 7 bit, nat scn, nat kbd?
  371.     jne    NX_xlt78_not_xlt        ; not Ctrl/Alt/F4 mode
  372.  
  373.     mov    bx,offset NX_n7to8tbl$        ; scan thru 7 bit eqv chars
  374. NX_xlt78_loop:
  375.     cmp    byte ptr [bx],0            ; see if end of translate tbl
  376.     jz    NX_xlt78_not_xlt        ; yes, check for paragraph
  377.     cmp    cl,[bx]                ; see if translation required
  378.     jz    NX_xlt78_7to8            ; yes, one of those characters
  379.     inc    bx                ; no, may be next time
  380.     jmps    NX_xlt78_loop            ; give it another try
  381.  
  382. NX_xlt78_7to8:
  383.     sub    bx,offset NX_n7to8tbl$        ; see how many chars checked
  384.     mov    cl,NX_n7to8chr$[bx]        ; get substitution
  385.  
  386. NX_xlt78_not_xlt:
  387.     pop    bx
  388.     ret    ; back to display routine
  389.     ret
  390.  
  391.  
  392.     end
  393.     
  394.  
  395.