-
Notifications
You must be signed in to change notification settings - Fork 5
/
TEST250F.ASM
128 lines (104 loc) · 2.35 KB
/
TEST250F.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
;******************************************************************************
; int 21 AX=250Fh test
;******************************************************************************
;
;[TAB=8]
;------------------------------------------------------------------------------
%macro PRINT 1
mov edx,%1
mov ah,09h
int 21h
%endmacro
;------------------------------------------------------------------------------
segment text align=4 class=CODE use32
;------------------------------------------------------------------------------
..start:
mov eax, ds
mov ebx, 2823h
mov ecx, 1800h
call test_250fh
mov eax, 40h ; all memory selector
mov es, eax
mov ebx, 012345h
mov ecx, 800h
call test_250fh
mov ebx, 022333h
mov ecx, 0FFF0h
call test_250fh
mov ebx, 022333h
mov ecx, 10000h
call test_250fh
mov ebx, 0BFF00h
mov ecx, 0F0h
call test_250fh
mov ebx, 0BFF00h
mov ecx, 100h
call test_250fh
mov ebx, 0FFF00h
mov ecx, 0ffh
call test_250fh
mov ebx, 0FFF00h
mov ecx, 100h
call test_250fh
mov ebx, 288000h
mov ecx, 100h
call test_250fh
;-----------------------------------------
; end
;-----------------------------------------
mov ah, 4ch
int 21h
;------------------------------------------------------------------------------
align 16
test_250fh:
mov eax, es
call print_eax_hex
mov al, ':'
int 29h
mov eax, ebx
call print_eax_hex
PRINT size
mov eax, ecx
call print_eax_hex
mov ax, 250fh
int 21h
PRINT ecx_is
mov eax, ecx
call print_eax_hex
PRINT crlf
ret
;------------------------------------------------------------------------------
align 16
;------------------------------------------------------------------------------
msg1 db ':$'
size db ' size=$'
ecx_is db ' ecx=$'
crlf db 13,10,'$'
error db ' error!',13,10,'$'
;------------------------------------------------------------------------------
; number to hex digits
;------------------------------------------------------------------------------
; in eax = value
;
align 16
print_eax_hex:
pusha
mov ecx, 8
mov edi, hex
.loop:
rol eax, 4
movzx ebx, al
and bl, 0fh
mov dl, [hex_str + ebx]
cmp byte [edi], '_'
jne .skip
inc edi
.skip:
mov [edi], dl
inc edi
loop .loop
PRINT hex
popa
ret
hex_str db '0123456789abcdef'
hex db '####_####$'