TIP-Quezon City College of Information Technology Education Bachelor of Science in Information Technology
TIP-Quezon City College of Information Technology Education Bachelor of Science in Information Technology
In Partial Fulfillment
of the Requirement of the Subject
Computer System Organization
With Assembly Language
(CSO002L1)
Presented by:
Betchie Rose Dahili
Tere Pasquil
Kev Angel
Eniel Peter Marcelo
Vargas Jerome
Kevin Cachuela
Gregy Conti
Presented to:
Junnel E. Avestro
Adviser
August 2014
Program 1 (ADD)
.model small
.stack 100h
.data
prompt1 DB 10,13, 'First number $'
prompt2 DB 10,13, 'Second number $'
result DB 13, 10, 'the sum is $'
;Variables
num1 dw ?
num2 dw ?
sum dw ?
.code
main proc
mov ax,
mov ds,
@data
;get data segment address
ax ;initialize ds
;Display Prompt
mov ah, 9
;print string function
mov dx, offset prompt1
;ds:dx points to string
int 21h
mov ah, 1
int 21h
xor ah, ah
mov num1, ax
;input function
;clear the top 8 bits of ax
;save the value from input
mov ah, 9
mov dx, offset prompt2
int 21h
mov ah, 1
int 21h
xor ah, ah
mov num2, ax
;Addition
sub num1, '0'
sub num2, '0'
mov ax, num1
;print prompt
;Print Sum
mov ah,9
lea dx, result
int 21h
mov ah,2
mov dx, sum
int 21h
mov ah,4ch
int 21h
main endp
end main
; print result
Program 2 (SUBTRACTION)
.model small
.stack 100h
.data
prompt1 DB 10,13, 'First number $'
prompt2 DB 10,13, 'Second number $'
result DB 13, 10, 'the difference is $'
;Variables
num1 dw ?
num2 dw ?
dif dw ?
.code
main proc
mov ax,
mov ds,
@data
;get data segment address
ax ;initialize ds
;Display Prompt
mov ah, 9
;print string function
mov dx, offset prompt1
;ds:dx points to string
int 21h
mov ah, 1
int 21h
xor ah, ah
mov num1, ax
;input function
;clear the top 8 bits of ax
;save the value from input
mov ah, 9
mov dx, offset prompt2
int 21h
;print prompt
mov ah, 1
int 21h
xor ah, ah
mov num2, ax
;difference
sub num1, '0'
sub num2, '0'
mov ax, num1
sub ax, num2
mov dif, ax
add dif, '0'
;Print Sum
mov ah,9
lea dx, result
int 21h
mov ah,2
mov dx, dif
int 21h
mov ah,4ch
int 21h
main endp
end main
; print result
Program 3 (MULTIPLICATION)
.model small
.stack 100h
.data
prompt1 DB 10,13, 'First number $'
prompt2 DB 10,13, 'Second number $'
result DB 13, 10, 'the product is $'
;Variables
num1 dw ?
num2 dw ?
prod dw ?
.code
main proc
mov ax,
mov ds,
@data
;get data segment address
ax ;initialize ds
;Display Prompt
mov ah, 9
;print string function
mov dx, offset prompt1
;ds:dx points to string
int 21h
mov ah, 1
int 21h
xor ah, ah
mov num1, ax
;input function
;clear the top 8 bits of ax
;save the value from input
mov ah, 9
mov dx, offset prompt2
int 21h
mov ah, 1
int 21h
xor ah, ah
mov num2, ax
;product
sub num1, '0'
sub num2, '0'
mov ax, num1
mov dx, num2
;print prompt
mul dx
mov prod, ax
add prod, '0'
;Print Sum
mov ah,9
lea dx, result
int 21h
mov ah,2
mov dx, prod
int 21h
mov ah,4ch
int 21h
main endp
end main
; print result
Program 4 (DIVISION)
.model small
.stack 100h
.data
prompt1 DB 10,13, 'First number $'
prompt2 DB 10,13, 'Second number $'
result DB 13, 10, 'the quotient is $'
;Variables
num1 dw ?
num2 dw ?
quo dw ?
.code
main proc
mov ax,
mov ds,
@data
;get data segment address
ax ;initialize ds
;Display Prompt
mov ah, 9
;print string function
mov dx, offset prompt1
;ds:dx points to string
int 21h
mov ah, 1
int 21h
xor ah, ah
mov num1, ax
;input function
;clear the top 8 bits of ax
;save the value from input
mov ah, 9
mov dx, offset prompt2
int 21h
mov ah, 1
int 21h
xor ah, ah
mov num2, ax
;quotient
sub num1, '0'
sub num2, '0'
mov ax, num1
mov bx, num2
;print prompt
div bx
mov quo, ax
add quo, '0'
;Print Sum
mov ah,9
lea dx, result
int 21h
mov ah, 2
mov dx, quo
int 21h
mov ah,4ch
int 21h
main endp
end main
; print result
Program 6
@echo off
:start
Echo Press 1 for Addition
echo Press 2 for Subtraction
echo Press 3 for Multiplication
echo Press 4 for Division
echo Press 5 to Quit
set /p type=
if %type%==1 goto a
if %type%==2 goto b
if %type%==3 goto c
if %type%==4 goto d
if %type%==5 goto e
:a
echo Addition
echo Please choose the 2 numbers you wish to add
set /p num1=
set /p num2=
echo %num1%+%num2%?
pause
set /a Answer=%num1%+%num2%
echo %Answer%
pause
goto start
:b
echo Subtraction
echo Please choose the 2 numbers you wsh to subtract
set /p num1=
set /p num2=
echo %num1%-%num2%?
pause
set /a Answer=%num1%-%num2%
echo %Answer%
pause
goto start
:c
echo Multiplication
echo Please choose the 2 numbers you wish to multiply
set /p num1=
set /p num2=
echo %num1%*%num2%?
pause
set /a Answer=%num1%*%num2%
echo %Answer%
pause
goto start
:d
echo Division
echo Please choose the 2 numbers you wish to divide
set /p num1=
set /p num2=
echo %num1%/%num2%?
pause
set /a Answer=%num1%/%num2%
echo %Answer%
pause
goto start
:e
echo.