قسم الميكروكنترولر والروبوت ودوائر الاتصال بالحاسب الالي قسم المتحكمات الـ microcontroller و المعالجات microprocessor و التحكم الرقمي بالكمبيوتر CNC والانظمة الآلية والروبوت Robots

أدوات الموضوع

so special
:: مهندس ::
تاريخ التسجيل: Jan 2014
المشاركات: 2
نشاط [ so special ]
قوة السمعة:0
قديم 04-01-2014, 03:48 AM المشاركة 1   
ha Custom_Interrupt رجاااااء توضيح هذا المثال Twitter FaceBook Google+



السلام عليكم
لو سمحتوا ممكن مساعدة في توضيح أو شرح مثال

Custom Interrupt

; interrupt vector (memory from 00000h to 00400h)
; keeps addresses of all interrupts (from 00h to 0ffh).
; you can add new interrupt or modify existing interrupts.
; address of interrupt M is stored in vector at offset M * 4,
; for example: interrupt 10h is stored at offset 10h * 4.
; first goes the offset, then segment (total of 2 bytes).

name "custint"


org 100h

start:

; set video mode to 3 - 16 color 80x25
mov ah, 0
mov al, 3
int 10h


; set es to "0000":
mov ax, 0
mov es, ax
; calculate vector address for interrupt 90h:
mov al, 90h
; multiply 90h by 4, store result in ax:
mov bl, 4h
mul bl
mov bx, ax
; copy offset into interrupt vector:
mov si, offset [test1]
mov es:[bx], si
add bx, 2
; copy segment into interrupt vector:
mov ax, cs
mov es:[bx], ax


int 90h ; test newly created interrupt.

; wait for any key press:
mov ah, 0
int 16h


int 20h ; halt execution.





; interrupt 90h starts here:
test1: pusha ; store all registers.

; make sure data segment is code segment:
push cs
pop ds

; set segment register to video memory:
mov ax, 0b800h
mov es, ax

; print message, each character is written as
; a word, high byte is color and low byte is
; ascii code:
lea si, msg ; load offset of msg to si.
mov di, 0 ; point to start of the screen.
print:
cmp [si], 0 ; if "0" then stop.
je stop
mov bl, [si] ; read ascii code from msg.
mov bh, 0f1h ; set colors: white background, blue text.
mov es:[di], bx ; write to video memory.
add di, 2 ; go to next position on screen.
inc si ; next char.
jmp print
stop:
popa ; re-store all registers.
iret ; return from interrupt.

msg db "test of custom interrupt!", 0



; interrupt vector (memory from 00000h to 00400h)
; keeps addresses of all interrupts (from 00h to 0ffh).
; you can add new interrupt or modify existing interrupts.
; address of interrupt M is stored in vector at offset M * 4,
; for example: interrupt 10h is stored at offset 10h * 4.
; first goes the offset, then segment (total of 2 bytes).

name "custint"


org 100h

start:

; set video mode to 3 - 16 color 80x25
mov ah, 0
mov al, 3
int 10h


; set es to "0000":
mov ax, 0
mov es, ax
; calculate vector address for interrupt 90h:
mov al, 90h
; multiply 90h by 4, store result in ax:
mov bl, 4h
mul bl
mov bx, ax
; copy offset into interrupt vector:
mov si, offset [test1]
mov es:[bx], si
add bx, 2
; copy segment into interrupt vector:
mov ax, cs
mov es:[bx], ax


int 90h ; test newly created interrupt.

; wait for any key press:
mov ah, 0
int 16h


int 20h ; halt execution.





; interrupt 90h starts here:
test1: pusha ; store all registers.

; make sure data segment is code segment:
push cs
pop ds

; set segment register to video memory:
mov ax, 0b800h
mov es, ax

; print message, each character is written as
; a word, high byte is color and low byte is
; ascii code:
lea si, msg ; load offset of msg to si.
mov di, 0 ; point to start of the screen.
print:
cmp [si], 0 ; if "0" then stop.
je stop
mov bl, [si] ; read ascii code from msg.
mov bh, 0f1h ; set colors: white background, blue text.
mov es:[di], bx ; write to video memory.
add di, 2 ; go to next position on screen.
inc si ; next char.
jmp print
stop:
popa ; re-store all registers.
iret ; return from interrupt.

msg db "test of custom interrupt!", 0

اعلانات
إضافة رد

العلامات المرجعية

«     الموضوع السابق       الموضوع التالي    »
أدوات الموضوع

الانتقال السريع إلى


الساعة معتمدة بتوقيت جرينتش +3 الساعة الآن: 11:42 AM
موقع القرية الالكترونية غير مسؤول عن أي اتفاق تجاري أو تعاوني بين الأعضاء
فعلى كل شخص تحمل مسئولية نفسه إتجاه مايقوم به من بيع وشراء وإتفاق وأعطاء معلومات موقعه
التعليقات المنشورة لا تعبر عن رأي موقع القرية الالكترونية ولايتحمل الموقع أي مسؤولية قانونية حيال ذلك (ويتحمل كاتبها مسؤولية النشر)

Powered by vBulletin® Version 3.8.6, Copyright ©2000 - 2025