diff --git a/bin/WORDLE.8xp b/bin/WORDLE.8xp index 7a842fd..0816d7d 100644 Binary files a/bin/WORDLE.8xp and b/bin/WORDLE.8xp differ diff --git a/bin/WORDLE.bin b/bin/WORDLE.bin index 671e534..b49b951 100644 Binary files a/bin/WORDLE.bin and b/bin/WORDLE.bin differ diff --git a/bin/WORDLE.map b/bin/WORDLE.map index 8b0bb01..c7c14f8 100644 --- a/bin/WORDLE.map +++ b/bin/WORDLE.map @@ -7,9 +7,9 @@ Section Base Top High Length .init.reruncheck D1A933 D1A933 0h .init D1A933 D1A95D 2Ah .fini D1A95D D1A991 34h -.text D1A991 D1B660 CCFh -.data D1B660 D254B1 9E51h -.rodata D254B1 D25516 65h +.text D1A991 D1B641 CB0h +.data D1B641 D25492 9E51h +.rodata D25492 D254F7 65h .init_array 000000 000000 0h .ctors 000000 000000 0h .dtors 000000 000000 0h @@ -33,8 +33,7 @@ _os_DisableHomeTextBuffer = D1A991 _os_EnableHomeTextBuffer = D1A9A3 _random = D1A9B5 _srandom = D1AA0C -__state = D1B660 -_os_FontDrawText = 021E00 +__state = D1B641 _os_FontSelect = 021E28 __frameset = D1AA23 __frameset0 = D1AA31 @@ -45,10 +44,10 @@ __iremu = 000170 __ishru = 000184 __sand = 000200 __setflag = 000218 -.missingappvar = D254B1 -.libloadname = D254B6 +.missingappvar = D25492 +.libloadname = D25497 .libloadnamelen = 000007 -.webaddress = D254BE +.webaddress = D2549F __start = D1A933 ___exithl = D1A95D skip._exit = D1A95D @@ -65,34 +64,34 @@ _drawGrid = D1AB37 _clearSquare = D1ABAA _fillSquare = D1AC1A _dispLetter = D1AC8F -_winLossDisplay = D1AD0F -_enterLetter = D1ADDF -_backspace = D1AE18 -_handleKeys = D1AE34 -_inDictionary = D1B048 -_inSelected = D1B105 -_resetGame = D1B1C2 -_gameWin = D1B201 -_gameLoss = D1B2FE -_evaluateGuess = D1B3FB -_init = D1B5D8 -_mainGame = D1B5FA -_main = D1B645 -_SELECTED = D1B670 -_DICTIONARY = D1E389 +_winLossDisplay = D1ACF0 +_enterLetter = D1ADC0 +_backspace = D1ADF9 +_handleKeys = D1AE15 +_inDictionary = D1B029 +_inSelected = D1B0E6 +_resetGame = D1B1A3 +_gameWin = D1B1E2 +_gameLoss = D1B2DF +_evaluateGuess = D1B3DC +_init = D1B5B9 +_mainGame = D1B5DB +_main = D1B626 +_SELECTED = D1B651 +_DICTIONARY = D1E36A _rowPtr = D052C6 _colPtr = D052C7 _answer = D052C8 _guess = D052CE -L_.str = D254D3 -_YOU_WIN = D254A4 -L_.str.1 = D254DC -_YOU_LOSE = D254A7 -L_.str.2 = D254E6 -_PLAY_AGAIN = D254AA -L_.str.3 = D25502 -_reveal = D254AD -_gameRunning = D254B0 +L_.str = D254B4 +_YOU_WIN = D25485 +L_.str.1 = D254BD +_YOU_LOSE = D25488 +L_.str.2 = D254C7 +_PLAY_AGAIN = D2548B +L_.str.3 = D254E3 +_reveal = D2548E +_gameRunning = D25491 _prevkey = D052D4 _#gfx_Begin = D1A901 _#gfx_End = D1A905 diff --git a/img/IMG_4787.JPG b/img/IMG_4787.JPG deleted file mode 100644 index 75cb85d..0000000 Binary files a/img/IMG_4787.JPG and /dev/null differ diff --git a/obj/src/main.c.src b/obj/src/main.c.src index bd84f8a..3f67301 100644 --- a/obj/src/main.c.src +++ b/obj/src/main.c.src @@ -158,7 +158,7 @@ _clearScreenSafe: _drawGrid: ld hl, -9 call __frameset - ld hl, -75 + ld hl, 74 push hl call _gfx_SetColor ld de, 0 @@ -250,7 +250,7 @@ _clearSquare: pop hl pop hl pop hl - ld hl, -75 + ld hl, 74 push hl call _gfx_SetColor pop hl @@ -311,7 +311,7 @@ _fillSquare: pop hl pop hl pop hl - ld hl, -75 + ld hl, 74 push hl call _gfx_SetColor pop hl @@ -331,63 +331,48 @@ _fillSquare: section .text,"ax",@progbits public _dispLetter _dispLetter: - ld hl, -8 + ld hl, -4 call __frameset - ld a, (ix + 6) - ld iyh, a - ld b, (ix + 9) + ld d, (ix + 9) ld h, (ix + 12) - ld c, 37 - ld iyl, 1 - ld e, c - ld d, b - mlt de - ld a, e + ld e, 37 + ld c, e + ld b, d + mlt bc + ld a, c add a, 68 - ld e, a - ld l, c + ld (ix - 3), a + ld l, e mlt hl ld a, l add a, 10 - ex de, hl - ld e, iyh - ex de, hl - ld (ix - 2), l + ld (ix - 4), a + ld a, (ix + 6) + add a, -32 + ld (ix - 2), a ld (ix - 1), 0 - or a, a - sbc hl, hl - ld (ix - 5), hl - ld l, e - ld (ix - 8), hl - ld c, iyl - call __ishru - ld.sis de, 3 - add.sis hl, de - ld de, (ix - 5) - ld e, a - ld (ix - 5), de - srl a - add a, 2 - ld e, a - push de + ld hl, 3 push hl - pea ix - 2 - call _os_FontDrawText - pop hl - pop hl - pop hl - ld hl, -75 push hl - call _gfx_SetColor + call _gfx_SetTextScale pop hl - ld hl, 35 - push hl - push hl - ld hl, (ix - 5) + pop hl + or a, a + sbc hl, hl push hl - ld hl, (ix - 8) + pop iy + push af + ld a, (ix - 3) + ld iyl, a + pop af + ld de, 7 + add iy, de + ld l, (ix - 4) + add hl, de push hl - call _gfx_Rectangle + push iy + pea ix - 2 + call _gfx_PrintStringXY ld sp, ix pop ix ret @@ -1537,7 +1522,7 @@ BB18_15: BB18_18: ld a, (_rowPtr) ld l, a - ld de, 74 + ld de, -75 push de push hl ld hl, (ix - 29) @@ -9815,46 +9800,6 @@ _START_X: _START_Y: dw 10 - section .rodata,"a",@progbits - public _LIGHT_GRAY -_LIGHT_GRAY: - db 222 - - section .rodata,"a",@progbits - public _GRAY -_GRAY: - db 181 - - section .rodata,"a",@progbits - public _DARK_GRAY -_DARK_GRAY: - db 74 - - section .rodata,"a",@progbits - public _RED -_RED: - db 224 - - section .rodata,"a",@progbits - public _YELLOW -_YELLOW: - db 229 - - section .rodata,"a",@progbits - public _GREEN -_GREEN: - db 4 - - section .rodata,"a",@progbits - public _BLACK -_BLACK: - db 0 - - section .rodata,"a",@progbits - public _WHITE -_WHITE: - db 255 - section .bss,"aw",@nobits public _rowPtr _rowPtr: @@ -9946,7 +9891,6 @@ _prevkey: extern __imulu extern _gfx_SetColor extern _gfx_Rectangle - extern _os_FontDrawText extern _gfx_PrintStringXY extern _gfx_End extern __frameset0 diff --git a/src/main.c b/src/main.c index 5f2f1e2..ce24993 100644 --- a/src/main.c +++ b/src/main.c @@ -7,8 +7,8 @@ *---------------------------------------- */ -//! letters will be lowercase -// TODO: switch letter handling from os to graphx +//! letters will be lowercase internally +// TODO: update rectangle drawing to no clip #include <graphx.h> #include <keypadc.h> @@ -31,14 +31,14 @@ const u16 START_X = (LCD_WIDTH - COLS * SIZE - GAP * (COLS - 1)) / 2; const u16 START_Y = (LCD_HEIGHT - ROWS * SIZE - GAP * (ROWS - 1)) / 2; // color codes -const color LIGHT_GRAY = 0xde; // kinda looks blue im no artist -const color GRAY = 0xb5; -const color DARK_GRAY = 0x4a; -const color RED = 0xe0; -const color YELLOW = 0xe5; -const color GREEN = 0x04; -const color BLACK = 0x00; -const color WHITE = 0xff; +#define LIGHT_GRAY 0xde // kinda looks blue im no artist +#define GRAY 0xb5 +#define DARK_GRAY 0x4a +#define RED 0xe0 +#define YELLOW 0xe5 +#define GREEN 0x04 +#define BLACK 0x00 +#define WHITE 0xff // grid & wordle variables u8 rowPtr = 0, colPtr = 0; @@ -94,7 +94,7 @@ void clearScreenSafe(color clr) { gfx_FillRectangle(0, 0, LCD_WIDTH, LCD_HEIGHT); } void drawGrid() { - gfx_SetColor(GRAY); + gfx_SetColor(DARK_GRAY); // for some reason x is across and y is down // opposite to how 2d arrays are usually done @@ -109,25 +109,22 @@ void clearSquare(u8 x, u8 y) { u8 posx = START_X + x * (SIZE + GAP), posy = START_Y + y * (SIZE + GAP); gfx_SetColor(WHITE); gfx_FillRectangle(posx, posy, SIZE, SIZE); - gfx_SetColor(GRAY); + gfx_SetColor(DARK_GRAY); gfx_Rectangle(posx, posy, SIZE, SIZE); } void fillSquare(u8 x, u8 y, color clr) { u8 posx = START_X + x * (SIZE + GAP), posy = START_Y + y * (SIZE + GAP); gfx_SetColor(clr); gfx_FillRectangle(posx, posy, SIZE, SIZE); - gfx_SetColor(GRAY); + gfx_SetColor(DARK_GRAY); gfx_Rectangle(posx, posy, SIZE, SIZE); } void dispLetter(char letter, u8 x, u8 y) { u8 posx = START_X + x * (SIZE + GAP), posy = START_Y + y * (SIZE + GAP); - char nullTerminated[2] = {letter, '\0'}; - os_FontDrawText(nullTerminated, (posx) / 2 + 3, (posy) / 2 + 2); - - // cover edges with rectangle - gfx_SetColor(GRAY); - gfx_Rectangle(posx, posy, SIZE, SIZE); + char nullTerminated[2] = {letter - 'a' + 'A', '\0'}; + gfx_SetTextScale(3, 3); + gfx_PrintStringXY(nullTerminated, posx + 7, posy + 7); } void winLossDisplay(u8 pos) { // pos: 0 is top, 1 is bottom @@ -261,14 +258,6 @@ void resetGame() { drawGrid(); copyStr(answer, SELECTED[randInt(0, SELECTED_LEN - 1)]); rowPtr = colPtr = 0; -#ifdef DEBUG - char nT[6]; - for (u8 i = 0; i < COLS; i++) { - nT[i] = answer[i]; - } - nT[COLS] = '\0'; - os_FontDrawText(nT, 0, 0); -#endif } void gameWin() { u8 pos = (rowPtr >= ROWS / 2); @@ -344,7 +333,7 @@ void evaluateGuess() { ansFreq[guess[i] - 'a']--; fillSquare(i, rowPtr, YELLOW); } else { - fillSquare(i, rowPtr, DARK_GRAY); + fillSquare(i, rowPtr, GRAY); } dispLetter(guess[i], i, rowPtr); }