⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 miscdemo.asm

📁 这是一些例程
💻 ASM
字号:
;* MISCDEMO - Invokes many of the assembly example procedures, most of them
;* demonstrating assembly language instructions and calls to the system BIOS.
;* MISCDEMO demonstrates how to:
;*
;*         -   determine hardware information
;*         -   display time and date while waiting for keystrokes
;*         -   play notes of any frequency on the speaker
;*         -   change the line mode for EGA or VGA systems
;*         -   create nondestructive pop-up windows
;*         -   execute another program as a child process
;*         -   create primitive handlers for Interrupts 1Bh, 23h, and 24h
;*         -   use procedures callable by C in assembly programs
;*         -   use simplified segment directives
;*         -   write model-independent procedures
;*         -   declare and initialize data with DUP, BYTE, WORD, and DWORD
;*         -   create structures with the STRUCT directive
;*         -   declare macros
;*         -   set up a dispatch table
;*
;* MISCDEMO.EXE is built from the following files:
;*    MISCDEMO.ASM - Main program
;*    MISC.ASM     - Assembly procedures for MISCDEMO
;*    COMMON.ASM   - Assembly procedures shared by other example programs
;*    DEMO.INC     - Include file with macros, structure declarations
;*
;* Procedures:  GetVidConfig    GetCurPos       VeriPrint       GetPSP
;*              WinOpen         VeriAnsi        VeriCop         GetVer
;*              WinClose        StrWrite        SetLineMode     NewBlockSize
;*              SetCurSize      GetKeyClock     BinToHex        IntToAsc
;*              SetCurPos       GetShift        Sound           Colors
;*              GetCurSize      GetMem          Pause           Exec
;*              WriteTTY        Initialize

        .DOSSEG
        .MODEL  small, pascal, os_dos
        INCLUDE demo.inc

NewBreak        PROTO   FAR
NewCtrlC        PROTO   FAR
NewCritErr      PROTO   FAR
DispMenu        PROTO   NEAR
Press           PROTO   NEAR
GetVidinfo      PROTO   NEAR
GetMemInfo      PROTO   NEAR
CheckPrinter    PROTO   NEAR
CheckAnsi       PROTO   NEAR
CheckCoproc     PROTO   NEAR
GetConfig       PROTO   NEAR
Speaker         PROTO   NEAR
SetLines        PROTO   NEAR
PopWindows      PROTO   NEAR
SetAttrs        PROTO   NEAR
ExecPgm         PROTO   NEAR

        .STACK
        .DATA

PGMSIZE EQU     500h                    ; Maximum program size in paragraphs
F1      EQU     59                      ; Extended code for first option key
F7      EQU     65                      ; Extended code for last option key
CLKROW  EQU     0                       ; Row for on-screen clock
CLKCOL  EQU     62                      ; Column for on-screen clock

;* Box - Macro to color portion of screen for effect. Not to be confused with
;* the WinOpen procedure, which is far more capable.
;*
;* Params:  Row1 - Screen row at top of box
;*          Col1 - Screen column at left side of box
;*          Row2 - Screen row at bottom of box
;*          Col2 - Screen column at right side of box

Box MACRO Row1, Col1, Row2, Col2
    LOCAL sk
    mov ax, 0600h                       ;; Scroll service
    mov bh, Filmono                     ;; Fill attribute
    .IF vconfig.adapter != MDA          ;; If color,
    mov bh, Filcolr                     ;;   use color fill attribute
    .ENDIF
    mov ch, Row1
    mov cl, Col1                        ;; CX = row/col for upper left
    mov dh, Row2
    mov dl, Col2                        ;; DX = row/col for lower right
    int 10h                             ;; Blank window area on screen
ENDM

OldMode BYTE    ?                       ; Original video mode
OldCurs WORD    ?                       ; Original cursor coordinates
KeepSeg PSEG    ?                       ; Segment addr, orig screen
Filcolr BYTE    1Fh, 20h, 3Bh, 4Eh      ; Color fill attributes
Filmono BYTE    70h, 89h, 78h, 1        ; Monochrome fill attributes
Fill    BYTE    7                       ; Default attribute for menu
Filsub  BYTE    ?                       ; Fore/background colors in submenu

PresMsg BYTE    ". . . press a key to continue", 0
yes     BYTE    "yes"
no      BYTE    "no "

; Main menu text

Menu1   BYTE    "***  MISC Demonstration Program  ***", 0
Menu2   BYTE    "F1  System Configuration", 0
Menu3   BYTE    "F2  Speaker Test", 0
Menu4   BYTE    "F3  Toggle Line Mode", 0
Menu5   BYTE    "F4  Windows", 0
Menu6   BYTE    "F5  Screen Colors", 0
Menu7   BYTE    "F6  Exec Program", 0
Menu8   BYTE    "Select an option, or press ESC to quit:", 0

; Option F1 - System Configuration

MonoStr BYTE    "monochrome"
ClrStr  BYTE    "color     "
AdapStr BYTE    "MDA CGA MCGAEGA VGA "
VidMsg1 BYTE    "Adapter:                 xxxx", 0
VidMsg2 BYTE    "Display:                 xxxxxxxxxx", 0
VidMsg3 BYTE    "Mode:                    xx", 0
VidMsg4 BYTE    "Rows:                    xx", 0
MemMsg1 BYTE    "Total memory:            xxxx Kb", 0
MemMsg2 BYTE    "Available memory:        xxxx Kb", 0
PrnMsg  BYTE    "Printer ready:           xxx", 0
AnsiMsg BYTE    "ANSI driver installed:   xxx", 0
CopMsg  BYTE    "Coprocessor installed:   xxx", 0
LEN1    EQU     LENGTHOF CopMsg - 4

; Option F3 - Toggle Line Mode

LineMsg BYTE    "Line mode reset available only for EGA or VGA", 0

; Option F4 - Windows

WinMsg  BYTE    "WINDOW x", 0
LEN3    EQU     LENGTHOF WinMsg - 2

; Option F5  Screen Colors

CMsg1   BYTE    "Toggle                   Step", 0
CMsg2   BYTE    "哪哪哪哪哪哪哪哪         哪哪哪哪哪哪哪哪哪", 0
CMsg3   BYTE    "B  blink                 ", 27, 26, "  foreground", 0
CMsg4   BYTE    "I  intensity             ", 24, 25, "  background", 0
CMsg5   BYTE    "Foreground:  press F, then color number 0-7", 0
CMsg6   BYTE    "Background:  press A, then color number 0-7", 0
CMsg7   BYTE    "Color Numbers", 0
CMsg8   BYTE    "哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -