BIOS color, scroll
This commit is contained in:
72
bios_scroll.S
Normal file
72
bios_scroll.S
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
BIOS has a scroll function!
|
||||
|
||||
Very convenient, otherwise that would be hard to implement.
|
||||
|
||||
How it works:
|
||||
|
||||
Before scroll:
|
||||
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
|
||||
We then choose to act on the rectangle with corners
|
||||
(1, 1) and (2, 2)} given by cx and dx:
|
||||
|
||||
a
|
||||
XX
|
||||
XX
|
||||
d
|
||||
|
||||
and scroll that rectangle down by one line (al).
|
||||
|
||||
The final outcome is:
|
||||
|
||||
a
|
||||
c
|
||||
NN
|
||||
d
|
||||
|
||||
where `N` are new squares generated by the scroll,
|
||||
which gets filled with the background color in bh.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
BEGIN
|
||||
|
||||
/* Print staircase. */
|
||||
CLEAR
|
||||
PUTC(61)
|
||||
PUTC(0A)
|
||||
PUTC(62)
|
||||
PUTC(0A)
|
||||
PUTC(63)
|
||||
PUTC(0A)
|
||||
PUTC(64)
|
||||
|
||||
/* Function ID. */
|
||||
mov $0x06, %ah
|
||||
/* nr. of lines to scroll */
|
||||
mov $0x01, %al
|
||||
/*
|
||||
BIOS color attributes.
|
||||
Background is the clear color.
|
||||
Foreground is set as the new foreground color.
|
||||
*/
|
||||
mov $0xA4, %bh
|
||||
/*
|
||||
CH,CL: row,column upper left corner (00:00)
|
||||
TODO what does that mean?
|
||||
*/
|
||||
mov $0x0101, %cx
|
||||
/*
|
||||
DH,DL: row,column lower right corner (24:79).
|
||||
TODO what does it mean?
|
||||
*/
|
||||
mov $0x0202, %dx
|
||||
int $0x10
|
||||
|
||||
hlt
|
||||
END
|
||||
Reference in New Issue
Block a user