Fixing putc and puts to use pointers correctly
This commit is contained in:
parent
f0243cb45e
commit
2c6826e293
2 changed files with 17 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
#include "font8x8_basic.h"
|
#include "font8x8_basic.h"
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
|
#include "xtoa.h"
|
||||||
|
|
||||||
static unsigned long fb_address;
|
static unsigned long fb_address;
|
||||||
static unsigned long fb_pitch;
|
static unsigned long fb_pitch;
|
||||||
|
@ -48,8 +49,8 @@ void putpixel(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void putc(
|
void putc(
|
||||||
const unsigned char character,
|
const unsigned char *character,
|
||||||
unsigned short x,
|
unsigned short x,
|
||||||
unsigned short y,
|
unsigned short y,
|
||||||
unsigned char r,
|
unsigned char r,
|
||||||
|
@ -57,16 +58,13 @@ static void putc(
|
||||||
unsigned char b
|
unsigned char b
|
||||||
){
|
){
|
||||||
// Limit to ASCII printable
|
// Limit to ASCII printable
|
||||||
if (character < 0x20) {
|
if (*character < 0x20 || *character > 0x7e) {
|
||||||
serial_write_string("\nASCII too low");
|
serial_write_string("\nputc ASCII out of range: ");
|
||||||
return;
|
serial_write_string(uitoa(*character, 16));
|
||||||
}
|
|
||||||
if (character > 0x7e) {
|
|
||||||
serial_write_string("\nASCII too hihg");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *rowdata = font8x8_basic[character];
|
unsigned char *rowdata = font8x8_basic[*character];
|
||||||
unsigned char charx, chary, iy, ix;
|
unsigned char charx, chary, iy, ix;
|
||||||
unsigned char sizex=1;
|
unsigned char sizex=1;
|
||||||
unsigned char sizey=1;
|
unsigned char sizey=1;
|
||||||
|
@ -94,7 +92,7 @@ void puts(
|
||||||
){
|
){
|
||||||
unsigned char i = 0;
|
unsigned char i = 0;
|
||||||
while (text[i]) {
|
while (text[i]) {
|
||||||
putc(text[i], x+i*8, y, r, g, b);
|
putc(text+i, x+i*8, y, r, g, b);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,15 @@ void putpixel(
|
||||||
unsigned char r,
|
unsigned char r,
|
||||||
unsigned char g,
|
unsigned char g,
|
||||||
unsigned char b
|
unsigned char b
|
||||||
);
|
);
|
||||||
|
void putc(
|
||||||
|
const unsigned char *character,
|
||||||
|
unsigned short x,
|
||||||
|
unsigned short y,
|
||||||
|
unsigned char r,
|
||||||
|
unsigned char g,
|
||||||
|
unsigned char b
|
||||||
|
);
|
||||||
void puts(
|
void puts(
|
||||||
const unsigned char *text,
|
const unsigned char *text,
|
||||||
unsigned short x,
|
unsigned short x,
|
||||||
|
|
Loading…
Reference in a new issue