FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
MS-DOS-kernel/test/test.asm at master · Programuserbash/MS-DOS-kernel · GitHub
Programuserbash
/
MS-DOS-kernel
Public
forked from
FDOS/kernel
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
MS-DOS-kernel
/
test
/
test.asm
Copy path
More file actions
More file actions
Latest commit
History
History
History
164 lines (136 loc) · 2.34 KB
Breadcrumbs
MS-DOS-kernel
/
test
/
test.asm
Copy path
File metadata and controls
164 lines (136 loc) · 2.34 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
%if
0
Usage of the works is permitted provided th
at
this
instrument is retained with the works
,
so th
at
any entity
th
at
uses the works is notified of this instrument.
DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
%endif
%include
"lmacros3.mac"
cpu
8086
org
256
start:
mov
ah
,
3Ch
xor
cx
,
cx
mov
dx
,
filename
int
21h
mov
dx
,
msg.creating
jc
error.nofile
xchg
bx
,
ax
mov
ah
,
40h
mov
dx
,
buffer
mov
cx
,
buffer.size
int
21h
mov
dx
,
msg.writing
jc
error
cmp
ax
,
cx
mov
dx
,
msg.full
jne
error
mov
ah
,
3Eh
int
21h
xor
ax
,
ax
jmp
quit
error:
mov
ah
,
3Eh
int
21h
.nofile:
push
ax
mov
ah
,
09h
int
21h
pop
ax
call
disp_ax_hex
mov
al
,
13
call
disp_al
mov
al
,
10
call
disp_al
mov
ax
,
-
1
jmp
quit
; INP: al = character to display
; CHG: -
; STT: ds, es don't care
disp_al:
push
ax
push
dx
xchg
ax
,
dx
mov
ah
,
02h
int
21h
pop
dx
pop
ax
retn
; Display number in ax hexadecimal, always 4 digits
;
; INP: ax = number
; OUT: displayed using disp_al
; CHG: none
disp_ax_hex:
xchg
al
,
ah
call
disp_al_hex
xchg
al
,
ah
disp_al_hex:
push
cx
mov
cl
,
4
rol
al
,
cl
call
disp_al_nybble_hex
rol
al
,
cl
pop
cx
disp_al_nybble_hex:
push
ax
and
al
,
0Fh
add
al
,
'0'
cmp
al
,
'9'
jbe
@F
add
al
,
-
'9'
-
1
+
'A'
@@:
call
disp_al
pop
ax
retn
%if
0
Shut down machine
by C. Masloch
,
2020
Usage of the works is permitted provided th
at
this
instrument is retained with the works
,
so th
at
any entity
th
at
uses the works is notified of this instrument.
DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
%endif
cpu
8086
; org 256
quit:
int3
mov
ax
,
0F000h
mov
es
,
ax
mov
di
,
0FFF5h
mov
si
,
msg.dosemudate
mov
cx
,
4
repe
cmpsw
; running in DosEmu?
jne
.quit_not_dosemu
xor
bx
,
bx
mov
ax
,
-
1
int
0E6h
; dosemu quit
.quit_not_dosemu:
; from https://stackoverflow.com/a/5240330/738287
mov
ax
,
5301h
xor
bx
,
bx
int
15h
; connect to APM API
mov
ax
,
530Eh
xor
bx
,
bx
mov
cx
,
0102h
int
15h
; set APM version to 1.02
mov
ax
,
5307h
mov
bx
,
1
mov
cx
,
3
int
15h
; shut down system
mov
dx
,
msg.failed
mov
ah
,
09h
int
21h
mov
ax
,
4C00h
int
21h
align
4
msg:
.dosemudate: db
"02/25/93"
.failed: db
"Quit failed."
,
13
,
10
,
36
.creating: ascic
"Creating failed, code="
.writing: ascic
"Writing failed, code="
.full: ascic
"Writing failed, full. AX="
filename:
asciz
"result.txt"
buffer:
.:
db
"success"
.size: equ $
-
.
Back
|
FazBrowse Home
|
New Git URL