From 73c7ac5941f472e4ab21235eaaf89a1f11c5e1ca Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Thu, 16 Nov 2023 13:40:23 -0600 Subject: [PATCH] added category field to presets --- presets/c64/cartheader.acme | 30 ++++++++++++++++++++++++++ presets/c64/hello.acme | 42 +++++++++++++++++++++++++++++++++++++ src/common/baseplatform.ts | 1 + src/ide/ui.ts | 11 +++++++--- src/machine/apple2.ts | 2 ++ src/platform/apple2.ts | 18 ++++++++-------- src/platform/atari8.ts | 6 +++--- src/platform/c64.ts | 9 ++++---- src/platform/nes.ts | 24 ++++++++++----------- src/platform/vcs.ts | 8 +++---- 10 files changed, 116 insertions(+), 35 deletions(-) create mode 100644 presets/c64/cartheader.acme create mode 100644 presets/c64/hello.acme diff --git a/presets/c64/cartheader.acme b/presets/c64/cartheader.acme new file mode 100644 index 00000000..c39e80d7 --- /dev/null +++ b/presets/c64/cartheader.acme @@ -0,0 +1,30 @@ + +* = $7ffe +; 2-byte load address for ROM image + !word $8000 +; http://swut.net/c64cart-howto.html +; https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image + !word CartKReset ; cold start vector + !word CartWStart ; warm start vector + !byte $c3, $c2, $cd, $38, $30 ; "CBM80" +CartKReset + STX $D016 ; Turn on VIC for PAL / NTSC check + JSR $FDA3 ; IOINIT - Init CIA chips + JSR $FD50 ; RANTAM - Clear/test system RAM + JSR $FD15 ; RESTOR - Init KERNAL RAM vectors + JSR $FF5B ; CINT - Init VIC and screen editor + CLI ; Re-enable IRQ interrupts +CartBReset +; init BASIC? +!ifdef CART_INIT_BASIC { + JSR $E453 ; Init BASIC RAM vectors + JSR $E3BF ; Main BASIC RAM Init routine + JSR $E422 ; Power-up message / NEW command + LDX #$FB + TXS ; Reduce stack pointer for BASIC +; don't init BASIC, just NOP +} else { + !fill 12, $ea ; nop +} +CartWStart +; should be * = $x025 diff --git a/presets/c64/hello.acme b/presets/c64/hello.acme new file mode 100644 index 00000000..c5d4812a --- /dev/null +++ b/presets/c64/hello.acme @@ -0,0 +1,42 @@ + +!src "cartheader.acme" + +!address { + Temp = $02 +} + +Start: + sei ; turn off interrupts + ldy #0 +Loop: + lda Message,y ; load message byte + beq EOM ; 0 = end of string + clc + adc #$40 + sta $400+41,y ; store to screen + iny + bne Loop ; next character +EOM: + +Wait1: + lda $d011 + bmi Wait1 ; wait for line < 256 +Wait2: + lda $d012 ; get current scanline +Wait3: + cmp $d012 + beq Wait3 ; wait for scanline to change + lsr ; divide by 2 + lsr ; divide by 2 + clc + adc Temp ; add to frame counter + sta $d020 ; set border color + lda $d011 ; get status bits + bpl Wait2 ; repeat until line >= 256 + sty $d020 ; reset border color + dec Temp ; change frame counter + jmp Wait1 ; endless loop + +Message: + !scr "HELLO WORLD", 0 + diff --git a/src/common/baseplatform.ts b/src/common/baseplatform.ts index 72a11e20..b63bbb13 100644 --- a/src/common/baseplatform.ts +++ b/src/common/baseplatform.ts @@ -158,6 +158,7 @@ export interface Preset { name : string; chapter? : number; title? : string; + category?: string; } export interface MemoryBus { diff --git a/src/ide/ui.ts b/src/ide/ui.ts index 804d925f..81920514 100644 --- a/src/ide/ui.ts +++ b/src/ide/ui.ts @@ -3,7 +3,7 @@ import * as localforage from "localforage"; import { CodeProject, createNewPersistentStore, LocalForageFilesystem, OverlayFilesystem, ProjectFilesystem, WebPresetsFileSystem } from "./project"; -import { WorkerResult, WorkerOutputResult, WorkerError, FileData, WorkerErrorResult } from "../common/workertypes"; +import { WorkerResult, WorkerError, FileData } from "../common/workertypes"; import { ProjectWindows } from "./windows"; import { Platform, Preset, DebugSymbols, DebugEvalCondition, isDebuggable, EmuState } from "../common/baseplatform"; import { PLATFORMS, EmuHalt } from "../common/emu"; @@ -15,7 +15,7 @@ import { GHSession, GithubService, getRepos, parseGithubURL } from "./services"; import Split = require('split.js'); import { importPlatform } from "../platform/_index"; import { DisassemblerView, ListingView, PC_LINE_LOOKAHEAD , SourceEditor } from "./views/editors"; -import { AddressHeatMapView, BinaryFileView, MemoryMapView, MemoryView, ProbeLogView, ProbeSymbolView, RasterPCHeatMapView, RasterStackMapView, ScanlineIOView, VRAMMemoryView } from "./views/debugviews"; +import { AddressHeatMapView, BinaryFileView, MemoryMapView, MemoryView, ProbeLogView, ProbeSymbolView, RasterStackMapView, ScanlineIOView, VRAMMemoryView } from "./views/debugviews"; import { AssetEditorView } from "./views/asseteditor"; import { isMobileDevice } from "./views/baseviews"; import { CallStackView, DebugBrowserView } from "./views/treeviews"; @@ -1221,11 +1221,16 @@ async function _downloadAllFilesZipFile(e) { function populateExamples(sel) { let files = {}; - let optgroup = $("").attr('label','Examples').appendTo(sel); + let optgroup; for (var i=0; i").attr('label','Examples: ' + preset.category).appendTo(sel); + } else if (!optgroup) { + optgroup = $("").attr('label','Examples').appendTo(sel); + } optgroup.append($("