CPCWiki forum

General Category => Programming => Topic started by: Bryce on 17:21, 22 October 11

Title: Memory Check.
Post by: Bryce on 17:21, 22 October 11
Hi All,
      I'm just experimenting with some RAM expansions and was wondering whether there is a quick way to report how much RAM is connected to the CPC. It needs to be on a disk (ie: not a ROM routine) because there isn't / can't be any ROM expansion connected to the CPC while I am performing certain tests.

Bryce.
Title: Re: Memory Check.
Post by: SyX on 19:44, 22 October 11
I have made a miniprogram that will report how many banks of expansion ram DK'Tronics compatible has your CPC, the sizes reported are 0, 64, 128, 256 or 512.

If you need page (16 KBs pages) accuracy instead of bank accuracy (64 KBs banks), only tell me ;)

PD:The DSK with the ram test is fixed now, sorry again ;)
Title: Re: Memory Check.
Post by: Bryce on 20:14, 22 October 11
Wow, thanks, "Bank acurracy" is enough for what I am doing :) I'll try it out tomorrow.

Bryce.
Title: Re: Memory Check.
Post by: SyX on 20:20, 22 October 11
You are welcome Sir Bryce :D
Title: Re: Memory Check.
Post by: Bryce on 17:48, 23 October 11
Hi SyX,
     somethings not quite right with the RAM test program. If I connect a 64K DKTronics expansion to the CPC, the program reports 512K, the same when I connect 256K. And it always crashes after reporting the RAM (strange flickering dots in top left corner of screen) except for when no expansion is connected.

Bryce.
Title: Re: Memory Check.
Post by: SyX on 18:50, 23 October 11
Upss, ok, i'll review it, i only has tested in WinApe (with its multiples ram expansion emulation worked great) and my CPC6128s without ram expansions (that showed the message 64 KBs of ram expansion), but i don't think it would be any problem, sorry.

PD: Fixed, only worked in my CPC by pure miracle :P

PD2: I will add the support to Silicon Disk Expansions, because now it could show wrong sizes in those ;)
Title: Re: Memory Check.
Post by: CanonMan on 21:44, 23 October 11
I had the same problem running it on WinAPE too.
 
I had a look at the code using the debugger and noticed that the bank switching codes weren't being sent to port &7f00. I'm surprised it worked at all.
 
Title: Re: Memory Check.
Post by: SyX on 22:02, 23 October 11
Only worked for the ghosting in the I/O ports, that is be lucky XDDD
Title: Re: Memory Check.
Post by: arnoldemu on 23:00, 23 October 11
This is the code I used for Batman Begins:
http://www.cpctech.org.uk/source/memcheck.html (http://www.cpctech.org.uk/source/memcheck.html)

it stores a list of the configurations that can be used, so you can count these up and multiply by 16 to give the total size in extra K.
This may be useful?
Title: Re: Memory Check.
Post by: TFM on 07:13, 24 October 11
Hi All,
      I'm just experimenting with some RAM expansions and was wondering whether there is a quick way to report how much RAM is connected to the CPC. It needs to be on a disk (ie: not a ROM routine) because there isn't / can't be any ROM expansion connected to the CPC while I am performing certain tests.

Bryce.

Look here:
http://www.cpcwiki.eu/imgs/4/44/4_MB_E-RAM_Test.zip (http://www.cpcwiki.eu/imgs/4/44/4_MB_E-RAM_Test.zip)
Title: Re: Memory Check.
Post by: SyX on 19:48, 24 October 11
I have finished the Expansion RAM Checker, include support for DK'Tronics Silicon Disk (and every standard ram expansion until 512 KB), page accuracy and a memory test (fill the ram in 4 passes with the values $00, $55, $AA, $FF and check the values) with a "gui" similar to the Atari 800 ram test.

As you can see in the picture:
White: Ram Page Detected.
Grey: There is not ram in this page.
Red: Ram page failed test.
Green: Ram page pass test.

TODO: Add support for ram expansions bigger 512KBs, it's easy but i'm lazy and except FutureOS i don't know what programs make use of those monstrous ram sizes :P
 
Any feedback will be well received :)

PD: I have included a tape version, too ;)
Title: Re: Memory Check.
Post by: PhilZeVibe on 20:28, 24 October 11
That's a very cool tool!

It will be a nice addition to the stress tests I use:
And now, what about a FDC tests suite? ;) Something that would check the different commands, examining the FDC flags state, the returned values and the timings.
It would be tremendously useful for us emulator authors. The FDC is sadly the most neglected chip at the moment :/
Title: Re: Memory Check.
Post by: arnoldemu on 20:57, 24 October 11
That's a very cool tool!

It will be a nice addition to the stress tests I use:
  • RAM: Expansion RAM Checker
  • CRTC & GA: Lots of demos  ;D
  • CPU: Z80 Tests Suite, Zexall
  • ASIC: Arnold V test cartridge
  • VDU, Z80, CRTC & ASIC: Plus test
And now, what about a FDC tests suite? ;) Something that would check the different commands, examining the FDC flags state, the returned values and the timings.
It would be tremendously useful for us emulator authors. The FDC is sadly the most neglected chip at the moment :/

http://www.cpctech.org.uk/download/fdctest.zip (http://www.cpctech.org.uk/download/fdctest.zip)

A test program I wrote a while ago.
Tests quite a lot of things, but after writing the loader, I found there was some things I had missed.

At this time, I am writing my own ppi, psg and memory testing programs.
I have found that it is possible to detect different versions of the ppi.
Not much use, but possible to know which is inside the cpc.

Title: Re: Memory Check.
Post by: SyX on 21:10, 24 October 11
And now, what about a FDC tests suite? ;) Something that would check the different commands, examining the FDC flags state, the returned values and the timings.
It would be tremendously useful for us emulator authors. The FDC is sadly the most neglected chip at the moment :/
I agreed totally with you, the last weekend i was breaking my head why the original version of Basun (an horrendous game :P ) doesn't work in emulators, but works perfectly in the real machine.

Well, the problem is when the loader finish to load everything, stop the disk drive motor, send the header to the track 38, wait to receive the acknowledge of this operation (the emulators enter in a infinite loop here, while waiting), restart the motor again, read the track 39 (a dummy read, because this track is a normal formatted track, only has $E5), stop the motor and launch the game.

It looks that the emulators stop immediately the disk drive motor and the program never receive the confirmation of the seek track 38; while in the real CPC take a time, in this time the seek track 38 is made and the FDC signal the operation was made correctly.

.
.
.
Although there is hope ;) , arnoldemu has made a lot of work studying the FDC, he's the author of the disk loader of Batman Begins, and he promise that when he finish a few of his projects, he will publish the sources of the loader and a lot of the secrets of the FDC will be disclosed  :)

PD: While i was writting this, arnoldemu has answered you ;)

PD2: If somebody wants the sources of the memory tester, only ask ;)
Title: Re: Memory Check.
Post by: arnoldemu on 21:23, 24 October 11
I see it's relying on the disc motor taking time to slow down.
Discology does something similar, it times how long it takes for the disc to stop, and uses that to calibrate it's writing.
Title: Re: Memory Check.
Post by: PhilZeVibe on 21:42, 24 October 11
http://www.cpctech.org.uk/download/fdctest.zip (http://www.cpctech.org.uk/download/fdctest.zip)

A test program I wrote a while ago.
Tests quite a lot of things, but after writing the loader, I found there was some things I had missed.
Very interesting. I didn't know there was already a FDC test suite.
And it looks nice too.

Some remarks though:
The test suite doesn't really indicate what each test is about.
I see there are some brief explanations in the asm code, but it would be even better if there was a small txt file explaining each one of these tests and what are the correct values to satisfy it.

I have bad news too. :( I have converted the dsk to an hfe file and ran it on my real CPC. The tests don't want to execute on it. Just after launching test.bas, the HxC goes crazy and then the Basic returns a "Drive A: read fail. Retry, Ignore or Cancel?".

At this time, I am writing my own ppi, psg and memory testing programs.
I have found that it is possible to detect different versions of the ppi.
Not much use, but possible to know which is inside the cpc.
Interesting! The more tests the better obviously ;)
Title: Re: Memory Check.
Post by: arnoldemu on 22:29, 24 October 11
Very interesting. I didn't know there was already a FDC test suite.
And it looks nice too.

Some remarks though:
The test suite doesn't really indicate what each test is about.
I see there are some brief explanations in the asm code, but it would be even better if there was a small txt file explaining each one of these tests and what are the correct values to satisfy it.
true, I don't have time to update this test at the moment.

I have bad news too. :( I have converted the dsk to an hfe file and ran it on my real CPC. The tests don't want to execute on it. Just after launching test.bas, the HxC goes crazy and then the Basic returns a "Drive A: read fail. Retry, Ignore or Cancel?".
Bad news. I ran the tests on a 6128plus. RUn one disc, then use that to format and make the test disc in another drive.
then run the tests on that created disc.
The test disc does have some special format tracks.

Title: Re: Memory Check.
Post by: PhilZeVibe on 22:53, 24 October 11
I ran the tests on a 6128plus. RUn one disc, then use that to format and make the test disc in another drive.
then run the tests on that created disc.
The test disc does have some special format tracks.

The problem is I can't do that. When I run test.bas, it doesn't even reach the menu. The drive fail message pops up before that.
Title: Re: Memory Check.
Post by: TFM on 00:25, 25 October 11
If somebody has questions (precisely, not general. For general use a book) about the FDC or RAM programming then you can ask me here. Will be my pleasure to share what I know.
Title: Re: Memory Check.
Post by: Bryce on 18:33, 31 October 11
Hi SyX,
     I just did some intensive testing of your RAMTest dsk and there is still a minor error in the program. If I connect a 256K RAM expansion (tested on a 6128+), which is mapped to Banks 0 to 3, the test claims that I have 320K total and Banks 0 to 4 are populated. Which definitely isn't the case. If I connect 512K it correctly reports Banks 0 to 7 are populated and if I connect 256K mapped to Banks 4 to 7 it also works correctly.

Otherwise a seriously cool program, reminds me of the Atari XL RAM Test :)

Bryce. 
Title: Re: Memory Check.
Post by: TFM on 19:09, 31 October 11
Hi SyX,
     I just did some intensive testing of your RAMTest dsk and there is still a minor error in the program. If I connect a 256K RAM expansion (tested on a 6128+), which is mapped to Banks 0 to 3, the test claims that I have 320K total and Banks 0 to 4 are populated. Which definitely isn't the case.

Have you done the test on a CPC6128? In this case you have 64 KB (internal E-RAM) + 256 KB = 320 KB.
 
Now, you can connect 256 KB in two ways. It can target the lower part (&7FCx, Dx) or the upper part (&7FEx, Fx) of the expansion RAM address range.
 
If the 256 KB are connected to the lower part, then the total expansion RAM ist 256 KB. The 256 KB overwrite the 64 KB of internal exp.RAM.
 
If the 256 KB are connected to the upper part, then the total expansion RAM (E-RAM) is 320 KB. 64 KB from the 6128 and 256 KB external E-RAM.
 
You can use also the FutureOS tool "OS Infos" to get a graphic map of the first 512 KB E-RAM. Then it's pretty obvious what I'm talking about. If not please let me know.
 
(http://www.cpcwiki.eu/imgs/3/36/320ERAM.png)
 
Every square is a block of 16 KB expansion RAM (E-RAM). The hex number in the upper, left corner of each square it the value for port &7Fxx to select that particular E-RAM.
 
Free = RAM is connected and free.
Not.c = RAM is not connected, does not exist.
DIR = RAM is used as DIRectory buffer, so it does exist
KZS = RAM used as buffer, so it also exists.
 
320 KB expansion RAM are shown :-)
 
Title: Re: Memory Check.
Post by: Bryce on 20:02, 31 October 11
I don't know which mode SyXs software uses, so I can't tell you how it's being banked. But no matter how it is banked, Bank 4 should be empty if only 256K external RAM is connected, shouldn't it?

Bryce.
Title: Re: Memory Check.
Post by: TFM on 20:10, 31 October 11
I don't know which mode SyXs software uses, so I can't tell you how it's being banked. But no matter how it is banked, Bank 4 should be empty if only 256K external RAM is connected, shouldn't it?

Bryce.

I can't tell you neither how SyX's soft works, therefore I suggest to use "OS Infos" from the FutureOS utility disc. This one will clearly show you which blocks are occupied in reality. It's easy:
 
- Start "OS Infos"
- Press "1"
- Press Space
Now you see the semi-graphic map of the first 512 KB expansion RAM. :)
 
You find a disc image here:
http://www.colorado-boys-muenchen.de/users/futureos/files/FutureOS_Utilities.zip (http://www.colorado-boys-muenchen.de/users/futureos/files/FutureOS_Utilities.zip)
 
Title: Re: Memory Check.
Post by: SyX on 22:35, 31 October 11
Thanks Bryce for your nice words :D

It's strange that bug, because my program is founding the internal 64 KBs expansion ram of the 6128+, and then, of course, the 4 banks of your 256 KBs expansion ram. Are you sure that the internal expansion ram is disabled?

