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

📄 system.inc

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 INC
📖 第 1 页 / 共 2 页
字号:
;none.
;
;On Exit:
;
;AL     - ASCII character code.
;AH     - Hardware key code.
;EAX high word  - Shift keys status word from 417h.
;
;*******************************************************************************
        externdef GetKey:near
SK_SHIFTR       equ     1
SK_SHIFTL       equ     2
SK_CTRL equ     4
SK_ALT  equ     8
SK_SCROLL       equ     16
SK_NUM  equ     32
SK_CAPS equ     64
SK_INS  equ     128


;******************************************************************************
;
;Convert a string to upper case.
;
;Usage: strupr(string);
;
;Returns:
;
;All registers preserved.
;
;******************************************************************************
        externdef strupr:near


;*******************************************************************************
;Print null terminated string on screen via DOS.
;
;Usage: PrintString(char *buffer);
;
;buffer - pointer to string to print.
;
;*******************************************************************************
        externdef PrintString:near


;*******************************************************************************
;Convert number into decimal ASCII.
;
;Usage: Bin2Dec(int num, char *buffer);
;
;num    - Number to convert.
;buffer - Buffer to put it in.
;
;On Exit:
;
;EAX    - Next available byte in buffer.
;
;All other registers preserved.
;
;*******************************************************************************
        externdef Bin2Dec:near


;*******************************************************************************
;Convert decimal zero terminated ASCII string into binary value.
;
;Usage: Dec2Bin(char *buffer, int *result);
;
;buffer - pointer to source string
;result - int to recieve the result.
;
;Returns:
;
;EAX    - status, 0=ok, none-zero=invalid character.
;
;All other registers preserved.
;
;*******************************************************************************
        externdef Dec2Bin:near


;*******************************************************************************
;Convert number into ASCII Hex version.
;
;Usage: Bin2Hex(int num, int digits, char *buffer);
;
;num    - Number to convert.
;digits - Digits to do.
;buffer - Buffer to put string in.
;
;On Exit:
;
;EDI    - Next un-used byte in buffer.
;
;All other registers preserved.
;
;*******************************************************************************
        externdef Bin2Hex:near


;*******************************************************************************
;Convert numerical zero terminated expresion into binary value.
;
;Usage: ASCII2Bin(char *buffer, int *result);
;
;buffer - pointer to source string
;result - int to recieve the result.
;
;Returns:
;
;EAX    - status, 0=ok, none-zero=invalid character.
;
;All other registers preserved.
;
;*******************************************************************************
        externdef ASCII2Bin:near


;*******************************************************************************
;Read the command line tail for parameters.
;
;supports / or - or + as switch/option settings. Options and names may be in
;any order, text can be tagged onto options, names must be in correct sequence
;for current program.
;
;Each character ( 33 to 127) has an entry in OptionTable & OptionTable+128.
;
;The first entry is a byte, and is 0 for OFF & none-zero for ON.
;The second entry is a pointer to any additional text specified, 0 means none.
;Entries 0-32 are reserved for text not preceded by - or + or /. These are
;intended to be file names, but neadn't be.
;All text entries are 0 terminated.
;
;OptionCounter   - Total command line parameters (files & switches).
;OptionTable     - Switch table, ASCII code is index to check.
;OptionPointers - Pointer table, ASCII code*4 is index to use.
;
;Usage: ReadCommand();
;
;Returns:
;
;EAX    - number of none-switch strings (file names).
;
;*******************************************************************************
        externdef ReadCommand:near
        externdef OptionCounter:byte
        externdef OptionTable:byte
        externdef OptionPointers:dword


;*******************************************************************************
;
;Return the true/false value of a config file option.
;
;Usage: cfgGetOnOff(filename,section,variable,result);
;
;filename       - name of the config file.
;section        - section name.
;variable       - variable/option text.
;result - address to put the result.
;
;Returns:
;
;EAX    - status code.
;       0=all ok, result updated.
;       1=file not found.
;       2=section not found.
;       3=option not found.
;       4=file I/O error occured.
;       5=invalid option value.
;
;The option can be: ON or OFF, 1 or 0, YES or NO, TRUE or FALSE
;ON,0,YES & TRUE are returned as none-zero, OFF,0,NO and FALSE as zero.
;
;*******************************************************************************
        externdef cfgGetOnOff:near


