📄 rxdosini.asm
字号:
; ax comment character(s) ;
; cx current line count ;
; ss:di line read from disk ;
; ;
; This reads through blocks and changes each block to a REM ;
; block that was not selected as a menu option. ;
;...............................................................;
configRemoveComments:
call _skipSpaces
push di ; save buffer pointer
cmp ah, 0 ; double character comments ?
jnz configRemoveComments_12 ; yes -->
configRemoveComments_06:
cmp al, byte ptr ss:[ di ] ; is it comment character ?
jz configRemoveComments_20 ; yes -->
inc di
loop configRemoveComments_06
jmp short configRemoveComments_20
configRemoveComments_12:
cmp ax, word ptr ss:[ di ] ; is it comment character ?
jz configRemoveComments_20 ; yes -->
inc di
loop configRemoveComments_12
configRemoveComments_20:
mov cx, di
pop di
sub cx, di ; new length
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Find Statement Type ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; ax config item type ;
; es:di configure table. ;
;...............................................................;
_findStatementType:
cmp word ptr es:[ configType ][ di ], CONFIGTYPE_ENDOFARGS
jnz _findStatementType_08
stc
ret
_findStatementType_08:
cmp ax, word ptr es:[ configType ][ di ] ; is it menu type ?
jnz _findStatementType_12 ; if not, goto next -->
or di, di
ret
_findStatementType_12:
add di, word ptr es:[ configLength ][ di ]
jmp _findStatementType
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Config Statement Prompt ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; ax statement type ;
; es:di pointer to first non-space after keyword ;
;...............................................................;
ConfigPrompt:
Entry
ddef _configTextPtr, es, di
cmp word ptr es:[ di ], '=?' ; is it ?=
jz ConfigPrompt_12 ; yes, go prompt -->
cmp word ptr cs:[ F8_PromptRequired ], 0000 ; F8_prompt required ?
jz ConfigPrompt_24 ; no, go skip = if set -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; prompt statement
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConfigPrompt_12:
push ds
setDS cs
mov dx, offset msgProcessCommandYesNo
Int21 DisplayString
ConfigPrompt_16:
xor ax, ax
int 16h
call upperCase
cmp al, 'Y' ; check for Yes
jz ConfigPrompt_20 ;
cmp al, 'N' ; check for No
jnz ConfigPrompt_16
ConfigPrompt_20:
mov dl, al
Int21 DisplayOutput ; echo character
mov dx, offset msgNewLine
Int21 DisplayString
pop ds
getdarg es, di, _configTextPtr
cmp al, 'N' ; if No
stc ; set carry if No
jz ConfigPrompt_36 ; exit -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Skip ? and ?= and any spaces which follow
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConfigPrompt_24:
cmp word ptr es:[ di ], '=?' ; '?=' in prompt ?
jnz ConfigPrompt_26 ; no -->
inc di ; skip over question mark
ConfigPrompt_26:
cmp byte ptr es:[ di ], '=' ; '=' in prompt ?
jnz ConfigPrompt_28 ; no -->
inc di ; skip over equal sign
ConfigPrompt_28:
cmp byte ptr es:[ di ], ' ' + 1 ; space follows ?
jnz ConfigPrompt_32 ; no, return -->
inc di ; skip over equal sign
jmp ConfigPrompt_28 ; loop through all spaces -->
ConfigPrompt_32:
clc ; clear carry
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Skip ? and ?= if
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConfigPrompt_36:
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Skip To Next Argument ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Usage: ;
; es:di points to line buffer ;
;...............................................................;
_nextArgument:
cmp byte ptr es:[ di ], ' ' ; ignore spaces
jz _nextArgument_06
cmp byte ptr es:[ di ], '=' ; ignore equal signs
jz _nextArgument_06
cmp byte ptr es:[ di ], ',' ; ignore commas
jnz _nextArgument_08
_nextArgument_06:
inc di
jmp _nextArgument
_nextArgument_08:
cmp byte ptr es:[ di ], ' ' ; carry means end of line
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Process Menus ;
;...............................................................;
configMenu:
Entry
ddef _ConfigStatements, es, di
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; identify all common components as enabled.
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
configMenu_04:
mov ax, CONFIGTYPE_MENUBLOCK
mov bx, offset Config_CommonSelector
call _findConfigMenuStatement ; identify common components
jc configMenu_08 ; if none left -->
or word ptr es:[ configFlags ][ di ], CONFIGFLAG_ENABLED
add di, word ptr es:[ configLength ][ di ]
jmp configMenu_04
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; search for menu starter
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
configMenu_08:
mov ax, CONFIGTYPE_MENUBLOCK
mov bx, offset Config_MenuSelector
getdarg es, di, _ConfigStatements
call _findConfigMenuStatement
jc configMenu_68
; ...
configMenu_68:
Return
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Remove Unused Blocks ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; ES:DI Configure Table. ;
; ;
; This reads through blocks and changes each block to a REM ;
; block that was not selected as a menu option. ;
;...............................................................;
removeUnusedBlocks:
mov ax, CONFIGTYPE_MENUBLOCK
call _findStatementType ; find start of block
jc removeUnusedBlocks_32 ; if none left -->
removeUnusedBlocks_08:
test word ptr es:[ configFlags ][ di ], CONFIGFLAG_ENABLED
jz removeUnusedBlocks_12 ; if disabled, delete -->
add di, word ptr es:[ configLength ][ di ]
jmp removeUnusedBlocks ; if enabled, we'll keep ->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; remove disabled blocks
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
removeUnusedBlocks_12:
mov word ptr es:[ configType ][ di ], CONFIGTYPE_REM
add di, word ptr es:[ configLength ][ di ]
cmp word ptr es:[ configType ][ di ], CONFIGTYPE_ENDOFARGS
jz removeUnusedBlocks_32 ; if none left -->
cmp word ptr es:[ configType ][ di ], CONFIGTYPE_MENUBLOCK
jz removeUnusedBlocks_08 ; if next block -->
jmp removeUnusedBlocks_12 ; go remove -->
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; return
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
removeUnusedBlocks_32:
ret
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Find Menu Statement ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; ax config item type ;
; bx menu name ;
; es:di configure table. ;
;...............................................................;
_findConfigMenuStatement:
cmp word ptr es:[ configType ][ di ], CONFIGTYPE_ENDOFARGS
jnz _findConfigMenuStatement_08
stc
ret
_findConfigMenuStatement_08:
cmp ax, word ptr es:[ configType ][ di ] ; is it menu type ?
jnz _findConfigMenuStatement_32 ; if not, goto next -->
push di
push bx
push ax
lea di, offset [ configStatement ][ di ]
_findConfigMenuStatement_12:
mov al, byte ptr [ bx ] ; get character
call upperCase ; upper case
mov ah, al
mov al, byte ptr es:[ di ]
call upperCase ; upper case
inc bx
inc di
cmp ah, al ; compare strings
jnz _findConfigMenuStatement_28 ; if not equal -->
or al, al ; both null terminators ?
jnz _findConfigMenuStatement_12 ; not yet -->
pop ax
pop bx
pop di
or di, di
ret
_findConfigMenuStatement_28:
pop ax
pop bx
pop di
_findConfigMenuStatement_32:
add di, word ptr es:[ configLength ][ di ]
jmp _findConfigMenuStatement
;''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''';
; Get Number ;
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -;
; ;
; Input: ;
; cx min acceptable number ;
; dx max acceptable number
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -