;include file for dislib.asm and maybe for your module

        include '__dislib.inc'

;for dis_input_t.flags
df_uppercasemnemonic equ 0000001h       ;MOV eax,ecx XCHG ecx,eax ETC es,ax
df_uppercasereg equ     00000002h       ;EAX,ECX,EDX,EBX,ESP,EBP,ES,CS,SS,ETC
df_uppercaseptr equ     00000004h       ;mov BYTE PTR [0000],00
df_msd0         equ     00000008h       ;if msd is char, use a 0 (F1=0F1)
df_msd0always   equ     00000010h       ;always put a 0 as msd (21h=021h)
df_usebasechar  equ     00000020h       ;FF=FFh,123=123d
df_uppercasebasechar equ 0000040h       ;if df_usebasechar: FFh=FFH
df_lowercasedigitchar equ 000080h       ;FF=ff
df_seginsidebrack equ   00000100h       ;mov al,[es:0000]
df_ptrinsidebrack equ   00000200h       ;mov [byte ptr 1234],00
df_showsizemem  equ     00000400h       ;mov al,byte ptr [esp+ebp*8+DEADBEEF]
df_nobracketsdispl equ  00000800h       ;mov al,[0000] -> mov al,0000
df_nozerodispl  equ     00001000h       ;mov al,[bp+00] -> mov al,[bp]
df_dsdispl      equ     00002000h       ;mov al,[1234] -> mov al,ds:[1234]
df_memsegoverride equ   00004000h       ;mov al,[bp] -> mov al,ss:[bp]
df_commaspace   equ     00008000h       ;mov al,FF -> mov al, FF
df_nearptr      equ     00010000h       ;jmp/call X -> jmp/call near ptr X
df_farptr       equ     00020000h       ;jmp/call X:Y -> jmp call far ptr X:Y
df_noshort      equ     00040000h       ;jmp short X -> jmp X
df_noptr        equ     00080000h       ;word ptr [0] -> word [0] also jmp/call
df_nomemsize    equ     00100000h       ;word ptr [0] -> [0]
df_usescale1    equ     00200000h       ;[ecx] -> [ecx*1] ([ecx]=index,not base)
df_nobracketsmem equ    00400000h       ;[bp+si] -> bp+si (not if only displ!)
df_tabafterrep  equ     00800000h       ;rep movsd -> rep    movsd
df_showsegmemsize equ   01000000h       ;mov es,[0] -> mov es,word ptr [0]
df_basecharifneeded equ 02000000h       ;1D -> 1Dh 09 -> 09 0A -> 0Ah
df_fewdigits    equ     04000000h       ;0013 -> 13
df_attsyntax    equ     08000000h       ;mov al,ah -> movb %ah,%al
df_Cnumbers     equ     10000000h       ;1234h -> 0x1234
df_noopnamesizeatt equ  20000000h       ;movb %al,%cl -> mov %al,%cl (only
                                        ; if one of the operands is a reg!)

struc   dis_input_t
  __dis_input   __dis_input_t ?         ;will be changed in dis:procptr
  flags         dd      ?
if @codesize
  ;
  ;   check one operand in an instruction before we print it in a string
  ;
  ;   input: _es:di start of string to print this operand
  ;          __dis_gs:si dis_input_t struc
  ;          __dis_gs:bx dis_operand_t struc (inside dis_input_t (_gs:si) struc)
  ;   output: cf=0=you printed/did something w/ the string (_es:di)
  ;                and advanced di past the last character and made
  ;                it an asciiz string
  ;           cf=1=you didn't do a thing with the string
  ;   registers: cf=0=di,cf=1=none
  ;
  if _wordsize eq 2
    checkoperand dd     ?
  else
    checkoperand df     ?
                dw      ?
  endif
else
  if _wordsize eq 2
    checkoperand dw     ?,?
  else
    checkoperand dd     ?
                dd      ?
  endif
endif
  octalbasechar db      ?
  tabsize       db      ?
  numberbase    db      ?               ;dis_changenumberbase must change it!
  maxdigitsbyte db      ?               ;max # of digits in a byte,
  maxdigitsword db      ?               ; word or dword for this numberbase.
  maxdigitsdword db     ?               ; CHANGED BY dis_changenumberbase only
                db      2 dup (?)
ends    dis_input_t

if (size dis_input_t) and 3
  err
endif

        ;disassemble one instruction and print it in a string
        ;input: __dis_gs:si dis_input_t struc
        ;       _es:di string to print the result
        ;output: cf=1=error (dis_input.__dis_input.getbyte returned an error)
        ;registers: none
        global  dis:procptr
        ;print one instrucion (but __dis:procptr has already been called)
        ;__dis_gs:si dis_input_t struc
        ;_es:di string to print the result
        ;cf=1=error (dis_input.__dis_input.getbyte returned an error)
        ;registers: none
        global  dis_printinstruction:procptr
        ;change the number base and update maxdigitsbyte/word/dword
        ;input: __dis_gs:si dis_input_t struc
        ;       bh new number base
        ;registers: none
        global  dis_changenumberbase:procptr
