📄 uinhelp.asm
字号:
and HelpFlags,NOT HLP_INHELP ; clear recursion lock
jmp CalcNCExit_Err ; and exit
SaveInitialNc:
mov WORD PTR ncInitial+2,ax ; save NC
mov WORD PTR ncInitial,dx
GotHelpFile:
and HelpFlags,NOT (HLP_FAILOOM OR HLP_FAILFNF) ; clear flags
cCall HelpNc,<ds,npsz,dx,ax> ; DX:AX = nc for this context str
test HelpFlags,HLP_FAILOOM OR HLP_FAILFNF ; a handled error?
jz CheckForSuccess ; no, check to see if we succeeded
mov retVal,HELP_HANDLED ; update return code otherwise
CheckForSuccess:
mov cx,dx
or cx,ax ; cx != 0 iff we got the topic
jnz CalcNcExit ; brif ok -- we got the NC
CalcNcExit_Err:
xor cx,cx ; set cx in case of error
mov al,retVal ; return error code
CalcNcExit: ;DX:AX = context #, or 0
cEnd
; Constants used by DoStatusButton(). All added with revision [10].
; NOTE: These messages must remain in sync with QBIMSGS.TXT so that the
; NOTE: status line buttons work properly.
; NOTE:
; NOTE: How to change the text of a message:
; NOTE:
; NOTE: 1. Make sure that the new message will not overflow the status
; NOTE: line. If it will, text changes are required, or a button
; NOTE: must be removed.
; NOTE: 2. Make the change to the text in QBIMSGS.TXT
; NOTE: 3. Make the change to the text in UINHELP.ASM
; NOTE: 4. Adjust the button position #'s in UINHELP.ASM
; NOTE:
; NOTE: How to add/remove a button:
; NOTE:
; NOTE: 1. Perform the steps required to change the status line text
; NOTE: 2. Inc/Dec the # of buttons constant in the appropriate
; NOTE: StatusXXXTable list.
; NOTE: 3. Add/Remove the Button_XXX constant corresponding to the
; NOTE: desired key from the appropriate StatusXXXTable list.
; NOTE:
; <Shift+F1=Help> <Possible other fields>
; ^ ^
All_ob1_F1 EQU 1 ;---------+ |
All_ob2_F1 EQU 16 ;------------------------+
;Editing
; 000000000011111111112222222222333333333344444444445555555555
; 012345678901234567890123456789012345678901234567890123456789
; <Shift+F1=Help> <F6=Window> <F2=Subs> <F5=Run> <F8=Step>
; ^ ^^ ^^ ^^ ^
Edit_ob1_F6 EQU 17 ;-+ || || || |
Edit_ob2_F6 EQU 28 ;------------+| || || |
Edit_ob1_F2 EQU 29 ;-------------+ || || |
Edit_ob2_F2 EQU 38 ;----------------------+| || |
Edit_ob1_F5 EQU 39 ;-----------------------+ || |
Edit_ob2_F5 EQU 47 ;-------------------------------+| |
Edit_ob1_F8 EQU 48 ;--------------------------------+ |
Edit_ob2_F8 EQU 57 ;-----------------------------------------+
;Program running (debugging):
; 000000000011111111112222222222333333333344444444445555555555
; 012345678901234567890123456789012345678901234567890123456789
; <Shift+F1=Help> <F5=Continue> <F9=Toggle Bkpt> <F8=Step>
; ^ ^^ ^^ ^
Running_ob1_F5 EQU 17 ;-+ || || |
Running_ob2_F5 EQU 30 ;--------------+| || |
Running_ob1_F9 EQU 31 ;---------------+ || |
Running_ob2_F9 EQU 47 ;-------------------------------+| |
Running_ob1_F8 EQU 48 ;--------------------------------+ |
Running_ob2_F8 EQU 57 ;-----------------------------------------+
;Immediate window active:
; 000000000011111111112222222222333333333344444444445555555555
; 012345678901234567890123456789012345678901234567890123456789
; <Shift+F1=Help> <F6=Window> <Enter=Execute Line>
; ^ ^^ ^
Immed_ob1_F6 EQU 17 ;-+ || |
Immed_ob2_F6 EQU 28 ;------------+| |
Immed_ob1_ENTER EQU 29 ;-------------+ |
Immed_ob2_ENTER EQU 49 ;---------------------------------+
;Help window active:
; 000000000011111111112222222222333333333344444444445555555555
; 012345678901234567890123456789012345678901234567890123456789
; <Shift+F1=Help> <F6=Window> <Esc=Cancel> <Ctrl+F1=Next> <Alt+F1=Back>
; ^ ^^ ^^ ^^ ^
Help_ob1_F6 EQU 17 ;-+ || || || |
Help_ob2_F6 EQU 28 ;------------+| || || |
Help_ob1_ESC EQU 29 ;-------------+ || || |
Help_ob2_ESC EQU 41 ;-------------------------+| || |
Help_ob1_CTRLF1 EQU 42 ;--------------------------+ || |
Help_ob2_CTRLF1 EQU 56 ;----------------------------------------+| |
Help_ob1_ALTF1 EQU 57 ;-----------------------------------------+ |
Help_ob2_ALTF1 EQU 70 ;------------------------------------------------------+
; Editing in QEDIT
; 000000000011111111112222222222333333333344444444445555555555
; 012345678901234567890123456789012345678901234567890123456789
; MS-DOS Editor <F1=Help> Press ALT to activate menus
; ^ ^
; | |
QEdit_ob1_F1 EQU 16 ; |
QEdit_ob2_F1 EQU 25 ;-------+
; Help window active: QEDIT
; 00000000001111111111222222222233333333334444444444555555555566666
; 01234567890123456789012345678901234567890123456789012345678901234
; <F1=Help> <F6=Window> <Esc=Cancel> <Ctrl+F1=Next> <Alt+F1=Back>
; ^ ^ ^ ^^ ^^ ^^ ^ ^
QHelp_ob1_F1 EQU 01 ; || || || |
QHelp_ob2_F1 EQU 09 ; || || || |
QHelp_ob1_F6 EQU 11 ; || || || |
QHelp_ob2_F6 EQU 22 ;------ | || || |
QHelp_ob1_ESC EQU 23 ;-------+ || || |
QHelp_ob2_ESC EQU 35 ;-------------------+| || |
QHelp_ob1_CTLF1 EQU 36 ;--------------------+ || |
QHelp_ob2_CTLF1 EQU 50 ;----------------------------------+| |
QHelp_ob1_ALTF1 EQU 51 ;-----------------------------------+ |
QHelp_ob2_ALTF1 EQU 64 ;------------------------------------------------+
; QHELP help viewer start-up status: MSG_StatusQHStart
; 000000000011111111112222222222333333333344444444445555555555
; 012345678901234567890123456789012345678901234567890123456789
; MS-DOS Help Viewer <F1=Help> Press ALT to activate menus
; ^ ^
; | |
QHStart_ob1_F1 EQU 21 ; |
QHStart_ob2_F1 EQU 29 ;-------+
; QHELP help window active: MSG_StatusQHHelp
; 00000000001111111111222222222233333333334444444444555555555566666666667
; 01234567890123456789012345678901234567890123456789012345678901234567890
; <Alt+C=Contents> <Alt+N=Next> <Alt+B=Back>
; ^ ^^ ^^ ^
QHHelp_ob1_CONTS EQU 01 ; || || |
QHHelp_ob2_CONTS EQU 17 ;-+| || |
QHHelp_ob1_NEXT EQU 18 ;--+ || |
QHHelp_ob2_NEXT EQU 30 ;--------------+| |
QHHelp_ob1_BACK EQU 31 ;---------------+ |
QHHelp_ob2_BACK EQU 43 ;---------------------------+
labelNP <StatusTable>
DW UIOFFSET StatusEditTable
DW UIOFFSET StatusRunningTable
DW UIOFFSET StatusImmedTable
DW UIOFFSET StatusHelpTable
DW UIOFFSET StatusQeditTable
DW UIOFFSET StatusQhelpTable
DW UIOFFSET StatusQHStartTable
DW UIOFFSET StatusQHhelpTable
StatusButton STRUC
SB_Command db ?
SB_obStart db ?
SB_obEnd db ?
StatusButton ends
LabelNP <StatusEditTable>
DB 5 ; # of buttons in Edit status message
StatusButton <midHelpHelp, ALL_ob1_F1, ALL_ob2_F1>
StatusButton <midNextWindow, Edit_ob1_F6, Edit_ob2_F6>
StatusButton <midViewSubs, Edit_ob1_F2, Edit_ob2_F2>
StatusButton <midRunContinue, Edit_ob1_F5, Edit_ob2_F5>
StatusButton <midStep, Edit_ob1_F8, Edit_ob2_F8>
LabelNP <StatusRunningTable>
DB 4 ; # of buttons in Running status message
StatusButton <midHelpHelp, ALL_ob1_F1, ALL_ob2_F1>
StatusButton <midRunContinue, Running_ob1_F5, Running_ob2_F5>
StatusButton <midDebugToggleBp, Running_ob1_F9, Running_ob2_F9>
StatusButton <midStep, Running_ob1_F8, Running_ob2_F8>
LabelNP <StatusImmedTable>
DB 3 ; # of buttons in Immediate status message
StatusButton <midHelpHelp, ALL_ob1_F1, ALL_ob2_F1>
StatusButton <midNextWindow, Immed_ob1_F6 , Immed_ob2_F6>
StatusButton <midEnter, Immed_ob1_ENTER, Immed_ob2_ENTER>
LabelNP <StatusHelpTable>
DB 5 ; # of buttons in Help status message
StatusButton <midHelpHelp, ALL_ob1_F1, ALL_ob2_F1>
StatusButton <midNextWindow, Help_ob1_F6, Help_ob2_F6>
StatusButton <midHelpClose, Help_ob1_ESC, Help_ob2_ESC>
StatusButton <midHelpNext, Help_ob1_CTRLF1, Help_ob2_CTRLF1>
StatusButton <midHelpBack, Help_ob1_ALTF1, Help_ob2_ALTF1>
LabelNP <StatusQeditTable>
DB 1 ; # of buttons in Edit status message
StatusButton <midHelpSyntax, Qedit_ob1_F1, Qedit_ob2_F1>
LabelNP <StatusQhelpTable>
DB 5 ; # of buttons in Help status message
StatusButton <midHelpSyntax, QHelp_ob1_F1, QHelp_ob2_F1>
StatusButton <midNextWindow, QHelp_ob1_F6, QHelp_ob2_F6>
StatusButton <midHelpClose, QHelp_ob1_ESC, QHelp_ob2_ESC>
StatusButton <midHelpNext, QHelp_ob1_CTLF1, QHelp_ob2_CTLF1>
StatusButton <midHelpBack, QHelp_ob1_ALTF1, QHelp_ob2_ALTF1>
LabelNP <StatusQHStartTable>
DB 1 ; # of buttons in QHELP start status message
StatusButton <midHelpHowToUse, QHStart_ob1_F1, QHStart_ob2_F1>
LabelNP <StatusQHhelpTable>
DB 3 ; # of buttons in QHELP Help status message
StatusButton <midHelpHelp, QHHelp_ob1_CONTS, QHHelp_ob2_CONTS>
StatusButton <midHelpNext, QHHelp_ob1_NEXT , QHHelp_ob2_NEXT >
StatusButton <midHelpBack, QHHelp_ob1_BACK , QHHelp_ob2_BACK >
;***
;HStatusButton
; Given a mouse position in the status line window, return
; a handle to the status button at that position.
;
;Purpose:
; Heavy modification in revision [52]
;
;Entry:
; posX = 0-relative mouse position
;Exit:
; AX - handle to the status button or NULL if no button.
; The handle is actually a pointer into the code segment.
;Uses:
; Per Convention
;****
cProc HStatusButton,<PUBLIC,NEAR>,<SI>
ParmW posX
cBegin
xor si,si ;Default return value: NULL
mov bx,iMsgStatusLine ; bx = current line displayed
sub bx,MSG_StatusEdit ; bx = 0, 1, 2, 3, or invalid
cmp bx,(MSG_StatusQHhelp - MSG_StatusEdit) ; out of range?
ja ButtonExit ; brif so -- just exit
shl bx,1 ; word index
mov si,word ptr cs:[bx].StatusTable
mov bx,[posX] ; bx = 0-relative position
lods byte ptr cs:[si] ; AL = number of entries for this line
cbw
xchg cx,ax ; CX = number of entries
ButtonLoop:
inc si ;Ignore the SB_Command
lods word ptr cs:[si] ;AH = obEnd, AL = obStart
cmp bl, al
jb ButtonNotFound
cmp bl, ah
jb ButtonFound
loop ButtonLoop
ButtonNotFound:
mov si,SIZE StatusButton ;return NULL
ButtonFound:
sub si,SIZE StatusButton ;point back to begining of structure.
ButtonExit:
mov ax, si
cEnd
;***
;ObStatusButton - Returns the position of a Status Line Button
;
;Purpose:
; Return the position of the specified Status Button.
;
; new for revision [52]
;
;Entry:
; hButton - handle to button (near pointer in CS)
;
;Exit:
; AX - Offset in characters from the beginning of the status line.
;
;Preserves:
;
;****
cProc ObStatusButton,<NEAR,PUBLIC>
parmW hButton
cBegin
mov bx, [hButton]
xor ax,ax
mov al, cs:[bx.SB_obStart]
cEnd
;***
;CbStatusButton - Returns the number of characters in a Status Line Button
;
;Purpose:
; Return the number of characters in the specified Status Button.
;
; new for revision [52]
;
;Entry:
; hButton - handle to button (near pointer in CS)
;
;Exit:
; AX - Size of button.
;
;Preserves:
;
;****
cProc CbStatusButton,<NEAR,PUBLIC>
parmW hButton
cBegin
mov bx, [hButton]
mov al, cs:[bx.SB_obEnd]
sub al, cs:[bx.SB_obStart]
xor ah,ah
cEnd
;***
;DoStatusButton - Posts the key message associated with a Status Line Button
;
;Purpose:
; Post the WM_CHAR message for the specified Status Button.
;
; new for revision [52]
;
;Entry:
; hButton - handle to button (near pointer in CS)
;
;Exit:
; None.
;
;Preserves:
;
;****
cProc DoStatusButton,<NEAR,PUBLIC>
parmW hButton
cBegin
mov bx, [hButton]
xor dx,dx
mov dl,cs:[bx.SB_Command]
pushi ax, <DATAOffset wndMain>
pushi ax, WM_COMMAND
push dx
xor ax,ax
push ax
push ax
call PostMessage
cEnd
cEnd
;***
;RecordHelpHistory - Add entry to history list
;
;Purpose:
; Record an entry into the help history list. If the list is already
; full, the last item gets bumped.
;
;Entry:
; DX:AX : item to be stored
; BL : flags to store with it (EI_VARHELP Only)
;
;Exit:
; None.
;
;Preserves:
; AX,DX
;
;****
cProc RecordHelpHistory,<NEAR,PUBLIC>,<DS>
cBegin
DbAssertRel BdlHelpHist.BDL_Seg,ne,NOT_OWNER,UI,<RecordHelpHistory:BdlHelpBack not initialized>
GETSEG ds,BdlHelpHist.BDL_Seg,bx,SIZE ; get segment of data
;NOTE: DS != DGROUP at this point
ASSUMES DS,NOTHING
xor bx,bx ; look at location 0
cmp WORD PTR [bx].HH_Used,NUM_HISTORY ; all slots being uses?
je RecordOverwrite ; yes, just overwrite last item
inc WORD PTR [bx].HH_Used ; one more item being used
RecordOverwrite:
mov cx,[bx].HH_First ; DX is location to stick item
push cx
add cx,SIZE HelpHistEntry ; point CX at next entry
cmp cx,HELPHIST_END ; at end of table?
jb NoTableWrap ; no
mov cx,HELPHIST_BEGIN ; point to begining of table
NoTableWrap:
mov [bx].HH_First,cx ; save new initial location
pop bx ; restore previous starting loc
mov [bx].HH_HiWord,dx ; save Hi word
mov [bx].HH_LoWord,ax ; save lo word
ASSUMES DS,DGROUP
cEnd
;***
;RetrieveHelpHistory - Get the last recorded item in help history list
;
;Purpose:
; Retrieve the last item from the help history list. Returns with CX=0
; if no items are left.
;
;Entry:
; None.
;
;Exit:
; if CX <> 0
; DX:AX : item stored
; BL : flags stored with it (IF EI_VARHELP)
; else
; No items recorded
;
;****
cProc RetrieveHelpHistory,<NEAR,PUBLIC>,<DS>
cBegin
DbAssertRel BdlHelpHist.BDL_Seg,ne,NOT_OWNER,UI,<RetrieveHelpHistory:BldHelBack not initialized>
GETSEG ds,BdlHelpHist.BDL_Seg,bx,SIZE ; get segment of data
;NOTE: DS != DGROUP at this point
ASSUMES DS,NOTHING
xor bx,bx ; look at location 0
mov cx,[bx].HH_Used ; CX = number of slots in use
jcxz RetrieveExit ; no items, return with error
;NOTE: CX <> 0 is preserved for rest of routine
dec WORD PTR [bx].HH_Used ; indicate one less
mov ax,[bx].HH_First ; AX = offset into table
sub ax,SIZE HelpHistEntry ; point to previous entry
cmp ax,HELPHIST_BEGIN ; before first entry?
jge NoRetrieveWrap ; no, continue
mov ax,HELPHIST_END - SIZE HelpH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -