-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: code execution requires a codepage type
- Loading branch information
Showing
5 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { createfirmware } from 'zss/firmware' | ||
|
||
export const ALL_FIRMWARE = createfirmware({ | ||
get(chip, name) { | ||
return [false, undefined] | ||
}, | ||
set(chip, name, value) { | ||
return [false, undefined] | ||
}, | ||
shouldtick(chip) { | ||
// | ||
}, | ||
tick(chip) { | ||
// | ||
}, | ||
tock(chip) { | ||
// | ||
}, | ||
}).command('stub', (chip, words) => { | ||
return 0 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,30 @@ | ||
import { CHIP } from 'zss/chip' | ||
import { FIRMWARE } from 'zss/firmware' | ||
import { CODE_PAGE_TYPE } from 'zss/memory/codepage' | ||
|
||
import { ALL_FIRMWARE } from './all' | ||
import { ZSS_FIRMWARE } from './zss' | ||
import { ZZT_FIRMWARE } from './zzt' | ||
|
||
const firmwares: Record<string, FIRMWARE> = { | ||
all: ALL_FIRMWARE, | ||
zzt: ZZT_FIRMWARE, | ||
zss: ZSS_FIRMWARE, | ||
} | ||
|
||
export type FIRMWARE_NAME = keyof typeof firmwares | ||
export const CODE_PAGE_FIRMWARE = { | ||
[CODE_PAGE_TYPE.ERROR]: [], | ||
[CODE_PAGE_TYPE.FUNC]: ['all'], | ||
[CODE_PAGE_TYPE.BOARD]: ['all'], | ||
[CODE_PAGE_TYPE.OBJECT]: ['all', 'zss', 'zzt'], | ||
[CODE_PAGE_TYPE.TERRAIN]: ['all'], | ||
[CODE_PAGE_TYPE.CHARSET]: ['all'], | ||
[CODE_PAGE_TYPE.PALETTE]: ['all'], | ||
} | ||
|
||
export type FIRMWARE_NAME = keyof typeof CODE_PAGE_FIRMWARE | ||
|
||
export function loadfirmware(chip: CHIP, items: FIRMWARE_NAME[]) { | ||
export function loadfirmware(chip: CHIP, firmware: CODE_PAGE_TYPE) { | ||
const items = CODE_PAGE_FIRMWARE[firmware] ?? [] | ||
items.forEach((name) => chip.install(firmwares[name])) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters