Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/platforms/tec1g/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ config (and optionally ROM listings via `extraListings`).
"entry": 0,
"matrixMode": false,
"protectOnReset": false,
"expansionBankHi": false
"expansionBankHi": false,
"sdEnabled": false,
"sdHighCapacity": true,
"sdImagePath": ""
}
}
```
Expand Down
7 changes: 6 additions & 1 deletion src/platforms/tec1g/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ export function normalizeTec1gConfig(cfg?: Tec1gPlatformConfig): Tec1gPlatformCo
const protectOnReset = config.protectOnReset === true;
const rtcEnabled = config.rtcEnabled === true;
const sdEnabled = config.sdEnabled === true;
const sdHighCapacity = config.sdHighCapacity !== false;
const sdImagePath =
typeof config.sdImagePath === 'string' && config.sdImagePath !== ''
? config.sdImagePath
Expand All @@ -324,6 +325,7 @@ export function normalizeTec1gConfig(cfg?: Tec1gPlatformConfig): Tec1gPlatformCo
protectOnReset,
rtcEnabled,
sdEnabled,
sdHighCapacity,
...(sdImagePath !== undefined ? { sdImagePath } : {}),
...(cartridgeHex !== undefined ? { cartridgeHex } : {}),
...(extraListings ? { extraListings } : {}),
Expand Down Expand Up @@ -353,6 +355,7 @@ export function createTec1gRuntime(
const rtc = rtcEnabled ? new Ds1302() : null;
const sdEnabled = config.sdEnabled;
const sdImagePath = config.sdImagePath;
const sdHighCapacity = config.sdHighCapacity;
let sdImage: Uint8Array | undefined;
if (sdEnabled && typeof sdImagePath === 'string' && sdImagePath !== '') {
try {
Expand All @@ -361,7 +364,9 @@ export function createTec1gRuntime(
sdImage = undefined;
}
}
const sdSpi = sdEnabled ? new SdSpi(sdImage ? { image: sdImage } : undefined) : null;
const sdSpi = sdEnabled
? new SdSpi({ highCapacity: sdHighCapacity, ...(sdImage ? { image: sdImage } : {}) })
: null;
let cartridgePresentDefault = config.cartridgeHex !== undefined;
const state: Tec1gState = {
digits: Array.from({ length: 6 }, () => 0),
Expand Down
2 changes: 2 additions & 0 deletions src/platforms/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export interface Tec1gPlatformConfig {
rtcEnabled?: boolean;
sdEnabled?: boolean;
sdImagePath?: string;
sdHighCapacity?: boolean;
cartridgeHex?: string;
uiVisibility?: {
lcd?: boolean;
Expand Down Expand Up @@ -96,6 +97,7 @@ export interface Tec1gPlatformConfigNormalized {
rtcEnabled: boolean;
sdEnabled: boolean;
sdImagePath?: string;
sdHighCapacity: boolean;
cartridgeHex?: string;
uiVisibility?: {
lcd?: boolean;
Expand Down
1 change: 1 addition & 0 deletions tests/debug/tec1g-memory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('TEC-1G expand bank switching', () => {
matrixMode: false,
rtcEnabled: false,
sdEnabled: false,
sdHighCapacity: true,
};
const runtime = createTec1gRuntime(config, () => {});
runtime.state.bankA14 = false;
Expand Down
1 change: 1 addition & 0 deletions tests/platforms/tec1g/glcd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function makeRuntime() {
protectOnReset: false,
rtcEnabled: false,
sdEnabled: false,
sdHighCapacity: true,
};
return createTec1gRuntime(config, () => {});
}
Expand Down
1 change: 1 addition & 0 deletions tests/platforms/tec1g/lcd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function makeRuntime() {
protectOnReset: false,
rtcEnabled: false,
sdEnabled: false,
sdHighCapacity: true,
};
return createTec1gRuntime(config, () => {});
}
Expand Down
1 change: 1 addition & 0 deletions tests/platforms/tec1g/matrix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function makeRuntime(matrixMode = true) {
protectOnReset: false,
rtcEnabled: false,
sdEnabled: false,
sdHighCapacity: true,
};
return createTec1gRuntime(config, () => {});
}
Expand Down
1 change: 1 addition & 0 deletions tests/platforms/tec1g/port03.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function makeRuntime(overrides: Partial<Tec1gPlatformConfigNormalized> = {}) {
protectOnReset: false,
rtcEnabled: false,
sdEnabled: false,
sdHighCapacity: true,
...overrides,
},
() => {}
Expand Down
1 change: 1 addition & 0 deletions tests/platforms/tec1g/portfc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function makeRuntime(rtcEnabled: boolean) {
protectOnReset: false,
rtcEnabled,
sdEnabled: false,
sdHighCapacity: true,
};
return createTec1gRuntime(config, () => {});
}
Expand Down
1 change: 1 addition & 0 deletions tests/platforms/tec1g/portfd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function makeRuntime(sdEnabled: boolean) {
protectOnReset: false,
rtcEnabled: false,
sdEnabled,
sdHighCapacity: true,
};
return createTec1gRuntime(config, () => {});
}
Expand Down
1 change: 1 addition & 0 deletions tests/platforms/tec1g/serial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function makeRuntime(onByte: (byte: number) => void) {
protectOnReset: false,
rtcEnabled: false,
sdEnabled: false,
sdHighCapacity: true,
};
return createTec1gRuntime(config, () => {}, onByte);
}
Expand Down
Loading