mirror of
https://github.com/option8/minesweeper.git
synced 2024-11-24 23:32:35 +00:00
added RND function
also properly increases difficulty on winning, decreases upon losing.
This commit is contained in:
parent
e1ddacf8be
commit
2df271c118
BIN
MINESWEEPER.dsk
BIN
MINESWEEPER.dsk
Binary file not shown.
268
MINESWEEPER.s
268
MINESWEEPER.s
@ -1,36 +1,8 @@
|
|||||||
DSK MS
|
DSK MS
|
||||||
|
|
||||||
**************************************************
|
|
||||||
* minesweeper
|
|
||||||
*
|
|
||||||
* test board
|
|
||||||
*
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
* 0 0 0 1 0 0 0 0 = 0x10
|
|
||||||
* 0 0 0 0 1 0 0 0 = 0x08
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
*
|
|
||||||
* solve result:
|
|
||||||
*
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
* 0 0 1 1 1 0 0 0
|
|
||||||
* 0 0 1 X 2 1 0 0
|
|
||||||
* 0 0 1 2 X 1 0 0
|
|
||||||
* 0 0 0 1 1 1 0 0
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
* 0 0 0 0 0 0 0 0
|
|
||||||
*
|
|
||||||
**************************************************
|
|
||||||
|
|
||||||
**************************************************
|
**************************************************
|
||||||
*
|
*
|
||||||
* TO DO: end-of-game state, so you can't keep marking cells after you lose
|
* TO DO: end-of-game state, so you can't keep marking cells after you lose
|
||||||
* draw board with mousetext, if available?
|
|
||||||
* elegant quit to prodos?
|
* elegant quit to prodos?
|
||||||
*
|
*
|
||||||
**************************************************
|
**************************************************
|
||||||
@ -41,22 +13,20 @@
|
|||||||
* Variables
|
* Variables
|
||||||
**************************************************
|
**************************************************
|
||||||
|
|
||||||
SOLVEORIGIN EQU $9100 ; 'solved' board to reveal
|
|
||||||
PROGRESSORIGIN EQU $9200 ; revealed squares
|
|
||||||
BOMBLOC EQU $FC
|
BOMBLOC EQU $FC
|
||||||
ROWBYTE EQU $FD
|
ROWBYTE EQU $FD
|
||||||
ROW EQU $FA ; row/col in board
|
ROW EQU $FA ; row/col in board
|
||||||
COLUMN EQU $FB
|
COLUMN EQU $FB
|
||||||
PLOTROW EQU $FE ; row/col in text page
|
PLOTROW EQU $FE ; row/col in text page
|
||||||
PLOTCOLUMN EQU $FF
|
PLOTCOLUMN EQU $FF
|
||||||
]ROWS = #$8
|
|
||||||
]COLUMNS = #$8
|
|
||||||
CHAR EQU $FC ; char to plot
|
CHAR EQU $FC ; char to plot
|
||||||
STRLO EQU $EB ; string lo/hi for printing
|
STRLO EQU $EB ; string lo/hi for printing
|
||||||
STRHI EQU $EC
|
STRHI EQU $EC
|
||||||
SCORE EQU $ED ; bombs found
|
SCORE EQU $ED ; bombs found
|
||||||
PROGRESS EQU $EE ; cells cleared
|
PROGRESS EQU $EE ; cells cleared
|
||||||
BOMBS EQU $EF ; total bombs
|
BOMBS EQU $EF ; total bombs
|
||||||
|
PLAYERLEVEL EQU $EA ; increase level, increase number of bombs.
|
||||||
|
LEVELTARGET EQU $E9 ;
|
||||||
|
|
||||||
**************************************************
|
**************************************************
|
||||||
* Apple Standard Memory Locations
|
* Apple Standard Memory Locations
|
||||||
@ -92,6 +62,8 @@ ROMINIT EQU $FB2F
|
|||||||
ROMSETKBD EQU $FE89
|
ROMSETKBD EQU $FE89
|
||||||
ROMSETVID EQU $FE93
|
ROMSETVID EQU $FE93
|
||||||
|
|
||||||
|
ALTCHAR EQU $C00F ; enables alternative character set - mousetext
|
||||||
|
|
||||||
BLINK EQU $F3
|
BLINK EQU $F3
|
||||||
SPEED EQU $F1
|
SPEED EQU $F1
|
||||||
|
|
||||||
@ -107,111 +79,68 @@ SPEED EQU $F1
|
|||||||
|
|
||||||
LDA #$01
|
LDA #$01
|
||||||
STA SPEED ; string/char output speed
|
STA SPEED ; string/char output speed
|
||||||
|
STA ALTCHAR ; enable mousetext
|
||||||
|
STA PLAYERLEVEL
|
||||||
LDA #$00
|
LDA #$00
|
||||||
STA BLINK ; blinking text? no thanks.
|
STA BLINK ; blinking text? no thanks.
|
||||||
|
|
||||||
DRAWBOARD JSR HOME
|
DRAWBOARD JSR HOME
|
||||||
|
JSR RNDINIT
|
||||||
|
|
||||||
|
|
||||||
**************************************************
|
**************************************************
|
||||||
* Draws the blank board borders, corners, borders
|
* Draws the blank board borders, corners, borders
|
||||||
**************************************************
|
**************************************************
|
||||||
|
|
||||||
CORNERS LDA #$01
|
|
||||||
STA PLOTROW
|
HLINES LDA #$01 ; start at column 2
|
||||||
STA PLOTCOLUMN
|
STA PLOTCOLUMN
|
||||||
LDA #$2E ; .
|
|
||||||
|
HLINESLOOP LDA #$4C ; -
|
||||||
|
STA CHAR
|
||||||
|
LDA #$01 ; row 1
|
||||||
|
STA PLOTROW
|
||||||
|
JSR PLOTCHAR
|
||||||
|
|
||||||
|
LDA #$12
|
||||||
|
STA PLOTROW
|
||||||
|
LDA #$4C
|
||||||
STA CHAR
|
STA CHAR
|
||||||
JSR PLOTCHAR
|
JSR PLOTCHAR
|
||||||
|
|
||||||
LDA #$11
|
|
||||||
STA PLOTCOLUMN
|
|
||||||
JSR PLOTCHAR
|
|
||||||
|
|
||||||
LDA #$27
|
|
||||||
STA CHAR ; '
|
|
||||||
LDA #$11
|
|
||||||
STA PLOTROW
|
|
||||||
STA PLOTCOLUMN
|
|
||||||
JSR PLOTCHAR
|
|
||||||
|
|
||||||
LDA #$01
|
|
||||||
STA PLOTCOLUMN
|
|
||||||
JSR PLOTCHAR
|
|
||||||
;/CORNERS
|
|
||||||
|
|
||||||
HLINES LDA #$02 ; start at column 2
|
|
||||||
STA PLOTCOLUMN
|
|
||||||
LDA #$2D ; -
|
|
||||||
STA CHAR
|
|
||||||
|
|
||||||
HLINESLOOP LDA #$01 ; row 1
|
|
||||||
STA PLOTROW
|
|
||||||
JSR PLOTCHAR
|
|
||||||
|
|
||||||
HROWSLOOP INC PLOTROW
|
|
||||||
INC PLOTROW ; row 3, 5, ...
|
|
||||||
JSR PLOTCHAR
|
|
||||||
LDA PLOTROW
|
|
||||||
CMP #$10 ; goes to 17
|
|
||||||
BMI HROWSLOOP
|
|
||||||
;/HROWSLOOP
|
|
||||||
INC PLOTCOLUMN
|
INC PLOTCOLUMN
|
||||||
LDA PLOTCOLUMN
|
LDA PLOTCOLUMN
|
||||||
CMP #$11 ; goes to 16
|
CMP #$12 ; goes to 16
|
||||||
BMI HLINESLOOP
|
BMI HLINESLOOP
|
||||||
;/HLINES
|
;/HLINES
|
||||||
|
|
||||||
VLINES LDA #$02 ; start at column 2
|
|
||||||
|
|
||||||
|
|
||||||
|
VLINES LDA #$01 ; start at row 2
|
||||||
STA PLOTROW
|
STA PLOTROW
|
||||||
LDA #$3A ; :
|
VLINESLOOP LDA #$5A ; :
|
||||||
STA CHAR
|
STA CHAR
|
||||||
|
|
||||||
VLINESLOOP LDA #$01 ; row 1
|
LDA #$00 ; row 1 - left border
|
||||||
STA PLOTCOLUMN
|
STA PLOTCOLUMN
|
||||||
JSR PLOTCHAR
|
JSR PLOTCHAR
|
||||||
|
|
||||||
VCOLUMNSLOOP INC PLOTCOLUMN ; row 2, 4, ...
|
LDA #$12
|
||||||
INC PLOTCOLUMN ; row 3, 5, ...
|
STA PLOTCOLUMN
|
||||||
|
LDA #$5F ; right box border
|
||||||
|
STA CHAR
|
||||||
JSR PLOTCHAR
|
JSR PLOTCHAR
|
||||||
LDA PLOTCOLUMN
|
|
||||||
CMP #$11 ; goes to 16
|
|
||||||
BMI VCOLUMNSLOOP
|
|
||||||
;/VCOLUMNSLOOP
|
|
||||||
|
|
||||||
INC PLOTROW
|
INC PLOTROW
|
||||||
LDA PLOTROW
|
LDA PLOTROW
|
||||||
CMP #$11 ; goes to 16
|
CMP #$12 ; goes to 16
|
||||||
BMI VLINESLOOP
|
BMI VLINESLOOP
|
||||||
;/VLINES
|
;/VLINES
|
||||||
|
|
||||||
* + ROW*2 + 1, COLUMN*2 + 1
|
|
||||||
|
|
||||||
PLUSES
|
|
||||||
|
|
||||||
LDA #$03 ; starts at 3,3
|
|
||||||
STA PLOTROW
|
|
||||||
LDA #$2B ; +
|
|
||||||
STA CHAR
|
|
||||||
|
|
||||||
PLUSLOOP
|
|
||||||
LDA #$03 ; starts at 3,3
|
|
||||||
STA PLOTCOLUMN
|
|
||||||
PLUSCOLS
|
|
||||||
JSR PLOTCHAR
|
|
||||||
INC PLOTCOLUMN
|
|
||||||
INC PLOTCOLUMN
|
|
||||||
LDA PLOTCOLUMN
|
|
||||||
CMP #$10
|
|
||||||
BMI PLUSCOLS
|
|
||||||
;/PLUSCOLS
|
|
||||||
INC PLOTROW
|
|
||||||
INC PLOTROW
|
|
||||||
LDA PLOTROW
|
|
||||||
CMP #$10
|
|
||||||
BMI PLUSLOOP
|
|
||||||
;/PLUSLOOP
|
|
||||||
|
|
||||||
**************************************************
|
**************************************************
|
||||||
* sets up solving matrix, resets scoreboard
|
* sets up solving matrix, resets scoreboard
|
||||||
@ -234,19 +163,26 @@ SETUPBOARD
|
|||||||
LDX #$8 ; X = 8
|
LDX #$8 ; X = 8
|
||||||
ROWLOOP3 ; (ROW 7 to 0)
|
ROWLOOP3 ; (ROW 7 to 0)
|
||||||
DEX
|
DEX
|
||||||
STX ROW
|
|
||||||
LDA #$0
|
LDA #$0
|
||||||
STA BOARDORIGIN,X ; set byte at BOARDORIGIN,x 0
|
STA BOARDORIGIN,X ; set byte at BOARDORIGIN,x 0
|
||||||
|
|
||||||
LDY #$8 ; start columnloop (COLUMN 0 to 7)
|
LDY #$8 ; start columnloop (COLUMN 0 to 7)
|
||||||
COLUMNLOOP3 CLC ; clear CARRY to 0
|
COLUMNLOOP3
|
||||||
DEY
|
DEY
|
||||||
STY COLUMN ; store column for later retrieval
|
|
||||||
LDA #$05 ; SLIGHT DELAY
|
LDA PLAYERLEVEL
|
||||||
JSR WAIT
|
STA LEVELTARGET
|
||||||
LDA SPEAKER ; get byte, pseudorandom source?
|
ROL LEVELTARGET ;x2
|
||||||
ROL ; random bit into Carry
|
ROL LEVELTARGET ;x4
|
||||||
ROL ; random bit into Carry
|
ROL LEVELTARGET ;x8
|
||||||
|
ROL LEVELTARGET ;x16
|
||||||
|
LDA #$FF
|
||||||
|
SBC LEVELTARGET
|
||||||
|
STA LEVELTARGET ; FF - 16xLEVEL = target
|
||||||
|
|
||||||
|
JSR RND ; random byte
|
||||||
|
CMP LEVELTARGET ; greater than target=carry true (1/16 * level=chance)
|
||||||
|
|
||||||
ROL BOARDORIGIN,X ; random bit into row byte
|
ROL BOARDORIGIN,X ; random bit into row byte
|
||||||
|
|
||||||
TYA ; last COLUMN?
|
TYA ; last COLUMN?
|
||||||
@ -295,6 +231,10 @@ NOBOMB ; do nothing.
|
|||||||
;/rowloop
|
;/rowloop
|
||||||
|
|
||||||
|
|
||||||
|
CHECKBOMBS LDA BOMBS ; on the off chance the random has come up all zeros
|
||||||
|
BEQ SETUP
|
||||||
|
|
||||||
|
|
||||||
**************************************************
|
**************************************************
|
||||||
* draws the blank squares to be solved
|
* draws the blank squares to be solved
|
||||||
*
|
*
|
||||||
@ -625,7 +565,7 @@ LEFTCOLUMN INC CV
|
|||||||
* puts ? in unsolved square by ROW, COLUMN
|
* puts ? in unsolved square by ROW, COLUMN
|
||||||
**************************************************
|
**************************************************
|
||||||
DRAWSQUARE ; puts ? in unsolved square
|
DRAWSQUARE ; puts ? in unsolved square
|
||||||
LDA #$BF ; "?"
|
LDA #$5E ; "?"
|
||||||
STA CHAR ; store as CHAR
|
STA CHAR ; store as CHAR
|
||||||
LDA ROW
|
LDA ROW
|
||||||
CLC
|
CLC
|
||||||
@ -644,7 +584,7 @@ DRAWSQUARE ; puts ? in unsolved square
|
|||||||
* puts _ in selected square by ROW, COLUMN
|
* puts _ in selected square by ROW, COLUMN
|
||||||
**************************************************
|
**************************************************
|
||||||
HILITESQUARE ; puts _ in selected square
|
HILITESQUARE ; puts _ in selected square
|
||||||
LDA #$5F ; "_"
|
LDA #$5D ; "+"
|
||||||
STA CHAR ; store as CHAR
|
STA CHAR ; store as CHAR
|
||||||
LDA ROW
|
LDA ROW
|
||||||
CLC
|
CLC
|
||||||
@ -674,12 +614,15 @@ DESELECTSQUARE ; puts number/? in deselected square
|
|||||||
ADC COLUMN ; offset = ROW * 8 + COLUMN
|
ADC COLUMN ; offset = ROW * 8 + COLUMN
|
||||||
TAX
|
TAX
|
||||||
LDA PROGRESSORIGIN,X ; get SOLVEORIGIN + offset
|
LDA PROGRESSORIGIN,X ; get SOLVEORIGIN + offset
|
||||||
|
BEQ SHOWSOLVEDZERO ; solved and zero, show space
|
||||||
CMP #$FF
|
CMP #$FF
|
||||||
BNE SHOWSOLVED ; if == FF , not yet solved. CHAR = ?
|
BNE SHOWSOLVED ; if == FF , not yet solved. CHAR = ?
|
||||||
LDA #$8F
|
LDA #$2E ; add 30 to get mousetext...
|
||||||
STA CHAR ; store as CHAR
|
STA CHAR ; store as CHAR
|
||||||
SHOWSOLVED CLC
|
SHOWSOLVED CLC
|
||||||
ADC #$30 ; add #$30 (becomes #)
|
ADC #$10 ; add #$30 (becomes #)
|
||||||
|
SHOWSOLVEDZERO CLC
|
||||||
|
ADC #$20 ; add #$30 (becomes #)
|
||||||
STA CHAR ; store as CHAR
|
STA CHAR ; store as CHAR
|
||||||
LDA ROW
|
LDA ROW
|
||||||
CLC
|
CLC
|
||||||
@ -709,7 +652,7 @@ DRAWMINE JSR BEEP ; puts * in selected square
|
|||||||
CLC
|
CLC
|
||||||
ADC COLUMN
|
ADC COLUMN
|
||||||
TAX
|
TAX
|
||||||
LDA #$7A ; * for mine
|
LDA #$2B ; * for mine
|
||||||
STA PROGRESSORIGIN,X ; store marker in progress
|
STA PROGRESSORIGIN,X ; store marker in progress
|
||||||
CLC
|
CLC
|
||||||
ADC #$30 ; add #$30 (becomes *)
|
ADC #$30 ; add #$30 (becomes *)
|
||||||
@ -759,7 +702,8 @@ DRAWSOLVEDSQUARE ; puts number in selected/solved square
|
|||||||
ADC COLUMN
|
ADC COLUMN
|
||||||
TAX
|
TAX
|
||||||
LDA PROGRESSORIGIN,X ; check if it hasn't been solved yet,
|
LDA PROGRESSORIGIN,X ; check if it hasn't been solved yet,
|
||||||
CMP #$7A ; if it's already been marked as a mine
|
BEQ SOLVECLEAR ; found zero, mark as space instead of 0
|
||||||
|
CMP #$2B ; if it's already been marked as a mine
|
||||||
BEQ SOLVEBOMB ; mark it unsolved
|
BEQ SOLVEBOMB ; mark it unsolved
|
||||||
CLC
|
CLC
|
||||||
CMP #$FF ; put the solution in the square,
|
CMP #$FF ; put the solution in the square,
|
||||||
@ -775,6 +719,7 @@ DRAWSOLVEDSQUARE ; puts number in selected/solved square
|
|||||||
|
|
||||||
LDA SOLVEORIGIN,X ; get SOLVEORIGIN + offset
|
LDA SOLVEORIGIN,X ; get SOLVEORIGIN + offset
|
||||||
STA PROGRESSORIGIN,X ; store progress
|
STA PROGRESSORIGIN,X ; store progress
|
||||||
|
BEQ SOLVECLEAR ; found zero, mark as space instead of 0
|
||||||
CMP #$08 ; IF >= F0, found a bomb
|
CMP #$08 ; IF >= F0, found a bomb
|
||||||
BMI SOLVENOBOMB
|
BMI SOLVENOBOMB
|
||||||
JSR BONK ; BONK!
|
JSR BONK ; BONK!
|
||||||
@ -783,7 +728,9 @@ DRAWSOLVEDSQUARE ; puts number in selected/solved square
|
|||||||
RTS ; stop solving and return to waiting for key
|
RTS ; stop solving and return to waiting for key
|
||||||
|
|
||||||
SOLVENOBOMB CLC
|
SOLVENOBOMB CLC
|
||||||
ADC #$30 ; add #$30 (becomes #)
|
ADC #$10 ; add #$30 (becomes #)
|
||||||
|
SOLVECLEAR CLC
|
||||||
|
ADC #$20
|
||||||
STA CHAR ; store as CHAR
|
STA CHAR ; store as CHAR
|
||||||
LDA ROW
|
LDA ROW
|
||||||
CLC
|
CLC
|
||||||
@ -847,6 +794,7 @@ SOLVEADJACENTSQUARE ; puts number in adjacent squares
|
|||||||
TAX
|
TAX
|
||||||
LDA PROGRESSORIGIN,X ; check if it hasn't been solved yet,
|
LDA PROGRESSORIGIN,X ; check if it hasn't been solved yet,
|
||||||
CLC
|
CLC
|
||||||
|
BEQ SOLVECLEAR2
|
||||||
CMP #$FF ; put the solution in the square,
|
CMP #$FF ; put the solution in the square,
|
||||||
BNE SOLVENOBOMB2 ; increment the progress
|
BNE SOLVENOBOMB2 ; increment the progress
|
||||||
|
|
||||||
@ -860,9 +808,12 @@ SOLVEADJACENTSQUARE ; puts number in adjacent squares
|
|||||||
|
|
||||||
LDA SOLVEORIGIN,X ; get SOLVEORIGIN + offset
|
LDA SOLVEORIGIN,X ; get SOLVEORIGIN + offset
|
||||||
STA PROGRESSORIGIN,X ; store progress
|
STA PROGRESSORIGIN,X ; store progress
|
||||||
|
BEQ SOLVECLEAR2
|
||||||
|
|
||||||
SOLVENOBOMB2 CLC
|
SOLVENOBOMB2 CLC
|
||||||
ADC #$30 ; add #$30 (becomes #)
|
ADC #$10 ; add #$30 (becomes #)
|
||||||
|
SOLVECLEAR2 CLC
|
||||||
|
ADC #$20
|
||||||
STA CHAR ; store as CHAR
|
STA CHAR ; store as CHAR
|
||||||
LDA ROW
|
LDA ROW
|
||||||
CLC
|
CLC
|
||||||
@ -961,6 +912,7 @@ YOUWIN LDA #$13
|
|||||||
LDY #>WINNER
|
LDY #>WINNER
|
||||||
LDA #<WINNER
|
LDA #<WINNER
|
||||||
JSR STROUT ;Y=String ptr high, A=String ptr low
|
JSR STROUT ;Y=String ptr high, A=String ptr low
|
||||||
|
INC PLAYERLEVEL ; increase difficulty for next round, unless they lose
|
||||||
JMP RTORESET
|
JMP RTORESET
|
||||||
|
|
||||||
YOULOSE LDA #$13
|
YOULOSE LDA #$13
|
||||||
@ -969,6 +921,10 @@ YOULOSE LDA #$13
|
|||||||
LDY #>LOSER
|
LDY #>LOSER
|
||||||
LDA #<LOSER
|
LDA #<LOSER
|
||||||
JSR STROUT ;Y=String ptr high, A=String ptr low
|
JSR STROUT ;Y=String ptr high, A=String ptr low
|
||||||
|
LDA PLAYERLEVEL
|
||||||
|
CMP #$01
|
||||||
|
BEQ RTORESET
|
||||||
|
DEC PLAYERLEVEL ; make easier next round
|
||||||
|
|
||||||
RTORESET JSR LEFTCOLUMN
|
RTORESET JSR LEFTCOLUMN
|
||||||
LDY #>RESETLINE
|
LDY #>RESETLINE
|
||||||
@ -1123,8 +1079,10 @@ BONKLOOP LDA #$20 ; longer DELAY
|
|||||||
*
|
*
|
||||||
**************************************************
|
**************************************************
|
||||||
|
|
||||||
BOARDORIGIN HEX 80,00,00,10,08,00,00,01 ; sets up the board
|
BOARDORIGIN HEX 80,00,00,10,08,00,00,01 ; sets up the default board
|
||||||
|
|
||||||
|
SOLVEORIGIN DS 256
|
||||||
|
PROGRESSORIGIN DS 256
|
||||||
|
|
||||||
|
|
||||||
**************************************************
|
**************************************************
|
||||||
@ -1182,33 +1140,43 @@ LoLineTableL db <Lo01,<Lo02,<Lo03
|
|||||||
db <Lo19,<Lo20,<Lo21
|
db <Lo19,<Lo20,<Lo21
|
||||||
db <Lo22,<Lo23,<Lo24
|
db <Lo22,<Lo23,<Lo24
|
||||||
|
|
||||||
* ROW, COLUMN
|
**************************************************
|
||||||
|
* DATASOFT RND 6502
|
||||||
|
* BY JAMES GARON
|
||||||
|
* 10/02/86
|
||||||
|
* Thanks to John Brooks for this. I modified it slightly.
|
||||||
|
*
|
||||||
|
* returns a randomish number in Accumulator.
|
||||||
|
**************************************************
|
||||||
|
RNDSEED DS 3
|
||||||
|
|
||||||
* . at 1,1 #$2E
|
RNDINIT
|
||||||
* . at 1,17
|
LDA $C030 ; #$AB
|
||||||
* ' at 17,1 #$27
|
STA RNDSEED
|
||||||
* ' at 17,17
|
LDA RDVBLBAR ; $4E ; #$55
|
||||||
* - 1,2 to 1,16 #$2D
|
STA RNDSEED+1
|
||||||
* - 17,2 to 17,16
|
LDA $C060 ; #$7E
|
||||||
* : 2,1 to 16,1 #$3A
|
STA RNDSEED+2
|
||||||
* : ROW*2,COLUMN*2 + 1
|
RTS
|
||||||
* - ROW*2 + 1, COLUMN*2
|
|
||||||
* + ROW*2 + 1, COLUMN*2 + 1
|
|
||||||
|
|
||||||
* .---------------.
|
* RESULT IN ACC
|
||||||
* :1:2:3:4:5:6:7:8:
|
RND LDA RNDSEED
|
||||||
* :-+-+-+-+-+-+-+-:
|
ROL RNDSEED
|
||||||
* :2:2:3:4:5:6:7:8:
|
EOR RNDSEED
|
||||||
* :-+-+-+-+-+-+-+-:
|
ROR RNDSEED
|
||||||
* :3:2:3:4:5:6:7:8:
|
INC RNDSEED+1
|
||||||
* :-+-+-+-+-+-+-+-:
|
BNE RND10
|
||||||
* :4:2:3:4:5:6:7:8:
|
LDA RNDSEED+2
|
||||||
* :-+-+-+-+-+-+-+-:
|
INC RNDSEED+2
|
||||||
* :5:2:3:4:5:6:7:8:
|
RND10 ADC RNDSEED+1
|
||||||
* :-+-+-+-+-+-+-+-:
|
BVC RND20
|
||||||
* :6:2:3:4:5:6:7:8:
|
INC RNDSEED+1
|
||||||
* :-+-+-+-+-+-+-+-:
|
BNE RND20
|
||||||
* :7:2:3:4:5:6:7:8:
|
LDA RNDSEED+2
|
||||||
* :-+-+-+-+-+-+-+-:
|
INC RNDSEED+2
|
||||||
* :8:2:3:4:5:6:7:8:
|
RND20 STA RNDSEED
|
||||||
* '---------------'
|
RTS
|
||||||
|
|
||||||
|
RND16 JSR RND ; limits RND output to 0-F
|
||||||
|
AND #$0F ; strips high nibble
|
||||||
|
RTS
|
||||||
|
Loading…
Reference in New Issue
Block a user