With respect at the order how the ram are paged, it's easy:
Code: [Select]
Bank 0 -> $C4 $C5 $C6 $C7 (internal expansion ram in 6128, if it's not disabled)
Bank 1 -> $CC $CD $CE $CF
Bank 2 -> $D4 $D5 $D6 $D7
Bank 3 -> $DC $DD $DE $DF
Bank 4 -> $E4 $E5 $E6 $E7
Bank 5 -> $EC $ED $EE $EF
Bank 6 -> $F4 $F5 $F6 $F7
Bank 7 -> $FC $FD $FE $FF
Are there any emulator that support this memory expansion configuration? WinApe doesn't let me to use 128 KBs + 256 Ram Expansion, only 64 + 256 or 128 + 256 Silicon Disks (Banks 4 - 7).

Sorry for the delay in answer, this afternoon i have been very busy finishing my Halloween costume (HalloGrease  ;D ), i'll review the program tomorrow if i return alive  :P

Go, greased lightnin', you're burnin' up the quarter mile
 Greased lightnin', go greased lightnin'... Pivas allá voy!!! xDDDD
Title: Re: Memory Check.
Post by: TFM on 23:42, 31 October 11
WinApe offers at least banks 4-7 (256 Silicon disc). Also Caprice can be used for 320 KB expansion RAM.
 
Solution: Check 128 KB and check box at 256 KB Silicon disc. Then you have RAM banks 0, 4-7. This makes the 320 KB expansion RAM. I checked that with my tool, WinApe works fine.
 
Cool picture! Have fun tonight :-)))
 
Title: Re: Memory Check.
Post by: Bryce on 00:49, 01 November 11
The memory expansions I used were both 256K DKTronics expansions, so they should always disable the internal upper 64K. It works correctly if the DK is set to banks 4 to 7, but not if banks 0 to 3 are set. So it must be something wrong in the software, because the same expansion can hardly show 256 or 320K just by swapping which bank number it reacts to?

That's one scary costume you've got there. I'll be sleeping with the light on tonight :D

Bryce.
Title: Re: Memory Check.
Post by: steve on 01:44, 01 November 11
Is it possible to design a memory expansion that does not disable the internal additional 64k in a 6128?
Title: Re: Memory Check.
Post by: Bryce on 01:53, 01 November 11
Yeah, that wouldn't be a problem, it would just mean that the expansion had one IC more on the PCB and cost a bit more.
 
 Bryce.
Title: Re: Memory Check.
Post by: SyX on 16:24, 01 November 11
WinApe offers at least banks 4-7 (256 Silicon disc). Also Caprice can be used for 320 KB expansion RAM.
 
Solution: Check 128 KB and check box at 256 KB Silicon disc. Then you have RAM banks 0, 4-7. This makes the 320 KB expansion RAM. I checked that with my tool, WinApe works fine.
Of course, TFM, if you take a look to the picture that i uploaded with the program, i was using that config with the Silicon Disk ;) And with every combination of memory config with WinApe, i get the correct ram size.

The process is (as i said before if you wanna take a look to the sources, only tell ;)):
1.- Mark every expansion page without thinking, ie follow the sequence C4, C5, C6, C7, CC, ... and put a $FF in the first byte.
2.- Initialize counter to 1 and new ram expansion page to $C4.
3.- Paging the new ram expansion page and read the mark byte, is $FF?
4a.- Yes, new ram page detected. Write the counter in the mark byte and in the first position of the array of 32 possible expansion ram pages, increase counter and pass to the next expansion page.
4b.- No,  this page was detected before. Put a 0 in its position in the array of possible expansion ram pages, NOT increase the counter and pass to the next expansion page.
5.- Go 3, while we have expansion pages to test.

Because that, once a page is detected, it's not gonna be detected again.

And that is the X-files with Bryce, it looks that the internal ram is not being disabled and as his DK'Tronics ram expansion is configured to use the banks 0-3... stupid question, could it appears the internal 6128+ ram expansion as the bank 4??? Instead of appearing the mirrors of the DK'Tronics  banks, it was the internal 6128 expansion ram bank.

Cool picture! Have fun tonight :-)))
Thanks TFM, you know well how i need the last night ;)

The memory expansions I used were both 256K DKTronics expansions, so they should always disable the internal upper 64K. It works correctly if the DK is set to banks 4 to 7, but not if banks 0 to 3 are set. So it must be something wrong in the software, because the same expansion can hardly show 256 or 320K just by swapping which bank number it reacts to?
Well, i'm tracing the program now and i hope been able to find the bug ;)

