SYSTEM.VMSR, SYSTEM.VMRS

General discussions about working with the Astrobe IDE and programming the Raspberry Pi RP2040 and the Pi Pico board.
Post Reply
gray
Posts: 169
Joined: Tue Feb 12, 2019 2:59 am
Location: Mauritius

SYSTEM.VMSR, SYSTEM.VMRS

Post by gray » Mon Jun 02, 2025 10:29 am

Astrobe for RP2350 uses 'SYSTEM.VMSR(0)' in the initialisation of the FPU (module Main). This SYSTEM procedure is not documented in SYSTEM.def, but the disassembly makes its function clear:

Code: Select all

SYSTEM.VMSR(0);
02000H          movs     r0,#0
0EEE10A10H      vmsr     fpscr,r0
If there's 'SYSTEM.VMSR' there is probably 'SYSTEM.VMRS' as well :) and indeed:

Code: Select all

SYSTEM.VMRS(1)
02001H          movs     r0,#1
0EEF10A10H      vmrs     r0,fpscr
I would have expected 'SYSTEM.VMRS' to take the target general register as argument, but the assembly code disagrees. Also, I don't really understand this code. I don't think 'movs r0,#1' has any effect.

What do I miss here? Thanks.

PS: Are there any other SYSTEM procedures not listed in SYSTEM.def, both for the RP2350 and the RP2040?

gray
Posts: 169
Joined: Tue Feb 12, 2019 2:59 am
Location: Mauritius

Re: SYSTEM.VMSR, SYSTEM.VMRS

Post by gray » Mon Jun 02, 2025 11:06 am

Another attempt:

Code: Select all

VAR x: INTEGER;
SYSTEM.VMRS(x)
0F8DF0008H      ldr.w    r0,[pc,#8] -> 24
06800H          ldr      r0,[r0]
0EEF10A10H      vmrs     r0,fpscr
Shouldn't this be something like this (using the same pc-offset for x):

Code: Select all

vmrs     r0,fpscr
ldr.w    r1,[pc,#8] -> 24
str      r0,[r1]

cfbsoftware
Site Admin
Posts: 545
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: SYSTEM.VMSR, SYSTEM.VMRS

Post by cfbsoftware » Mon Jun 02, 2025 9:46 pm

Sorry - support is not provided for "undocumented features".

Post Reply