I/O ports שערי קלט/פלט
Emulator does not reproduce any original I/O ports of IBM PC, instead it has virtual devices that can be accessed by IN/OUT instructions. האמולטור לא משתמש בכתובות ממשיות של המחשב. במקום זה לאמולטור התקנים מדומים (וירטואליים) הניתנים  להפעלה דרך פקודות קלט פלט.
Custom I/O Devices

"Emu8086" supports additional devices that can be created by 3rd party vendors. Device can be written in any language, such as: Visual Basic, VC++, Delphi. For more information and sample source code look inside DEVICES folder.

Reserved input / output addresses for custom devices are: from 00000Fh to 0FFFFh (15 to 65535). Port 100 corresponds to byte 100 in "EmuPort.io" file, port 101 to the byte 101, etc...
(we count from zero).
"EmuPort.io" file is located in Windows "Temp" directory (can be accessed by GetTempPath() function of the API).

I'll be glad to include devices made by you in the next release of "Emu8086". If you decide to share your device with other developers around the world - please send us the source code of the device!

התקני קלט/פלט סטנדרטים

תוכנת Emu8086 מאפשרת שימוש בהתקנים מדומים פרי פיתוח של בתי תוכנה או מרצי בתי הספר. ההתקנים ניתנים לתכנות דרך תכנות  בשפת:  Visual Basic, VC++, Delphi. ראה דוגמאות בכתובת:
http://www.coval.net/teach/Emu8086/custom.htm
להסברים ודוגמת כתיבת קובץ מקור ב- VB  ראה בתיקיית DEVICES שבתוכנה שלך.

לשימוש המתכנתים נשמרו כתובות קלט/פלט שבתחום 15 עד 65535 ( 000Fh ועד 0FFFFh). שער 100 מתאים לבית 100 בקובץ "EmuPort.io", שער 101 לבית 101 וכו'...(אנו סופרים מאפס).
קובץ
"EmuPort.io" נמצא בתיקיה TEMP של מערכת ההפעלה חלונות,  ניתן לחפש דרך הפונקציה GetTempPath() של API .

בית התוכנה ישמח לכלול מכשירים פרי תכנון שלך במהדורה הבאה של האמולטור. אם אתה מחליט לשתף את התכנון אם מפתחים אחרים מסביב העולם, נא לשלוח לנו את הקוד המקורי של ההתקן ל-
Emu8086, Inc או לשאול קובל

Devices are available from "Virtual Devices" menu of the emulator.
  • Traffic Lights - Port 4 (word)

    The traffic lights are controlled by sending data to I/O Port 4.
    There are 12 lamps: 4 green, 4 yellow, and 4 red.

    You can set the state of each lamp by setting its bit:

    1 - the lamp is turned on.
    0 - the lamp is turned off.

    Only 12 low bits of a word are used (0 to 11), last bits (12 to 15) are unused.

ההתקנים ניתנים להפעלה מתוך התפריט של האמולטור ב- "מתקנים מדומים"

  • רמזורים - שער 4 (בגודל מילה)

    שליטת הרמזורים מתבצעת על ידי משלוח נתונים שכתובת קלט/פלט מס' 4.
    יש 12 נוריות: 4 ירוקות, 4 צהובות ו- 4 אדומות.

    ניתן לקבוע את המצב של כל נורה על ידי הכנסת נתון מתאים לסיבית המתאימה:

    1 - מדליק את הנורה.
    0 - מכבה את הנורה.

    רק ה- 12 סיביות הנמוכות הם בשימוש
     (0 עד 11), הסיביות האחרונות הם לא בשימוש (12 עד 15).

For example   -  למשל

MOV AX, 0000001011110100b
OUT 4, AX

We use yellow hexadecimal digits in caption (to achieve compact view), here's a conversion: אנחנו משתמשים בספרות על פי שיטה בסיס 16 לצורך ההפעלות. בהמשך טבלת המרה:

Hex - Decimal
עשרוני - הקסה
A   -   10
B   -   11
C   -   12    (unused - ללא שימוש)
D   -   13    (unused
- ללא שימוש)
E   -   14    (unused
- ללא שימוש)
F   -   15    (unused
- ללא שימוש)

First operand for OUT instruction is a port number (4), second operand is a word (AX) that is written to the port. First operand must be an immediate byte value (0..255) or DX register. Second operand must be AX or AL only.

See also "traffic_lights.asm" in Samples.

If required you can read the data from port using IN instruction, for example:

        IN AX, 4

First operand of IN instruction (AX) receives the value from port, second operand (4) is a port number. First operand must be AX or AL only. Second operand must be an immediate byte value (0..255) or DX register.