That's one scary costume you've got there. I'll be sleeping with the light on tonight :D
You would have to see the full costume, much more Travolfrighten xDDD Although a great success between witches and vamps... Je ne comprends pas!!! xDDDD
Title: Re: Memory Check.
Post by: TFM on 00:59, 02 November 11
The memory expansions I used were both 256K DKTronics expansions, so they should always disable the internal upper 64K.

No, because the are different (see my last posts). Boiled down:
 
- One 256 KB expansion provides banks 0,1,2 and 3.
- The other 256 KB expansion provides banks 4, 5, 6 and 7.
 
Only the first one disables the internal bank 0 (of 64 KB).
 
Therefore dk'tronics calls one "Silicon disc" and the other one "Memory expansion".
 
Title: Re: Memory Check.
Post by: TFM on 01:01, 02 November 11
Is it possible to design a memory expansion that does not disable the internal additional 64k in a 6128?

Yes, if the expanson provides 448 KB for banks 1-7 (but not for 0). The Dobbertin one could be used that way IIRC.
Title: Re: Memory Check.
Post by: Bryce on 11:01, 02 November 11

No, because the are different (see my last posts). Boiled down:
 
- One 256 KB expansion provides banks 0,1,2 and 3.
- The other 256 KB expansion provides banks 4, 5, 6 and 7.
 
Only the first one disables the internal bank 0 (of 64 KB).
 
Therefore dk'tronics calls one "Silicon disc" and the other one "Memory expansion".

Correct, but SyXs software is only testing external RAM, so it shouldn't make a difference.
At the moment if I connect 256K as banks 0 to 3, I should NOT see RAM in bank 4, which SyXs program is showing me.

Bryce.
Title: Re: Memory Check.
Post by: TFM on 18:28, 02 November 11
Correct, but SyXs software is only testing external RAM, so it shouldn't make a difference.

Software can NOT see the difference between internal or external expansion RAM, because if you use the expansion RAM bank 0 for example, then you always address it by &7FC4,5,6,7.
 
So it does MAKE a difference. And that's the reason for detecting 256 KB in one case and 320 KB in the other case.
 
At the moment if I connect 256K as banks 0 to 3, I should NOT see RAM in bank 4, which SyXs program is showing me.

Right, there is no expansion which will occupy five banks (0,1,2,3 and 4).
 
To re-check what's really connected use my "OS-Infos" program :-)
 
Title: Re: Memory Check.
Post by: Bryce on 21:15, 02 November 11
I will be checking the RAM with your OS-Info later tonight, I'll let you know.

It's not that I think the expansion is occupying five banks, but that his program is detecting 5 Blocks: ie: The internal upper 64K plus the 4 Blocks in the expansion.

Bryce.
Title: Re: Memory Check.
Post by: TFM on 01:13, 03 November 11
Remains a mystery! Good luck!!! :)
Title: Re: Memory Check.
Post by: Bryce on 10:58, 03 November 11
I will be checking the RAM with your OS-Info later tonight, I'll let you know.

A small person started crying shortly after posting this, so the test hasn't been done yet.

Bryce.
Title: Re: Memory Check.
Post by: SyX on 12:09, 03 November 11
It's perfectly understable ;)

The other interesting mystery is your change of country flag :P
Title: Re: Memory Check.
Post by: Bryce on 12:16, 03 November 11
I decided that Pit Cairn was getting a bit boring (you don't meet many new people there :D ), so a spot of North Africa seemed like a good idea :)

Bryce.
Title: Re: Memory Check.
Post by: TFM on 17:07, 03 November 11
I decided that Pit Cairn was getting a bit boring (you don't meet many new people there :D ), so a spot of North Africa seemed like a good idea :)

Bryce.

But Burkina Faso is in West Africa, not in North Africa. BTW: Can I take the Spot in Pitcairn?
Title: Re: Memory Check.
Post by: Bryce on 17:27, 03 November 11
Well it's in North Africa too, depending on whether you divide the continent horizontally or vertically :D Ok, technically (official UN definition) it's west africa, but it is on the border of North Africa.

Yup, the spot in Pit Cairn is all yours :)

Bryce.


Title: Re: Memory Check.
Post by: TFM on 17:30, 03 November 11
Ok, let's put it that way. It's in non-South-Africa. :laugh:
 
Thank's for the other spot, need some time to regenerate :-)
 
Hope Bryce V2 and family are fine :-) Just a day more, and it's weekend. And I _really_ hope that you find some time for you, your family and... the CPC  ;)