[vga] a few more vga character writing functions
This commit is contained in:
parent
fa79d54ce2
commit
eb3fa7d499
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ kernel
|
||||
*.o
|
||||
bootdisk.img
|
||||
initrd
|
||||
*.swp
|
||||
|
37
core/vga.c
37
core/vga.c
@ -66,6 +66,43 @@ cls() {
|
||||
move_csr();
|
||||
}
|
||||
|
||||
/*
|
||||
* placech
|
||||
* Put a character in a particular cell with the given attributes.
|
||||
*/
|
||||
void
|
||||
placech(
|
||||
unsigned char c,
|
||||
int x,
|
||||
int y,
|
||||
int attr
|
||||
) {
|
||||
unsigned short *where;
|
||||
unsigned att = attr << 8;
|
||||
where = textmemptr + (y * 80 + x);
|
||||
*where = c | att;
|
||||
}
|
||||
|
||||
/*
|
||||
* writechf
|
||||
* Force write the given character.
|
||||
*/
|
||||
void
|
||||
writechf(
|
||||
unsigned char c
|
||||
) {
|
||||
placech(c, csr_x, csr_y, attrib);
|
||||
csr_x++;
|
||||
if (csr_x >= 80) {
|
||||
csr_x = 0;
|
||||
++csr_y;
|
||||
}
|
||||
scroll();
|
||||
move_csr();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* writech
|
||||
* Write a character to the screen.
|
||||
|
@ -48,6 +48,8 @@ extern void puts(char *str);
|
||||
extern void settextcolor(unsigned char forecolor, unsigned char backcolor);
|
||||
extern void resettextcolor();
|
||||
extern void init_video();
|
||||
extern void placech(unsigned char c, int x, int y, int attr);
|
||||
extern void writechf(unsigned char c);
|
||||
extern void writech(unsigned char c);
|
||||
|
||||
/* GDT */
|
||||
|
Loading…
Reference in New Issue
Block a user