Specifically:
- Writes to $401E - either #$40 (reading) or #$00 (after read)
- Reads from $4019 - seems to be some sort of status register where the top two bits are used. Waits for read AND #$C0 == #$80
- Reads from $4018 - at least 7 bits of data (high bit unsure) in one read, i.e. not strobed reads like the joypads.
This is the code:
Code: Select all
; Interacts with unknown hardware
; $401E: Output?
; $4019: Status?
; $4018: Data?
; Returns data in A
QueryMysteryHardware: ; $C7C0
LDA #0
STA byte_401E ; Send device command?
- LDA byte_4019 ; Check status register
AND #$C0 ; Check top two bits
CMP #$80 ; Is only the top bit set?
BNE - ; If not, wait
LDA byte_4018 ; Read device response?
PHA ; Store response on stack
LDA #$40 ; Load new command
STA byte_401E ; Send device command
- LDA byte_4019 ; Check device status
AND #$80 ; Top bit clear?
BNE - ; If not, wait
PLA ; Pull response
RTS
It doesn't seem like there is any way to create/handle this kind of data with the standard Expansion Port on the Famicom, nor with the expanded (unused) port on the NES.
For some more details, this is some unreferenced, unused code in a prototype circa 1987.