home *** CD-ROM | disk | FTP | other *** search
- ;LISTNAT.A86
- title 'National printer conversion'
- pagesize 60+11
- ; *--------------------------------------------------------------
- ; *
- ; * Keyboard & Printer Driver for the National XIOS
- ; * ===============================================
- ; *
- ; * Date: 8th Oct 1986
- ; * Author: Glenn Stephens
- ; *
- ; * This is the printer driver to be used with the national
- ; * Version of the XIOS for CDOS 6.0
- ; * Output is handled through standard driver in LISTAUX.A86
- ; *
- ; *--------------------------------------------------------------
- ; *
- ; * Copyright (C) 1983-87 DIGITAL RESEARCH
- ; * P.O. Box 579
- ; * 160 Central
- ; * Pacific Grove, CA 93950
- ; *
- ; *--------------------------------------------------------------
- ; Major mods
- ; CDOS 6.0
- ; 4/AUG/87 -- allow printer numbers greater than 4 GMS
-
- nolist
- include NAT.EQU
- include ASCII.EQU
- list
- ; include NAT.EQU
- ; include ASCII.EQU
-
-
-
- public io_list@ ; for HEADER.A86
- public io_list_normal@ ; for KEYBOARD.A86
-
- dseg
- ; in NATDATA.A86
- extrn NX_natnlmode$ :byte, NX_graph_esc$ :byte
- extrn lv_table$ :word, NX_dead_ascii$ :word, NX_dead_set$ :word
- extrn NX_eps_l$ :word, NX_eps_a$ :word, NX_spec_char$ :word
- extrn NX_dw_special$ :byte, NX_eps_sp_a$ :byte, NX_eps_sp_l$ :byte
- extrn NX_dw_l$ :word, NX_dw_a$ :word, NX_dw_dead$ :word
- extrn NX_dw_esc1$ :word, NX_dw_esc2$ :word
- extrn NX_n7to8tbl$ :word, NX_n7to8chr$ :byte
-
- cseg
- extrn io_list_org@ :near ; in LISTAUX.A86
- extrn NX_scanstr@:near ; in KEYBOARD.A86
-
- cseg
-
- ;========
- io_list@:
- ;========
- ; entry: cl = character to print
- ; dl = printer number
- ;
- cmp dl,5 ; check if printer in range
- jae io_list_ret ; skip if it isn't
-
- sub bx,bx ; zero index register
- mov bl,dl ; bx = list device number
- shl bx,1 ; point to pointer
- mov bx,lv_table$[bx] ; bx -> lv_ [printer]
- jmp lv_escape ; jump to list escape handler
-
- io_list_ret:
- jmp io_list_org@ ; invoke original handler
-
-
- io_list_nxlt: ; jump here on 1st call to IO_LIST if no translate
- ;------------
- mov lv_escape,offset io_list_phys
- jmp io_list_phys ; never translate any thing
-
-
- io_list_normal@: ; default output handler
- ;--------------
- cmp lv_ptype,NX_noxlat ; no translation mode?
- je io_list_nxlt ; never translate any thing
-
- cmp cl,ESC ; is this an ESCape sequence?
- je io_list_norm4 ; skip if it is one
-
- cmp NX_natnlmode$,3 ; Ctrl/Alt/F4 = 7 bit Ntnl Kbd+Scrn */
- jne io_list_norm1 ; this mode requires tranlation
- call NX_xlt_7to8 ; translate 7 to 8 bit
- io_list_norm1:
- cmp lv_ptype,NX_ibm ; is this an IBM printer?
- jne io_list_norm3 ; no, print seven bit code
-
- cmp cl,236 ; our 8-bit paragraph
- jne io_list_norm2 ; no then leap
- mov cl,15 ; else make it IBM's crazy ^U char
- io_list_norm2:
- jmp io_list_phys ; print the character on IBM printer
-
- io_list_norm3:
- jmp NX_lst_nibm ; print on non-IBM printer
-
-
- io_list_norm4:
- call io_list_wait ; send next char to escape handler
-
- io_list_escape: ; leap here after ESC was printed
- ;--------------
- test lv_cap,lv_cp_hasgraph ; graphics supported?
- jz io_list_esc1 ; no, don't check for it
-
- mov di,offset NX_graph_esc$
- call NX_scanstr@ ; is it a graphics sequence?
- cmp di,no_match ; check result
- je io_list_esc1 ; leap if not graphics
-
- mov lv_escape,offset io_list_g1
- jmps io_list_esc_done ; continue with next character
-
- io_list_esc1:
- mov di,offset NX_dw_esc1$ ; see if "ESC x n" type of sequence
- call NX_scanstr@ ; character in table?
- cmp di,no_match
- je io_list_esc2 ; leap if not
-
- mov lv_escape,offset io_list_gr
- mov lv_graph,1 ; don't translate one character
- jmps io_list_esc_done ; print this one
-
- io_list_esc2:
- mov di,offset NX_dw_esc2$ ; see if "ESC x m n" type sequence
- call NX_scanstr@ ; character in table?
- cmp di,no_match
- je io_list_esc3 ; leap if not
-
- mov lv_escape,offset io_list_gr
- mov lv_graph,2 ; don't translate 2 characters
- jmps io_list_esc_done ; print this one
-
- io_list_esc3:
- mov lv_escape,offset io_list_normal@
- io_list_esc_done:
- jmp io_list_phys
-
-
- io_list_g1:
- ;----------
- mov ch,0 ; zero hi byte of graphics count
- mov lv_graph,cx ; initialize graphics count
- call io_list_wait ; lv_escape=io_list_g2, jmp io_l_p
-
-
- io_list_g2:
- ;----------
- mov byte ptr lv_graph+1,cl ; save hi byte
- call io_list_wait ; lv_escape=io_list_gr, jmp io_l_p
-
-
- io_list_gr:
- ;----------
- dec lv_graph ; decrement graphics count
- jne io_list_g_done ; leap if more to come
- mov lv_escape,offset io_list_normal@ ; else back to normalcy
- io_list_g_done:
- jmp io_list_phys ; print physical & return
-
-
- ; procedure to select national character set
- ; on EPSON MX-80/MX-100/FX-80
- ;
- NX_swtset:
- ;---------
- ; entry: bx -> lv_ structure
- ; cl = new character set
- ;
- test lv_cap, lv_cp_hassets ; can we switch character sets?
- jz NX_swt_set_done ; no, forget it
- cmp lv_lang, cl ; is desired set already select?
- je NX_swt_set_done ; yes, done
-
- push cx ; save character set
- mov cl,ESC ; send ESC character
- call io_list_phys
- mov cl,'R' ; send "R" (EPSON printers)
- call io_list_phys
- pop cx ; restore character set
- mov lv_lang, cl ; save new character set
- jmp io_list_phys ; select new character set
-
- NX_swt_set_done:
- ret
-
-
- NX_lst_nibm:
- ;-------------
- ; entry: bx -> lv_ structure
- ; cl = character to print
- ;
- cmp cl,128 ; plain US ASCII ?
- jae NX_lst_nibm1 ; no, special handling req'd
-
- mov lv_char,cl ; don't modify anything
- mov lv_set,NX_l_us ; select US character set
- jmp NX_lst_nibm_ok ; print that character
-
- NX_lst_nibm1:
- cmp cl,176 ; IBM european national code?
- jae NX_lst_nibm3 ; no, maybe special character
-
- cmp lv_ptype,NX_daisy ; is this a daisy wheel printer?
- jne NX_lst_nibm2 ; leap if not
-
- sub cl,128 ; make it index into table
- mov al,cl
- push bx ; save -> lv_
- mov bx,offset NX_dw_a$ ; get DAISY WHEEL ASCII
- xlat NX_dw_a$ ; translate via table
- pop bx ; restore -> lv_
- mov lv_char,al ; save remapped char
- mov al,cl ; get the character
- push bx ; save -> lv_
- mov bx,offset NX_dw_l$ ; get DAISY WHEEL LANGUAGE
- xlat NX_dw_l$ ; remap it
- pop bx ; restore -> lv_
- mov lv_set,al ; save new dead key
- jmps NX_lst_nibm6 ; print char (and overstrike key)
-
- NX_lst_nibm2: ; no daisy wheel printer
- sub cl,128 ; make it table index
- mov al,cl
- push bx ; save -> lv_
- mov bx,offset NX_eps_a$ ; point to EPSON ASCII table
- xlat NX_eps_a$ ; get remapped ascii code
- pop bx ; restore -> lv_
- mov lv_char,al ; save the remapped character
- mov al,cl
- push bx ; save -> lv_
- mov bx,offset NX_eps_l$ ; point to EPSON LANGUAGE
- xlat NX_eps_l$ ; get national character set
- pop bx ; restore -> lv_
- mov lv_set,al ; save remapped character set
- jmps NX_lst_nibm6 ; print character (from set)
-
- NX_lst_nibm3:
- mov di,offset NX_spec_char$ ; see if special character
- call NX_scanstr@ ; look thru table
- cmp di,no_match ; not in table?
- je NX_lst_nibm5 ; leap if not
-
- cmp lv_ptype,NX_daisy ; is it daisy wheel printer
- jne NX_lst_nibm4 ; leap if not
-
- mov al,NX_dw_special$[di] ; remap it for daisy wheel printer
- mov lv_char,al ; ...and store away
- mov lv_set,NX_l_us ; assume any character set (unused)
- jmps NX_lst_nibm_ok ; ...and print character
-
- NX_lst_nibm4: ; see if EPSON and special character
- mov al,NX_eps_sp_a$[di] ; get right EPSON SPECIAL ASCII
- mov lv_char,al ; ...and save it
- mov al,NX_eps_sp_l$[di] ; get right EPSON SPECIAL LANGUAGE
- mov lv_set,al ; ...and save it
- jmps NX_lst_nibm_ok ; print those characters
-
- NX_lst_nibm5:
- cmp cl,0ffh ; make BASIC + PrtSc happy
- jne NX_lst_nibm_bad ; (by remapping 0xff -> ' ')
-
- mov lv_char,' ' ; (yet another MS crime!)
- mov lv_set,NX_l_us ; (the dirtier the better...)
-
- NX_lst_nibm6:
- cmp lv_set,NX_l_no ; remapped code ok?
- jne NX_lst_nibm_ok ; leap if yes
-
- NX_lst_nibm_bad:
- mov cl,BEL ; sound the printer buzzer
- call io_list_phys ; "BEEP"
- mov cl,'?' ; print some visible garbage
- jmp io_list_phys ; "?"
-
- NX_lst_nibm_ok:
- cmp lv_set,NX_l_d0 ; see if overstrike required
- jae NX_lst_nibm_dkey ; yes the leap
-
- mov cl,lv_set ; get new character set
- call NX_swtset ; select it
- mov cl,lv_char ; get translated character
- jmp io_list_phys ; print it
-
- NX_lst_nibm_dkey:
- sub lv_set,NX_l_d0 ; make it overstrike code
- ; call NX_lst_dkey ; print with overstrike
- ; ret
-
-
- NX_lst_dkey: ; print character, back space, overstrike
- ;-------------
- ; entry: lv_char = ascii character
- ; lv_set = dead key index
-
- mov cl,NX_l_us ; switch to US character set
- call NX_swtset ; select it
- mov cl,lv_char ; print the national character
- call io_list_phys ; display it
-
- test lv_cap,lv_cp_hasbs ; back space supported?
- jz NX_lst_dkey_done ; no, forget it
-
- mov cl,BS ; print a back space
- call io_list_phys
- test lv_cap,lv_cp_hassets ; do we have multiple character sets?
- jnz NX_lst_dkey1 ; yes, select overstrike set
-
- mov al,lv_set ; no, daisy wheel: get overstrike code
- push bx ; save -> lv_
- mov bx,offset NX_dw_dead$ ; get "dead key" table
- xlat NX_dw_dead$ ; get overstrike character
- pop bx ; restore -> lv_
- mov cl,al
- call io_list_phys ; print overstrike character
- jmps NX_lst_dkey_done ; done
-
- NX_lst_dkey1:
- mov al,lv_set ; get desired character set
- push bx ; save -> lv_
- mov bx,offset NX_dead_set$ ; point to overstrike character set
- xlat NX_dead_set$ ; get overstrike set
- pop bx ; restore -> lv_
- mov cl,al
- call NX_swtset ; select new set
- mov al,lv_set ; get overstrike code
- push bx ; save -> lv_
- mov bx,offset NX_dead_ascii$ ; point to DEAD key ASCII
- xlat NX_dead_ascii$ ; get ascii code of overstrike char
- pop bx ; restore -> lv_
- mov cl,al ; get overstrike ascii code
- jmps io_list_phys ; print it
-
- NX_lst_dkey_done:
- ret
-
-
- io_list_wait:
- ;------------
- pop lv_escape ; go to return address next time
- ; jmps io_list_phys ; and print character in cl
-
-
- io_list_phys: ; print physical character
- ;-----------
- ; entry: cl = character to print
- ; bx -> lv_ structure
-
- push bx ; keep lv_ structure safe
- mov dl,lv_pnum ; get back printer number
- call io_list_org@ ; invoke original handler
- pop bx ; restore lv_ structure
- ret
-
-
- NX_xlt_7to8: ; translate 7 to 8 bit code
- ;-------------
- ; entry: cl = character to translate
- ; exit: cl = translated character
-
- push bx ; keep every register safe
- cmp NX_natnlmode$,3 ; 7 bit, nat scn, nat kbd?
- jne NX_xlt78_not_xlt ; not Ctrl/Alt/F4 mode
-
- mov bx,offset NX_n7to8tbl$ ; scan thru 7 bit eqv chars
- NX_xlt78_loop:
- cmp byte ptr [bx],0 ; see if end of translate tbl
- jz NX_xlt78_not_xlt ; yes, check for paragraph
- cmp cl,[bx] ; see if translation required
- jz NX_xlt78_7to8 ; yes, one of those characters
- inc bx ; no, may be next time
- jmps NX_xlt78_loop ; give it another try
-
- NX_xlt78_7to8:
- sub bx,offset NX_n7to8tbl$ ; see how many chars checked
- mov cl,NX_n7to8chr$[bx] ; get substitution
-
- NX_xlt78_not_xlt:
- pop bx
- ret ; back to display routine
- ret
-
-
- end
-
-
-