الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

سؤالين في Assembly Language

مغلق
بدأه abu_majed في 10 نوفمبر 2004 · 6 رد · 1,033 مشاهدة · في لغة Assembly لأنظمة 16, 32, 64 بت
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم و رحمة الله و بركاته

أخوكم في الله يطلب منكم مساعدته في ايجاد حل كامل لسؤالين في لغة الأسمبلي علما أني حاولت فيهما و لكن من دون جدوى

و السؤالين هما

1 طباعة رسالة

A) Displaying Messages

Write an assembly language program with the following specifications:

1) Create a $ terminated message at a reasonable offset in the data segement, for example the message: "Ramadan Mubarak".

2) Repeatedly display this message on the screen on a new line whenever any keyboard character, other than the character "s", is pressed.

3) Stop displaying the message when the character "s" is entered from the keyboard.

4) Terminate the program and return to DOS.

Hints:

1) Use DOS Function number 9 to display the memory message.

2) Use DOS Function number 7 or 8 to read a keyboard entered character without echoing the character to the display.

3) Use the CMP, JZ, JMP, or LOOP as needed.

4) Use DOS function number 4C to Return to DOS.

و الثاني

B) Printing Messages Using the PC's Parallel printer

Write an assembly language program with the following specifications:

1) Create a message at a reasonable offset address in the data segement, for example the message: "Ramadan Mubarak and Kulu Eam wa antum bixair".

2) Print the message on a new line by reading the message character-by-character and sending each character to the parallel printer port.

3) Position the printer on a new line after the message is printed.

4) Repeat printing the message when any keyboard character, other than "s" is pressed.

5) Stop printing and return to DOS when "s" is pressed.

6) Terminate the program and return to DOS.

Hints:

1) Write a subroutine that reads the memory message character-wise and place each character read in Al register.

2) Call the above subroutine.

3) Send the character in AL to the printer data port.

4) Before printing the next character read the printer status from the status port and check that the printer is not busy before sending it to the printer data port.

5) If the printer is busy repeatedly poll the printer or check its status.

6) When the printer is ready, start and stop printing the charcter in its data port by sending a control signal to the control port.

7) Repeat steps 2- 6 until the whole message is printed.

8) While repeating steps 2-6, listen to a key press at the start of every new line, if "s" is pressed terminate the program and return to DOS.

Use any DOS or Windows PC configuration program to find out the addresses of the parallel printer 8-bits Status, Data, and Control ports.

Find out about the bit assignments for each port.

Use the TEST instruction to test if certain bits are set to zero (this is useful in testing for the printer status). Other useful instructions are: CMP, JZ, JNZ, JMP, LOOP, IN, and OUT.

و شكرا سلفا

Mini project.doc

#2

السلام عليكم,

الأخ أبو ماجد لقد وضعنا قانونا لهذا المنتدى وهو عدم حل التمارين إلا بعد ما يقوم صاحب السؤال ولو بمبادرة بسيطة وهذا في صالح الجميع.

على العموم هنا في المنتدى أمثلة متعددة في هذا الشكل ويمكنك فقط تغيير محتوى الرسالة التي تريد طبعها.

أرجو التفهم من الجميع وإلى اللقاء.

#3

و عليكم السلام و رحمة الله و بركاته

اخي الفاضل سبق و ورد في رسالتي عبارة " علما أني حاولت فيهما و لكن من دون جدوى " و لكن لم افهم معنى هذه الجملة الواردة في رسالتك " إلا بعد ما يقوم صاحب السؤال ولو بمبادرة بسيطة وهذا في صالح الجميع "

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

و تفضل بقبول التحية مني

#4

السلام عليكم

فى هذا الموضوع تجد برنامج لطباعة نص على الشاشه :

/index.php?showtopic=49780

حاول ان تعدل فيه كى تحصل على ما تريد, وإن شاء الله نساعدك إذا واجهتك مشكله, وياريت تقوم بشوية بحث فى المنتدى اخى ستجد الكثير من المواضيع مشابهه لمشكلتك.

عموماً حياك الله باى اسئله ونحن تحت امرك إن شاء الله.

والسلام

لا إله إلا الله محمد رسول الله

busbar : يجب ان تدرك انه هناك حد ادنى للمعرفة المطلوبة قبل البدء في عمل أي شئ.

#5

ما حصلت شي

أرجو المساعدة

#6

يا ابو ماجد كيف ما حصلت شئ, ها هو البرنامج انقله لك هنا :

s_seg segment para stack
 db 100 dup ("?")

 s_seg ends

 d_seg segment

nam db  30, 30 DUP ('0');buffer for entered name
nline      db  10,10,'$'   ; this prints a new line
message     db  "Enter Your Name :",10,13 ,'$'
 string db "my name is : $"

   d_seg ends

 c_seg segment
 assume cs:c_seg , ds:d_seg , ss:s_seg

        main proc
        mov ax,d_seg
        mov ds,ax
;******** Print the message******************
lea dx,message
mov ah,9
int 21h
;*******************************************
;******** Process the entered string ********
lea dx,nam
mov di,dx

mov ah,0Ah
int 21h     
   
xor bx,bx       
mov bl,[di+1] ;bl will contain lenth of string
inc bl
inc bl
mov byte ptr [di + bx],'$'; make the end of string
;*********************************************
;******** print a new line
lea dx,nline
mov ah,9
int 21h

;*********** Print string
lea dx,string
mov ah,9
int 21h
;*********** print the name
lea dx,nam
inc dx
inc dx
mov ah,9
int 21h
;******** print a new line
lea dx,nline
mov ah,9
int 21h
mov ah,4ch
int 21h

        main endp
        c_seg ends
        end main

والسلام

لا إله إلا الله محمد رسول الله

busbar : يجب ان تدرك انه هناك حد ادنى للمعرفة المطلوبة قبل البدء في عمل أي شئ.

#7

يا عيني عليك يا استاذ احمد بس يا ريت تكمل معروفك معي و تعطيني حل البرنامج الثاني

Printing Messages Using the PC's Parallel printer

انا عارف اني غلبتك بس بدك تستحملني شوي

شكرا

هذا الموضوع مغلق.

مواضيع مشابهة