-
Notifications
You must be signed in to change notification settings - Fork 0
/
create a bin file.asm
97 lines (70 loc) · 1.5 KB
/
create a bin file.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
; this is an example of how to make a ".bin" file.
name "bintest"
; directive to create bin file:
#make_bin#
; where to load?
#load_segment=1234#
#load_offset=0000#
; set these values to registers on load:
#al=12#
#ah=34#
#bh=56#
#bl=78#
#ch=9a#
#cl=bc#
#dh=de#
#dl=f0#
#ds=ddee#
#es=abcd#
#si=aaaa#
#di=cccc#
#bp=dddd#
#cs=1234#
#ip=0000#
#ss=3000#
#sp=ffff#
; when loading "bintest.bin" file in emulator
; it will look for a "bintest.binf" file,
; and load ".bin" file to location specified
; in that file, registers are also set using
; information in that file (open this file
; in a text editor to edit or investigate).
;
; ".binf" file is created automatically
; by compiler when it processes the above
; directives.
; this sample just prints out a part of
; some ascii character set, in an eternal
; loop, press [stop] or esc to terminate.
start:
mov al, '0'
mov ah, 0eh
print_more:
int 10h
inc al
; keep original ax:
mov cx, ax
;============================
; check for esc key to
; reboot:
; check for keystroke in
; keyboard buffer:
mov ah, 1
int 16h
jz key_processed
; get keystroke from keyboard:
; (remove from the buffer)
mov ah, 0
int 16h
; press 'esc' to exit:
cmp al, 27
jnz key_processed
hlt
key_processed:
;============================
; restore original ax:
mov ax, cx
cmp al, 'z'
jbe print_more
mov al, '0'
jmp print_more