7 #define FONT_ADDR 0xb400
9 extern uint16_t font8x8_data[], font8x8_data_end[];
11 static int cur_x, cur_y, left_margin;
16 uint16_t *src = font8x8_data;
18 vdp_setup_addr(VDP_VRAM, FONT_ADDR);
19 while(src < font8x8_data_end) {
26 void dbg_printchar(int x, int y, char c)
28 unsigned int addr = 0xc000 + (y << 7) + (x << 1); /* 64x32 scroll size */
29 int tile = (c - 32) + (FONT_ADDR / TILESZ);
30 vdp_setup_addr(VDP_VRAM, addr);
31 VDP_DATA = VDP_TILENAME(tile, 0, 0);
34 void dbg_printstr(int x, int y, const char *str)
38 /* put the first char to set up the address once */
39 dbg_printchar(x++, y, *str++);
41 while(*str && x < 40) { /* 40 visible cells across in H40 (320) mode */
42 int tile = (*str++ - 32) + (FONT_ADDR / TILESZ);
43 VDP_DATA = VDP_TILENAME(tile, 0, 0);
47 void dbg_setcursor(int x, int y)
54 void dbg_putchar(int c)
63 if(cur_x > left_margin) {
64 dbg_printchar(--cur_x, cur_y, ' ');
69 cur_x = (cur_x + 8) & 0xf8;
73 dbg_printchar(cur_x++, cur_y, c);
77 static const char *exc_str[] = {
81 "illegal instruction",
85 "priviledge violation",
91 "uninitialized vector",
92 "", "", "", "", "", "", "", "",
103 } __attribute__((packed));
105 void exc_dump(unsigned int num, struct frame *frm)
108 printf("num addr: %x\n", &num);
110 if(num < sizeof exc_str / sizeof *exc_str) {
111 printf("Exception %xh: %s\n", num, exc_str[num]);
113 printf("Exception %xh\n", num);
116 printf("status: %x\n", frm->status);
117 printf("pc: %x\n", frm->pc);
118 printf("fmt: %x / vector: %x\n", frm->fmtoffs >> 12, frm->fmtoffs & 0xfff);