-
Notifications
You must be signed in to change notification settings - Fork 0
/
decimal_test.asm
executable file
·76 lines (49 loc) · 1.38 KB
/
decimal_test.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
67
68
69
70
71
72
73
74
75
76
INCLUDE 'decimal_input.asm'
include 'decimal_output.asm'
org 100h
jmp start
;;;; Data section -----------
row_dt db 0 ; current row
col_dt db 0 ; current col
attrib db 0111_0000b ; color attribute
msg1 db "Enter a Number (-32767 to +32767):"
msg1_end:
;;;; Code section -----------
start:
LEA bp, msg1
MOV CX, msg1_end - offset msg1
call print_string
MOV BL, 0AH ; load color profile
call Decinput ; decinput return decimal in BX
; go to a new line
PUSH AX
MOV AL, 02H
INC DH
MOV DL, 0
INT 10H
POP AX
mov ax , bx
call decoutput
jmp $
print_string:
; this procedure prints a string in the data segment and move cursor after it
; Input: BP = address of the string, CX = total size of the string
PUSH ax
push bx
mov ah, 13h ; string print function
mov al, 1 ; update cursor
mov bh, 0 ; page 0
mov bl, attrib ; color
mov dh, row_dt ; current row
mov dl, col_dt ;
int 10h
; get cursor position
mov bh, 0
mov ah, 03h
int 10h
POP bx
pop ax
ret
DEFINE_DEC_INPUT
DEFINE_DEC_OUTPUT
END