FDS and $4018/$4019/$401E

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
Posts: 90
Joined: Fri Feb 29, 2008 10:35 am

FDS and $4018/$4019/$401E

Post by Xkeeper » Wed Jan 13, 2021 5:51 pm

This is a little strange to ask, but is there any known hardware or method to communicate with a device listening on these addresses?

- 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
Doing research on this has been made difficult because of the APU test registers located at this address, but this appears to have nothing to do with that.

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.

User avatar
Ben Boldt
Posts: 708
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: FDS and $4018/$4019/$401E

Post by Ben Boldt » Wed Jan 13, 2021 8:10 pm

Is this from a prototype FDS image or a ROM? Maybe the FDS itself has undiscovered/hidden registers.

Posts: 90
Joined: Fri Feb 29, 2008 10:35 am

Re: FDS and $4018/$4019/$401E

Post by Xkeeper » Wed Jan 13, 2021 11:47 pm


The code is here -- look for byte_4018. This was a segment of the Air Fortress FDS prototype we dumped a while ago that occupies the program space from $C300~$CFFF (some of it has been lost).

Posts: 239
Joined: Sat Nov 18, 2017 9:15 pm

Re: FDS and $4018/$4019/$401E

Post by Fiskbit » Thu Jan 14, 2021 12:37 am

Unless these registers exist on the FDS today and we're unaware of them, I expect they could only come from one of the following kinds of unknown hardware:

- A custom development console
- A device between the console and the FDS RAM adapter
- A custom development FDS RAM adapter

The linked code has a comment saying "Mystery hardware device possibly connected to EXT port", but whether that's referring to the Famicom expansion port or the RAM adapter expansion port, neither can respond to these register accesses. The Famicom expansion port does not have any CPU address or data lines on it, and the RAM adapter port is accessed over registers $4026 and $4033.

(Speaking of mystery FDS hardware, the Famicom Network System software Nomura no Famicom Trade surprisingly has an FDS version and appears to rely on some unknown external hardware hooked up over the RAM adapter port. I don't think anyone's yet looked into how it interacts with that hardware.)

Posts: 442
Joined: Mon Apr 01, 2013 11:17 pm

Re: FDS and $4018/$4019/$401E

Post by Joe » Thu Jan 14, 2021 1:27 pm

Whatever it was, it had a keyboard. It uses HJKL as one set of arrow keys and ;/@] as another.

Code: Select all

$0B = CTRL+K = up
$0C = CTRL+L = right
$0A = CTRL+J = down
$08 = CTRL+H = left

$40 = @ = up
$5D = ] = right
$2F = / = down
$3B = ; = left

Post Reply