home *** CD-ROM | disk | FTP | other *** search
- page 55, 132
- .model SMALL
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Copyright (C) 1990 G. Adam Stanislav
- ;; All Rights Reserved
- ;;
- ;; Purpose:
- ;;
- ;; To show how AVATAR console can be accessed and used by
- ;; communications programs.
- ;;
- ;; AVATAR and AVATAR console are trademarks of
- ;; G. Adam Stanislav and Stanislav Publishing
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ; Equates
-
- FOSSIL equ 14h
- MULTIVIDEO equ 1Ah ; Video function of MULTIPLEX
- DOS equ 21h
- MULTIPLEX equ 2Fh
- VIDEO equ 29h
- KEYBOARD equ 79h ; AVATAR fastread interrupt
-
- CURSOR equ 08h ; ^H
- CLS equ 0Ch ; ^L
- DLE equ 10h ; ^P
- AVTCODE equ 16h ; ^V
- WINSWITCH equ 17h ; ^W
- QUERY equ 11h ; ^Q
- RESETWINDOWS equ 12h ; ^R
- WAKE equ 1Dh ; GS
-
- BEL equ 07h ; beep
- LF equ 0Ah ; line feed
- CR equ 0Dh ; carriage return
- EOS equ 24h ; end of string ('$')
-
- SHIFT_F1 equ 54h ; Shift-F1 scan code
-
- ; macros
-
- VERSION macro
-
- db "1.03"
-
- endm
-
- page
- .data
-
- comport dw 0 ; This is COM1. Change it as needed.
-
- notice db LF, "AVATERM, version "
- VERSION
- db CR, LF
- db "Copyright (C) 1990 G. Adam Stanislav.", CR, LF
- db "All Rights Reserved.", CR, LF, LF
- db "AVATAR and AVATAR console are trademarks of", CR, LF
- db "G. Adam Stanislav and Stanislav Publishing."
- db CR, LF, LF, EOS
- fatalmsg db "Fatal error: ", BEL, EOS
- nofosmsg db "FOSSIL not loaded or accessible.", CR, LF, EOS
- noavtcon db "AVATAR console not loaded.", CR, LF, EOS
-
- ; Save the original state of AVATAR console in a buffer, so you can restore
- ; it when exiting.
- origcount dw oslen
- origstate db 32 dup (0)
- oslen equ $-origstate
- origcursor db 8 dup(0)
- ocurlen equ $-origcursor
-
- ; This is what we want to set the driver to: 'a'ctive and converting 'g'ray
- ; keys all the time.
-
- activate db 'ag' ; Activate, gray-keys on.
- actlen equ $-activate
-
- ; Query the original wake state of the AVATAR console.
-
- wakequery db AVTCODE, QUERY, WAKE
- wqlen equ $-wakequery
-
- ; Save the original wake state
-
- origwake db AVTCODE, WAKE ; Just in case there is no reply.
- owlen equ $-origwake
-
- ; Ask the cursor position
- cursorquery db AVTCODE, QUERY, CURSOR
- curqlen equ $-cursorquery
-
- ; Wake up the interpreter, reset the windows, clear the screen.
- wakeupmsg db AVTCODE, WAKE
- db AVTCODE, RESETWINDOWS
- db CLS
- wumlen equ $-wakeupmsg
-
- ; Query the driver for its version.
- versionquery db AVTCODE, QUERY, QUERY
- vqlen equ $-versionquery
-
- ; Reset all AVATAR windows to their default values.
- resetmsg db AVTCODE, RESETWINDOWS
- resetlen equ $-resetmsg
-
- ; Help message
- helpmsg db CR, LF, LF
- db "Press Shift-F1 to hang up", CR, LF
- db "or to quit.", CR, LF, LF, EOS
-
- ; Switch to raw parser mode. If we call an AVT/0 system,
- ; that is the state we need to be in. If, on the other hand,
- ; we call an AVT/1 system, chances are it will start by issuing the
- ; reset command which will switch us to cooked mode.
- ;
- ; By the same token, we emulate an AVT/0 window. Let's call it
- ; window 'E' for Emulate. Remember that 'E' is really an ASCII
- ; number somewhere between 0-255, so it is an acceptable window
- ; handle. We will make it default to cyan color attribute as
- ; required by AVT/0 specs. We will make it cover the entire screen.
- ; An apparent problem is that we do not know what size the screen is.
- ; We could figure it out by querying window 0, which is always full
- ; screen. But there is an easier way. Obviously, upper left corner
- ; is at 1, 1. It is the lower right corner we do not know.
- ;
- ; But AVATAR console always compares the requested window size with
- ; the actual physical size of the screen. If the requested size is too
- ; big, AVATAR console will automatically shrink the request to fit
- ; within the available screen size.
- ;
- ; Thus, if we request the lower left corner to be -1, -1 (which is the
- ; same as the highest possible unsigned integer, as far as the computer
- ; is concerned), we will be well past the limit. AVATAR console will
- ; shrink our request. The result: Window 'E' covers the full screen.
- ;
- ; Once we have defined 'E' window, we switch in it. With raw parser
- ; mode, cyan default attribute and full screen, we are AVT/0 compatible.
- ; If we happen to be calling an AVT/1 system, this one will issue the
- ; reset command, and presto we are operating at AVT/1 level.
-
- rawmode db AVTCODE, "=R"
- db AVTCODE, AVTCODE, 'E' ; define window 'E'
- db 3 ; cyan
- db 1, 1 ; upper left corner
- db -1, -1 ; lower left corner
- db AVTCODE, WINSWITCH, 'E'
- rawmodelen equ $-rawmode
-
- ; Hang up message.
- hangupmsg db CR, LF, CR, LF
- db "Hanging up. Do you also want to quit? [y/N] ", EOS
-
- yesmsg db "Yes.", CR, LF, LF
- db "Bye-bye.", CR, LF, LF, EOS
-
- nomsg db "No, not yet!", CR, LF, LF, EOS
-
- page
- .code
-
- ; Routines to check/set the state of AVATAR console, either via
- ; AVATAR codes or direct driver manipulation:
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Check for the presence of AVATAR console.
- ;; If found, save its current state and return no carry.
- ;; Else, return carry.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- AVT_check:
-
- ; First, check if the driver is loaded at all
- mov ax, 1A00h
- mov bx, 'AV'
- mov cx, 'AT'
- mov dx, 'AR'
- int MULTIPLEX
-
- ; See if there is *any* CON driver at all. If so, AL = -1
- inc al
- jne AVT_check_CY ; Probably no CON driver loaded.
- ; Definitely no AVATAR CON driver.
-
- ; There is something there, see if it is AVATAR console
- cmp dx, AVTCODE
- jne AVT_check_CY ; Nope, it is some other driver.
-
- ; AVATAR console is there. Save its original state.
- mov cx, origcount
- lea di, origstate
-
- mov ax, (MULTIVIDEO shl 8) or '?' ; Query the device driver
- int MULTIPLEX
- jc AVT_check_CY ; Something's wrong!
- mov origcount, cx ; save the size of the reply
-
- ; Activate the driver. Make it convert gray keys to 0 plus scan code.
- mov ax, (MULTIVIDEO shl 8) or '!' ; Command the driver
- mov cx, actlen
- lea si, activate
- int MULTIPLEX
- jc AVT_check_CY ; Something's wrong again
-
- clc ; clear carry flag
- ret
-
-
- AVT_check_CY:
- stc
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Restore the state of AVATAR con as it was before we came in.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- AVT_restore:
- mov cx, origcount
- lea si, origstate
-
- mov ax, (MULTIVIDEO shl 8) or '!' ; send a command to driver
- int MULTIPLEX
-
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Wake up the AVT interpreter, if asleep, after saving its state.
- ;; Also reset all windows to their defaults and clear the screen.
- ;;
- ;; If the AVATAR keyboard is functional, read and display
- ;; the driver version.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- AVT_wakeup:
- ; First query its sleep state
- mov cx, wqlen
- lea si, wakequery
- call AVT_print
-
- ; Read and save the reply.
- int KEYBOARD ; This is a faster alternative to DOS.
- ; It returns carry and AX=FFFF if no char is
- ; pending for input. Otherwise, it returns
- ; no carry and character in AX (AH=0).
- jc AVT_wakeup_RET ; Nothing there, return to caller.
-
- cmp al, AVTCODE ; Make sure it is a reply.
- jne AVT_wakeup_RET ; An artifact. Ignore it.
-
- int KEYBOARD ; Read the state.
- mov origwake[1], al ; Save it.
-
- call driver_version
-
- AVT_wakeup_RET:
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Restore the original state of the interpreter.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- int_restore:
- mov cx, owlen
- lea si, origwake ; Write the string returned by initial query.
- call AVT_print
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Query the driver for its version. Display the reply.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- driver_version:
- ; First, send the query to the driver.
- mov cx, vqlen
- lea si, versionquery
- call AVT_print
-
- ; Now read the reply and print it. Do so until the character
- ; read and printed is a CR.
- dr_ver_print:
- int KEYBOARD ; Read a character,
- int VIDEO ; write it,
- cmp al, CR ; check if it is the last one.
- jne dr_ver_print ; If it is not, read some more.
-
- ; Print two line feeds.
- mov al, LF
- int VIDEO
- mov al, LF
- int VIDEO
-
- ; Return to the caller.
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Emulate AVT/0. See detailed discussion in DATA section above.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- emulate:
- mov cx, curqlen
- lea si, cursorquery
- call AVT_print ; find cursor position
- sub cx, cx ; initialize counter
- lea di, origcursor
-
- emuloop:
- int KEYBOARD
- jc outofemuloop
- stosb
- inc cx
- cmp cx, ocurlen
- jb emuloop
-
- outofemuloop:
- push cx
-
- mov cx, rawmodelen
- lea si, rawmode
- call AVT_print
-
- pop cx
- jcxz emuret
- lea si, origcursor
- ; At this point *we* are in raw mode, but the information at
- ; origcursor is pre-cooked. We have to un-cook it if need be.
- lodsb
- int VIDEO ; presumably AVTCODE
- dec cx
- jcxz emuret
- lodsb
- int VIDEO ; presumably CURSOR
- dec cx
- jcxz emuret
- lodsb
- dec cx
- cmp al, DLE
- jne emu_1
- jcxz emuret
- lodsb
- and al, 1Fh ; turn to raw code
-
- emu_1:
- int VIDEO
- dec cx
- jcxz emuret
- lodsb
- cmp al, DLE
- jne emu_2
- lodsb
- and al, 1Fh
-
- emu_2:
- int VIDEO
-
- emuret:
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Reset all AVATAR windows to their default values.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- AVT_reset:
- mov cx, resetlen
- lea si, resetmsg
- call AVT_print
- ret
-
- page
- ; Console (via AVATAR) input and output routines:
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Print a string at DS:SI of CX bytes to AVATAR console
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- AVT_print:
- ; Get the first (or next) character.
- lodsb ; Load byte from buffer.
- int VIDEO ; print character
-
- ; Continue printing in a loop until all characters of the
- ; string are printed.
- loop AVT_print
-
- ; When you come here, the printing is done. Return to the caller.
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Print an individual character in AL. Cook it if necessary.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- putchar:
- int VIDEO
- ret
-
- page
- ; Communications routines via FOSSIL driver:
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Check for the presence of a FOSSIL driver. Raise DTR.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- find_fossil:
- mov ah, 04h
- mov dx, comport
- int FOSSIL
-
- cmp ax, 1954h ; This will be there if FOSSIL is loaded.
- jne find_fossil_CY
-
- clc ; return success as no carry
- ret
-
- find_fossil_CY:
- stc ; return failure in carry flag
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Tell the FOSSIL we are leaving
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- bye_fossil:
- mov ah, 05h
- mov dx, comport
- int FOSSIL
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Check if a byte arrived at the modem
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- mdmcheck:
- mov ah, 0Ch
- mov dx, comport
- int FOSSIL
-
- ; returns AX = -1 if nothing available
- inc ax
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Read a byte from modem.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- getbyte:
- mov ah, 02h
- int FOSSIL
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Send a byte in AL to the modem.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- putbyte:
- mov ah, 01h
- mov dx, comport
- int FOSSIL
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Hang up the phone.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- hang_up:
- ; Lower DTR.
- mov ax, 0600h
- mov dx, comport
- int FOSSIL
-
- ; Create a minimal delay.
- jmp $+2
-
- ; Check for CD
- mov ah, 03h
- mov dx, comport
- int FOSSIL
- test al, 80h
- jne hang_up
-
- ; Raise DTR again.
- mov ax, 0601h
- mov dx, comport
- int FOSSIL
-
- ; Reset the Avatar driver.
- call AVT_reset
-
- ; Switch to AVT/0 emulation.
- call emulate
-
- ; Return to the caller.
- ret
-
- page
- ; The main section of the program
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; This is where the program starts its execution. Check and
- ;; set up everything conceivable.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- begin:
- call disable_ctlC
-
- mov ax, _data
- mov ds, ax
- mov es, ax
-
- ; We are calling AVT_check before saying hello. Otherwise,
- ; AVT_check would erase our greetings. So, we call this first,
- ; save the result (PUSHF) and restore it (POPF) after hello
-
- call AVT_check
- pushf
-
- ; say hello
- mov ah, 09h
- lea dx, notice
- int DOS
-
- popf
- jc no_AVATAR
-
- call find_fossil
- jc no_fossil
-
- call AVT_wakeup
-
- call help
-
- call emulate
-
- call terminal
-
- call cleanup
-
- ; exit to DOS with errorlevel = 0
- mov ax, 4C00h
- int DOS
-
- no_fossil:
- call fatal
- mov ah, 09h ; print warning message
- lea dx, nofosmsg
- int DOS
-
- ; exit with errorlevel = 1
- mov ax, 4C01h
- int DOS
-
- no_AVATAR:
- call fatal
- mov ah, 09h ; print warning message
- lea dx, noavtcon
- int DOS
-
- ; exit with errorlevel =2
- mov ax, 4C02h
- int DOS
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; This is the terminal itself. It is a simple loop which checks
- ;; the keyboard for any keystrokes and modem input.
- ;;
- ;; The keystrokes are sent to the modem with the exception of
- ;; Shift-F1 which AVATAR PC keyboard emulator saves for the use
- ;; of the terminal. We use it to hang up and to quit.
- ;;
- ;; The modem input is sent to the console.
- ;;
- ;; Obviously, in a full-fledged communications program you need
- ;; much more activity to be going on. But this program is here
- ;; only to demonstrate the use of AVATAR console with a terminal
- ;; program.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- terminal:
-
- int KEYBOARD ; See if a key was pressed. If so, read it.
- jc terminal_3
-
- ; A key was pressed. See what it is.
- or al, al ; This means: if AL <> 0
- jne terminal_2
-
- ; A function key was received. Need further checking.
- call function_key
- jc terminal_out ; This was the "quit" key.
- jmp short terminal_3
-
- terminal_2:
- call putbyte ; Send the character received out.
-
- terminal_3:
- call mdmcheck ; Anything in the modem?
- jz terminal ; No, continue the loop
-
- ; Yes, receive and print it.
- call getbyte
- call putchar
- jmp terminal ; Continue the loop.
-
- terminal_out: ; Quit.
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; A function key was received. If it is Shift-F1, process it.
- ;; Else, send it out.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- function_key:
- ; Receive the scan code from the AVATAR console /stdin
- int KEYBOARD
- cmp al, SHIFT_F1
- je function_key_1
-
- ; It is not a shift-F1. Send out a 0 followed by the scan code.
- push ax
- sub al, al ; AL = AL - AL = 0 (These assembly language
- ; programmers are weird. :-)
- call putbyte
- pop ax
- call putbyte
- clc
- ret
-
- function_key_1:
- ; A shift-F1 was pressed. First hang up.
- call hang_up
-
- ; Now ask if we should quit
- mov ah, 09
- lea dx, hangupmsg
- int DOS
-
- ; Get the answer. Loop if necessary.
- function_key_2:
- mov ax, 0C07h ; Clear the input buffer. Then read.
- int DOS
-
- ; See what you got
- cmp al, CR
- je function_key_NO
-
- cmp al, 'n'
- je function_key_NO
-
- cmp al, 'N'
- je function_key_NO
-
- cmp al, 'y'
- je function_key_YES
-
- cmp al, 'Y'
- je function_key_YES
-
- ; Check for smart allecks here:
- cmp al, LF
- jne function_key_2 ; Try again
-
- function_key_NO:
- ; print "No", clear carry and return
- mov ah, 09h
- lea dx, nomsg
- int DOS
- clc
- ret
-
- function_key_YES:
- ; Print "Yes", set carry and return
- mov ah, 09h
- lea dx, yesmsg
- int DOS
- stc
- ret
-
- page
- ; System support routines
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Disable ^C break.
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- disable_ctlC:
- mov ax, 2523h ; set vector for int 23h
- lea dx, dummy_interrupt
- push cs
- pop ds
- int DOS
- ret
-
- dummy_interrupt:
- iret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Print fatal error message
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- fatal:
- mov ah, 09h
- lea dx, fatalmsg
- int DOS
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Print initial help message
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- help:
- mov ah, 09h
- lea dx, helpmsg
- int DOS
- ret
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; Restore all defaults
- ;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- cleanup:
- call AVT_reset ; This will also set the cooked mode.
- call int_restore
- call AVT_restore
- call bye_fossil
- ret
-
- ; N.B. There is no need to restore the original ^C handler.
- ; DOS will take care of it for us.
-
- .stack
-
- dw 512 dup(1990h)
-
- end begin
-
-