פורסם 2005 בינואר 2220 שנים יש לי שאלה כשאת לשיוערי הבית - "כתוב תוכנית שמכפילה את ערכו של אוגר CL פי 5."עכשיו אני יודע איך לכפול במספרים זוגיים אבל לא במספרים אי זוגיים.חשבתי אולי על לכפול בעשר ועאז לחלק ב-2 אבל אני לא יודע איך ואם זה נכון.אפשר להשתמש בפקודות MOV,ADD,SUBתודה!
פורסם 2005 בינואר 2220 שנים i won't write in asm, but here's one option:move the value "5" to another register, then run some sort of a loop (5 time) till that register is 0on each iteration, add the value of the CL register to an empty register (total of 5 times).
פורסם 2005 בינואר 2220 שנים מחבר "then run some sort of a loop (5 time) till that register is 0on each iteration, add the value of the CL register to an empty register (total of 5 times").אני לא מבין..... מה זה? איך אני עושה את זה?
פורסם 2005 בינואר 2220 שנים i haven't programmed in asm, i worked with another asm-like program, but here goes: mov #5, r1 ; loop counter mov #0, r2 ; r2 = 0loop: add r0, r2 ; sum += cl sub r1 ; counter reduce tst r1 bnq loop ; if r1 != 0, continue loop mov r2, r0 ; cl = sum halt ; end note: i am assuming the register names are r0 ... r5 r0 = cl, all the others just replace as you wish hope its close enough
פורסם 2005 בינואר 2220 שנים מחבר יש פה פקודות שאני חושב שאני לא יכו להשתמש... לדוגמה - ,tst r1,bnq loop אני יכול להשתמש רק ב- MOV, ADD SUB ומה זה? - "sub r1 " מה אתה בדיוק מחסר פה? ומה זה tst? ושוב תודה רבה על הטרחה!
פורסם 2005 בינואר 2220 שנים i haven't programmed in asm, i worked with another asm-like program, but here goes: mov #5, r1 ; loop counter mov #0, r2 ; r2 = 0loop: add r0, r2 ; sum += cl sub r1 ; counter reduce tst r1 bnq loop ; if r1 != 0, continue loop mov r2, r0 ; cl = sum halt ; end note: i am assuming the register names are r0 ... r5 r0 = cl, all the others just replace as you wish hope its close enough מישהו פה מתכנת לARM, או שרק נדמה לי?
פורסם 2005 בינואר 2220 שנים מחבר למדו אותי דבר כזה - נגיד שאני רוצה לכפול בארבע :mov cl, 2 (2)add cl,cl (4) add cl,cl (8) (מה שבסוגריים מסמל את התוצאה)אז העיה היא שאיך אני אמור לכפול ב- 5?כי אני יכול לפי השיטה הזאתי לכפול רק במספרים זוגיים.ו- ballerium אני לא יכול להשתמש בפקודות האלה ... רק ב- mov,add,sub
פורסם 2005 בינואר 2220 שנים MOV CH,CLADD CH,CHADD CH,CHADD CL,CHטוב?הפקודה הראשונה שומרת את CL בצד בתוך CHהפקודה השניה מכפילה את CH ב- 2הפקודה השלישית מכפילה את התוצאה פי 2, סה"כ פי 4הפקודה האחרונה מוסיפה את התוצאה הקודמת ל- CL, סה"כ פי 5.
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.