Coa Lab 1
Coa Lab 1
Faculty of Computing
UNIVERSITI TEKNOLOGI MALAYSIA
SUBJECT NAME:
COMPUTER ORGANIZATION AND ARCHITECTURE
SEMESTER: 2 - 2023/24
A23CS0157
Section: 09
Email: radensalmahumaira@graduate.utm.my
hynanie04@gmail.com
13/5/2024
SUBMITTED DATE:
COMMENTS:
1
Lab # 1
Simple program to familiarize with Program Code, Rebuild & Start Without
Debugging
INCLUDE Irvine32.inc
.data
TOTAL dword 0 ; a variable named TOTAL (declared as DWORD)
.code
main PROC
mov eax, 123400h ; Set EAX with the value of
123400h add eax, 567800h ; Add the content of EAX
with 567800h sub eax, 77700h ; Subtract content of EAX
with 77700h mov TOTAL, eax ; Store content of EAX to
TOTAL
call DumpRegs
exit
main ENDP
END main
Experimental Results:
a) Rebuild & Start Without Debugging
Screenshot Result:
2
i. Part B: Adding Variables
INCLUDE Irvine32.inc
.data
val1 DWORD 10000h
val2 DWORD 40000h
val3 DWORD 20000h
finalVal DWORD ?
.code
main
PROC
mov eax,val1 ; start with
10000h add eax,val2 ; add
40000h sub eax,val3 ; subtract
20000h
mov finalVal,eax ; store the result (30000h)
Experimental Results:
a) Rebuild & Start Without Debugging
Screenshot Result:
3
ii. Part C: Add and Subtract 8 and 16-Bit Version
INCLUDE Irvine32.inc
.data
valw1 WORD 1000h
valw2 WORD 4000h
valw3 WORD 2000h
finalValw WORD ?
valb1 BYTE 10h
valb2 BYTE 40h
valb3 BYTE 20h
finalValb BYTE ?
.code main PROC mov ax,valw1 ; start with
10000h add ax,valw2 ; add 40000h sub
ax,valw3 ; subtract 20000h mov
finalValw,ax ; store the result (30000h) call
DumpRegs ; display the registers
mov ah,valb1 ; start with 10000h add
ah,valb2 ; add 40000h sub ah,valb3
; subtract 20000h mov finalValb,ah ; store
the result (30000h) call DumpRegs ; display
the registers
exit
main
ENDP
END main
Experimental Results:
a) Rebuild & Start Without Debugging
4
Detail Debugging Process
PART 2:
3. Open 5 windows:
a. Watch
b. Autos
c. Memory
d. Registers
e. Disassembly
5
4. Default memory data segment value is at first variable: &val1 or 0x00405000
(depend on memory used).
6
6. F10 to trace/step the assembly program line by line.
What is Byte Code (or Machine Code) for the following assembly instructions:
Byte Code:
Experimental Results:
7
Lab 1 Submission
1. Screen capture results part 1(a), (b), (c) - Start Without Debugging
2. Code Submission
2. Prepare a video demo for debugging process Lab 1(b) and Lab 1(c) – Start
Debugging. If your group consists of 3 students, must do Lab 1(a). Each student
should explain one debugging process.
3. Video Submission
OR
b) Upload your video to your YouTube account and share the YouTube video
link in the submission option. Set your YouTube video unlisted video (i.e. only
person whou has the link can see the video)
• Upload OR share the YT video link to e-learning under [ Lab
Submission] section.