flowrs-engine/tools/qemu-mips-wasm/fixtures/toggle/toggle.S
flowRS 49c9d04fbc flowRS engine, cut from flowRS bd343e051a2e
Built alone from an empty CARGO_HOME, its tests passed, and flowrsc checked, ran and exported a
document from the conformance corpus; the export built alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 13:37:09 -05:00

26 lines
986 B
ArmAsm

/*
* The PIC32 panel's instruction-count demo: RG6 toggled by a loop whose length is known, so the
* pin's rate follows from the instruction count alone. Entered through -kernel with no reset
* code of its own (the machine jumps to the entry, as after a chipKIT bootloader).
*
* Each half period is one store to LATGINV, 125 NOPs, the branch and its delay slot: 128
* instructions. Under -icount shift=4 every instruction is 16 ns, so a period is 256 x 16 ns =
* 4096 ns: 244140.625 Hz, duty exactly 50 % (both halves are the same instructions).
*
* SPDX-License-Identifier: Apache-2.0
*/
.set noreorder
.set noat
.text
.globl _start
_start:
li $t0, 0xBF886184 /* TRISGCLR */
li $t1, 1 << 6
sw $t1, 0($t0) /* RG6 an output */
li $t0, 0xBF8861AC /* LATGINV */
1: sw $t1, 0($t0)
.rept 125
nop
.endr
b 1b
nop