; ; GRDP ; ; Copyright(c) LADsoft ; ; David Lindauer, gclind01@starbase.spd.louisville.edu ; ; ; OPTIONS.ASM.ASM ; ; Function: Option input and display ; ;MASM MODE .MODEL SMALL .386 NUMOPTS = 6 include version.asi include prints.ase include input.ase include mtrap.ase include breaks.ase include ints.ase include logging.ase PUBLIC doopt,optdword, optdwordcommand,optpure,opthist PUBLIC ReadOptions, WriteOptions, opt32ins .data ; ; optlist, optvals, and optvect MUST be kept in sync ; optlst db "wrfr32zrbknvhi" ; writeopts db 0 ; optmark dw verid ; MUST preced optvals optvals label BYTE optdword db 0 optdwordcommand db 0 opt32ins db 1 optdiv0 db 1 ; these two options DEPEND on VECTLIST optbrk db 1 ; having the upper bits of the ints set right ; on a no-param file start optpure db 1 opthist db 1 ; optvect dw vsetopt,vsetopt,vsetopt dw voptdiv0,voptbrk1b,vsetopt,vsetopt optname db "grdb.opt",0 .CODE ; ; for display of states ; optmsgs label BYTE db 13,10,"WR - wide registers ",0 db 13,10,"FR - flat real commands ",0 db 13,10,"32 - 32 bit disassembly ",0 db 13,10,"ZR - divide by zero trap",0 db 13,10,"BK - ctrl-break trap ",0 db 13,10,"NV - native video ",0 ; db 13,10,"HI - command history ",0 ; ; option command ; doopt PROC Call WadeSpace ; Wade till address jnz optlp mov si,offset _text : optmsgs ; no args, print all options mov di,offset dgroup : optvals mov cx,NUMOPTS polp: call PrintOption loop polp call LoggingStat optxit: clc ret ; ; subroutine to print an option and its enabled/disabled value ; PrintOption: mov bx,si call olMessage test byte ptr [di],-1 jnz dotype Msg <9,"disabled"> jmp dojoin dotype: Msg <9,"enabled"> dojoin: inc di frs_lp: lods byte ptr cs:[si] or al,al jnz frs_lp ret ; ; comes here to set/reset an option ; optlp: cmp al,13 jz doopt ; go back and show vals after the set cmp al,'-' ; check for off command pushf jz incpos cmp al,'+' jnz noinc incpos: inc si noinc: call WadeSpace ; now get the option letters jz opterr lodsw cmp ah,13 jz opterr mov cx,NUMOPTS ; search for them mov di,offset dgroup : optlst cmplp: scasw jz dovect loop cmplp opterr: add sp,2 ; bad opt, exit with no display clc ret dovect: mov [writeopts],1 ; changing, need disk update neg cx add cx,NUMOPTS movzx ebx,cx popf lahf and ah,40h xor ah,40h shr ah,6 ; ah = opt new val call [optvect + ebx*2] ; call handler call WadeSpace jmp optlp ; get another ; ; option routines ; ; this one is for basic bools ; vsetopt: mov [bx + optvals],ah ret ; ; following this we have interrupt enables/disables. ; they run through VECLIST and set the high bit to match the ; bool value ; voptbrk1b: mov al,1bh voptdiv0: mov al,0 vopttraps: mov [bx + optvals],ah mov bl,ah voptrefresh: push si mov si,offset dgroup:veclist call SetVectAttrib pop si ret doopt ENDP ; ; write options to disk file ; WriteOptions PROC mov [optmark],verid test [writeopts],0ffh jz wo_x call optcreat jc wo_x mov dx,offset dgroup:optmark mov cx,NUMOPTS+2 mov ah,40h int 21h jc wo_x2 mov [writeopts],0 wo_x2: call optclose wo_x: ret WriteOptions ENDP ; ; read options from disk file ; ReadOptions PROC mov [writeopts],1 mov [optmark],-1 call optopen jc ro_x mov dx,offset dgroup:optmark mov cx,2 mov ah,3fh int 21h jc ro_x2 cmp [optmark],verid jnz ro_x2 mov dx,offset dgroup:optmark+2 mov cx,NUMOPTS mov ah,3fh int 21h jc ro_x2 cmp ax,NUMOPTS jnz ro_x2 mov [writeopts],0 ; the option file is read mov bl,[optdiv0] ; now set the attrib bits in veclist mov al,0 call voptRefresh mov bl,[optbrk] mov al,1bh call voptRefresh nd1bfix: ro_x2: call optclose ro_x: ret ReadOptions ENDP ; ; generi disk file stuff. Should probably merge with loader and logger ; routines... ; OptOpen PROC mov ax,3d02h mov dx,offset dgroup:optname int 21h mov bx,ax ret OptOpen ENDP OptCreat PROC mov ax,3c00h mov cx,0 mov dx,offset dgroup:optname int 21h mov bx,ax ret OptCreat ENDP OptClose PROC mov ah,3eh int 21h ret OptClose ENDP end