You are on page 1of 2

Computer Organization And Architechture

- Semester 2/11/12

Quiz 1
Identify the basic element of assembly language in the Addsub.asm and Addsub2.asm
program.
TITLE Add and Subtract

(AddSub.asm)

; ThisBasic
program
adds and of
subtracts
32-bit integers.
Element
Assembly
Language
; Last update: 06/01/2006

Identifier

TITLE Add and Subtract, Version 2

(AddSub2.asm)

; This program
adds and
subtracts 32-bit
integers
Examples
in Addsub
andAddSub2
; and stores the sum in a variable.
Val1, 06/01/2006
val2, val3, finalVal, main
; Last update:

INCLUDE Irvine32.inc

Reserved
.code
main PROC
mov
add
sub
call
exit
main ENDP
END main

INCLUDE Irvine32.inc

words

eax,10000h
eax,40000h
eax,20000h
DumpRegs

Dword, .data, .code, main PROC, INCLUDE

; EAX = 10000h
; EAX = 50000h
; EAX = 30000h

Mnemonics instruction

Directives

Operands
Registers

Memory (data label)


Constant
Integer

Comment

.data
val1
dword 10000h
Irvine32.inc,
main ENDP, END
val2 dword 40000h
val3
call,dword
sub, 20000h
eax, DumpRegs, exit
finalVal dword ?
.code
main PROC
mov,

main, mov, add,

add, sub, call

mov

eax,val1 ; start with 10000h

add
eax,val2
; add 40000h
dword,
.data,
.code
sub
mov
call=,
eax,

eax,val3 ; subtract 20000h


finalVal,eax
; store the result (30000h)
DumpRegs
finalVal
dword? ; display the registers

eaxexit
main ENDP
END main

val1, val2, val3, finalVal dword?


=
10000h, 40000h, 20000h, 50000h, 30000h

; This program adds and subtracts 32-bit


integers
; and stores the sum in a variable.
; Last update: 06/01/2006
; EAX = 10000h
; EAX = 50000h
; EAX = 30000h
; start with 10000h
; add 40000h
; subtract 20000h
; store the result (30000h)
; display the registers

1/mdm rozi

Computer Organization And Architechture


- Semester 2/11/12

1 mark each

2/mdm rozi

You might also like