-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitAd.asm
66 lines (52 loc) · 1.43 KB
/
bitAd.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
; Program: bitadjust.asm
; Authors: Jorge Macias
; Diego Cervantes
; Christian Alvarez
;
; Description: An example program that uses and shows the concept of
; adjustment and carriage in math operations.
.model small
.stack
.data ; Data section (put variables here)
first_number dw 0
second_number dw 0
result dw ?
carriage db ?
welcome_message db 10, 13, 'Welcome! adjustment and carriage program example $'
message_first_input db 10, 13, 'Enter first number: $'
message_second_input db 10, 13, 'Enter second number: $'
buffer db 6 dup (?)
.code
start:
; code section begins here
; To understand syscalls and which one use to achieve something
; see this link: https://en.wikipedia.org/wiki/DOS_API#DOS_INT_21h_services
; Configure data segments
mov ax, @data
mov ds, ax
; Print welcome message
mov ah, 9
lea dx, welcome_message
int 21h
; Print input message #1
mov ah, 9
lea dx, message_first_input
int 21h
; Ask for input #1
mov ah, 1
int 21h
sub al, 30h
mov first_number, al
; Print input message #2
mov ah, 9
lea dx, message_second_input
int 21h
; Ask for input #2
mov ah, 1
int 21h
sub al, 30h
mov second_number, al
; Exit from the program
mov ah, 4ch ; function to finish the program
int 21h ; Make the DOS syscall
end start