← Supporting evidence

Evidence record

experiments/xroar/common-loop.asm

From Windows Application to Portable Emulation Platform

2,058 bytes

; SPDX-License-Identifier: GPL-3.0-or-later
; Authored differential fixture, adapted from VCC Plus's GPL reference loop:
; Public source discussion: https://vccplus-git.brianholman.com/VCCPlus/VCCPlusOSS/src/branch/main/docs/macos/CPU_CORE.md
; Explicit initialization avoids comparing undefined reset-register contents.
; Python run.py emits the exact bytes below; no assembler is required.
;
; Common ROM variant starts at $8000. The native variant prefixes LDMD #$01
; (11 3D 01), moving the common code and stop address three bytes higher.
; CPU vectors all point to $8000. Unused ROM bytes are $FF.
        org     $8000
start   orcc    #$50             ; 1A 50       IRQ/FIRQ remain masked
        lds     #$7000           ; 10 CE 70 00
        ldu     #$0000           ; CE 00 00
        ldy     #$0000           ; 10 8E 00 00
        clra                    ; 4F
        tfr     a,dp            ; 1F 8B
        ldb     #16              ; C6 10
        ldx     #$4100           ; 8E 41 00
; Comparison begins here, after every compared common register is initialized.
loop    inca                    ; 4C
        sta     ,x+             ; A7 80
        decb                    ; 5A
        bne     loop            ; 26 FA
        ldy     #$4100           ; 10 8E 41 00
        ldb     #16              ; C6 10
        clra                    ; 4F
sum     adda    ,y+             ; AB A0
        decb                    ; 5A
        bne     sum             ; 26 FB
done    bra     done            ; 20 FE, stopped BEFORE execution
;
; Expected after 115 compared instructions:
; PC=$8027 (native $802A); A=$88; B=$00; CC=$54; DP=$00;
; X=Y=$4110; U=$0000; S=$7000; RAM $4100-$410F contains bytes 1..16.
; The guest reads back all sixteen bytes through ADDA ,Y+; each trace accumulator
; delta identifies the corresponding byte modulo 256, not just a final checksum.
; E/F/V are intentionally neither initialized nor compared. Native MD is
; observed in VCC's snapshot; XRoar's text trace exposes the LDMD instruction
; but does not directly expose MD.

SHA-256854daabd15f737b731c789075076ea9883140ff7a1c48bec63b3d00b7425242f

A closer look

Open original