Skip to content

Commit

Permalink
fix win display positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackgaurd committed Sep 7, 2022
1 parent cdbfcae commit babde60
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 86 deletions.
Binary file modified bin/WORDLE.8xp
Binary file not shown.
Binary file modified bin/WORDLE.bin
Binary file not shown.
62 changes: 30 additions & 32 deletions bin/WORDLE.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Section Base Top High Length
.init.reruncheck D1A933 D1A933 0h
.init D1A933 D1A95D 2Ah
.fini D1A95D D1A991 34h
.text D1A991 D1B641 CB0h
.data D1B641 D25492 9E51h
.rodata D25492 D254F7 65h
.text D1A991 D1B5F4 C63h
.data D1B5F4 D25445 9E51h
.rodata D25445 D254AA 65h
.init_array 000000 000000 0h
.ctors 000000 000000 0h
.dtors 000000 000000 0h
Expand All @@ -33,21 +33,19 @@ _os_DisableHomeTextBuffer = D1A991
_os_EnableHomeTextBuffer = D1A9A3
_random = D1A9B5
_srandom = D1AA0C
__state = D1B641
__state = D1B5F4
_os_FontSelect = 021E28
__frameset = D1AA23
__frameset0 = D1AA31
__iand = 000134
__idivs = 00013C
__imulu = 000158
__iremu = 000170
__ishru = 000184
__sand = 000200
__setflag = 000218
.missingappvar = D25492
.libloadname = D25497
.missingappvar = D25445
.libloadname = D2544A
.libloadnamelen = 000007
.webaddress = D2549F
.webaddress = D25452
__start = D1A933
___exithl = D1A95D
skip._exit = D1A95D
Expand All @@ -65,33 +63,33 @@ _clearSquare = D1ABAA
_fillSquare = D1AC1A
_dispLetter = D1AC8F
_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
_enterLetter = D1AD73
_backspace = D1ADAC
_handleKeys = D1ADC8
_inDictionary = D1AFDC
_inSelected = D1B099
_resetGame = D1B156
_gameWin = D1B195
_gameLoss = D1B292
_evaluateGuess = D1B38F
_init = D1B56C
_mainGame = D1B58E
_main = D1B5D9
_SELECTED = D1B604
_DICTIONARY = D1E31D
_rowPtr = D052C6
_colPtr = D052C7
_answer = D052C8
_guess = D052CE
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
L_.str = D25467
_YOU_WIN = D25438
L_.str.1 = D25470
_YOU_LOSE = D2543B
L_.str.2 = D2547A
_PLAY_AGAIN = D2543E
L_.str.3 = D25496
_reveal = D25441
_gameRunning = D25444
_prevkey = D052D4
_#gfx_Begin = D1A901
_#gfx_End = D1A905
Expand Down
69 changes: 18 additions & 51 deletions obj/src/main.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -381,25 +381,13 @@ _dispLetter:
section .text,"ax",@progbits
public _winLossDisplay
_winLossDisplay:
ld hl, -9
ld hl, -3
call __frameset
ld hl, (_PLAY_AGAIN)
push hl
call _gfx_GetStringWidth
pop de
ld de, 50
add hl, de
ld bc, 65535
call __iand
push hl
pop de
ld hl, 320
ld (ix - 3), de
or a, a
sbc hl, de
ld bc, 2
call __idivs
ld (ix - 9), hl
sbc hl, hl
push hl
call _gfx_SetColor
pop hl
ld a, (ix + 6)
or a, a
jq z, BB9_1
Expand All @@ -408,49 +396,30 @@ _winLossDisplay:
BB9_1:
ld hl, 130
BB9_3:
ld (ix - 6), hl
or a, a
sbc hl, hl
push hl
call _gfx_SetColor
pop hl
ld hl, (ix - 9)
ld bc, 255
call __iand
ld (ix - 9), hl
ld (ix - 3), hl
dec hl
push hl
pop bc
ld iy, (ix - 6)
dec iy
ld hl, (ix - 3)
ld de, 2
add hl, de
ld de, 102
push de
ld de, 222
push de
push hl
ld hl, 49
push hl
push iy
push bc
call _gfx_Rectangle
pop hl
pop hl
pop hl
pop hl
ld iy, (ix - 9)
ld hl, -2
ex de, hl
add iy, de
lea bc, iy
ld iy, (ix - 6)
add iy, de
ld hl, (ix - 3)
ld de, 4
ld de, -2
add hl, de
ld de, 104
push de
ld de, 224
push de
push hl
ld hl, 48
push hl
push iy
push bc
call _gfx_Rectangle
pop hl
pop hl
Expand All @@ -462,11 +431,11 @@ BB9_3:
pop hl
ld hl, 100
push hl
ld hl, (ix - 3)
ld hl, 220
push hl
ld hl, (ix - 6)
ld hl, (ix - 3)
push hl
ld hl, (ix - 9)
ld hl, 50
push hl
call _gfx_FillRectangle
ld sp, ix
Expand Down Expand Up @@ -9876,10 +9845,8 @@ _prevkey:
extern _gfx_SetTextFGColor
extern _gfx_Begin
extern __sand
extern __idivs
extern __setflag
extern _srandom
extern __iand
extern _gfx_FillRectangle
extern _os_FontSelect
extern __frameset
Expand Down
5 changes: 2 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ void dispLetter(char letter, u8 x, u8 y) {
}
void winLossDisplay(u8 pos) {
// pos: 0 is top, 1 is bottom
const u16 width = gfx_GetStringWidth(PLAY_AGAIN) + 50;
const u16 height = 100;
const u8 x = (LCD_WIDTH - width) / 2, y = (pos ? 0 : LCD_HEIGHT / 2) + (LCD_HEIGHT / 2 - height) / 2;
const u16 width = 220, height = 100;
const u16 x = (LCD_WIDTH - width) / 2, y = (!pos * LCD_HEIGHT / 2) + (LCD_HEIGHT / 2 - height) / 2;

// draw outline
gfx_SetColor(BLACK);
Expand Down

0 comments on commit babde60

Please sign in to comment.