CPCWiki forum

General Category => Amstrad CPC hardware => Topic started by: llopis on 22:09, 22 March 21

Title: 4MB RAM expansion ports trigger drive motor?
Post by: llopis on 22:09, 22 March 21
I noticed that while I'm trying to detect existing RAM expansions, the text will cause the drive motor to turn on. As I dug a bit deeper into it, I noticed that even though #7800 and #7A00 are reserved for the 4MB expansion, if you write #C5 to either of them on a CPC 6128 or a 6128 Plus, you'll turn on the drive motor. Writing #C4 will turn it off.

You can even do this from BASIC with out &7800,&c5 and out &7800,&c4

Why is that? Is there some decoding of partial bits going on that is being triggered by that?


And the followup question: Is there any way to detect all existing RAM without triggering that? My strategy has been to start in #78 and work my way up to #7F writing the port and the bank to RAM and then checking which ones are correct in the right location. Is there a better approach that allows me to skip the ports that are causing the motor to turn on?
Title: Re: 4MB RAM expansion ports trigger drive motor?
Post by: GUNHED on 22:27, 22 March 21
You use the wrong ports, set unused bits to 1, never to 0!!! Because 0 activates a line.


My 4 MB works perfect. See FutureOS memory tool.
Title: Re: 4MB RAM expansion ports trigger drive motor?
Post by: llopis on 22:40, 22 March 21
Quote from: GUNHED on 22:27, 22 March 21
You use the wrong ports, set unused bits to 1, never to 0!!! Because 0 activates a line.

My 4 MB works perfect. See FutureOS memory tool.


Oh interesting! I had made this note to myself:


;; 7 - always 1
;; 6 - always 1
;; 5 - bank
;; 4 - bank
;; 3 - bank
;; 2 - always 1
;; 1 - block
;; 0 - block

So you're saying that bits 2, 6, and 7 should always be 0 instead of 1?
Edit: Oh, no wait, you're saying I should set them to 1, I misread that. So I think I'm doing that correctly, right?
Title: Re: 4MB RAM expansion ports trigger drive motor?
Post by: GUNHED on 22:46, 22 March 21
No, you're using port &7800 instead &78FF.
Title: Re: 4MB RAM expansion ports trigger drive motor?
Post by: llopis on 23:11, 22 March 21
Quote from: GUNHED on 22:46, 22 March 21
No, you're using port &7800 instead &78FF.
Oooohhh, those bits! I'm so used to them not mattering that I didn't even think about it! :-) Thanks!
Title: Re: 4MB RAM expansion ports trigger drive motor?
Post by: pelrun on 05:05, 23 March 21
It's a common misunderstanding about the CPC's io architecture. When the documentation for a device says certain bits are "don't care", it specifically means only that device doesn't care, another device in the system may/will. You have to ensure every other device stays off, so any bits you aren't explicitly using have to be 1.
The top 6 bits are especially important here, as each independently enables a single function when it's 0. Once you know this, it's pretty obvious why &7800 also triggered the disc drive:
15 - Gate Array
14 - CRTC
13 - Upper ROM banking
12 - Printer
11 - PIO
10 - FDC

Title: Re: 4MB RAM expansion ports trigger drive motor?
Post by: GUNHED on 15:39, 23 March 21
Yeah, because of the low bits. Bit 7 = 0 activates the FDC / Motor flip flop. See:


https://www.cpcwiki.eu/index.php/765_FDC#Accessing_the_FDC_765
Powered by SMFPacks Menu Editor Mod