האופרנד הראשון של פקודת OUT הוא שער מספר (4), האופרנד השני זו מילה (AX) שתוכנה נרשמת בשער. האופרנד הראשון חייב להיות מספר על פי מיעון מיידי (0...255) או תוכן של אוגר DX. האופרנד השני חייב להיות רק AX או AL בלבד.
ניתן לבדוק דרך העבודה על פי הרשום בקובץ 
"traffic_lights.asm" שנמצא בתיקיית SAMPLES של התוכנה.


ניתן לקרוא תוכן של שער (נתון) אם משתמשים בפקודת IN, לדוגמה:

            
IN AX, 4

האופרנד הראשון (
AX) של הפקודה IN מקבלת את ערך הנתון שבשער, האופרנד השני (4) הוא מספר השער (הכתובת). האופרנד הראשון חייב להיות רק AX או AL בלבד. האופרנד השני חייב להיות מספר על פי מיעון מיידי (0...255) או תוכן של אוגר DX.

Stepper Motor - Port 7 (byte)

The Stepper Motor is controlled by sending data to I/O Port 7.

Stepper Motor is electric motor that can be precisely controlled by signals from a computer.

The motor turns through a precise angle each time it receives a signal.

By varying the rate at which signal pulses are produced, the motor can be run at different speeds or turned through an exact angle and then stopped.

This is a basic 3-phase stepper motor, it has 3 magnets controlled by bits 0, 1 and 2. Other bits (3..7) are unused.

When magnet is working it becomes red. The arrow in the left upper corner shows the direction of the last motor move. Green line is here just to see that it is really rotating.
מנוע צעד - שער 7 (בגודל מילה)

שליטת המנוע צעד מתבצעת על ידי משלוח נתונים שכתובת קלט/פלט מס' 7.

מנוע צעד הוא מנוע חשמלי הניתנת לשליטה במדויק על ידי אותות מתוך מחשב.

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

על ידי שינוי של קצב העברת האותות, המנוע יכול לנוע במהירויות שונות או להסתובב בזוית מדויקת ואז נעצר.

זה מנוע צעד בסיסי של  3 פאזות, למנוע 3 מגנטים הנשלטים דרך סיביות 0, 1 ו- 2. יתר הסיביות הם לא בשימוש.

כאשר המגנט פועל בהדמיה הוא הופך לאדום. החץ בפינה העליונה והשמאלית מראה את הכיוון של התנועה האחרונה של המנוע. הקו הירוק פשוט מסמן שהמנוע באמת מסתובב.

For example, the code below will do three clock-wise half-steps: למשל, התוכנית שבהמשך יגרום למנוע לבצע שלוש חצי-צעדים בכיוון השעון:

MOV AL, 001b ; initialize - אתחול
OUT 7, AL

MOV AL, 011b ; half step - 1 - חצי צעד
OUT 7, AL

MOV AL, 010b ; half step - 2
- חצי צעד
OUT 7, AL

MOV AL, 110b ; half step - 3
- חצי צעד
OUT 7, AL

If you ever played with magnets you will understand how it works. Try experimenting, or see "stepper_motor.asm" in Samples.

If required you can read the data from port using IN instruction, for example:

        IN AL, 7

Robot - Port 9 (3 bytes)

אם אי פעם שיחקת עם מגנטים אתה תבין איך זה פועל. נסה לבצע ניסוים בעצמך או ראה תוכן הקובץ: "stepper_motor.asm"  שנמצא בתיקיית SAMPLES של התוכנה.

אם יש לך צורך, אתה יכול לקרוא מהשער תוך שימוש בפקודת
IN, למשל:

           
IN AL, 7


רובוט - שער 9 (בגודל 3 מילים)

The Robot is controlled by sending data to I/O Port 9.

First byte (Port 9) is a Command Register. Set values to this port to make robot do something. Supported values:
שליטת הרובוט מתבצעת על ידי משלוח נתונים שכתובת קלט/פלט מס' 9.

הבית הראשון (שער 9) זו פקודה לאוגר הבקרה של הרובוט. קביעת ערכים לשער זה גורמים לרובוט לבצע משהו.  הערכים הנתמכים הם:
Decimal Value
ערך עשרוני

Binary Value
ערך בינארי

Action  -  פעולה
0 00000000 Do nothing - על תעשה שום דבר
1 00000001 Move Forward - הזז קדימה
2 00000010 Turn Left - סובב שמאלה
3 00000011 Turn Right - סובב ימינה
4 00000100

Examine. Examines an object in front using sensor. When robot completes the task, result is set to Data Register and Bit #0 of Status Register is set to 1.

בחון. בחון חפץ בחזית תוך שימוש בחישן. כאשר הרובוט מסיים את המשימה, התוצאה נשמרת באוגר נתונים והסיבית מספר אפס של אוגר המצב הוגדר כאחת.