;*******************************************************************************
;
;Return the integer value of a config file option.
;
;Usage: cfgGetInt(filename,section,variable,result);
;
;filename       - name of the config file.
;section        - section name.
;variable       - variable/option text.
;result - address to put the result.
;
;Returns:
;
;EAX    - status code.
;       0=all ok, result updated.
;       1=file not found.
;       2=section not found.
;       3=option not found.
;       4=file I/O error occured.
;       5=invalid option value.
;
;*******************************************************************************
        externdef cfgGetInt:near


;*******************************************************************************
;
;Set the integer value of a config file option.
;
;Usage: cfgSetInt(filename,section,variable,value);
;
;filename       - name of the config file.
;section        - section name.
;variable       - variable/option text.
;value  - value to write.
;
;Returns:
;
;EAX    - status code.
;       0=all ok, value updated.
;       1=file not found.
;       2=section not found.
;       4=file I/O error occured.
;       5=invalid option value.
;
;*******************************************************************************
        externdef cfgSetInt:near


;*******************************************************************************
;
;Return the integer list of values of a config file option.
;
;Usage: cfgGetInts(filename,section,variable,results,maxres);
;
;filename       - name of the config file.
;section        - section name.
;variable       - variable/option text.
;results        - address to put the results.
;maxres - maximum number of results.
;
;Returns:
;
;EAX    - status code.
;       0=all ok, result updated.
;       1=file not found.
;       2=section not found.
;       3=option not found.
;       4=file I/O error occured.
;       5=invalid option value.
;       6=maxres reached with more values to come.
;
;*******************************************************************************
        externdef cfgGetInts:near


;*******************************************************************************
;
;Return the string assigned to a config file option.
;
;Usage: cfgGetString(filename,section,variable,result,maxlen);
;
;filename       - name of the config file.
;section        - section name.
;variable       - variable/option text.
;result - address to put the result.
;maxlen - maximum string length.
;
;Returns:
;
;EAX    - status code.
;       0=all ok, result updated.
;       1=file not found.
;       2=section not found.
;       3=option not found.
;       4=file I/O error occured.
;       5=invalid option value.
;       6=maxlen exceded.
;
;*******************************************************************************
        externdef cfgGetString:near


;*******************************************************************************
;
;Set the string value of a config file option.
;
;Usage: cfgSetString(filename,section,variable,value);
;
;filename       - name of the config file.
;section        - section name.
;variable       - variable/option text.
;value  - address of string to write.
;
;Returns:
;
;EAX    - status code.
;       0=all ok, value updated.
;       1=file not found.
;       2=section not found.
;       4=file I/O error occured.
;       5=invalid option value.
;
;*******************************************************************************
        externdef cfgSetString:near


;*******************************************************************************
;
;Delete a config file option.
;
;Usage: cfgDelOption(filename,section,variable);
;
;filename       - name of the config file.
;section        - section name.
;variable       - variable/option text.
;
;Returns:
;
;EAX    - status code.
;       0=all ok, value updated.
;       1=file not found.
;       4=file I/O error occured.
;
;*******************************************************************************
        externdef cfgDelOption:near


;*******************************************************************************
;
;Find a config file option within a [section]
;
;Usage: cfgFindSectionOption(handle,section,variable);
;
;handle - file handle to search.
;section        - section name.
;variable       - variable/option text.
;
;Returns:
;
;EAX    - status code.
;       0=option found.
;       1=reserved.
;       2=section not found.
;       3=option not found.
;       4=file I/O error occured.
;
;The file is searched from the current position so it's up to the caller to
;make sure it starts in the right place.
;
;*******************************************************************************
        externdef cfgFindSectionOption:near


