home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-01-26 | 29.4 KB | 1,137 lines |
- ; CONIN.A86
- title 'CONIN and PFKs'
- pagesize 60+11
- ;********************************************************
- ;* *
- ;* CONSOLE INPUT / PROGRAMMABLE FUNCTION KEYS *
- ;* CDOS 6.0 XIOS *
- ;* DRI OS ENGR, JMB *
- ;* *
- ;********************************************************
- ; Major mods:
- ; 6.x
- ; 9 DEC 88 -- make all direct screen write apps full screen GMS
- ; 12 OCT 88 -- patch out call io_switch GMS
- ; 11 Aug 88 -- call io_open/io_close round print_screen IJ
- ; 9 AUG 88 -- lower PIN's priority during print_screen GMS
- ; 9 AUG 88 -- use lcb_list instead of lcb_tab GMS
- ; 2 AUG 88 -- change default F3 key to ctrlE GMS
- ; 1 JUL 88 -- force mode change if 43 line mode app aborted GMS
- ; 19 APR 88 -- added SunRiver support GMS
- ; 4 FEB 88 -- VS_CUR_TYPE_HW updated in trans_cur_type GMS
- ; 4 DEC 87 -- VS_SCREEN_MODE now uses ROS video mode values GMS
- ; 2 DEC 87 -- replaced ega$ with redefined video$ GMS
- ; 6.0
- ; 3 NOV 87 -- reset cursor bit in pc_kbd GMS
- ; 17 OCT 87 -- Remove cntrl-break handler code GMS
- ; 15 OCT 87 -- No line feed if pc_kbd if old mode pcmode 24 line GMS
- ; 5 OCT 87 -- use larger cursor if ega mono GMS
- ; 1 OCT 87 -- PFK tables made public for 386 PCTERM support GMS
- ; 15 SEP 87 -- change to console numbers for conin_serial GMS
- ; 10 AUG 87 -- PC_KBD supports new parameters GMS
- ; 17 JUL 87 -- converted XIOS to small model JW
- ; 5.2
- ; 1 APR 87 -- pc_shifts includes status bits for extended keyboard GMS
- ; 4 MAR 87 -- bug fix, status line disappeared after mode change to B/W 80
- ; 3 MAR 87 -- changed default PFK value from SCEPTER
- ; 5.1
- ; 9 JAN 87 -- allow escape from print screen function
- ; 30 JUL 86 -- make conditional f-keys permanent
- ; 30 JUL 86 -- remove below
- ; 17 JUL 86 -- cntl-prntscr to cntl-p
- ; 17 JUL 86 -- change keypad defaults
- ; 27 MAY 86 -- return ^c for cntl_break
- ; 26 MAY 86 -- conditional f-keys for QXM
- ; 18 APR 86 -- support VS_CUR_TYPE_HW (for ega)
- ; 17 JAN 86 -- correct CONIN for dos pgms
- ; 15 OCT 85 -- CONIN/KEYBOARD-ISR redone for ROS usage
- ; 19 JUL 85 -- dress up PFK esc handlers
- ; 10 JUN 85 -- update 4.1 ASM86 XIOS to RASM86
-
- ; include COPYRITE.TXT
-
- nolist
- include CDOS.EQU
- include XIOS.EQU
- include PCHW.EQU
- include ROSDATA.EQU
- include ASCII.EQU
- include NAT.EQU
- list
- ; These have been included:
- ; include CDOS.EQU
- ; include XIOS.EQU
- ; include PCHW.EQU
- ; include ROSDATA.EQU
- ; include ASCII.EQU
- ; include NAT.EQU
-
- CGROUP group CODE
- DGROUP group DATA
-
-
- public io_const@, io_conin@, ww_key@, pc_kbd@, pc_shifts@
- public pfk_tbl0$, pfk_tbl1$, pfk_tbl2$, pfk_tbl3$
- public z_prog_pfk@, z_pfk_on@, z_pfk_off@
- public check_no_switch@
-
- eject
-
- cseg
- extrn flagwait@:near, flagset@:near ;in HEADER.A86
- extrn supervisor$:dword, supif@:near
- extrn io_list@:near, conin_serial@:near ;in LISTAUX.A86
- extrn io_listst@:near
- extrn io_open@:near, io_close@ :near
- extrn set_screen@:near, vc_out_lf@:near ;in WINDOWS1.A86
- extrn z_up@:near, z_erase_eos@:near
- extrn show_cursor@:near
- extrn leave_until_char@:near
- extrn point_vs@:near, get_all_mxs@:near ; in WINDOWS2.A86
- extrn ww_full_window@:near, new_pc_window@:near
- extrn free_all_mxs@:near, do_true_view@:near
- extrn restore_state@:near, check_full@:near
- extrn io_switch@:near
- extrn copy_full_top@:near,trans_cur_type@:near ; in WINDOWS3.A86
- extrn put_crt_s@:near ; in WINDOWS3.A86
- extrn switch_statline@:near, io_statline@:near ; in STATLINE.A86
- extrn int16_entry@:near, int10_entry@:near ; in ROSIF.A86
- if SR
- extrn test_srterm@ :near ; in SRTERM.A86
- extrn sr_ww_key@ :near
- endif
-
-
- dseg
- public pfk_code_tbl$
- public pfk_scan_list$
- public PFK_SCAN_LIST_SIZE
-
- extrn key_flag$:word, cntl_break$:byte ; in KEYBOARD.A86
- extrn beep_counter$:byte ; in ISRS.A86
- extrn switch_key$:byte, wmenu_key$:byte
- extrn prtsc_key$:byte
- extrn ccb_list$:word, lcb_list$:word ; in PUBDATA.A86
- extrn timer_count$:word, blank$:word
- extrn top_screen$:byte, im_here$:byte ; in WINDOWS3.A86
- extrn graphic_bits$:byte, var_cursor$:word
- extrn NX_kbd_type$ :byte, NX_natnlstat$ :byte ; in NATDATA.A86
- extrn video$ :byte ; in WINDOWS1.A86
-
- eject
- cseg
- ;=========
- io_const@:
- ;=========
- ; This routine returns always ready, but it's really a nop, since
- ; normally PIN is the only one calling it, and PIN just sleeps on io_conin.
-
- xor ax,ax ; always ready
- ret
-
-
- ;=========
- io_conin@:
- ;=========
- cmp dl,1
- jb conin_keyboard ; jump if PC keyboard
-
- ;; sub dl,1 ; else which serial terminal?
- cmp dl,NUM_AUX_PORTS ; if too big...
- ja conin_no_go ; then forget it.
- jmp conin_serial@ ; else handle serial port
- conin_no_go:
- sub ax,ax ; return null
- ret
-
- conin_keyboard:
- ; Get console input from the standard keyboard:
-
- mov dl,top_screen$ ; current foreground console
- call point_vs@ ; get the screen structure
-
- test VS_MODE,PCMODE_BIT ; if a DOS program...
- jnz conin_wait1 ; no func. keys so jump
-
- cmp VS_PFK_COUNT,0 ; if no PFKs waiting...
- je conin_wait1 ; then jump
-
- ; Here if there are pending function key characters:
- mov si,VS_PFK_PTR ; get the current pointer
- lodsb ; get the value
- test al,al ; if valid then jump
- jnz conin_pfk
- mov VS_PFK_COUNT,al ; else put 0 in the count
- jmps conin_wait1 ; and wait for a key
-
- conin_pfk:
- mov VS_PFK_PTR,si ; update the pointer
- dec VS_PFK_COUNT ; and the count
- mov ah,0 ; char is in al
- ret
- eject
-
- conin_wait:
- ;----------
- ; Here to wait for a real key to be typed:
-
- push bx
- push cx
- mov dx,CI_FLAG ; console-in flag
- call flagwait@
- pop cx
- pop bx
-
- conin_wait1:
- test prtsc_key$,0ffh ; did our isr slip this in?
- jmpnz print_screen
- test wmenu_key$,0ffh ; anything there?
- jmpnz handle_wmenu
- test switch_key$,0ffh ; how bout here?
- jmpnz handle_switch
- test cntl_break$,0ffh ; set by int handler
- jmpnz handle_break ; control break key
-
- mov ah,1 ; ROS keyboard status
- call int16_entry@
- jz conin_wait ; means nothing is available
-
- sub ah,ah ; else ROS key input function
- call int16_entry@
-
-
- ; Check for cntl-prntscr:
- ; cmp ax,7200h ; what it looks like
- ; jnz not_cp
- ; mov ax,1710h ; force to cntl-p
- ;not_cp:
- ; The above was removed because it's not the IO system's job to do that.
- ; An application must be able to do an int 16h to get back 7200h, and some
- ; do. The emulator must handle that if it's desired to do so.
-
- ; Now check for a dos pgm:
- test VS_MODE,PCMODE_BIT ; if DOS pgrm.
- jnz pc_kb_ret ; return immediately
-
- ; Check for extended key:
- or al,al ; extended?
- jnz conin_ret ; no, just ascii...jump.
-
- ; Here if it may be a programmable:
- cmp ah,TWO_SCAN ; If cntl @, leave it as null
- je conin_ret
- cmp ah,TAB_SCAN ; if backtab, return FF
- jne not_bt
- mov al,FF ; for COPYMENU
- jmps conin_ret
- not_bt:
- cmp ah,F1_SCAN ; nothing below is programmable
- jb conin_done ; no key yet
- call trans_pfk ; maybe a PFK
- jnz conin_done ; jump if no...loop
- cmp VS_PFK_EXP,0 ; if expansion is turned off
- je conin_done ; then return the unexpanded key
-
- xchg ah,al ; pfk index to ah
- call point_pfk ; a programmable
- jmp conin_keyboard ; get first
- conin_done:
- or al,al
- jmpz conin_wait ; nothing, so wait more
- conin_ret:
- sub ah,ah ; else CPM spec.
- pc_kb_ret:
- ret
- eject
-
- ; Here if it was control break
- handle_break:
- mov ax,0ae03h ; cntl-c set top bit on SCAN
- mov cntl_break$,0 ; code value for PC emulator
- ret
-
-
-
- handle_wmenu:
- ; Deal w/ WAKE or FULL menu keys:
- mov al,wmenu_key$
- cmp al,PLUS_SCAN
- je w_wake
- cmp al,DEL_SCAN
- je w_full
- ww_reset:
- mov wmenu_key$,0 ; zero it for next time
- jmp conin_wait ; shouldn't get here
-
- w_wake:
- ; Wake up the window manager:
- cmp im_here$,1 ; see if mgr is resident
- jb ww_reset ; forget it if not there
- call check_no_switch@ ; see if con. is no-sw. mode
- jnz ww_reset ; if so, forget it
- cmp graphic_bits$,0 ; if anyone is graphics,
- jnz ww_reset ; then also forget it
-
- mov im_here$,2 ; indicate resident and active
- mov dx,WW_FLAG ; WMENU flag
- mov key_flag$,dx ; for the isr to use
- mov ww_stat_flag,TRUE ; for ww_key status check
- call flagset@ ; wake it up
- pushf ; fake an interrupt
- callf dword ptr dispatcher ; and a return
- jmp conin_wait ; now wait for a wake-up
-
- w_full:
- ; If current window is small, switch to full.
- ; If current window is full, switch to previous size.
- mov dl,top_screen$ ; get active console number
- call ww_full_window@ ; full/small switch
- jmps ww_reset ; and wait for a real key
-
-
- handle_switch:
- ; The key combo detected by our ISR was a screen switch
- call get_all_mxs@ ; avoid deadly embrace w/ a
- call free_all_mxs@ ; proc. in suspend mode.
- sub al,al
- xchg al,switch_key$
- sub al,PAD4_SCAN ; subtract bias
- mov ah,0FFh ; indicates console switch
- push bx
- mov bx,offset switch_scan_table
- xlat bx ; get console requested
- pop bx
- cmp al,-1
- jne sw_ret
- jmp conin_wait ; should never happen
- sw_ret:
- ret
- eject
-
- trans_pfk:
- ;---------
- ; This routine takes an Extended scan code as returned from ROS and converts
- ; it to it's unexpanded CPM equivalent.
- ; Entry: ah = scan, al = 0
- ; Exit: ZF = set, ah=PFK index, al=translation (w/ hi bit set)
- ; if a CPM programmable
- ; ZF = reset, ax = preserved if not
-
- push es
- mov cx,ds
- mov es,cx ; point es here
- xchg al,ah
- mov cx,PFK_SCAN_LIST_SIZE ; how many to check
- cld
- mov di,offset pfk_scan_list$
- mov dx,di
- repne scasb ; look for it
- pop es
- jz found_scan ; found it
- xchg al,ah
- ret ; return w/ ZF = 0 if no match
-
- found_scan:
- dec di
- sub di,dx
- mov ax,di
- mov ah,al
- mov al,pfk_code_tbl$[di] ; get the cpm code
- or al,80h ; set the high bit
- cmp al,al ; ZF = 1
- ret
- eject
-
- point_pfk:
- ;---------
- ; Point to PFK table -- called by z_prog_pfk and conin
- ; entry: al = pfk table index
- ; bx -> vs_
- ; exit: VS_PFK_PTR -> pfk value
- ; VS_PFK_COUNT = maximum char count
-
- sub si,si ; zero offset for low table
- mov cl,PFK_L_SIZE ; chars per low pfk
- cmp al,LOW_PFKS ; check for low table
- jb point_pfk1 ; skip if unshifted F1-F10
- sub al,LOW_PFKS ; index into high table
- mov si,PFK_L_SIZE * LOW_PFKS ; offset for high table
- mov cl,PFK_H_SIZE ; chars per high pfk
- point_pfk1:
- mul cl ; index into high table
- add si,ax
- add si,VS_PFK_TBL ; add table offset
- mov VS_PFK_PTR,si ; set initial pointer
- mov VS_PFK_COUNT,cl ; and initial count
- cmp ax,ax ; set zero flag
- ret
-
- eject
-
- print_screen:
- ;------------
- ; Print the current screen (virtual console)
- ; to the current default list device (if unowned):
- mov di,rlr$ ; get running proc
- mov al,P_PRIOR[di] ; priority
- push ax ; and save for exit
- mov cl,P_PRIORITY
- mov dl,201 ; lower PIN's priority
- push si
- call supif@ ; during print screen
- pop si
-
- mov al,top_screen$ ; get the top process
- cbw
- shl ax,1 ; word pointer
- xchg ax,bx ; bx = vc index
- mov bx,ccb_list$[bx] ; bx -> top ccb
- mov si,C_OWNER[bx] ; si = top process desc
- mov dl,P_LIST[si] ; fetch default printer
- xor bh,bh
- mov bl,dl
- shl bx,1
- mov si,lcb_list$[bx] ; si-> default lcb
-
- cli ;; critical section
- cmp LCB_ATTACH[si],0 ;; if somebody owns this
- jnz print_screen_block ;; then just ignore key
- mov LCB_ATTACH[si],PRSC_PD ;; insert a phony pd
- sti ; interrupts now ok
-
- push si ; save for release
- push dx
- mov dh,1 ; L_ATTACH ourselves
- call io_open@ ; before we use the printer
- pop dx
- push dx
- call print_top_vc ; now we print
- pop dx
- mov dh,1 ; L_DETACH ourselves
- call io_close@ ; we are finished with the printer
- pop si
- mov ax,LCB_QUEUE[si] ; get the next proc in line
- mov LCB_ATTACH[si],ax ; and give it the lcb
- test ax,ax ; if it's nobody
- jz print_screen_done ; then just leave
-
- mov cx,F_WAKEUP ; to awake the next process
- lea dx,LCB_QUEUE[si] ; point to next
- callf supervisor$ ; non-stop flight
- jmps print_screen_done ; that should do it
-
- print_screen_block:
- sti ; release critical section
- inc beep_counter$ ; beep the error
- ; jmps print_screen_done ; and fall through
-
- print_screen_done:
- mov prtsc_key$,0 ; reset
- pop dx ; restore PIN's priority
- mov cl,P_PRIORITY
- call supif@
- jmp conin_wait1 ; await another character
-
- ; The coast is clear, print the virtual console:
- ; entry: dl = printer number
-
- print_top_vc:
- push dx ; save the printer number
- mov dl,top_screen$ ; who is it anyway?
- call point_vs@ ; we keep bx now
- mov al,VS_MODE ; save the match bit to keep
- push ax ; full screens in step
- call copy_full_top@ ; get vc in sync
- pop ax
- mov VS_MODE,al ; restore mode with match bit
- pop dx ; restore printer
-
- mov si,0 ; vc pointer
- mov al,VS_CRT_ROWS ; number of rows to print
- cbw ; wordize it
- xchg ax,cx ; cx = row count
- print_top_rows:
- push cx ; save row count
- mov cx,CRT_COLS ; cx = column count
- print_top_cols:
- call print_top_in ; get one char from vc
- call print_top_out ; and send it to printer
- or al,al
- jnz print_scrn_abort
- loop print_top_cols ; for each column
-
- mov al,CR ; now do a crlf
- call print_top_out
- or al,al
- jnz print_scrn_abort
- mov al,LF
- call print_top_out
- or al,al
- jnz print_scrn_abort
- pop cx
- loop print_top_rows ; do another row
- print_exit:
- ret ; finished
-
- print_scrn_abort: ; print screen aborted
- pop cx ; exit ....
- ret
-
- print_top_in:
- push ds
- mov ds,VS_VC_SEG ; reach into virtual console
- lodsw ; grab char and attrib
- pop ds
- ret ; with al = char
-
- ; Exit: AL = 0 if ok
- ; <> 0 keyboard abort..
- print_top_out:
- push bx ! push cx ! push si
- push ax
- push dx
- not_ready:
- mov ah,1 ; ROS int 16 status
- call int16_entry@
- jz no_char
- sub ah,ah ; ROS int 16 conin
- call int16_entry@ ; if so, get the char
- cmp al,ESC ; was it escape
- jz abort_print
- cmp al,ETX ; was it ^c?
- jnz no_char ; jump if no
- abort_print:
- pop dx
- pop ax
- jmps pto_exit ; return al <> 0
- no_char:
- pop dx ; get device
- push dx
- call io_listst@
- or al,al
- jz not_ready
-
- pop dx ; get device
- pop cx ; get the char for output
- push dx
- call io_list@ ; dl is right, print char
- xor al,al ; ok return
- pop dx
- pto_exit:
- pop si ! pop cx ! pop bx
- ret
- eject
-
- ; Check for console in no switch mode:
- ; exit: zf set switch is allowed
-
- check_no_switch@:
- ;---------------
- mov al,top_screen$
- cbw
- shl ax,1
- xchg bx,ax ; bx = screen word ptr
- mov bx,ccb_list$[bx] ; get foreground ccb
- test C_STATE[bx],CSM_NOSWITCH ; set flag if switchable
- ret
-
-
-
- ; XIOS back door entry to pass window manager a keystroke.
- ; Window manager will go to sleep on this call if cl < 0FEH.
-
- ; entry: cl = 0FFH => input/status
- ; exit: ax = char if char ready
- ; ax = 0 if no char ready
- ;
- ; cl = 0FEH => status only
- ; exit: ax = 0FFH if char ready
- ; ax = 0 if no char ready
- ;
- ; cl < 0FEH => wait for input
- ; exit: ax = char when ready
-
- ; exit: if al = char then
- ; ah = key type
- ; 0 => regular
- ; 0FFH => special
-
- ;=======
- ww_key@:
- ;=======
-
- ; New code:
- mov di,rlr$
- if SR
- cmp P_CONS[di],NUM_VIR_CONS ; is it master console
- jb main_vc
- mov dl,P_CONS[di] ; get VC number
- call test_srterm@ ; is it SunRiver VC
- jz main_vc ; no...
- jmp sr_ww_key@ ; SunRiver station
-
- main_vc:
- endif
- mov prtsc_key$,0 ; we ignore this one
- cmp cl,0FEh
- je status_only
- cmp cl,0FFh
- je input_status
-
- ; Here if cl < FE meaning wait for a char:
- wait:
- push cx
- mov dx,WW_FLAG
- call flagwait@
- pop cx
- cmp im_here$,1
- jbe wait
-
- ; Check for keys:
- input_status:
- sub al,al
- xchg al,wmenu_key$ ; FULL or WAKE
- test al,al
- jnz return_wmenu_key
- xchg al,switch_key$
- test al,al
- jnz return_switch_key
-
- mov ah,1 ; stat call
- push cx
- call int16_entry@
- pop cx
- jnz return_key
- no_kbd:
- cmp cl,0FFh ; input or status?
- jne wait
- sub ax,ax ; no char
- ret
-
- return_wmenu_key:
- ;----------------
- cmp al,DEL_SCAN ; FULL?
- jne not_full
- mov ax,0FF7Eh
- ret
- not_full:
- mov ax,0FF7Dh
- ret ; wake
-
-
- return_switch_key:
- ;-----------------
- sub al,PAD4_SCAN ; subtract bias
- push bx
- mov bx,offset switch_scan_table
- xlat bx
- pop bx
- sub ah,ah
- add ax,0FF70h ; like WMENU wants it
- ret
-
-
- return_key:
- ;----------
- sub ah,ah
- push cx
- call int16_entry@
- pop cx
- test al,al ; extended code
- jz ext
- sub ah,ah ; reg ascii
- jmps rk_ret
- ext:
- push cx
- call trans_pfk
- pop cx
- jnz no_kbd ; we really don't have a key
- got_cpm:
- xchg ah,al ; WMENU wants the index
- mov ah,0ffh
- rk_ret:
- ret
-
-
- status_only:
- ;-----------
- mov al,0ffh
- test wmenu_key$,al
- jnz st_done
- test switch_key$,al
- jnz st_done
- mov ah,1
- call int16_entry@
- mov al,0ffh
- jnz st_done
- sub ax,ax ! ret
- st_done:
- ret
- eject
-
- ;************************************************
- ;* *
- ;* ESCAPE PFK PROGRAMMING SUPPORT *
- ;* *
- ;************************************************
-
- z_prog_pfk@:
- ;-----------
- ; esc : - program a programmable function key
-
- call leave_until_char@
- push es
- push ds ! pop es ; local es for scan
- mov di,offset pfk_code_tbl
- mov dx,di ; save start addr
- mov cx,LOW_PFKS + HIGH_PFKS ; pfk count
- repnz scasb ; scan for legal code
- pop es
- jnz z_pfk_done ; done if not legal
-
- dec di ; correct overscan
- sub di,dx
- xchg ax,di ; ax = index value
- call point_pfk ; set pointer and count
-
- call leave_until_char@
- mov di,VS_PFK_PTR ; point to table entry
- mov [di],al ; store the value
- inc di
- mov VS_PFK_PTR,di ; bump the pointer
-
- test al,al ; if char = 0
- jz z_pfk_val1 ; then we're done
- dec VS_PFK_COUNT ; if entry is filled
- jz z_pfk_done ; we're also done
- ret ; if not, stay here
- z_pfk_val1:
- mov VS_PFK_COUNT,al ; zero the count
-
- z_pfk_done:
- jmp restore_state@ ; reset the vector
- eject
-
- z_pfk_off@:
- ;---------
- ; esc 6 - turn pfk expansion off
-
- mov VS_PFK_EXP,0 ; expansion flag false
- ret
-
- z_pfk_on@:
- ;---------
- ; esc 7 - turn pfk expansion on
-
- mov VS_PFK_EXP,0FFh ; expansion flag true
- ret
- eject
-
- ;********************************
- ;* *
- ;* KEYBOARD TABLES *
- ;* *
- ;********************************
-
- dseg
-
- ; PFK codes used for programming and no-exp returns:
-
- pfk_code_tbl$ db ';<=>?@ABCD' ; F1 - F10
- db 'GHIKMOPQRS' ; numeric pad
- db 'abcdefghij' ; alt F1 - F10
- db 'klmnopqrst' ; shift F1 - F10
- db 'uvwxyz{|}~' ; crtl F1 - F10
-
-
- ; List of extended codes which represent programmable keys:
- ; Same order as pfk_code_tbl.
- pfk_scan_list$ rb 0
- db 3Bh,3Ch,3Dh,3Eh,3Fh,40h ; unshifted F1-F10
- db 41h,42h,43h,44h
-
- db 47h,48h,49h ; pad home, up-arr, pgup
- db 4Bh,4Dh ; pad lft-arr, rt-arr
- db 4Fh,50h,51h,52h,53h ; pad end,dn-arr,pgdn,ins,del
-
- db 68h,69h,6Ah,6Bh,6Ch,6Dh ; alt F1-F10
- db 6Eh,6Fh,70h,71h
-
- db 54h,55h,56h,57h,58h,59h ; shift F1-F10
- db 5Ah,5Bh,5Ch,5Dh
-
- db 5Eh,5Fh,60h,61h,62h,63h ; ctrl F1-F10
- db 64h,65h,66h,67h
-
- PFK_SCAN_LIST_SIZE equ offset $ - offset pfk_scan_list$
-
- ; Console number to be returned by a screen-switch key stroke:
-
- switch_scan_table db 3 ; scan = 75, PAD 4
- db -1 ; 76, PAD 5
- db -1 ; 77, PAD 6
- db -1 ; 78, PAD +
- db 0 ; 79, PAD 1
- db 1 ; 80, PAD 2
- db 2 ; 81, PAD 3
- db -1 ; 82, PAD 0
- db -1 ; 83, PAD DEL
-
- ww_stat_flag db 0
- eject
-
- pfk_tbl0$ rb 0 ; for virtual console #0
-
- ; F1 - F10:
- db 'HELP',CR,0,' '
- db 'FM',CR,0,' '
- db 05h,0,' '
- db 'DIR',CR,0,' '
- db 'CHKDSK',CR,0,' '
- db 'DIR A:',CR,0,' '
- db 'FUNCTION',CR,0,' '
- db 'WMENU',CR,0,' '
- db 'DSKMAINT',CR,0,' '
- db 'STOP',CR,0,' '
- eject
- ; numeric keypad:
- dw 11h,0, 05h,0, 17h,0, 13h,0, 04h,0
- dw 01h,0, 18h,0, 06h,0, 16h,0, 07h,0
- ; dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7Fh,0
- ; alt F1 - alt F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- ; shift F1 - shift F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- ; ctrl F1 - crtl F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- eject
-
- pfk_tbl1$ rb 0 ; for virtual console #1
-
- ; F1 - F10:
- db 'HELP',CR,0,' '
- db 'FM',CR,0,' '
- db 05h,0,' '
- db 'DIR',CR,0,' '
- db 'CHKDSK',CR,0,' '
- db 'DIR A:',CR,0,' '
- db 'FUNCTION',CR,0,' '
- db 'WMENU',CR,0,' '
- db 'DSKMAINT',CR,0,' '
- db 'STOP',CR,0,' '
- eject
- ; numeric keypad:
- dw 11h,0, 05h,0, 17h,0, 13h,0, 04h,0 ; for cmd line edit
- dw 01h,0, 18h,0, 06h,0, 16h,0, 07h,0
- ; dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7Fh,0
- ; alt F1 - alt F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- ; shift F1 - shift F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- ; ctrl F1 - crtl F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- eject
-
- pfk_tbl2$ rb 0 ; for virtual console #2
-
- ; F1 - F10:
- db 'HELP',CR,0,' '
- db 'FM',CR,0,' '
- db 05h,0,' '
- db 'DIR',CR,0,' '
- db 'CHKDSK',CR,0,' '
- db 'DIR A:',CR,0,' '
- db 'FUNCTION',CR,0,' '
- db 'WMENU',CR,0,' '
- db 'DSKMAINT',CR,0,' '
- db 'STOP',CR,0,' '
- eject
- ; numeric keypad:
- dw 11h,0, 05h,0, 17h,0, 13h,0, 04h,0 ; for cmd line edit
- dw 01h,0, 18h,0, 06h,0, 16h,0, 07h,0
- ; dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7Fh,0
- ; alt F1 - alt F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- ; shift F1 - shift F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- ; ctrl F1 - crtl F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- eject
-
- pfk_tbl3$ rb 0 ; for virtual console #3
-
- ; F1 - F10:
- db 'HELP',CR,0,' '
- db 'FM',CR,0,' '
- db 05h,0,' '
- db 'DIR',CR,0,' '
- db 'CHKDSK',CR,0,' '
- db 'DIR A:',CR,0,' '
- db 'FUNCTION',CR,0,' '
- db 'WMENU',CR,0,' '
- db 'DSKMAINT',CR,0,' '
- db 'STOP',CR,0,' '
- eject
- ; numeric keypad:
- dw 11h,0, 05h,0, 17h,0, 13h,0, 04h,0 ; for cmd line edit.
- dw 01h,0, 18h,0, 06h,0, 16h,0, 07h,0
- ; dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7Fh,0
- ; alt F1 - alt F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- ; shift F1 - shift F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- ; ctrl F1 - crtl F10:
- dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- eject
-
- ;********************************************************
- ;* *
- ;* PC MODE KEYBOARD SUPPORT *
- ;* *
- ;********************************************************
-
- ; Code and data required for PC_MODE keyboard support in XIOS
- ; MPV 22 NOV 83.
-
- cseg
-
- ;==========
- pc_shifts@:
- ;==========
- ; New XIOS function 33 returns current vc shift states;
- ; Returns shift byte in AL:
- ;
- ; **** NOW with ADDED status bits ****
- ; returns extended keyboard shift status in AH
-
- mov ch,0
- test NX_natnlstat$,NX_nkbd_bit ; is it US keyboard
- jz norm_kbd ; yes...
- test NX_kbd_type$,NX_enhanced ; international enchanced keyboard
- jz norm_kbd ; no .. normal keyboard
- mov ch,1
- norm_kbd:
- push ds
- mov ax,PC_SEGMENT
- mov ds,ax
- mov ah,kb_flag_1_40
- and ah,SYS_SHIFT
- mov cl,5
- shl ah,cl
- mov al,kb_flag_1_40
- and al,73h ; get rid of sys_shift,hold and insert
- or ah,al ; mash into AH
- mov al,kb_flag_3_40 ; get extended status bits
- and al,0ch ; remove hidden flag bits
- or ah,al ; and merge
-
- mov al,kb_flag_40 ; get normal status bits into al
- or ch,ch
- jz norm_kbd1
- test kb_flag_1_40,L_ALT ;; is left ALT down
- jnz norm_kbd1 ; yes
- and al,not ALT_BIT ; else make sure no ALT status
- norm_kbd1: ; bit from Right ALT key
- pop ds
- ret
-
-
- ;=======
- pc_kbd@:
- ;=======
- ; New XIOS function 32 switches VC input mode to/from PC MODE
- ; and also sets up the display for 25 lines without status line
- ; The COMMAND processor checks the ATTRIBUTES field in the CCB
- ; before loading a DOS process to check that the virtual console
- ; provides all the video services required by the DOS process as
- ; defined in its PIF data.
- ; If no PIF data available function is called with value
- ; as set in ATTRIBUTES field of CCB.
- ; (see :- CCB definition in PUBDATA.A86)
- ;
- ; entry: dl = vcons number
- ; cl = following Bits used
- ; Bit 0 : = set when DOS program executes
- ; reset on termination
- ; Bit 1 : = process requires 25 lines
- ; Bit 2 : = process uses ANSI escape sequences
- ; Bit 3 : = process uses Ros INT 10h
- ; Bit 4 : = process accesses PC video hardware
- ;
- ; exit: ax = 0 success ax = 0FFFFh failure
-
- cmp dl,NUM_VIR_CONS ; see if dl is too big
- jb pc_kbd_good ; if it isn't, skip
- if SR
- call test_srterm@ ; test if SUN RIVER main console
- jnz pc_kbd_good ; yes..
- endif
- mov ax,0FFFFh ; if one of the serial consoles
- ret ; then deny pc-mode
-
- pc_kbd_good:
- push cx ; save enable/disable
- push dx ; save the vc number
- call point_vs@ ; bx -> virtual con structure
- mov VS_PC_SHIFTS,0 ; clear the shift flags
- test cl,1
- jz disable_pcmode
-
- mov al,VS_SCREEN_MODE ; get the current screen mode
- mov VS_SCREEN_SAVE,al ; store
- or VS_MODE,PCMODE_BIT ; turn on the PC Mode
- mov al,CRT_ROWS_C ; assume 24 lines
- test cl,CA_25LINES ; do we require 25 line mode
- jz set_lines ; no
- mov al,CRT_ROWS_P ; set 25 lines
- set_lines:
- mov VS_CRT_ROWS,al
- test cl,CA_HARDWARE ; do we require screen writes
- jz is_full ; no
- call check_full@ ; see if it's full
- jz is_full ; skip if full
- mov dl,VS_NUMBER
- call ww_full_window@ ; make 25 line DOS app full
- is_full:
- jmp set_pc_window ; if full, redo the window
-
- disable_pcmode:
- mov ax,timer_count$ ; set by INIT or SETUP
- out TIMER_0_REG,al ; in case some nasty pc mode
- mov al,ah ; program has hammered it.
- out TIMER_0_REG,al
-
- test VS_MODE1,LINE_43_MODE ; if 43 line mode ?
- jnz change_to_alpha ; force mode change
- mov al,VS_SCREEN_SAVE ; if the old mode is the same as the
- cmp VS_SCREEN_MODE,al ; new, then skip the reset
- jz disable_pcmode1
-
- ; Here we want to skip the change-to-alpha if the former mode was 3 and
- ; the new one is 2, to leave any final DOS pgm. messages on the screen. But,
- ; change the mode variable to 3 because the statline driver requires that.
- cmp al,03
- jne change_to_alpha
- cmp VS_SCREEN_MODE,02
- jne change_to_alpha ; 3-2, skip change but fake-out
- mov VS_SCREEN_MODE,al
- mov switch_flag,1 ; must do io_switch before exit
- jmps disable_pcmode1
-
- change_to_alpha:
- mov cl,VS_SCREEN_SAVE ; get ROS mode
- push bx
- call set_screen@ ; do mode switch
- pop bx
-
- disable_pcmode1:
- cmp VS_CRT_ROWS,CRT_ROWS_C ; is old mode set to cpm size
- je no_lf
- mov dx,VS_CURSOR
- call vc_out_lf@ ; force a scroll if at bottom
- mov dx,VS_CURSOR
- call z_up@ ; then move up a line to restore
- no_lf:
- and VS_MODE,not PCMODE_BIT ; turn pc mode off
- mov VS_CRT_ROWS,CRT_ROWS_C ; set to cpm size
-
- ; Restore the cursor in case pc mode did something funny:
- or VS_MODE,CURSOR_BIT ; make sure cursor on
- mov cx,MONO_CURSOR
- cmp VS_SCREEN_MODE,07 ; if color monitor, skip
- je disable_color
- mov cx,var_cursor
- disable_color:
- push cx
- call trans_cur_type@ ; update VS_CUR_TYPE_HW
- pop cx
-
- mov VS_CUR_TYPE,cx
- mov ah,1 ; int 10 function #
- call int10_entry@ ; set cursor type
- call show_cursor@ ; display correct cursor
-
- set_pc_window:
- pop dx
- push dx
- cmp VS_ROWSB,CRT_ROWS_C ; if neither 24 or 25 lines
- jb set_pc_statline ; then skip
-
- mov al,CRT_COLS
- cmp VS_COLSB,al ; clear zf if wrong width
- jnz set_pc_statline
-
- ; So, we have a full screen, better make a whole new window:
-
- mov ah,VS_CRT_ROWS
- sub ax,0101h ; bottom right corner
- push ax
- call get_all_mxs@ ;; lock out the world
- cmp dl,top_screen$ ; if we're not top screen exit
- jne set_pc_statlinea
- call copy_full_top@ ;; update the image
- set_pc_statlinea:
- pop ax
- mov VS_BOT_RIGHT,ax ;; save new b_r corner
- mov VS_TOP_LEFT,0 ;; make sure of t_l too
- push bx
- call new_pc_window@ ;; special pc mode entry
- pop bx
-
- set_pc_statline:
- pop dx ; restore vc number
- cmp dl,top_screen$ ; now, if we're the top screen
- jnz set_pc_clear ; then take care of the
- call switch_statline@ ; status line switch
- mov al,0
- xchg al,switch_flag ; do we need to do switch
- cmp al,1
- jne set_pc_clear1
- push bx
- mov dl,top_screen$ ; do switch to restore
- ;;;;;; call io_switch@ ; status line update
- pop bx
- set_pc_clear1:
- if SR
- mov di,2*S_L_OFFSET ; point to physical statline
- mov cx,80 ; chars per line
- mov ax,blank$
- call put_crt_s@ ; store to our monitor
-
- mov dl,top_screen$ ; do switch to restore
- xor dh,dh
- mov si,dx
- shl si,1
- mov si,ccb_list$[si] ; get ccb pointer for VC
- mov dl,C_PC[si] ; logical physical console number
- mov cx,0
- push bx
- call io_statline@ ; force update of status line
- pop bx
- endif
- set_pc_clear:
- push dx ; #IJ
- call do_true_view@ ; correct cursor position
- pop dx ; #IJ
- pop cx ; restore enable/disable
- test cl,1 ; if disable then done
- jz set_pc_done
-
- cmp dl,top_screen$ ; #IJ if we're not the top screen
- jnz set_pc_done ; #IJ then do no more
-
- mov dx,VS_CURSOR
- call z_erase_eos@ ; clear from cursor to screen end
- set_pc_done:
- sub ax,ax ; always successful
- ret
-
- dseg
-
- switch_flag db 0
-
- end
-
- ; END OF CONIN.A86
-
-