사용 방법
- 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
- 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
- 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/ewrogers/sgdk-skills --skill sgdk-cartridge시작 전 확인
- 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
- 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.
SGDK Cartridge
Keep common code and assets reachable while loading different parts of a large ROM. Use the mapper the target cartridge actually supports. Banking is a board feature, not extra RAM or a way around VRAM and DMA limits.
Establish the target
- Identify ROM size, intended emulator/flash cart/physical board, SRAM wiring,
and existing linker layout. Ordinary cartridges expose up to 4 MiB linearly; using SRAM can overlay part of that window. Do not add banking to a small game without a reason.
- Pull
ewrogers/sgdk:latest, rundoctor, and inspect itsinc/mapper.h,
inc/config.h, md.ld, ResComp manual, and the chosen audio driver's source. The references below were checked with SGDK 2.11. Review differences when the image changes.
- Separate physical ROM offsets from CPU addresses. Write down who owns each
mapper window, which resources must stay pinned, and when a temporary view may change. See mapping and resource lifetime.
Implement a small proof
- Rebuild the SDK with
ENABLE_BANK_SWITCH=1, including the library. Setting a
flag only on game sources does not change an already compiled library.
- Keep entry points, interrupts, shared sprite metadata, hero/UI assets and
initialized-data load bytes in stable storage. NEAR alone does not prove that something fits the fixed first bank. Add linker assertions.
- Read FAR resources through the selected SDK's helpers. Copy small values to
owned RAM when they must survive another mapping. Never retain a transient mapped pointer in a scene, queue or callback without an explicit lifetime.
- Check actual ELF load sections and final ROM bytes. A symbol's address alone
does not prove that its payload was emitted.
- Finish queued DMA readers before remapping their source, or queue a copy of
owned RAM. Plan sprite uploads and interrupts as readers too.
- Reserve a stable audio window for a playing stream and its samples. A play
call does not copy the entire song into Z80 RAM. Quiesce the driver before changing that window. See audio and saves.
- Keep SRAM operations short, close its overlay on every path, and preserve
mapper assignments. Use validated, versioned records. A checksum detects corruption; it does not make a single-slot write power-loss safe.
Adapt the Bank Lab rather than inventing mapper register calls. Its private SDK build leaves the installed container unchanged. It demonstrates two stage banks, pinned common content, a cross-bank read, queued palette copies, banked FM music and SRAM save/load. Its deliberately sparse 6 MiB layout is a proof, not a recommended cartridge size.
Validate and report
- Host tests: reject invalid ranges and saves, verify view invalidation,
audio handoff order and unchanged bank assignments across SRAM access.
- Container builds: release and debug, base 68000 code, bank-enabled SDK,
placement assertions, payload bytes, header, padding and SDK checksum.
- Emulator: switch stages repeatedly during music; save, move, switch and load;
verify shared graphics, audio and checks remain intact.
- Hardware: validate the actual board/flash-cart mapper, SRAM and region.
Emulator success is not evidence of physical cartridge compatibility.
Report the physical layout, window ownership, RAM staging cost, tool versions, commands and tests performed. Keep ROM mapping, VRAM, DMA, sprite scanlines and CPU budgets separate. Do not silently reset all banks or rewrite a project's mapper/header to make a test pass.




