עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

יישום אסמבלר ב C

Featured Replies

פורסם

אהלן.

אני צריך לכתוב תוכנית שתקרא נתונים ותרוץ כל הזמן - למעשה TSR שמשתמשת בפסיקת ISR שנכתבה מחדש על ידי ותכתוב את הנתונים האלה לתוך קובץ.

לכאורה פשוט.

את החלק של האסמבלר כתבתי בתוכנית ישנה שמחליפה בין האותיות y ל n והיא תקינה וגם עבודה עם קבצים ב c אני יודע.

הבעיה כיצד אני מיישם את זה ? איך אני משלב בין 2 התוכניות ? TSR ב c ??

או לחילופין אם למישהו יש שיטה פשוטה וקלה לכתוב לקבצים באסמבלר - אני מוכן לקבל.

בגדול התוכנית שצריכה לעבור את השינוי היא זאת :

.model small

.stack 100h

.386

.code

start:

mov al,9h

mov ah,35h ;get vector bx=ip es=cs

int 21h

mov ax,seg newisr ;enter the new segment to ax

mov ds,ax

mov dx,offset newisr ;enter the new address to dx

mov al,9h

mov ah,25h ;set vector of values :ds,dx

int 21h

mov ax,es ;mov the old vector to 0a0h

mov ds,ax

mov dx,bx

mov al,0a0h

mov ah,25h

int 21h

mov dx,0400h ;TSR

int 27h ;EXIT

newisr proc far

pusha ;push all registers to the stack

in al,60h ;gets scan code

cmp al,15h ;compare with 'y'

je switch ;jump if equel to yes

cmp al,31h ;compare with 'n'

jne orig ;jmp to origenal vector

mov dl,'y' ;enter 'y' insted of 'n'

jmp print ; skip yes loop

switch: mov dl,'n' ;enter 'n' insted of 'y'

print: mov ah,2h

int 21h ;print 'n' or 'y'

jmp eoi

orig: int 0a0h ;the origenal vector

eoi: mov al,61h

out 20h,al ;send EOI

popa ;pop al registers

iret ;

newisr endp

end

פורסם

ב-C אתה יכול לכתוב

asm {

assembler operator

assembler operator

...

}

פורסם

OUCH, INT27.. מזכיר לי נשכחות מימים שעוד היה לי DOS :)

בכל מקרה, לכל קומפיילר יש את ה ASM DIRECTIVES שגורמות לו לעבוד עם פקודות כאלו.. לדוגמא ב GNU C יש את

asm ("mov %0,eax"); //this is an asm command

פורסם
  • מחבר

כן, אבל שוב - כאן אנחנו מדברים על תוכנית TSR מלאה ולא על מספר הוראות מצומצמות באסמבלר שנועדו לתגובה מהירה יותר.

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

אני חושב שאני אלך לכיוון כתיבת קבצים באסמבלר. למישהו יש ניסיון עם זה?

פורסם

מה הבעיה ? אתה יוצר קובץ .ASM ומקמפל אותו עם TASM או MASM ומריץ...

ארכיון

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

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.