Copy Link
Add to Bookmark
Report

Minotauro Magazine Issue 10 08 PMID.ASM

eZine's profile picture
Published in 
Minotauro Magazine
 · 6 Feb 2021

  

; Medidor de size de prefetch queue
; asume que el size de la prefetch es menor a MAX_PREFETCH y mayor a 2
; por FVG (o quien sea el autor de CPUTYPE.EXE) :)
; simplificado y conchetificado por T & D

code segment para public
assume cs:code, ds:code, es:code, ss:code
org 100h

MAX_PREFETCH EQU 1000H

start:
call measure_prefetch ; medir la prefetch
push cs cs
pop ds es
mov di, offset value ; convertirlo a ascii
call itoa
mov dx, offset message ; mostrarlo
mov ah, 9
int 21h
mov ax, 4c00h ; adious muchachous
int 21h

message db "Prefetch queue length",13,10,"for this computer: "
value db " h bytes",13,10,'$'
hexav db "0123456789ABCDEF",0

itoa proc near
; in: ax = numero a convertir
; es:di = area de memoria en la que se guardara la string
push ax bx cx di
mov bx,offset hexav
mov cl, 4
push ax
shr al, cl
xlat
stosb
pop ax
and al, 0fh
xlat
stosb
pop di cx bx ax
ret
endp

measure_prefetch proc near
; retorna el numero de bytes del largo de la prefetch en AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH ES

MOV AX,cs ; primero llenar todo de NOPs
MOV ES,ax
MOV CX, MAX_PREFETCH
MOV DI, offset prefetch_field
MOV AL, 90h
CLD
REPZ STOSB

MOV AL,80h ; deshabilitar nmis
OUT 70h,AL
CLI ; deshabilitar ints

MOV CX, MAX_PREFETCH
MOV DI, offset field_end-1
STD
MOV AX,43h ; 43h = opcode INC BX
XOR BX,BX

jmp $+2

align 10h ; hay que asegurarse que la medicion en si
REPZ STOSB ; caiga justo en paragrafo.
prefetch_field:
db MAX_PREFETCH dup(90h); incs y nops

field_end:
XOR AL,AL ; rehabilitar ints y nmis
OUT 70h,AL
STI

CLD ; este +2 es por el repz stosb (que se asume
MOV AX, MAX_PREFETCH+2; que esta dentro de la prefetch)
SUB AX,BX ; ax contiene el nro de bytes

POP ES
POP DI
POP DX
POP CX
POP BX
RET
endp
ends code
end start

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT