Clean up interface

This commit is contained in:
Thomas Lovén 2018-02-15 10:22:16 +01:00
parent e6d046d593
commit 2da088f031
3 changed files with 16 additions and 19 deletions

View File

@ -2,6 +2,19 @@
#include <memory.h> #include <memory.h>
#include <ports.h> #include <ports.h>
#define VGA_COLS 80
#define VGA_ROWS 24
#define VGA_SIZE (VGA_COLS*VGA_ROWS)
#define VGA_ROW(pos) ((pos)/VGA_COLS)
#define VGA_COL(pos) ((pos)%VGA_COLS)
#define VGA_POS(row, col) ((row)*VGA_COLS + (col))
#define VGA_ADDRESS_PORT 0x3D4
#define VGA_DATA_PORT 0x3D5
#define VGA_REGISTER_CURSOR_POS_LOW 0xF
#define VGA_REGISTER_CURSOR_POS_HIGH 0xE
void *vidmem; void *vidmem;
struct vga_cell{ struct vga_cell{
uint8_t c; uint8_t c;

View File

@ -1,6 +1,4 @@
#pragma once #pragma once
#include <stddef.h>
#include <stdarg.h>
#ifndef NDEBUG #ifndef NDEBUG
#define debug(...) debug_printf(__VA_ARGS__) #define debug(...) debug_printf(__VA_ARGS__)
@ -20,8 +18,7 @@
#define debug_error(...) #define debug_error(...)
#endif #endif
void debug_putch(char c);
void debug_putsn(char *s, size_t n);
void debug_puts(char *s);
void debug_vprintf(char *fmt, va_list args);
void debug_printf(char *fmt, ...); void debug_printf(char *fmt, ...);
void debug_puts(char *s);
void debug_putsn(char *s, size_t n);
void debug_putch(char c);

View File

@ -1,19 +1,6 @@
#pragma once #pragma once
#define VGA_COLS 80
#define VGA_ROWS 24
#define VGA_SIZE (VGA_COLS*VGA_ROWS)
#define VGA_ROW(pos) ((pos)/VGA_COLS)
#define VGA_COL(pos) ((pos)%VGA_COLS)
#define VGA_POS(row, col) ((row)*VGA_COLS + (col))
#define VGA_MEMORY P2V(0xB8000) #define VGA_MEMORY P2V(0xB8000)
void vga_init(); void vga_init();
void vga_write(char c); void vga_write(char c);
#define VGA_ADDRESS_PORT 0x3D4
#define VGA_DATA_PORT 0x3D5
#define VGA_REGISTER_CURSOR_POS_LOW 0xF
#define VGA_REGISTER_CURSOR_POS_HIGH 0xE