1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2026-03-11 03:16:11 +00:00
Files
rk65c02/examples/mmu_multitasking_task.s
Radosław Kujawa ee826da6ec MMU: host-pluggable translation, TLB, JIT coherence, docs and examples
- Add MMU API: translate and fault callbacks, begin/mark/end_update, TLB
- Translation result: ok, paddr (32-bit), perms (R/W/X), fault_code, no_fill_tlb
- Internal TLB (transparent); no_fill_tlb for context-dependent mappings
- JIT: invalidate only code on changed pages; code-page refcount
- Fault: EMUERROR, mmu_last_fault_*; resume by re-run after mapping update
- doc/MMU.md: design goals, API reference, usage, guest contract, limits
- examples/mmu_cart: C64-style bank switch (host + guest asm)
- examples/mmu_multitasking: minimal task switch (host + guest asm)
- test_mmu: MMU tests; bench_mmu: ns/insn for MMU configs
- README: MMU feature and example links

Made-with: Cursor
2026-03-07 04:05:50 +01:00

27 lines
882 B
ArmAsm

; =============================================================================
; MMU Multitasking — Per-task code (loaded at physical $1000 and $5000)
; =============================================================================
; Assemble to mmu_multitasking_task.rom. The host loads this at physical
; $1000 (task 0) and $5000 (task 1). Virtual $1000 is mapped to either
; physical $1000 or $5000 depending on current task.
;
; Guest contract: $FF00 = yield (write next task id), $FF01 = current task id (read-only, set by host).
; =============================================================================
.org 0x1000
task_entry:
inc 0x0200 ; per-task counter (each task has its own 0x0200)
lda 0x0200
cmp #3
bcs halt
lda 0xFF01 ; current task id (host wrote it when switching)
eor #1
sta 0xFF00 ; yield to the other task
jmp task_entry
halt:
stp