📄 elimfunc.new
字号:
in al,dx ; Y: do input
mov cl,al ; and set value into CL
jmp SHORT DPIO_OK ; and leave
DPIO_InW:
cmp di,1 ;Q: word input ?
jne SHORT DPIO_InDW ; N: chk for dword
in ax,dx ; Y: do input
mov cx,ax ; and set value into CL
jmp SHORT DPIO_OK ; and leave
DPIO_InDW:
cmp di,2 ;Q: dword input ?
jne SHORT DPIO_error ; N: bad xfer size
in eax,dx ; Y: do input
mov ecx,eax ; and set value into CL
jmp SHORT DPIO_OK ; and leave
DPIO_Out:
cmp di,0 ;Q: byte output ?
jne SHORT DPIO_OutW ; N: chk for word
mov al,cl ; Y: get byte for out
out dx,al ; do output
jmp SHORT DPIO_OK ; and leave
DPIO_OutW:
cmp di,0 ;Q: word output ?
jne DPIO_OutW ; N: chk for dword
mov ax,cx ; Y: get word for out
out dx,ax ; do output
jmp SHORT DPIO_OK ; and leave
DPIO_OutDW:
cmp di,2 ;Q: dword output ?
jne SHORT DPIO_error; N: bad xfer size
mov eax,ecx ; Y: get dword for out
out dx,eax ; do output
; and leave
DPIO_OK:
clc
DPIO_exit:
pop eax
ret
DPIO_error:
stc
jmp DPIO_exit
Debug_PhysIO endp
endif
R_CODE ENDS
LAST segment
assume CS:LAST, DS:LAST, ES:R_CODE
;******************************************************************************
; I_Message_Display - display banner
;
; ENTRY: NONE
;
; EXIT: none
;
; USED: none
;
;******************************************************************************
I_Message_Display PROC near
push ds
mov dx, cs
mov ds, dx
mov dx,offset LAST:InitMessage
mov ah,PRINT_STRING
int MS_DOS ; output init message
pop ds
RET
I_Message_Display ENDP
;******************************************************************************
; E_XStatus_Display - display ELIM/VDM status
;
; ENTRY: DS = R_CODE
;
; EXIT: none
;
; USED: none
;
;******************************************************************************
E_XStatus_Display proc near
;
push ds
push es
push di
push ds
pop es ; es = R_CODE
mov ax, cs ; si = LAST
mov ds, ax ; ds = LAST
mov dx,offset LAST:NoEMSmess ; assume EMS N/A
;; cmp cs:[NoEMSset],TRUE ;Q: Is EMS available?
;; je short EXSprint ; N: print EMS N/A message
cmp es:[VCPIset], -1 ; Q: has noems been specifed
jne EXSprint ; Y: print EMS N/A message
EXSDcont:
ifdef QEMS
mov ax,es:[free_4k_pages]
shl ax,2 ; amount in K
endif
mov ax,es:[TopOfHandleSpace] ; top of free EMS handle space
sub ax,FIRST_HANDLE_PTE ; subtract start of handle space
sub ax,es:[UsedVCPIPages] ; number of free EMS pages
shr ax,2 ; convert to 16K pages
sub ax,es:[UsedEMSPages] ; number of free EMS pages
shl ax,4 ; number in KBs
mov di,offset LAST:ISizeMess; store decimal size in ASCII here.
mov cx,5
call b2asc10 ; convert to ASCII...(R_CODE)
mov dx,offset LAST:MemSizeMess
mov ah,PRINT_STRING
int MS_DOS ; output message
mov al,EMM_VERSION
xor ah,ah
ror ax,4
shr ah,4
or ax,'00'
mov di,offset LAST:LIMVerMess
;; stosb
mov byte ptr ds:[di], al
inc di
inc di
xchg al,ah
;; stosb
mov byte ptr ds:[di], al
inc di
mov ax,es:[TopOfHandleSpace]; top of free EMS handle space
sub ax,FIRST_HANDLE_PTE ; subtract start of handle space
shr ax,2
;QEMS mov ax,es:[total_4k_pages]
;QEMS shr ax,1
;QEMS shr ax,1
mov cx,4
mov di,offset LAST:TotalPagesMess
call b2asc10
mov ax,es:[TopOfHandleSpace]; top of free EMS handle space
sub ax,FIRST_HANDLE_PTE ; subtract start of handle space
sub ax,es:[UsedVCPIPages] ; number of free EMS pages
shr ax,2 ; convert to 16K pages
sub ax,es:[UsedEMSPages] ; number of free EMS pages
;QEMS mov ax,es:[free_4k_pages]
;QEMS shr ax,1
;QEMS shr ax,1
mov cx,4
mov di,offset LAST:AvailPagesMess
call b2asc10
mov ax,es:[ttl_hndls]
mov cx,4
mov di,offset LAST:TotalHanMess
call b2asc10
mov ax,es:[handle_count]
mov cx,4
mov di,offset LAST:AvailHanMess
call b2asc10
CMP es:[PF_Base], FREE ; Q: Is there a page frame? ;@PIW
JE SHORT get_status_mess ; N: Skip this part ;@PIW
mov ax,es:[PF_Base] ; page frame base addr
mov di,offset LAST:PFBAMess ; here for page frame base addr
call b2ascHEX
; Append " H" to hex value
MOV BYTE PTR [DI], ' ' ; Ensure blank for localized ver (IPG)
MOV BYTE PTR [DI+1], 'H' ; Put H at end of the segment ;@PIW
get_status_mess:
mov dx,offset LAST:StatusMess
EXSprint:
mov ah,PRINT_STRING
int MS_DOS ; output message
ifndef MSFLAG
call dword ptr es:[checkXMMFar]
;Q: Is there an XMM in the system
jc short EXSexit ; N: exit
endif
cmp es:[UMBptr],0 ;Q: Any UMBs?
je short EXSexit ; N: exit
call AvailUMB
shr ax,6
mov di,offset LAST:UMBavail; store decimal size in ASCII here.
mov cx,4
call b2asc10 ; convert to ASCII...(R_CODE)
call LargestUMB
shr ax,6
mov di,offset LAST:UMBlargest; store decimal size in ASCII here.
mov cx,4
call b2asc10 ; convert to ASCII...(R_CODE)
mov ax,es:[UMBptr] ; first UMB address
mov di,offset LAST:UMBstart
call b2ascHEX
mov byte ptr [di+1],'H' ; Put H at end of the segment
mov dx,offset LAST:UMBStatusMess
mov ah,PRINT_STRING
int MS_DOS ; output message
EXSexit:
pop di
pop es
pop ds
ret
;
E_XStatus_Display endp
;******************************************************************************
;
; b2asc10 - Converts binary to ascii decimal and stores at ES:DI.
; Stores CX ascii chars (decimal # is right justified and
; filled on left with blanks).
;
; entry: ax = binary number
; cx = digits to display
; es:di = place to store ascii chars.
;
; exit: ASCII decimal representation of number stored at DS:DI
;
; used: none
;
; stack:
;
;******************************************************************************
;
power10 dw 1,10,100,1000,10000
;
b2asc10_far proc far
call b2asc10
ret
b2asc10_far endp
;
b2asc10 proc near
;
push ax
push bx
push cx
push dx
push si
;
mov si,cx ; index to base 10 table
dec si
shl si,1 ;word index
xor bl,bl ; leading zeroes flag
cld
;
; convert binary number to decimal ascii
;
b2_loop:
xor dx,dx ; clear word extension
mov cx,cs:power10[si]
div cx ; divide by power of 10
or bl,bl
jnz short b2_ascii
;
or ax,ax ; q: zero result?
jnz short b2_ascii ; n: go convert to ascii
;
mov al,' ' ; y: go blank fill
jmp short b2_make_strg ;
;
b2_ascii:
add al,'0' ; put into ascii format
mov bl,1 ; leading zeroes on
;
b2_make_strg:
;; stosb ; put ascii number into string
mov byte ptr ds:[di], al
inc di
mov ax,dx
sub si,2 ; decrement power of 10 pointer
jg short b2_loop ; Q: Last digit? N: Jump if not
mov al,dl
and al,0Fh
add al,'0'
;; stosb
mov byte ptr ds:[di], al
inc di
;
pop si
pop dx
pop cx
pop bx
pop ax
ret ; *** return ***
;
b2asc10 endp
;******************************************************************************
;
; b2ascHEX- converts binary to ascii HEX and store at ES:DI
; stores 4 ascii chars (HEX # is right justified and
; filled on left with blanks)
;
; entry: ax = binary number
; es:di = place to store ascii chars.
;
; exit: ASCII HEX representation of number stored at DS:DI
;
; used: none
;
; stack:
;
;******************************************************************************
;
hextab db "0123456789ABCDEF"
;
b2ascHEX_far proc far
call b2ascHEX
ret
b2ascHEX_far endp
;
b2ascHEX proc near
;
push ax
push bx
push cx
push dx
cld ;forward,increment
mov dx,ax
mov cx,12
b2hex_loop:
mov bx,dx
shr bx,cl ; get highest nibble
and bx,0Fh ; nibble only
mov al,CS:hextab[bx] ; get ASCII for it
;; stosb ; store ASCII
mov byte ptr ds:[di], al
inc di
sub cx,4
jge short b2hex_loop
pop dx
pop cx
pop bx
pop ax
ret
;
b2ascHEX endp
LAST ends
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -