micro68/rom.c
2026-08-04 18:27:00 +09:00

38 lines
700 B
C

static unsigned short* lcd = (unsigned short*)0xf00100;
static void lcd_wait(void){
while(lcd[1] & (1 << 7));
}
static void lcd_cmd(unsigned char cmd){
lcd[0] = cmd;
lcd_wait();
}
static void lcd_data(unsigned char c){
lcd[1] = c;
lcd_wait();
}
static void lcd_print(const char* str){
int i;
for(i = 0; str[i] != 0; i++) lcd_data(str[i]);
}
#define LCD_DISPLAY (1 << 3)
#define LCD_DISPLAY_ON (1 << 2)
#define LCD_FUNCTION (1 << 5)
#define LCD_FUNCTION_8_BITS (1 << 4)
#define LCD_FUNCTION_2_LINES (1 << 3)
int main(void){
lcd_cmd(LCD_FUNCTION | LCD_FUNCTION_8_BITS | LCD_FUNCTION_2_LINES);
lcd_cmd(LCD_DISPLAY | LCD_DISPLAY_ON);
lcd_print("Hello, world!");
}
void tick(void){
}