Skip to content

Commit

Permalink
Fix typo in README.md and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
menshiva committed Jan 29, 2021
1 parent 90f65f7 commit e5af650
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@
2) Add forbes.asm as source file
3) Mark forbes.asm as entry file
4) Assemble project
5) Now you should see chars.inc, print.inc and m169def.inc in included files
5) Now you should see chars.inc, print.inc and m169def.inc in an included files folder
6) Run and **enjoy** the game!

## How to Play 🕹️

1) [Build and run](#build-) the game
2) You should see "START" on display
3) Press center button on joystick to start a new game
4) There are three reels. The main task of the game is to stop all three reels with the same picture on it (_Note_: picture on reel is generated "randomly" from list of 0-9 and A-F)
5) Press center button on joystick to stop a reel
2) You'll see "START" on the display of your kit
3) Push center button on joystick to start a new game
4) There are three reels. The main task of the game is to stop all three reels with the same picture on them (_Note_: picture on reel is generated "randomly" from list of 0-9 and A-F)
5) Push center button on joystick to stop a reel
6) When one reel stops, the next one starts to spin
7) At the end of the game you should see "WINNER" if all reels have the same picture, otherwise "LOOSER"
8) Wait until your game result blinks and press center button to start a new game
7) At the end of the game you'll see "WINNER" if all reels have the same picture, otherwise "LOOSER"
8) Wait until your game result blinks and push center button to start a new game

## Credits ✍

#### Related

* Special thanks to [ultimatearm](https://www.flaticon.com/authors/ultimatearm) for app icon!
* Special thanks to [ultimatearm](https://www.flaticon.com/authors/ultimatearm) for icon!

#### Author

Expand Down
23 changes: 11 additions & 12 deletions src/forbes.asm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.org 0x1000
.include "utils\print.inc"

.def displayChar = R16 ; Stores char to show on display
.def displayChar = R16 ; Char to show on display
.def displayCharPos = R17 ; Position of char on display
.def seed = R18 ; Seed for random function
.def randNum = R19 ; Random number
Expand Down Expand Up @@ -59,8 +59,8 @@ start:
LDI buttonLocker, 1

;---------------------------------
; Waits for user to press button
; to start a new game
; Waits for user to push center
; button to start a new game
start_loop:
INC seed
; Read center button status
Expand Down Expand Up @@ -95,8 +95,8 @@ roll_loop:
MOV displayChar, randNum
CALL showChar

; Check if button pressed and wait for time
; Time is longer when gamemode is 1
; Check if button is pressed and wait for delay
; Delay is longer when gamemode is 1
LDI R26, 0x10
CPI mode, 1
BRNE wait
Expand All @@ -107,7 +107,7 @@ wait:
CPI pressedButton, 1
; If center button is pressed
BRNE centerBtnNotPressed
; If buttonLocker == 0 then buttonLocker = 1 and displayCharPos -= 1 to set next reel
; If buttonLocker == 0 then buttonLocker = 1 and displayCharPos -= 1 to set the next reel
; Else continue loop
CPI buttonLocker, 0
BRNE endCheckButton
Expand Down Expand Up @@ -145,7 +145,8 @@ endCheckButton:
;---------------------------------
; Print game result
;
; If gameResult == 1 then blink_winner() else blink_loser()
; If gameResult == 1 then blink_winner()
; else blink_loser()
printResult:
CPI gameResult, 1
BREQ win
Expand All @@ -155,7 +156,7 @@ win:
CALL blink_winner

;---------------------------------
; Waits for user to press button
; Waits for user to push center button
; to accept game result
final_loop:
; Read center button status
Expand Down Expand Up @@ -298,8 +299,7 @@ print_loser:
RET

;---------------------------------
; Print reels initial values
; (0 0 0)
; Print reels initial values (0 0 0)
forbes_diplay_init:
LDI displayCharPos, 4
LDI displayChar, '0'
Expand Down Expand Up @@ -346,8 +346,7 @@ init_joy:
RET

;---------------------------------
; Store joystick pressed button
; in R20
; Store joystick pressed button in R20
read_joy:
PUSH R16
PUSH R17
Expand Down
13 changes: 8 additions & 5 deletions src/utils/print.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ displayInit:
;---------------------------------
; Show char on display
;
; R16 char, R17 position on display
; Stores and refreshes the registers
; R16 - char, R17 - position on display
; Function stores and refreshes
; the registers
showChar:
PUSH R0
PUSH R1
Expand All @@ -50,20 +51,22 @@ showChar:
;---------------------------------
; Undefined symbol
;
; Activates all segments on display
; Function activates all segments
; on display
undef:
LDI R16, '`'
JMP prep

;---------------------------------
; Space symbol " "
;
; Using undefined comma instead of space symbol
; Using undefined comma instead
; of space symbol
space:
LDI R16, ','

;---------------------------------
; Prepare for showing
; Prepare for displaying a symbol
prep:
SUBI R16, '*' ; Convert symbol to char table index
LSL R16
Expand Down

0 comments on commit e5af650

Please sign in to comment.