;*******************************************************************************
;
;Find a config file [section]
;
;Usage: cfgFindSection(handle,section);
;
;handle - file handle to search.
;section        - section name to search for.
;
;Returns:
;
;EAX    - status code.
;       0=section found.
;       1=section NOT found.
;       2=file I/O error.
;
;The file is searched from the current position so it's up to the caller to
;make sure it starts in the right place.
;
;*******************************************************************************
        externdef cfgFindSection:near


;*******************************************************************************
;
;Find an option within current section.
;
;Usage: cfgFindOption(handle,variable);
;
;handle - file handle to search.
;variable       - option text to find.
;
;Returns:
;
;EAX    - status code.
;       0=option found.
;       1=option NOT found.
;       2=file I/O error.
;
;The file is searched from the current position so it's up to the caller to
;make sure it starts in the right place. A line with "[" as the first character
;or EOF will be treated as the end of the section.
;
;*******************************************************************************
        externdef cfgFindOption:near
        externdef cfgIOBuffer:byte


;*******************************************************************************
;Generate list of files that match a given file mask. Wild cards permitted.
;
;Usage: MakeFileList(char *filename, int attribs);
;
;filename       - File name mask (can include a path).
;attribs        - search attributes.
;
;On Exit:
;
;EAX    - buffer with file names etc, EAX=0 if not enough memory.
;
;Each entry in the buffer will have the following format.
;
;13 bytes zero terminated ASCII file name (may be less)
; 1 byte file attribute (directory,vulume,hidden,system etc.)
;
; If you specify directories in the attribute search mask the names . & .. will
; be removed from the list to avoid making special checks for them. Anything
; that might have found these useful will have to have knowledge of its
; current path anyway.
;
;
;Attributes are as follows:-
;
;  5  4  3  2  1  0
;  |  |  |  |  |  |
;  |  |  |  |  |  \_ Read only. (1)
;  |  |  |  |  \____ Hidden.    (2)
;  |  |  |  \_______ System.    (4)
;  |  |  \__________ Label.     (8)
;  |  \_____________ Directory. (16)
;  \________________ Archive.   (32)
;
; Bits 6-15 are reserved and may be used in the search mask, but bits 8-15 won't
; appear in the attributes for listed files.
;
; The first dword in the buffer is the number of entries.
; Next 256 bytes is the path to append the names to.
;
;*******************************************************************************
        externdef MakeFilelist:near


;*******************************************************************************
;Make a full drive:path\file name from a file list path string and specified
;file name.
;
;Usage: FilelistMakeName(int entry, void *filelist, void *buffer);
;
;entry  - entry number to make name from.
;filelist       - pointer to file list.
;buffer - pointer to destination buffer.
;
;Returns:
;
;ALL registers preserved.
;
;Name in a file list are just the 8.3 portion. A more useful name can be made
;by combineing the path string from the start of the list buffer with the file
;name which this routine does.
;
;*******************************************************************************
        externdef FilelistMakeName:near


;*******************************************************************************
;Convert normal names to lower case and directory names to upper case.
;
;Usage: ULFileList(void *filelist);
;
;filelist       - pointer to file list.
;
;On Exit:
;
;ALL registers preserved.
;
;Most routines that need to display a file list want directory names in upper
;case and the remaining names in lower case. This routine formats a file list
;to that specification. Doing things this way means that if the file list is
;then sorted, directory names will appear at the top.
;
;*******************************************************************************
        externdef ULFilelist:near


;*******************************************************************************
;Sort a file list into alpha-numeric order. Assumes you want DIR's at the top
;of the list.
;
;Usage: SortFileList(void *filelist);
;
;filelist       - pointer to file list to sort.
;
;On Exit:
;
;ALL registers preserved.
;
;File names are not case converted so upper case names will appear at the top
;of the list.
;
;*******************************************************************************
        externdef SortFilelist:near


;*******************************************************************************
;Wait for a while.
;
;Usage: Delay(int period);
;
;Returns:
;
;nothing.
;
;*******************************************************************************
        externdef Delay:near


;*******************************************************************************
;This gets used in variables that need a valid destination that doesn't actually
;do anything. Saves keep checking for zero before makeing a CALL or JMP.
;*******************************************************************************
        externdef DummyRET:near



⌨️ 快捷键说明

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