Skip to content

anydas build flag #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if (args.includes('-h')) {

-m mapper
-a faster aeppoz + press select to end game
-A build anydas
-s disable highscores/SRAM
-k Famicom Keyboard support
-w force WASM compiler
Expand Down Expand Up @@ -88,6 +89,11 @@ if (args.includes('-o')) {
console.log('cnrom override for autodetect');
}

if (args.includes('-A')) {
compileFlags.push('-D', 'ANYDAS=1');
console.log('anydas enabled');
}

// pass additional arguments to ca65
if (args.includes('--')) {
const ca65Flags = args.slice(1+args.indexOf('--'));
Expand All @@ -100,6 +106,7 @@ console.log();
// build / compress nametables

console.time('nametables');
process.env['GYM_FLAGS'] = compileFlags.join(' ');
require('./src/nametables/build');
console.timeEnd('nametables');

Expand Down
6 changes: 6 additions & 0 deletions src/boot.asm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@
sta paceModifier

lda #$10
.if ANYDAS <> 1
sta dasModifier
.else
sta anydasDASValue
lda #$06
sta anydasARRValue
.endif

lda #INITIAL_LINECAP_LEVEL
sta linecapLevel
Expand Down
26 changes: 25 additions & 1 deletion src/constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ KEYBOARD := 0
CNROM_OVERRIDE := 0
.endif

.ifndef ANYDAS
ANYDAS = 0
.endif

NO_MUSIC := 1

; dev flags
Expand Down Expand Up @@ -81,7 +85,9 @@ MODE_TAPQTY
MODE_CHECKERBOARD
MODE_GARBAGE
MODE_DROUGHT
.if ANYDAS <> 1
MODE_DAS
.endif
MODE_LOWSTACK
MODE_KILLX2
MODE_INVISIBLE
Expand All @@ -98,12 +104,19 @@ MODE_DARK
MODE_GOOFY
MODE_DEBUG
MODE_LINECAP
.if ANYDAS <> 1
MODE_DASONLY
.endif
MODE_QUAL
MODE_PAL
.if ANYDAS = 1
MODE_DAS_VALUE
MODE_ARR_VALUE
MODE_ARE_CHARGE
.endif
MODE_QUANTITY
.endenum

MODE_QUANTITY = MODE_PAL + 1
MODE_GAME_QUANTITY = MODE_HARDDROP + 1

SCORING_CLASSIC := 0 ; for scoringModifier
Expand Down Expand Up @@ -149,7 +162,9 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
.byte $8 ; MODE_CHECKERBOARD
.byte $4 ; MODE_GARBAGE
.byte $12 ; MODE_DROUGHT
.if ANYDAS <> 1
.byte $10 ; MODE_DAS
.endif
.byte $12 ; MODE_LOWSTACK
.byte $0 ; MODE_KILLX2
.byte $0 ; MODE_INVISIBLE
Expand All @@ -166,9 +181,16 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
.byte $1 ; MODE_GOOFY
.byte $1 ; MODE_DEBUG
.byte $1 ; MODE_LINECAP
.if ANYDAS <> 1
.byte $1 ; MODE_DASONLY
.endif
.byte $1 ; MODE_QUAL
.byte $1 ; MODE_PAL
.if ANYDAS = 1
.byte $40 ; MODE_DAS_VALUE
.byte $40 ; MODE_ARR_VALUE
.byte $1 ; MODE_ARE_CHARGE
.endif
.endmacro

.macro MODENAMES
Expand All @@ -188,7 +210,9 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
.byte "CKRBRD"
.byte "GARBGE"
.byte "LOBARS"
.if ANYDAS <> 1
.byte "DASDLY"
.endif
.byte "LOWSTK"
.byte "KILLX2"
.byte "INVZBL"
Expand Down
2 changes: 2 additions & 0 deletions src/modes/hz.asm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ hzTap:
lda #0
sta hzDebounceCounter

.if ANYDAS <> 1
lda dasOnlyFlag
beq :+
lda #0
Expand All @@ -104,6 +105,7 @@ hzTap:
lda #1
sta dasOnlyShiftDisabled
:
.endif

; ignore 1 tap
lda hzTapCounter
Expand Down
135 changes: 68 additions & 67 deletions src/nametables/game_type_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const {
flatLookup,
} = require('./nametables');

const anydas = !!process.env['GYM_FLAGS']?.match(/-D ANYDAS=1/);

const lookup = flatLookup(`
0123456789ABCDEF
GHIJKLMNOPQRSTUV
Expand All @@ -29,71 +31,72 @@ WXYZ-,˙>########
const buffer = blankNT();
const extra = [...buffer];

drawTiles(buffer, lookup, `
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a TETRIS d#
#a T-SPINS d#
#a SEED d#
#a STACKING d#
#a PACE d#
#a SETUPS d#
#a B-TYPE d#
#a FLOOR d#
#a CRUNCH d#
#a (QUICK)TAP d#
#a TRANSITION d#
#a MARATHON d#
#a TAP QUANTITY d#
#a CHECKERBOARD d#
#a GARBAGE d#
#a DROUGHT d#
#a DAS DELAY d#
#a LOW STACK d#
#a KILLSCREEN »2 d#
#a INVISIBLE d#
#a HARD DROP d#
`);drawTiles(extra, lookup, `
#a TAP/ROLL SPEED d#
#a SCORING d#
#a CRASH d#
#a STRICT CRASH d#
#a HZ DISPLAY d#
#a INPUT DISPLAY d#
#a DISABLE FLASH d#
#a DISABLE PAUSE d#
#a DARK MODE d#
#a GOOFY FOOT d#
#a BLOCK TOOL d#
#a LINECAP d#
#a DAS ONLY d#
#a QUAL MODE d#
#a PAL MODE d#
#a d#
#a d#
#a V6 d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
#a d#
`);
modes = `
TETRIS
T-SPINS
SEED
STACKING
PACE
SETUPS
B-TYPE
FLOOR
CRUNCH
(QUICK)TAP
TRANSITION
MARATHON
TAP QUANTITY
CHECKERBOARD
GARBAGE
DROUGHT
DAS DELAY
LOW STACK
KILLSCREEN »2
INVISIBLE
HARD DROP
TAP/ROLL SPEED
SCORING
CRASH
STRICT CRASH
HZ DISPLAY
INPUT DISPLAY
DISABLE FLASH
DISABLE PAUSE
DARK MODE
GOOFY FOOT
BLOCK TOOL
LINECAP
DAS ONLY
QUAL MODE
PAL MODE
`
.trim()
.split('\n');

if (anydas) {
modes.splice(modes.indexOf('DAS DELAY'), 1);
modes.splice(modes.indexOf('DAS ONLY'), 1);
modes.push('DAS', 'ARR', 'ARE CHARGE');
}

const modeStartRow = 9;
const modeOffset = 6;
const modeIdx = modeStartRow * 32 + modeOffset;

const urlX = 3;
const urlY = 17;

menuScreens = [...Array(30 * 2)]
.map(() => '#a d#'.split(''))
.flat();

modes.forEach((mode, i) =>
menuScreens.splice(i * 32 + modeIdx, mode.length, ...mode),
);

menuScreens.splice((30 + urlY) * 32 + urlX, 2, ...'V6');

drawTiles(buffer, lookup, menuScreens.splice(0, 32*30).join(''));
drawTiles(extra, lookup, menuScreens.join(''));

const background = `
ɢ##############################ɳ
Expand Down Expand Up @@ -133,8 +136,6 @@ drawTiles(extra, lookup, background);

drawRect(buffer, 8, 2, 10, 5, 0xB0); // draw logo

const urlX = 3;
const urlY = 17;
drawRect(extra, urlX, urlY, 12, 1, 0x74);
drawRect(extra, urlX+12, urlY, 12, 1, 0x84);

Expand Down
53 changes: 53 additions & 0 deletions src/playstate/active.asm
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ framesPerDropTablePAL:
.byte $02,$02,$02,$01,$01,$01,$01,$01
.byte $01,$01,$01,$01,$01,$01
shift_tetrimino:
.if ANYDAS <> 1
; dasOnlyFlag
lda dasOnlyShiftDisabled
beq @dasOnlyEnd
Expand Down Expand Up @@ -445,6 +446,7 @@ shift_tetrimino:
lda #$08
sta dasValuePeriod
@shiftTetrimino:
.endif

lda tetriminoX
sta originalY
Expand All @@ -457,6 +459,18 @@ shift_tetrimino:
lda heldButtons
and #$03
beq @ret
.if ANYDAS = 1
dec autorepeatX
lda autorepeatX
cmp #$01
bpl @ret
lda anydasARRValue
sta autorepeatX
beq @zeroArr
bne @buttonHeldDown
@resetAutorepeatX:
lda anydasDASValue
.else
inc autorepeatX
lda autorepeatX
cmp dasValueDelay
Expand All @@ -467,6 +481,7 @@ shift_tetrimino:

@resetAutorepeatX:
lda #$00
.endif
sta autorepeatX
@buttonHeldDown:
lda heldButtons
Expand All @@ -493,6 +508,44 @@ shift_tetrimino:
@restoreX:
lda originalY
sta tetriminoX
.if ANYDAS = 1
lda #$01
.else
lda dasValueDelay
.endif
sta autorepeatX
@ret: rts

.if ANYDAS = 1
@zeroArr:
lda heldButtons
and #BUTTON_RIGHT
beq @checkLeftPressed
@shiftRight:
inc tetriminoX
jsr isPositionValid
bne @shiftBackToLeft
lda #$03
sta soundEffectSlot1Init
jmp @shiftRight
@checkLeftPressed:
lda heldButtons
and #BUTTON_LEFT
beq @leftNotPressed
@shiftLeft:
dec tetriminoX
jsr isPositionValid
bne @shiftBackToRight
lda #$03
sta soundEffectSlot1Init
jmp @shiftLeft
@shiftBackToLeft:
dec tetriminoX
dec tetriminoX
@shiftBackToRight:
inc tetriminoX
lda #$01
sta autorepeatX
@leftNotPressed:
rts
.endif
6 changes: 6 additions & 0 deletions src/playstate/spawnnext.asm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ playState_spawnNextTetrimino:
jsr incrementPieceStat
jsr chooseNextTetrimino
sta nextPiece
.if ANYDAS = 1
lda anydasARECharge
beq :+
sta autorepeatX ; store 1 if ARE Charge is on
:
.endif
@resetDownHold:
lda #$00
sta autorepeatY
Expand Down
Loading