8086 Assembler Tutorial for Beginners (Part
4)
Interrupts |
הדרכה בתכנות אסמבלר 8086 למתחילים (חלק
4)
פסיקות |
Interrupts can be seen as a number of functions. These functions make
the programming much easier, instead of writing a code to print
a character you can simply call the interrupt and it will do everything
for you. There are also interrupt functions that work with disk drive
and other hardware. We call such functions software interrupts.
Interrupts are also triggered by different hardware, these are called hardware interrupts. Currently we are interested in software interrupts only. To make a software interrupt there is an INT instruction, it has very simple syntax:
Where value can be a number between 0 to 255 (or 0 to 0FFh),generally we will use hexadecimal numbers.
|
ניתן להתייחס לפסיקות כמספר פונקציות. הפונקציות
מקלות על עבודת המתכנת, במקום לכתוב קוד להדפסת אות אתה יכול פשוט לקרוא לפסיקה והיא
תעשה הכול בשבילך. קיימות גם פונקציות
העובדות עם כונני דיסקים וחומרה
אחרת. אנו קוראים לפונקציות האלה פסיקות דרך תוכנה. ניתן להפעיל פסיקות גם על ידי ציוד (חומרה), פסיקות אלו נקראות פסיקות דרך חומרה. לפי שעה אנחנו מעוניינים בפסיקות דרך תוכנה בלבד. להפעלת פסיקה דרך תוכנה נשתמש בפקודה INT, יש לה תחביר פשוט מאוד:
הערך יכול להיות מספר בין 0 ל- 255 (או 0 ל-
0FFh), בדרך כלל נשתמש במספרים של בסיס
16. |
#MAKE_COM# ; instruct compiler to make COM file. ORG 100h ; .הגדרות לבניית קובץ רגיל ; The sub-function that we are using ; does not modify the AH register on ; return, so we may set it only once. ; כאשר התת שיגרה חוזרת לתוכנית הראשית ; ,AH היא לא משנה את תוכן אוגר ; .בגלל זה מגדירים אותו רק פעם אחד בלבד ; MOV AH, 0Eh ; select sub-function - בחר שיגרה ; INT 10h / 0Eh sub-function - 0Eh פסיקה מספר 10 עם פונקציה ; receives an ASCII code of the - מקבל צופן אסקי של ; character that will be printed - האות שצריך להדפיס ; in AL register. AL באוגר MOV AL, 'H' ; ASCII code: 72 : צופן אסקי INT 10h ; print it! !הדפס אותו MOV AL, 'e' ; ASCII code: 101 : צופן אסקי INT 10h ; print it! !הדפס אותו MOV AL, 'l' ; ASCII code: 108 : צופן אסקי INT 10h ; print it! !הדפס אותו MOV AL, 'l' ; ASCII code: 108 : צופן אסקי INT 10h ; print it! !הדפס אותו MOV AL, 'o' ; ASCII code: 111 : צופן אסקי INT 10h ; print it! !הדפס אותו MOV AL, '!' ; ASCII code: 33 : צופן אסקי INT 10h ; print it !הדפס אותו! RET ; returns to operating system. ; חזרה למערכת הפעלה או לתוכנית הראשי |
Copy & paste the above program to Emu8086 source code editor,
and press [Compile and Emulate] button. Run it!
See list of supported interrupts for more information about interrupts. |
העתק והדבק את התוכנית שלמעלה לתוך עורך התוכניות של EMU8086
, לחץ על כפתור [עריכה והדמיה]. הרץ! ליותר מידע על פסיקות ראה רשימה של פסיקות הנתמכות. |
Copyright 2002-2003 - Emu8086, Inc. All rights reserved. - Portions Copyright 1997-2003 Barry Allyn. All rights reserved.
Hebrew Version Copyright COVAL Computer Software - Copyright © 2003 R&D Private Advisers All rights reserved.