Difference between revisions of "CSC231 Many Mov Instructions"
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | --[[User:Thiebaut|D. Thiebaut]] | + | --[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 12:46, 23 September 2015 (EDT) |
---- | ---- | ||
Line 10: | Line 10: | ||
5 ;;; | 5 ;;; | ||
6 ;;; To assemble, link, and run: | 6 ;;; To assemble, link, and run: | ||
− | 7 ;;; nasm -f elf -F stabs manyMoves.asm | + | 7 ;;; nasm -f elf -F stabs manyMoves.asm -l manyMoves.lst |
8 ;;; ld -melf_i386 -o manyMoves manyMoves.o | 8 ;;; ld -melf_i386 -o manyMoves manyMoves.o | ||
− | 9 ;;; ./ | + | 9 ;;; ./skel |
10 ;;; | 10 ;;; | ||
11 | 11 | ||
Line 29: | Line 29: | ||
24 0000000B B403 mov ah, 3 | 24 0000000B B403 mov ah, 3 | ||
25 | 25 | ||
− | 26 0000000D A1[03000000] mov eax, dword[c] | + | 26 0000000D B8[03000000] mov eax, c |
− | + | 27 00000012 A1[03000000] mov eax, dword[c] | |
− | + | 28 00000017 66A1[01000000] mov ax, word[b] | |
− | + | 29 0000001D A0[00000000] mov al, byte[a] | |
− | + | 30 00000022 8A25[00000000] mov ah, byte[a] | |
− | + | 31 | |
− | + | 32 00000028 BB03000000 mov ebx, 3 | |
− | + | 33 0000002D 66BB0300 mov bx, 3 | |
− | + | 34 00000031 B303 mov bl, 3 | |
− | + | 35 00000033 B703 mov bh, 3 | |
− | + | 36 | |
− | + | 37 00000035 BB[03000000] mov ebx, c | |
− | + | 38 0000003A 8B1D[03000000] mov ebx, dword[c] | |
− | + | 39 00000040 668B1D[01000000] mov bx, word[b] | |
− | + | 40 00000047 8A1D[00000000] mov bl, byte[a] | |
− | + | 41 0000004D 8A3D[00000000] mov bh, byte[a] | |
− | + | 42 | |
− | + | 43 00000053 88D8 mov al, bl | |
− | + | 44 00000055 6689D1 mov cx, dx | |
− | + | 45 00000058 89DA mov edx, ebx | |
− | + | 46 | |
− | + | 47 ;;; put your code here | |
− | + | 48 | |
+ | 49 ;;; exit | ||
+ | 50 0000005A BB00000000 mov ebx, 0 | ||
+ | 51 0000005F B801000000 mov eax, 1 | ||
+ | 52 00000064 CD80 int 0x80 | ||
+ | 53 | ||
+ | 54 | ||
+ | |||
</source> | </source> | ||
Latest revision as of 12:46, 23 September 2015
--D. Thiebaut (talk) 12:46, 23 September 2015 (EDT)
1 ;;; manyMoves.asm
2 ;;; D. Thiebaut
3 ;;;
4 ;;;
5 ;;;
6 ;;; To assemble, link, and run:
7 ;;; nasm -f elf -F stabs manyMoves.asm -l manyMoves.lst
8 ;;; ld -melf_i386 -o manyMoves manyMoves.o
9 ;;; ./skel
10 ;;;
11
12 section .data
13 00000000 00 a db 0
14 00000001 0000 b dw 0
15 00000003 00000000 c dd 0
16
17
18 section .text
19 global _start
20 _start:
21 00000000 B803000000 mov eax, 3
22 00000005 66B80300 mov ax, 3
23 00000009 B003 mov al, 3
24 0000000B B403 mov ah, 3
25
26 0000000D B8[03000000] mov eax, c
27 00000012 A1[03000000] mov eax, dword[c]
28 00000017 66A1[01000000] mov ax, word[b]
29 0000001D A0[00000000] mov al, byte[a]
30 00000022 8A25[00000000] mov ah, byte[a]
31
32 00000028 BB03000000 mov ebx, 3
33 0000002D 66BB0300 mov bx, 3
34 00000031 B303 mov bl, 3
35 00000033 B703 mov bh, 3
36
37 00000035 BB[03000000] mov ebx, c
38 0000003A 8B1D[03000000] mov ebx, dword[c]
39 00000040 668B1D[01000000] mov bx, word[b]
40 00000047 8A1D[00000000] mov bl, byte[a]
41 0000004D 8A3D[00000000] mov bh, byte[a]
42
43 00000053 88D8 mov al, bl
44 00000055 6689D1 mov cx, dx
45 00000058 89DA mov edx, ebx
46
47 ;;; put your code here
48
49 ;;; exit
50 0000005A BB00000000 mov ebx, 0
51 0000005F B801000000 mov eax, 1
52 00000064 CD80 int 0x80
53
54