mirror of
https://github.com/mlaux/gb6.git
synced 2024-09-27 09:56:08 +00:00
sixel graphics for test purposes
This commit is contained in:
parent
ec9226e144
commit
ab630f2e38
@ -13,6 +13,7 @@ add_executable(gb6
|
|||||||
../src/lcd.c
|
../src/lcd.c
|
||||||
../src/rom.c
|
../src/rom.c
|
||||||
emulator.c
|
emulator.c
|
||||||
|
lcd_sixel.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(gb6
|
target_link_libraries(gb6
|
||||||
|
34
cli/lcd_sixel.c
Normal file
34
cli/lcd_sixel.c
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "../src/lcd.h"
|
||||||
|
|
||||||
|
void lcd_draw(struct lcd *lcd)
|
||||||
|
{
|
||||||
|
int x, y, yy;
|
||||||
|
|
||||||
|
puts("\033[2J\033[H"); // clear screen and move cursor to 0, 0
|
||||||
|
puts("\033Pq"); // enter sixel graphics mode
|
||||||
|
for (y = 0; y < LCD_HEIGHT; y += 6) {
|
||||||
|
for (x = 0; x < LCD_WIDTH; x++) {
|
||||||
|
int val = 63;
|
||||||
|
for (yy = 0; yy < 6; yy++) {
|
||||||
|
val += !lcd->pixels[(y + yy) * LCD_WIDTH + x] << yy;
|
||||||
|
}
|
||||||
|
putchar(val);
|
||||||
|
}
|
||||||
|
putchar('-');
|
||||||
|
}
|
||||||
|
// puts("#0;2;0;0;0#1;2;100;100;0#2;2;0;100;0");
|
||||||
|
// puts("#1~~@@vv@@~~@@~~$");
|
||||||
|
// puts("#2??}}GG}}??}}??-");
|
||||||
|
// puts("#1!14@");
|
||||||
|
puts("\033\\"); // leave graphics mode
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
struct lcd lcd;
|
||||||
|
lcd_new(&lcd);
|
||||||
|
lcd_draw(&lcd);
|
||||||
|
return 0;
|
||||||
|
}
|
@ -40,4 +40,6 @@ void lcd_put_pixel(struct lcd *lcd, u8 x, u8 y, u8 value);
|
|||||||
// i feel like i'm going to need to call this every cycle and update regs
|
// i feel like i'm going to need to call this every cycle and update regs
|
||||||
void lcd_step(struct lcd *lcd);
|
void lcd_step(struct lcd *lcd);
|
||||||
|
|
||||||
|
void lcd_draw(struct lcd *lcd);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user