-
Notifications
You must be signed in to change notification settings - Fork 0
/
1.asm
57 lines (49 loc) · 1.13 KB
/
1.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
.model tiny
.code
org 80h
cmd_len db ?
cmd_line db ?
org 100h
start:
jmp main
msg db "Hello TASM",10,13, '$'
resident_end:
usage_msg db "Specify t or f parameter (f - use function, i - use interrupt)",10,13, '$'
func_using_msg db "Made resident by func", 10, 13, '$'
int_using_msg db "Made resident by int", 10, 13, '$'
main:
cmp cmd_len, 2
jne print_usage
cld
mov di, offset cmd_line
inc di
mov si,di
lodsb
cmp al, 102 ; 'f'
je make_resident_by_func
cmp al, 105 ; 'i'
je make_resident_by_int
jmp print_usage
make_resident_by_int:
mov dx, offset int_using_msg
call print
mov dx, offset resident_end
int 27h
make_resident_by_func:
mov dx, offset func_using_msg
call print
mov dx, offset resident_end
shr dx, 4
mov ax, 3100h
int 21h
print_usage:
mov dx, offset usage_msg
call print
ret
print:
push ax
mov ah, 9
int 21h
pop ax
ret
end start