forked from mig-hub/mikeOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandbook-appdev-asm.html
1748 lines (1057 loc) · 31.6 KB
/
handbook-appdev-asm.html
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The MikeOS Assembly App Developer Handbook</title>
<style type="text/css">
body {
font-family: sans-serif;
}
h1 {
margin-top:5px;
color: #DF6020;
}
h2 {
color: #DF6020;
}
h3 {
margin-top:5px;
color: #DF6020;
}
hr {
border: 0;
color: #DF6020;
background-color: #DF6020;
height: 3px;
}
pre {
background-color: #F0F0F0;
border: 5px solid #F0F0F0;
}
a {
text-decoration: none;
color: #0000F0;
}
a:visited {
text-decoration: none;
color: #0000F0;
}
a:hover {
text-decoration: underline;
}
li {
margin-left: -1ex;
}
</style>
</head>
<body>
<table border="0" cellpadding="10">
<tr>
<!-- NAVIGATION PANEL -->
<td style="border:1px solid black; width:160px;" valign="top">
<h3>Navigate</h3>
<p><strong>Overview</strong></p>
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#toolsneeded">Tools needed</a></li>
</ul>
<p><strong>Example</strong></p>
<ul>
<li><a href="#sourcecode">Source code</a></li>
<li><a href="#building">Building</a></li>
<li><a href="#explanation">Explanation</a></li>
</ul>
<p><strong>System calls</strong></p>
<ul>
<li><a href="#syscallintro">Introduction</a></li>
<li><a href="#syscalldisk">Disk</a></li>
<li><a href="#syscallkeyboard">Keyboard</a></li>
<li><a href="#syscallmath">Math</a></li>
<li><a href="#syscallmisc">Misc</a></li>
<li><a href="#syscallports">Ports</a></li>
<li><a href="#syscallscreen">Screen</a></li>
<li><a href="#syscallstring">String</a></li>
<li><a href="#syscallsound">Sound</a></li>
<li><a href="#syscallbasic">BASIC</a></li>
</ul>
<p><strong>Extra</strong></p>
<ul>
<li><a href="#help">Help</a></li>
<li><a href="#license">License</a></li>
</ul>
</td>
<!-- MAIN CONTENT PANEL -->
<td valign="top">
<h1>The MikeOS Assembly App Developer Handbook</h1>
<h3>For version 4.5, 21 December 2014 - (C) MikeOS Developers</h3>
<p>This documentation file explains how write software for MikeOS in assembly language. It shows you the tools you need,
how MikeOS programs work, and how to use the system calls included in the kernel. If you have
any questions, see <a href="http://mikeos.berlios.de">the MikeOS website</a> for contact details
and mailing list information.</p>
<p>Click the links on the left to navigate around this guide.</p>
<br />
<hr noshade="noshade" />
<h2>Overview</h2>
<a name="introduction"></a>
<h3>Introduction</h3>
<p>Many MikeOS programs are written in 16-bit, real mode assembly language. (The OS
also includes a BASIC interpreter.) Because MikeOS and its programs live in a single 64K
memory segment, you do not need to concern yourself with segment registers.</p>
<p>MikeOS programs are loaded at the <strong>32K point</strong> (32768) in the segment, and have a
maximum size of 32K. Consequently, your programs will need to begin with these directives:</p>
<pre>
BITS 16
ORG 32768
</pre>
<p>There are many system calls available in MikeOS for controlling the screen, getting input, manipulating
strings, loading/saving files, and more. All parameters to MikeOS system calls are passed in registers,
and not on the stack. To use them in your programs, you need this line:</p>
<pre>
%INCLUDE "mikedev.inc"
</pre>
<p>This doesn't include any code, but a list of <strong>equ</strong> directives that point to system call vectors
in the kernel. So, by including this file you can call, for instance, the MikeOS <strong>os_print_string</strong>
routine without having to know exactly where it is in the kernel. <strong>mikedev.inc</strong> is included in
the <strong>programs/</strong> directory of the MikeOS download -- it also provides a quick reference to the
system calls.</p>
<p>If a MikeOS program is run from the command line, and one or more parameters was provided with the command,
they are passed to the program via the SI register as a zero-terminated string.</p>
<br />
<a name="toolsneeded"></a>
<h3>Tools needed</h3>
<p>To write MikeOS programs you need:</p>
<ul>
<li><strong>NASM</strong> -- A powerful, free and open source assembler</li>
<li><strong>mikedev.inc</strong> -- The system call vectors described above</li>
<li>A way to add programs to the floppy disk</li>
</ul>
<p>Let's clarify this: MikeOS uses NASM for its programs and kernel source code, hence why we recommend it
here. You can, of course, use any other assembler that can output plain binary files (ie with no header)
and accept 16-bit code. NASM is available in most Linux distro repositories, or you can download the Windows
version <a href="http://www.nasm.us/pub/nasm/releasebuilds/">from here</a> (get the 'win32' file).</p>
<p>For the second point, copy <strong>programs/mikedev.inc</strong> so that it's alongside your program's
source code for inclusion.</p>
<p>For the third point, if you've written MikeOS to a real floppy disk, you can just copy your <strong>.BIN</strong>
programs onto that disk (root directory only!), boot MikeOS and test them out. If you're working with the virtual
<strong>mikeos.flp</strong> disk image, see the <em>Copying files</em> section of the User Handbook.</p>
<br />
<hr noshade="noshade" />
<h2>Example</h2>
<a name="sourcecode"></a>
<h3>Source code</h3>
<p>Here is an example MikeOS program, in NASM format, which prints a string to the screen
and waits for the user to press a key before finishing:</p>
<pre>
BITS 16
ORG 32768
%INCLUDE 'mikedev.inc'
start:
mov si, mystring
call os_print_string
call os_wait_for_key
ret
mystring db 'My first MikeOS program!', 0
</pre>
<br />
<a name="building"></a>
<h3>Building</h3>
<p>Save the above code as <strong>testapp.asm</strong>, and enter this command to assemble it
(works on both Linux and Windows):</p>
<pre>
nasm -f bin -o testapp.bin testapp.asm
</pre>
<p>Using the '-f bin' option we tell NASM that we just want a plain binary file: no header or sections.
The resulting executable file is <strong>testapp.bin</strong> that we can copy to our floppy disk or add
to the virtual disk image as described in <em>Copying files</em> in the User Handbook. Then we can boot
MikeOS and run the program.</p>
<br />
<a name="explanation"></a>
<h3>Explanation</h3>
<p>This is a very short program, but we'll explain exactly how it works for complete clarity. The first
three lines will not be assembled to machine code instructions, but are just directives to tell NASM that
we want to operate in 16 bit mode, our code is written to be executed from the 32K mark, and we want to
use system calls from the MikeOS API.</p>
<p>Next we have the 'start:' label, which is not essential but good practice to make things clear. We put
the location of a zero-terminated string into the <strong>SI</strong> register, then call the MikeOS
<strong>os_print_string</strong> routine which we can access via the vectors listed in <strong>mikedev.inc</strong>.
After that we pause program until a the user presses a key.</p>
<p>All MikeOS programs must end with a <strong>ret</strong> instruction, which passes control back to the OS.
After that instruction we have the data for our string. And that's it!</p>
<br />
<hr noshade="noshade" />
<h2>System calls</h2>
<a name="syscallintro"></a>
<h3>Introduction</h3>
<p>The MikeOS kernel includes system calls for outputting to the screen, taking keyboard input,
manipulating strings, producing PC speaker sounds, math operations and disk I/O. You can get
a quick reference to the registers that these calls take and pass back by looking at <strong>mikedev.inc</strong>,
and see practical use of the calls in the <strong>programs/</strong> directory.</p>
<p>Here we have a detailed API explanation with examples. You can see the full source code behind these system
calls in the <strong>source/features/</strong> directory in MikeOS. Each aspect of the API below is contained
within an assembly source file, so you can enhance the system calls as per the MikeOS System Developer Handbook.</p>
<br />
<hr style="width:50%;" />
<a name="syscalldisk"></a>
<h2>Disk</h2>
<h3>os_get_file_list</h3>
<p><strong>Generate comma-separated string of files on floppy</strong></p>
<ul>
<li>IN/OUT: AX = location to store zero-terminated filename string</li>
</ul>
<p>Example:</p>
<pre>
mov ax, .filestring
call os_get_file_list
; Now .filestring will contain something like
; 'HELLO.BIN,FOO.BAR,THREE.TXT', 0
.filestring times 256 db 0
</pre>
<br />
<h3>os_load_file</h3>
<p><strong>Load file into RAM</strong></p>
<ul>
<li>IN: AX = location of zero-terminated filename string, CX = location in RAM to load file</li>
<li>OUT: BX = file size (in bytes), carry set if file not found</li>
</ul>
<p>Example:</p>
<pre>
mov ax, filename
mov cx, 36960 ; 4K after where external program loads
call os_load_file
...
filename db 'README.TXT', 0
</pre>
<br />
<h3>os_write_file</h3>
<p><strong>Save (max 64K) file to disk</strong></p>
<ul>
<li>IN: AX = filename, BX = data location, CX = bytes to write</li>
<li>OUT: Carry clear if OK, set if failure</li>
</ul>
<p>Example:</p>
<pre>
; For this example, there's some text stored in .data
mov ax, .filename
mov bx, .data
mov cx, 4192
call os_write_file
.filename db 'HELLO.TXT', 0
.data times 4192 db 0
</pre>
<br />
<h3>os_file_exists</h3>
<p><strong>Check for presence of file on the floppy</strong></p>
<ul>
<li>IN: AX = filename location</li>
<li>OUT: carry clear if found, set if not</li>
</ul>
<p>Example:</p>
<pre>
mov ax, .filename
call os_file_exists
jc .not_found
...
.not_found:
; Print error message here
.filename db 'HELLO.TXT', 0
</pre>
<br />
<h3>os_create_file</h3>
<p><strong>Creates a new 0-byte file on the floppy disk</strong></p>
<ul>
<li>IN: AX = location of filename</li>
<li>OUT: Nothing</li>
</ul>
<p>Example:</p>
<pre>
mov ax, .filename
call os_create_file
...
.filename db 'HELLO.TXT', 0
</pre>
<br />
<h3>os_remove_file</h3>
<p><strong>Deletes the specified file from the filesystem</strong></p>
<ul>
<li>IN: AX = location of filename to remove</li>
<li>OUT: Nothing</li>
</ul>
<br />
<h3>os_rename_file</h3>
<p><strong>Change the name of a file on the disk</strong></p>
<ul>
<li>IN: AX = filename to change, BX = new filename (zero-terminated strings)</li>
<li>OUT: carry set on error</li>
</ul>
<p>Example:</p>
<pre>
mov ax, .filename1
mov bx, .filename2
call os_rename_file
jc .error
...
.error:
; File couldn't be renamed (may already exist)
.filename1 db 'ORIG.TXT', 0
.filename2 db 'NEW.TXT', 0
</pre>
<br />
<h3>os_get_file_size</h3>
<p><strong>Get file size information for specified file</strong></p>
<ul>
<li>IN: AX = filename</li>
<li>OUT: BX = file size in bytes (up to 64K) or carry set if file not found</li>
</ul>
<br />
<hr style="width:50%;" />
<a name="syscallkeyboard"></a>
<h2>Keyboard</h2>
<h3>os_wait_for_key</h3>
<p><strong>Waits for keypress and returns key</strong></p>
<ul>
<li>IN: Nothing</li>
<li>OUT: AX = key pressed, other regs preserved</li>
</ul>
<p>Example:</p>
<pre>
.loop:
call os_wait_for_key
cmp al, 'y'
je .yes
cmp al, 'n'
je .no
jmp .loop
</pre>
<br />
<h3>os_check_for_key</h3>
<p><strong>Scans keyboard for input, but doesn't wait</strong></p>
<ul>
<li>IN: Nothing</li>
<li>OUT: AX = 0 if no key pressed, otherwise scan code</li>
</ul>
<p>Example: see code above</p>
<br />
<hr style="width:50%;" />
<a name="syscallmath"></a>
<h2>Math</h2>
<h3>os_bcd_to_int</h3>
<p><strong>Converts binary coded decimal number to an integer</strong></p>
<ul>
<li>IN: AL = BCD number</li>
<li>OUT: AX = integer value</li>
</ul>
<p>Example:</p>
<pre>
mov al, 00010110b ; 0001 0110 = 16 (decimal) or 10h in BCD
call os_bcd_to_int
; AX now contains the 16 bit-integer 00000000 00010000b
</pre>
<br />
<h3>os_long_int_negate</h3>
<p><strong>Multiply value in DX:AX by -1</strong></p>
<ul>
<li>IN: DX:AX = long integer </li>
<li>OUT: DX:AX = -(initial DX:AX)</li>
</ul>
<p>Example:</p>
<pre>
mov dx, 01h
mov ax, 45h
call os_long_int_negate
; DX now contains 0xFFFF
; and AX 0xFEBB
</pre>
<br />
<h3>os_get_random</h3>
<p><strong>Get a random integer between high and low values (inclusive)</strong></p>
<ul>
<li>IN: AX = low integer, BX = high</li>
<li>OUT: CX = random number between AX and BX</li>
</ul>
<br />
<hr style="width:50%;" />
<a name="syscallmisc"></a>
<h2>Misc</h2>
<h3>os_get_api_version</h3>
<p><strong>Return current version of MikeOS API</strong></p>
<ul>
<li>IN: Nothing </li>
<li>OUT: AL = API version number</li>
</ul>
<p>Example:</p>
<pre>
call os_get_api_version
; AL now contains version number (eg 8)
</pre>
<br />
<h3>os_pause</h3>
<p><strong>Delay execution for specified 10ths of second</strong></p>
<ul>
<li>IN: AX = number of 10ths of second to wait</li>
<li>OUT: nothing</li>
</ul>
<p>Example:</p>
<pre>
; Halt execution for 3 secs
mov ax, 30
call os_pause
</pre>
<br />
<h3>os_fatal_error</h3>
<p><strong>Display error message and halt execution</strong></p>
<ul>
<li>IN: AX = error message string location</li>
<li>OUT: nothing</li>
</ul>
<p>Example:</p>
<pre>
mov ax, .error_msg
call os_fatal_error
.error_msg db 'Massive error!', 0
</pre>
<br />
<hr style="width:50%;" />
<a name="syscallports"></a>
<h2>Ports</h2>
<h3>os_port_byte_out</h3>
<p><strong>Sends a byte to the specified port</strong></p>
<ul>
<li>IN: DX = port address, AL = byte</li>
<li>OUT: Nothing</li>
</ul>
<br />
<h3>os_port_byte_in</h3>
<p><strong>Retrieves a byte from the specified port</strong></p>
<ul>
<li>IN: DX = port address</li>
<li>OUT: AL = byte</li>
</ul>
<br />
<h3>os_serial_port_enable</h3>
<p><strong>Turn on the first serial port</strong></p>
<ul>
<li>IN: AX = 0 for normal mode (9600 baud), or 1 for slow mode (1200 baud)</li>
<li>OUT: AH = bit 7 clear on success</li>
</ul>
<br />
<h3>os_send_via_serial</h3>
<p><strong>Send a byte via the serial port</strong></p>
<ul>
<li>IN: AL = byte to send via serial</li>
<li>OUT: AH = bit 7 clear on success</li>
</ul>
<p>Example:</p>
<pre>
mov al, 'a' ; Place char to transmit in AL
call os_send_via_serial
cmp ah, 128 ; If bit 7 is set, there's an error
jnz all_ok ; Otherwise it's all OK
jmp oops_error ; Deal with the error
</pre>
<br />
<h3>os_get_via_serial</h3>
<p><strong>Get a byte from the serial port</strong></p>
<ul>
<li>IN: nothing</li>
<li>OUT: AL = byte that was received; OUT: AH = bit 7 clear on success</li>
</ul>
<p>Example:</p>
<pre>
call os_get_via_serial
cmp ah, 128 ; If bit 7 is set, there's an error.
jnz all_ok ; Otherwise it's all OK
jmp oops_error ; Deal with the error
all_ok:
mov [rx_byte], al ; Store byte we retrieved
</pre>
<br />
<hr style="width:50%;" />
<a name="syscallscreen"></a>
<h2>Screen</h2>
<h3>os_print_string</h3>
<p><strong>Displays text</strong></p>
<ul>
<li>IN: SI = message location (zero-terminated string)</li>
<li>OUT: Nothing (registers preserved)</li>
</ul>
<p>Example:</p>
<pre>
mov si, .message
call os_print_string
...
.message db 'Hello, world', 0
</pre>
<br />
<h3>os_clear_screen</h3>
<p><strong>Clears the screen to background</strong></p>
<ul>
<li>IN/OUT: Nothing (registers preserved)</li>
</ul>
<br />
<h3>os_move_cursor</h3>
<p><strong>Moves cursor in text mode</strong></p>
<ul>
<li>IN: DH, DL = row, column </li>
<li>OUT: Nothing (registers preserved)</li>
</ul>
<p>Example:</p>
<pre>
; Move to middle of screen
mov dh, 12
mov dl, 40
call os_move_cursor
</pre>
<br />
<h3>os_get_cursor_pos</h3>
<p><strong>Return position of text cursor</strong></p>
<ul>
<li>OUT: DH, DL = row, column</li>
</ul>
<br />
<h3>os_print_horiz_line</h3>
<p><strong>Draw a horizontal line on the screen</strong></p>
<ul>
<li>IN: AX = line type (1 for double, otherwise single)</li>
<li>OUT: Nothing (registers preserved)</li>
</ul>
<br />
<h3>os_show_cursor</h3>
<p><strong>Turns on cursor in text mode</strong></p>
<ul>
<li>IN/OUT: Nothing</li>
</ul>
<br />
<h3>os_hide_cursor</h3>
<p><strong>Turns off cursor in text mode</strong></p>
<ul>
<li>IN/OUT: Nothing</li>
</ul>
<br />
<h3>os_draw_block</h3>
<p><strong>Render block of specified colour</strong></p>
<ul>
<li>IN: BL/DL/DH/SI/DI = colour/start X pos/start Y pos/width/finish Y pos</li>
<li>OUT: Nothing</li>
</ul>
<p>Example:</p>
<pre>
mov bl, 0100111b ; White on red
mov dl, 20 ; Start X position
mov dh, 2 ; Start Y position
mov si, 40 ; Width
mov di, 23 ; Finish Y position
call os_draw_block
</pre>
<br />
<h3>os_file_selector</h3>
<p><strong>Show a file selection dialog</strong></p>
<ul>
<li>IN: Nothing </li>
<li>OUT: AX = location of filename string (or carry set if Esc pressed)</li>
</ul>
<p>Example:</p>
<pre>
call os_file_selector
jc .esc_pressed
; Now AX points to the chosen filename
...
.esc_pressed:
...
</pre>
<br />
<h3>os_list_dialog</h3>
<p><strong>Show a dialog with a list of options</strong></p>
<ul>
<li>IN: AX = comma-separated list of strings to show (zero-terminated),</li>
<li> BX = first help string, CX = second help string</li>
<li>OUT: AX = number (starts from 1) of entry selected carry set if Esc pressed</li>
</ul>
<p>Example:</p>
<pre>
mov ax, .list
mov bx, .msg1
mov cx, .msg2
call os_list_dialog
jc .esc_pressed
; Now AX = number (from 1) of option chosen
...
.esc_pressed:
...
.list db 'Open,Close,Reboot', 0
.msg1 db 'Choose an option', 0
.msg2 db 'Or press Esc to quit', 0
</pre>
<br />
<h3>os_draw_background</h3>
<p><strong>Clear screen with white top and bottom bars, containing text, and a coloured middle section</strong></p>
<ul>
<li>IN: AX/BX = top/bottom string locations, CX = colour</li>
<li>OUT: Nothing</li>
</ul>
<p>Example:</p>
<pre>
mov ax, .title_msg
mov bx, .footer_msg
mov cx, 00100000b ; Colour
call os_draw_background
...
.title_msg db 'File manager', 0
.footer_msg db 'Choose an option...', 0
</pre>
<br />
<h3>os_print_newline</h3>
<p><strong>Reset cursor to start of next line</strong></p>
<ul>
<li>IN/OUT: Nothing (registers preserved)</li>
</ul>
<br />
<h3>os_dump_registers</h3>
<p><strong>Displays register contents in hex on the screen</strong></p>
<ul>
<li>IN/OUT: AX/BX/CX/DX = registers to show</li>
</ul>