Results Screen
Proper end-of-game display with final scores, winner announcement, and victory margin.
When a game ends, the current display simply shows “P1 WINS!” or “DRAW!” overlaid on the board. This unit creates a proper results screen with structured information: a header, final scores for both players in their colours, the winner announcement, and the victory margin.
The results screen transforms the end of game from an afterthought into a satisfying conclusion.
Run It
pasmonext --sna inkwar.asm inkwar.sna

Play a complete game to see the enhanced results screen with final scores and victory margin.
Results Screen Layout
The screen shows information in a clear hierarchy:
GAME OVER
P1:32 P2:32
P1 WINS!
BY 04 CELLS
PRESS ANY KEY
Each element has a defined position:
This code sample could not be loaded. The file may be missing or the path may be incorrect.
The layout uses the lower portion of the screen, below the game board.
Enhanced Show Results
The show_results function now builds the complete results display:
This code sample could not be loaded. The file may be missing or the path may be incorrect.
Key improvements:
- “GAME OVER” header — Clear signal the game has ended
- Final scores — Both players’ scores displayed prominently with their colours
- Winner message — In the winner’s colour (P1 = red, P2 = blue)
- Victory margin — How many cells the winner led by
Calculating Victory Margin
When someone wins, we show the score difference:
This code sample could not be loaded. The file may be missing or the path may be incorrect.
The margin calculation uses neg to negate one score before adding:
ld a, (p1_count)
ld b, a
ld a, (p2_count)
neg ; A = -p2_count
add a, b ; A = p1_count - p2_count
This gives the difference without needing a subtraction instruction.
Draw Handling
Draws skip the margin display entirely — there’s no meaningful difference to show:
.sr_draw:
; Display "DRAW!" (centred)
ld b, WINNER_ROW
ld c, WINNER_COL + 2
ld hl, msg_draw
ld e, TEXT_ATTR
call print_message
; No margin for draw - skip directly to prompt
The DRAW! message is centred differently (offset by 2) because it’s shorter than “P1 WINS!”.
Visual Consistency
The results screen maintains visual consistency with the rest of the game:
- P1’s score uses
P1_TEXTattribute (red background) - P2’s score uses
P2_TEXTattribute (blue background) - Winner message uses the winner’s colour
- Header and margin use neutral
TEXT_ATTR
This colour coding reinforces the game’s visual language — players immediately recognise “their” colour.
The Complete Code
This code sample could not be loaded. The file may be missing or the path may be incorrect.
Try This: Percentage Display
Show victory as a percentage of the board:
; Calculate percentage: (score * 100) / 64
ld a, (p1_count)
; ... multiply by 100, divide by 64 ...
; Display as "50%" instead of "32"
This gives players a different perspective on their performance.
Try This: Best Score Tracking
Track and display the highest winning margin:
best_margin: defb 0
; After calculating margin:
ld b, a ; B = current margin
ld a, (best_margin)
cp b
jr nc, .not_best
ld a, b
ld (best_margin), a ; New record
; ... display "NEW RECORD!" ...
This adds replay value by giving players a target to beat.
What You’ve Learnt
- Screen composition — Building complex displays from simple elements
- Information hierarchy — Ordering content by importance
- Visual consistency — Maintaining colour coding throughout
- Calculation techniques — Using
negfor subtraction
What’s Next
In Unit 16, we’ll complete Phase 1 with final polish and a complete playable game.