-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutputNumber.ASM
More file actions
64 lines (49 loc) · 1.05 KB
/
OutputNumber.ASM
File metadata and controls
64 lines (49 loc) · 1.05 KB
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
org 100h
Start:
mov ax, 2021
mov ax, 3745o
mov ax, 0111'1110'0101b
mov ax, 0x7E5
mov ax, $7E5
call Output
mov ax, 0C08h
int 21h
test al, al
je .End
mov ah, 08h
int 21h
.End:
ret
;-------------------------------------------------------
Output:
push bp
mov bp, sp
xor di, di
test eax, eax
jne .Divide
push $30
inc di
jmp .Print
.Divide:
mov bx, 10
mov cx, 10
.Loop:
cmp eax, 0
je .Print
xor edx, edx
div ebx
add dx, '0'
push dx
inc di
.Next:
loop .Loop
.Print:
mov cx, di
mov ah, 02h
@@:
pop dx
int 21h
loop @B
mov sp, bp
pop bp
ret