@@ -131,30 +131,35 @@ Registers
131131 - Write the OS operation id here to begin an OS call.
132132 * - $FFF0
133133 - IRQ
134- - Set bit 0 high to enable VSYNC interrupts. Verify source
135- with VSYNC increment then read or write this register to clear
136- interrupt .
134+ - Set bit 0 high to enable VSYNC interrupts. To clear the
135+ interrupt, first verify the source by checking the VSYNC
136+ counter, then read or write this register .
137137 * - $FFF1
138138 - RETURN
139- - Always $80, BRA. Entry to blocking OS call.
139+ - Always $80 (the BRA opcode). JSR here to spin-wait for an
140+ OS call: the CPU loops on this BRA until BUSY clears, then
141+ falls through to LDA and LDX below.
140142 * - $FFF2
141143 - BUSY
142144 - Bit 7 high while OS operation is running.
143145 * - $FFF3
144146 - LDA
145- - Always $A9.
147+ - Always $A9 (the LDA immediate opcode). Part of the
148+ spin-loop return sequence.
146149 * - $FFF4
147150 - A
148151 - OS call register A.
149152 * - $FFF5
150153 - LDX
151- - Always $A2.
154+ - Always $A2 (the LDX immediate opcode). Part of the
155+ spin-loop return sequence.
152156 * - $FFF6
153157 - X
154158 - OS call register X.
155159 * - $FFF7
156160 - RTS
157- - Always $60.
161+ - Always $60 (the RTS opcode). Ends the spin-loop return
162+ sequence, returning to the caller with A and X loaded.
158163 * - | $FFF8 -
159164 | $FFF9
160165 - SREG
@@ -190,10 +195,10 @@ portal would make moving XRAM very slow since data would have to
190195buffer in 6502 RAM. Ideally, you won't move XRAM and can use the pair
191196for better optimizations.
192197
193- STEP0 and STEP1 are reset to 1. These are signed so you can go
194- backwards and reverse data . These adders allow for very fast sequential
195- access, which typically makes up for the slightly slower random access
196- compared to 6502 system RAM.
198+ STEP0 and STEP1 default to 1 after reset. Both are signed, so
199+ negative values traverse XRAM in reverse . These auto-increment
200+ adders enable very fast sequential access, which more than offsets
201+ the slightly slower random access compared to 6502 system RAM.
197202
198203Extended Stack (XSTACK)
199204-----------------------
@@ -314,9 +319,10 @@ in XRAM.
314319 xreg_ria_keyboard(xaddr); // macro shortcut
315320
316321 The RIA continuously updates XRAM with a bit array of USB HID
317- keyboard codes. Note that these are not PS/2 scancodes.
318- Each bit represents one key with the first four bits/codes having special
319- meaning:
322+ keyboard keycodes. Note that these are not PS/2 scancodes.
323+ Each keycode is one bit in the array — bit N is 1 when the key
324+ with HID keycode N is currently pressed. The first four keycodes
325+ have special meaning:
320326
321327- 0 - No key pressed
322328- 1 - Num Lock on
@@ -402,7 +408,7 @@ use a specific gamepad or include a "AB or BA" option.
402408 Retro-style gamepads are designed with button mappings for emulators while
403409 emulators expect the button layout of a modern gamepad. These do not cancel
404410 each other out. Instead, you end up with wonky button mappings that do not
405- follow the defacto standard for modern gamepads.
411+ follow the de facto standard for modern gamepads.
406412
407413Enable and disable access to the RIA gamepad XRAM registers by setting
408414the extended register. The register value is the XRAM start address of
@@ -513,9 +519,9 @@ with extended register device 0 channel 1 address 0x00.
513519* Stereo panning.
514520* PWM for all waveforms.
515521
516- Each of the eight oscillators requires eight bytes of XRAM for
517- configuration. The unused byte is padding so multiplication is a fast
518- bit shift.
522+ Each of the eight oscillators uses eight bytes of XRAM for
523+ configuration. The structure size is a power of two so indexing
524+ into the oscillator array is a bit shift rather than a multiply .
519525
520526.. code-block :: C
521527
@@ -557,13 +563,13 @@ shenanigans.
557563 - 0-255 (0-100%) Duty cycle of oscillator. This affects all
558564 waveforms.
559565 * - vol_attack
560- - Attack volume and rate.
566+ - Attack phase volume and rate.
561567
562568 * bits 7-4 - 0-15 volume attenuation.
563569 * bits 3-0 - 0-15 attack rate.
564570
565571 * - vol_decay
566- - Decay volume and rate.
572+ - Decay phase volume and rate.
567573
568574 * bits 7-4 - 0-15 volume attenuation.
569575 * bits 3-0 - 0-15 decay rate.
@@ -676,10 +682,10 @@ registers. The OPL2 registers must begin on a page boundary.
676682 If, for example, xaddr is 0x4200 then the 256 registers of an OPL2 chip
677683are mapped into XRAM from 0x4200 to 0x42FF.
678684
679- Timers, interrupts, and the status register are not supported and were
680- not widely used. These were in Yamaha OPL chips to assist with cost
681- reducing consumer devices and rarely used in computers which had their
682- own timers.
685+ Timers, interrupts, and the status register are not supported.
686+ These features existed in Yamaha OPL chips primarily to help
687+ cost-reduce consumer devices; computers of the era had their own
688+ timers and rarely used them .
683689
684690
685691Virtual Communications Port
@@ -740,7 +746,8 @@ and ``len`` bytes of raw binary data:
740746 * - Field
741747 - Description
742748 * - ``addr ``
743- - Destination address in 6502 RAM or XRAM.
749+ - Destination address in 6502 RAM (0x0000-0xFEFF) or XRAM
750+ (0x10000-0x1FFFF).
744751 * - ``len ``
745752 - Number of raw binary bytes that immediately follow this line.
746753 * - ``crc ``
0 commit comments