5 00000101 Switch On a Lamp - הדלק מנורה
6 00000110 Switch Off a Lamp - כבה מנורה
Second byte (Port 10) is a Data Register. This register is set after robot completes the Examine command: הבית השני (שער 10) זו פקודה לאוגר הנתונים של הרובוט. קביעת ערכים לשער זה מתבצע לאחר שהרובוט מסיים את פקודת ההבחון:

Decimal Value
ערך עשרוני

Binary Value
ערך בינארי

Meaning
משמעות
255 11111111

Wall - קיר

0 00000000

Nothing - כלום

7 00000111 Switched-On Lamp
מנורה דולקת
8 00001000 Switched-Off Lamp
מנורה כבויה
Third byte (Port 11) is a Status Register. Read values from this port to determine the state of the robot. Each bit has a specific property: הבית השלישי (שער 11) זו מאוגר המצב של הרובוט. יש לקרוא  ערכים משער זה לצורך קביעת מצב הרובוט. כל סיבית מצביע על תכונה ספציפית:
Bit  סיבית

Description

תאור

Bit #0 zero when there is no new data in Data Register, one when there is new data in Data Register. אפס כאשר אין נתונים חדשים באוגר הנתונים, אחד כאשר יש נתונים חדשים באוגר הנתונים.
Bit #1 zero when robot is ready for next command, one when robot is busy doing some task. אפס כאשר הרובוט מוכן לפקודה הבאה, אחד כאשר הרובוט עסוק ועושה משימה כל שהיא.
Bit #2 zero when there is no error on last command execution.
one
when there is an error on command execution (when robot cannot complete the task: move, turn, examine, switch on/off lamp).

אפס כאשר אין טעות בביצוע של הפקודה האחרונה.
אחד כאשר יש טעות בפקודת ביצוע (כאשר הרובוט לא יכול לסיים את המשימה: הזזה, סיבוב, אבחן, הפעל או כבה נורה).

Example  דוגמה

MOV AL, 1  ; move forward - הזז קדימה
OUT 9, AL  ;

MOV AL, 3  ; turn right - סובב ימינה
OUT 9, AL  ;

MOV AL, 1  ; move forward - הזז קדימה
OUT 9, AL  ;

MOV AL, 2  ; turn left - סובב שמאל
OUT 9, AL  ;

MOV AL, 1  ; move forward - הזז קדימה
OUT 9, AL  ;

Keep in mind that robot is a mechanical creature and it takes some time for it to complete a task. You should always check bit#1 of Status Register before sending data to Port 9, otherwise the robot will reject your command and "BUSY!" will be shown. See "robot.asm" in Samples.

זכור שהרובוט הוא יצור מכני וזה לוקח לו כמה זמן לסיים משימה. אליך לבדוק תמיד את ערך הסיבית אחד (bit#1) של אוגר המצב לפני כל משלוח נתון לשער 9, אחרת הרובוט ידחה את הפקודה שלך ויופיע את ההודעה  "BUSY!" .
נסה לבצע ניסוים בעצמך או ראה תוכן הקובץ:
"robot.asm"  שנמצא בתיקיית SAMPLES של התוכנה.

Creating Custom Robot World Map

You can create any map for the robot using the tool box.

If you choose robot and place it over existing robot it will turn 90 degrees counter-clock-wise. To manually move the robot just place it anywhere else on the map.

If you choose lamp and place it over switched-on lamp the lamp will become switched-off, if lamp is already switched-off it will be deleted.

Placing wall over existing wall will delete it.

Current version is limited to a single robot only. If you forget to place a robot on the map it will be placed in some random coordinates.

The map is automatically saved on exit.

Right-click the map to get a popup menu that allows to Switch-Off/On all Lamps.

 

יצירת מפה עבור הפעלת הרובוט

אתה יכול ליצור כל מפה עבור הרובוט תוך שימוש ב"קופסת הכלים".

אם אתה בוחר ברובוט ושם אותו מעל רובוט קיים, הוא יפנה 90 מעלות נגד כיוון השעון. להזזה ידנית של הרובוט פשוט שים אותו בכל מקום במפה על פי רצונך.

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

אם שמים קיר מעל קיר שקיים אתה מבטל (מוחק) אותו.

הגרסה הנוכחית מוגבלת רק לרובוט יחיד. אם אתה שוכח לשים רובוט על המפה המערכת תכניס אותו במקום אקראי.

ביציאה מהתוכנית המפה נשמרת באופן אוטומטי.

להפעלת תפריט המאפשר להדליק או לכבות כל הנורות יש להקיש בכפתור הימני של העכבר מעל המפה.