gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 112036a6d9aee53b858794a5f43ee432dc72b648 parent bb9295e714c243a2679d69200ac049febedbc5a2 Author: toxa <untoxa@mail.ru> Date: Tue, 27 Oct 2020 22:35:25 +0300 definition of cls(); bring sound.c example to compilable state Diffstat:
| M | gbdk-lib/examples/gb/sound.c | 22 | +++++++++++----------- |
| M | gbdk-lib/include/gb/console.h | 17 | ++++++++--------- |
2 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/gbdk-lib/examples/gb/sound.c b/gbdk-lib/examples/gb/sound.c @@ -656,13 +656,13 @@ UBYTE draw_screen(UBYTE mode) cls(); gotoxy(FIRST_X, TITLE_Y); - print(params[0].name); + printf("%s", params[0].name); for(i = 0; params[i+1].name; i++) { gotoxy(FIRST_X, FIRST_Y+i); - print(params[i+1].name); + printf("%s", params[i+1].name); gotoxy(VAL_X, FIRST_Y+i); - println(current_value(mode, i), 10, UNSIGNED); + printf("%d", current_value(mode, i)); } return i-1; } @@ -689,19 +689,19 @@ void dump_registers() cls(); gotoxy(FIRST_X, TITLE_Y); - print("Register Dump"); + printf("Register Dump"); for(i = 0, j = 0; i <= 0x16; i++, j++) { if(i == 0x05 || i == 0x0F) i++; if(j%2 == 0) { gotoxy(FIRST_X, FIRST_Y+j/2); - print("0xFF"); + printf("0xFF"); } else { gotoxy(FIRST_X+6, FIRST_Y+j/2); putchar('-'); } - printn(i+0x10, 16, UNSIGNED); + printf("%ux", (UBYTE)(i+0x10)); if(j%2 == 0) { gotoxy(VAL_X, FIRST_Y+j/2); } else { @@ -710,7 +710,7 @@ void dump_registers() } reg = ((UBYTE *)soundReg)[i]; if(!(reg & 0xF0U)) putchar('0'); - printn(reg, 16, UNSIGNED); + printf("%ux", reg); } } @@ -748,8 +748,8 @@ void wait_event(UBYTE mode) else l--; update_value(mode, y-FIRST_Y, l); - gotoxy(VAL_X, y); print(" "); - gotoxy(VAL_X, y); println(l, 10, UNSIGNED); + gotoxy(VAL_X, y); printf(" "); + gotoxy(VAL_X, y); printf("%d", l); } } else if(input & J_RIGHT) { l = current_value(mode, y-FIRST_Y); @@ -761,8 +761,8 @@ void wait_event(UBYTE mode) else l++; update_value(mode, y-FIRST_Y, l); - gotoxy(VAL_X, y); print(" "); - gotoxy(VAL_X, y); println(l, 10, UNSIGNED); + gotoxy(VAL_X, y); printf(" "); + gotoxy(VAL_X, y); printf("%d", l); } } else if(input & J_START) { if(input & J_A) diff --git a/gbdk-lib/include/gb/console.h b/gbdk-lib/include/gb/console.h @@ -9,25 +9,24 @@ /** Move the cursor to an absolute position. */ -void -gotoxy(UINT8 x, - UINT8 y); +void gotoxy(UINT8 x, UINT8 y); /** Get the current X position of the cursor. */ -UINT8 -posx(void); +UINT8 posx(void); /** Get the current Y position of the cursor. */ -UINT8 -posy(void); +UINT8 posy(void); /** Writes out a single character at the current cursor position. Does not update the cursor or interpret the character. */ -void -setchar(char c); +void setchar(char c); + +/** Clears the screen +*/ +void cls(); #endif /* _CONSOLE_H */
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.