Difference between revisions of "CSC231 Homework 3 Solutions 2010"
(→hw3c.asm) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
--[[User:Thiebaut|D. Thiebaut]] 14:18, 15 October 2010 (UTC) | --[[User:Thiebaut|D. Thiebaut]] 14:18, 15 October 2010 (UTC) | ||
---- | ---- | ||
+ | <onlysmith> | ||
+ | |||
=hw3a.asm= | =hw3a.asm= | ||
<code><pre> | <code><pre> | ||
Line 47: | Line 49: | ||
add ah, byte[tableb] ; add "1" to ah | add ah, byte[tableb] ; add "1" to ah | ||
mov byte[tablew], ah ; ah -> 1st B of tablew | mov byte[tablew], ah ; ah -> 1st B of tablew | ||
+ | |||
;; using a word | ;; using a word | ||
mov ax, word[tableb+1] ; "10" and "0xff" -> ax | mov ax, word[tableb+1] ; "10" and "0xff" -> ax | ||
mov byte[tablew+1*2], al ; "10" -> 3rd B of tablew | mov byte[tablew+1*2], al ; "10" -> 3rd B of tablew | ||
mov byte[tablew+2*2], ah ; "0xff" -> 5th B of tablew | mov byte[tablew+2*2], ah ; "0xff" -> 5th B of tablew | ||
+ | |||
;; using a double word | ;; using a double word | ||
mov eax, dword[tableb+3] ; "5", "0x0a", "01" -> eax | mov eax, dword[tableb+3] ; "5", "0x0a", "01" -> eax | ||
Line 110: | Line 114: | ||
mov byte[tabled], al ; "1" -> 1st B of tabled | mov byte[tabled], al ; "1" -> 1st B of tabled | ||
mov byte[tabled+1*4], ah ; "10" -> 4th B of tabled | mov byte[tabled+1*4], ah ; "10" -> 4th B of tabled | ||
+ | |||
;; using a byte | ;; using a byte | ||
mov ah, byte[tableb+2] ; "ff" -> ah | mov ah, byte[tableb+2] ; "ff" -> ah | ||
mov byte[tabled+2*4], ah ; ah -> 8th B of tabled | mov byte[tabled+2*4], ah ; ah -> 8th B of tabled | ||
+ | |||
;; using a word | ;; using a word | ||
mov ax, word[tableb+3] ; "5" and "0a" -> ax | mov ax, word[tableb+3] ; "5" and "0a" -> ax | ||
Line 202: | Line 208: | ||
int 0x80 ; final system call | int 0x80 ; final system call | ||
</pre></code> | </pre></code> | ||
− | + | </onlysmith> | |
<br /> | <br /> | ||
<br /> | <br /> |
Latest revision as of 12:20, 14 December 2010
--D. Thiebaut 14:18, 15 October 2010 (UTC)