עבור לתוכן

שאלה בסיסית באסמבלי

Featured Replies

פורסם

כתבתי תוכנית אשר משתלתת על פסיקה Trap Flag עלמנת לבדוק האם הפקודה הבאה לביצוע היא חיבור או כפל. אם כן תמנה אותן. זה הכל

הנה:

.model large
;------MUL/SUM counter-----;
.data
count dw 0
int1save dw ?
int1saveSeg dw ?
.code

;------------------------------------------------

public _Start_IMUL_Count
_Start_IMUL_Count proc far

push bp
mov bp,sp
push cx
push es
push ax

;-------------Int1Save = getvect (1);

mov ax,0
xor ax,ax
mov es,ax
mov ax,es:[4]
mov word ptr int1save,ax
mov ax,es:[6]
mov word ptr int1saveSeg,ax

;------------------setvect (1,add_identify);

cli
mov word ptr es:[4],offset add_identify
mov word ptr es:[6],cs
sti
pop ax
pop es

;------------turn on the trap flag
pushf
pop ax
or ax,100000000B
push ax
popf

pop cx
pop bp
ret
_Start_IMUL_Count endp

;-------------------------------------------------

public _Return_IMUL_Count
_Return_IMUL_Count proc far

push bp
mov bp,sp
;------------turn off the trap flag
pushf
pop ax
and ax,1111111011111111B
push ax
popf

;----------------------------setvect (1,Int1Save);
push es
push ax
mov ax,0
mov es,ax
cli
mov ax,word ptr int1save
mov es:[4],ax
mov ax,word ptr int1saveSeg
mov es:[6],ax
sti
pop ax
pop es
;-------------------------------------------

mov ax,0
pop bp

mov ax,count
mov count,0

ret
_Return_IMUL_Count endp

lab:
;-------------------------------------------------

add_identify proc far

push bp
mov bp,sp
push ax
push bx
push cx
push dx
push es
push ds
push si
push di
;----------------------------------------------------------------------

mov es,[bp+4] ; es = cs ; segment
mov bx,[bp+2] ; bx = ip ; offset
mov ax,es:[bx]
cmp al,03h
Je Fadd
;cmp al,f7h
;jne label1
jmp label1
Fadd:
inc count
; cmp al,f7h
; jne label1
; inc count

label1:
;----------------------------------------------------------------------
pop di
pop si
pop ds
pop es
pop dx
pop cx
pop bx
pop ax
pop bp

iret
add_identify endp

END

עכשיו יש בעיה קטנה. אני לא יודע מה ה-opcode של הפקודה של הכפל. (השדות שהם בתור הערות). יש לי פה טבלה שממנה אני אמור לשלוף את ה-opcode אבל אני לא מצליח להבין איך עושים את זה.

הנה הטבלה של ה-opcodes :

http://wwwcsif.cs.ucdavis.edu/~davis/50/8086%20Opcodes.htm

בכל אופן, ניסיתי לעשות השוואה של al עם F7H אבל זה לא נכון.

למישהו יש מושג איך להוציא מהטבלה המוזרה הזאת את ה-opcode של הפקודה imul??

תודה

פורסם
  • מחבר

תודה, הסתדרתי פשוט ממירים את המספר לדצימלי

אפשר לנעול

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים