Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPL4 initial register values and masks #1084

Open
grauw opened this issue Sep 18, 2017 · 6 comments
Open

OPL4 initial register values and masks #1084

grauw opened this issue Sep 18, 2017 · 6 comments

Comments

@grauw
Copy link
Contributor

grauw commented Sep 18, 2017

FM1
 
  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
0 FF FF 00 00 00 FF FF FF 00 FF FF FF FF FF FF FF
1 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
2 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 FF FF
3 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF
4 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 FF FF
5 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF
6 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 FF FF
7 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF
8 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 FF FF
9 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF
A 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF
B 00 00 00 00 00 00 00 00 00 00 00 3F 3F 00 3F 3F
C 30 30 30 30 30 30 30 30 30 30 30 FF F1 F1 F1 FF
D FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
E 00 00 00 00 00 00 07 07 00 00 00 00 00 00 07 07
F 00 00 00 00 00 00 07 07 07 07 07 07 07 07 07 07
 
FM2
 
  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
0 FF FF FF FF 00 00 FF FF FF FF FF FF FF FF FF FF
1 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
2 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 FF FF
3 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF
4 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 FF FF
5 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF
6 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 FF FF
7 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF
8 00 00 00 00 00 00 FF FF 00 00 00 00 00 00 FF FF
9 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF
A 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF
B 00 00 00 00 00 00 00 00 00 00 00 3F 3F FF 3F 3F
C 30 30 30 30 30 30 30 30 30 30 30 FF F1 F1 F1 FF
D FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
E 00 00 00 00 00 00 07 07 00 00 00 00 00 00 07 07
F 00 00 00 00 00 00 07 07 07 07 07 07 07 07 07 07
 
WAVE
 
  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
0 FF FF 20 00 00 00 FF FF 00 00 00 00 00 00 00 00
1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
7 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
F 00 00 00 00 00 00 00 00 1B 00 FF FF FF FF FF FF

Notes:

  1. OpenMSX returns 00H from unused registers
  2. Obviously I can’t read the initial value of FM2 register 5, so I wrote down 00H (since if those bits were 1 initially FM2 and WAVE would be enabled)
  3. Writing FFH to FM2 register 5 reads back 03H, so unused bits stay 0
  4. Writing FFH to FM2 register CCH reads back FFH, and none of C0H-C8H change (hidden feature?)
  5. Writing FFH to FM2 register B9H reads back 3FH, and changes B7H to 3FH as well. Ditto for BAH (+B8H)
  6. Writing FFH to FM2 register BBH reads back 3FH, writing 00H ditto
10 SCREEN 0 : WIDTH 64 : KEY OFF : POKE &HF3B1,26 : VDP(10) = VDP(10) OR 128
20 FOR I=0 to 255 : OUT &HC4,I : PRINT RIGHT$("0" + HEX$(INP(&HC5)), 2); : NEXT
30 OUT &HC6,5 : OUT &HC7,3
40 FOR I=0 to 255 : OUT &HC6,I : PRINT RIGHT$("0" + HEX$(INP(&HC7)), 2); : NEXT
50 FOR I=0 to 255 : OUT &H7E,I : PRINT RIGHT$("0" + HEX$(INP(&H7F)), 2); : NEXT
@MBilderbeek
Copy link
Member

Here's an initial patch that sets the values to the above ones at the reset method. (Not ideal, but better than before, I guess). I'm not sure how to implement the Notes:

  1. yes, it's simply using an array which was mostly initialized with zeroes
  2. OK, I guess.
  3. The test program reads back 0x03 now, so I guess that's OK now.
  4. I guess that's also what the FIX ITs in the reset are talking about. Not sure how to implement this. What about other writes?
  5. Not sure how to implement this. What about other writes?
  6. Not sure how to implement this. What about other writes?

init_reg_vals.patch.txt

@m9710797
Copy link
Contributor

m9710797 commented Sep 22, 2017 via email

@MBilderbeek
Copy link
Member

Wouter, by the way, your patch is not attached to the ticket. (I guess attaching via e-mails doesn't work.)

@m9710797
Copy link
Contributor

init-opl4.patch.txt

@MBilderbeek
Copy link
Member

@grauw Can you comment on the questions above, please?

@grauw
Copy link
Contributor Author

grauw commented Mar 25, 2022

When you write a value to FM1 register 4 (timer control) with bit 7 set, the value is not stored. The value read back is always the last value written where bit 7 was not set, with mask 63H (unused bits zeroed).

(Values with bit 7 set are IRQ reset commands.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants