├── arm1.PNG ├── arm2.PNG ├── x86.PNG ├── x86 examples.asm └── firstAsm.s /arm1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmedeid6842/computer-architecture-task/master/arm1.PNG -------------------------------------------------------------------------------- /arm2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmedeid6842/computer-architecture-task/master/arm2.PNG -------------------------------------------------------------------------------- /x86.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmedeid6842/computer-architecture-task/master/x86.PNG -------------------------------------------------------------------------------- /x86 examples.asm: -------------------------------------------------------------------------------- 1 | ;X86 assembly language Examples 2 | 3 | 4 | 5 | ;the problem is find the factorial 6 | Include irvine32.inc 7 | 8 | .data 9 | Var1 byte 10 10 | 11 | .code 12 | Fact proc 13 | Mov ecx,var1 14 | Mov eax,1 15 | 16 | L: 17 | Imul ecx 18 | Loop L 19 | Ret 20 | 21 | End fact 22 | 23 | 24 | ;the problem is :P = Q + R + S 25 | .data 26 | 27 | Q dword 2 28 | R dword 4 29 | S dword 5 30 | P dword ? 31 | .code 32 | 33 | Mov eax ,Q 34 | Mov ebx ,R 35 | Add eax,ebx 36 | Add eax,s 37 | Mov P ,eax 38 | 39 | end -------------------------------------------------------------------------------- /firstAsm.s: -------------------------------------------------------------------------------- 1 | ;ARM Examples 2 | 3 | 4 | 5 | ;the proplem is :calculate the factorial number 6 | 7 | AREA Prog2, CODE, READONLY 8 | 9 | ENTRY 10 | MOV r6,#10 ; load n into r6 11 | MOV r7,#1 ; if n = 0, at least n! = 1 12 | Loop CMP r6, #0 13 | MULGT r7, r6, r7 14 | SUBGT r6, r6, #1 ; decrement n 15 | BGT loop ; do another mul if counter!= 0 16 | stop B stop ; stop program 17 | END 18 | 19 | 20 | 21 | ; the problem is "The problem: P = Q + R + S" adding three different registers 22 | ; and store them in fourth register 23 | AREA Example1, CODE, READONLY 24 | 25 | ADD r0,r1,r2 ;P-Q+R 26 | ADD r0,r3 ;P=P+s 27 | 28 | Stop B Stop ;FALL through to and infinte loop 29 | 30 | END ;this end of the program 31 | 32 | 33 | 34 | ;the problem is "same as above" : P = Q + R + S 35 | AREA Example2, CODE, READONLY 36 | 37 | MOV r1,#Q ;load r1 with the constant Q 38 | MOV r2,#R 39 | MOV r3,#S 40 | ADD r0,r1,r2 41 | ADD r0,r0,r3 42 | 43 | Stop B Stop 44 | 45 | Q EQU 2 ;Equate the symbolic name Q to the value 2 46 | R EQU 4 ; 47 | S EQU 5 ; 48 | 49 | END 50 | 51 | 52 | 53 | --------------------------------------------------------------------------------