Ram Expansion

249 views
Skip to first unread message

Neil Andretti

unread,
Oct 16, 2021, 8:16:14 AM10/16/21
to PAL 6502 computer
Thank you Liu for setting up the group.

Is there a chance to mod the Ram expansion card to work in the upper 32kb? (a000-ffff)... I do own two cards and, just for being able to, maybe want to use the 2nd card to have the full memory space available.
I have exactly _no_ knowledge on 74xx and on how to rewire the board.

Thanks
Nils Andreas (netzherpes on twitter)

GN L

unread,
Oct 16, 2021, 8:30:25 AM10/16/21
to PAL 6502 computer
Hello Nils,
I know it's you~  The group is HJM(twitter)'s idea!

The RAM expansion card can be modified to work in the upper area(A000-FFFF), but there are only about 24KB space there.

I'm working on the new version of ROM card now, after that, I will draw a modification schematic for the full RAM solution and reply here for your reference.

Hans Otten

unread,
Oct 16, 2021, 11:00:50 AM10/16/21
to PAL 6502 computer
The memory map of the KIM-1 is not ideal for 64K RAM. First 8K is taken by low RAM and I/O and KIM-1 ROM's. FFFF etc is mapped to 1FFF verstors.
Using the 74LS145 outputs pin Q5,Q6, Q7 instead of Q1, Q2,  Q3, Q4 will give ate least 16K extra, total 48K from $2000. That is what my ancient KIM-1 was given by me in 1980 with 2114 RAM IC's (and lots of power and bus drivers and money!).

Hendrik-Jan Megens

unread,
Oct 17, 2021, 8:30:20 AM10/17/21
to PAL 6502 computer
Hi Liu and others, great to find all of you here! I hope this will grow as a forum to share experiences and ideas, and for posting questions, troubleshooting etc. In any case easier to share information than over Twitter!

Cheers,
Hendrik-Jan

Neil Andretti

unread,
Oct 18, 2021, 8:41:56 AM10/18/21
to PAL 6502 computer
Thank you Hans, thank you Liu,
If it's that easy, I'll give it a try next weekend. \o/
Nils

GN L

unread,
Oct 21, 2021, 12:51:24 AM10/21/21
to Neil Andretti, PAL 6502 computer
Hi Niel and all,

I just modified a 32K RAM card for the upper RAM area. Just need to cut 1 wire and solder 2 jumper wires like below:

IMG_0386.jpg
IMG_0389.jpg

The KIM ROM needs the highest area of 64K for the vectors, so the Exxx to FFFF cannot be decoded with the second 32K RAM card.
We can use $A000~$DFFF (16K) more RAM with the second RAM card installed.

I attached some pictures of the two RAM card system running.

RAM test: 
IMG_0391.jpg

system photo:
IMG_0390.jpg

Now, the PAL-1 can fitted with HUGE program~~~

--
You received this message because you are subscribed to the Google Groups "PAL 6502 computer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pal6502+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pal6502/3c4744f7-7f89-44bf-a721-d1c1cdf7abfdn%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Best regards,
Liu GN

GN L

unread,
Oct 21, 2021, 1:03:29 AM10/21/21
to PAL 6502 computer
SORRY, it's Nils, not Niel...  :b

Neil Andretti

unread,
Oct 21, 2021, 7:57:50 AM10/21/21
to PAL 6502 computer
Now thats easy ;)
My plans for the weekend: I need to rewire the microkim ram expansion to fit on the motherboard first and afterwards mod the PAL-1 RAM Card.
I keep you updated

Neil Andretti

unread,
Oct 21, 2021, 4:19:21 PM10/21/21
to PAL 6502 computer
DID IT.
IMG_5142.jpg

One thing noticed: The MS Basic Memory test fails. It produces just a lot of y's
Can you confirm this? I can set the memory by hand, but it won't go up to 40kb.

IMG_5143.jpg


The Butterfield Mem Test works like a charme.
butterfield_memtest.png

Now we need larger Programs ;)
Thank you Liu,

regards, Nils

Jim McClanahan

unread,
Oct 21, 2021, 7:41:09 PM10/21/21
to PAL 6502 computer
My guess on the BASIC memory test behavior is that the test is able to march up through at least a part of the I/O space mirrored to $D7xx.

If not that, you might be wrapping past $FFFF and doing the memory test starting back down at $0000 and hitting the I/O space at $1700. (I seem to remember that there is no test for the high byte of the test address wrapping from $FF to $00. It was considered 'bad form' for you not to hit either dead space with nothing or a ROM as you tested up.)

The fact that the KIM monitor seems to have the previously set address when you reset (and is ready to jump right back into BASIC) would seem to indicate the sliver of RAM above the I/O space isn't being corrupted by the memory test marching through it.

Thanks,
Jim W4JBM

Jim McClanahan

unread,
Oct 22, 2021, 9:21:43 AM10/22/21
to PAL 6502 computer
A correction to my earlier post, the I/O mirrors to $F7xx, not $D7xx.

You could also use a modified ROM card if you are happy with an additional 16K. I used a 62256 RAM chip when I first lashed up my ROM circuit on a protoboard. (I couldn't find my stash of 27C256s so I used the RAM chip instead while I order some more.) It has pretty much the same pinout as the 28C256. The only difference is that /WE is off the 6502 bus instead of an EPROM programmer. Since I don't use the cassette interface I also looked at using one of the lines that is assigned to it and available on the expansion bus to control A14 to allow me to have two 16K banks I could switch between, but I never got that fully working like I wanted. (My original thought was more around being able to fully address and reprogram a 28C256 without having to change any jumpers related to addressing. Eventually, simplicity won out over elegance.)

This actually was pretty handy for testing some of the ROM code without having to erase and reburn EPROMs. But once the code was finished, the instant availability the EPROM offers was really, really nice.

Thanks,
Jim W4JBM



GN L

unread,
Oct 23, 2021, 12:58:09 PM10/23/21
to PAL 6502 computer
Nils, 
I tried it, and I can confirm the same result as yours.

When I hit enter at MEMORY SIZE? for BASIC auto, it output all "y" with two dots.
reset the PAL-1, then input 49000 at MEMORY SIZE? can got 32550 bytes free information.

Need more dig in KIMKB9, but I think binary program will run normally with this new RAM configuration.

Hans Otten

unread,
Oct 24, 2021, 10:19:48 AM10/24/21
to PAL 6502 computer
Basic does a simple memory test to determine memory size. (On my first KIM-1 with my own 2114 SRAM  based RAM modules this helped me to find bad RAM).

The memory test of KB9 is writing to memory a patttern, starting after the last part of the KB9 program loaded ($4262 if no sin/cos/atn), reading it back, shift it left and read and write back
The test stops when reading back fails. So this routine  writes $92 and then $24 to the last available upper RAM location + 1! Note the +1 !!!!!! 
If that location has I/O  or zeropage  the result will be disaster (this explains the YYYYY printed!). 
 
This is the part of the Microsoft Basic from pagetable in init.s 

.ifdef CONFIG_2
        lda     #$55 ; 01010101 / 10101010
.else
        lda     #$92 ; 10010010 / 00100100
.endif
        sta     (LINNUM),y
        cmp     (LINNUM),y
        bne     L40FA
        asl     a
        sta     (LINNUM),y
        cmp     (LINNUM),y
.ifdef CONFIG_CBM_ALL
        beq     L40D7
.else
  .ifndef CONFIG_11
        beq     L40D7; old: faster
        bne     L40FA
  .else
        bne     L40FA; new: slower
        beq     L40D7
  .endif

On the KIM-1 this results in memory filled with $24 (=$92 asl a)

When you have ram to $E000  (32K + 16 K)  there will be 40894 BYTES FREE

Now with the PAL-1 32K RAM module the lower 8K and upper 8K of memory are overlapping  (pin Q7  and pin Q0 of the 74LS145 are connected to DEN, vectors NMI RESET IRQ of thh KIM-1 ROM at 1XXX  also appear at Fxxx ).
Memory expansion is therefore limited to max $E000 if you do not break that connection and have the vectors served by another ROM or a circuit that only maps FFFE and above to 1FFE (see the Junior articles for that).

With 48K RAM you must enter memory size therefore. 49000 is too much!

See the Appendix A of the KIM-1 User manual about expanding the system.

GN L

unread,
Oct 25, 2021, 8:50:15 PM10/25/21
to Neil Andretti, PAL 6502 computer
Aha, you find the way to use all available memory in KB9! 
Now KB9 report 41184 bytes free without SIN-COS-TAN-ATN support~

It feels vintage of the MEMORY SIZE? input that needs humans to calculate the real memory ;)

Liu

On Sun, Oct 24, 2021 at 5:13 PM Neil Andretti <master...@googlemail.com> wrote:
Ok, so I supose I did everything right ;)
I still wonder how KB9 calculates free RAM.
With the 32KB expansion,  it says 24510 Bytes free.  (23kb - Basic binary is around 8KB, 32-8=24, seems legit)
Adding the 16KB extra would result in 40 KB free in BASIC.

basic_start.png

When Basic asks me "MEMORY SIZE?" and I enter 32768 manually (32KB) It only shows 16318 Bytes free, 8K less than it should be.
Strange, but this implies, that you should not give the free byte block from $2000 on, but the last free byte adress.
In other words, when adding the 32KB Memory expansion, this makes the KIM-1  a "40 K system".

tl;dr
For the 48 kB Setup the correct number to enter is 57344.

Have a nice weekend,
Nils

GN L

unread,
Oct 25, 2021, 11:13:56 PM10/25/21
to Neil Andretti, PAL 6502 computer
Hi, 

I just tried this:

MEMORY SIZE? 59999
TERMINAL WIDTH?
WANT SIN-COS-TAN-ATN? Y

 43549 BYTES FREE

MOS TECH 6502 BASIC V1.1
COPYRIGHT 1977 BY MICROSOFT CO.


OK

GN L

unread,
Oct 25, 2021, 11:33:24 PM10/25/21
to PAL 6502 computer
I'm now confused about how did the BASIC check the actually available memory...

Hans Otten

unread,
Oct 26, 2021, 4:41:29 AM10/26/21
to PAL 6502 computer
When you enter the memory size you set the upper limit for the ram test. Look at the code on pagetable, I only copied a fragment.
After the test all is initialized, so basic runs.

It is not possible to to go beyond E000 since then the test  will overwrite zeropage and the rest of ram in 0000-1400. And at 11401 it ends.
So it looks like the memory test succeeded. And Basic will run until your program grows big. Then zeropage and stack and RAM to 1400 will be overwritten.

Max RAM memory is 48K from $2000 to $DFFF
First 8K is RAM from 0000 to $13FF (5K max) and I/O 1700, 1740 and ROM to 1FFF
Last 8K is identical to first 8K due to K0 to K7 connection. 

Basic uses $2000 to $DFFF for the program itself (just over 8K) and free memory until $E000, that is 40K max.
Value depends on SIN/COS wanted no. 41184  or  yes 40894 BYTES FREE

With 48K RAM enter memory size therefore not above these values!

Neil Andretti

unread,
Oct 26, 2021, 3:03:52 PM10/26/21
to PAL 6502 computer
So 56 x 1024 = 57344 is the correct answer to 'MEMORY SIZE?' for the 48K expansions.
👍
Nils

Hans Otten

unread,
Oct 26, 2021, 4:20:20 PM10/26/21
to PAL 6502 computer

max ram is 48k in an expanded KIM-1 from $2000 to $DFFF. MS-Basic takes 8k, that leaves 40k for basic workspace. 

GN L

unread,
Oct 27, 2021, 9:53:27 AM10/27/21
to Hans Otten, PAL 6502 computer
Thanks Hans! Now I'm more clear with this!

Best,
Liu

-- 
You received this message because you are subscribed to the Google Groups "PAL 6502 computer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pal6502+u...@googlegroups.com.

Adolfo Fernandez

unread,
Dec 23, 2023, 6:07:14 AM12/23/23
to PAL 6502 computer
Hi!
This is an old thread but I wonder if there is any game or program that can only be used using these two ram expansion boards because is not possible to load it on a simple expansion board due to lack of memory

GN Liu

unread,
Dec 25, 2023, 4:53:01 AM12/25/23
to PAL 6502 computer
As far as I know the old programs or games are relatively small, so the RAM after expanded will be huge for them.

or you can try this with ROM exp.  https://groups.google.com/g/pal6502/c/jCmIpyySWOY

Adolfo Fernandez

unread,
Dec 26, 2023, 4:42:42 PM12/26/23
to PAL 6502 computer
Thanks, Liu. As you said, an impressive job. Yes, I imagine the text adventures were some of the largest programs of the time. By the way, I've discovered recently this (not new) article where the author explains how he ported the Infocom interpreter from the Apple II to run on an Apple 1 using the CFFA (Compact Flash) adapter. http://randomvariations.com/2014/11/02/infocom-games-on-an-apple-1/ It would be possible to port the Infocom interpreter to run on the PAL-1?

GN Liu

unread,
Jan 1, 2024, 8:10:20 PMJan 1
to PAL 6502 computer
The game seems amazing but I'm also learning and playing with the KIM-1/PAL-1 system, I think your question needs to be answered by someone senior in the 6502 world.

Best,
Liu

Hans Otten

unread,
Jan 2, 2024, 6:22:04 AMJan 2
to PAL 6502 computer
The Infocom adapter for the Apple II disassembly is here : GitHub - brouhaha/a2zip: Infocom ZIP, EZIP, XZIP interpreters for Apple II, partially reverse-engineered

The Apple 1 adaptation is here,  Infocom Games on an Apple 1 | Random Variations
But essential information is missing, no source of the adaptation, only the patch binary is available. Which makes it useless as is.

Porting to a KIM-1 would require:
- source of the Apple 1 adaptation (one could ask the author or disassemble the 768 bytes binary) and understanding the Apple I CFFA mass storage 
- change of memory layout (Apple interpreter starts at $0800 and uses RAM upwards . For a KIM-1 this needs to be $2000.
- enough RAM, I guess 32K RAM from $2000 but could be more, say 40K
- finding a mass storage solution for the KIM-1 (and resolve any zero page problems with the mass storage and  the interpreter). One less primitive than the 1541 one for example.

Adolfo Fernandez

unread,
Jan 2, 2024, 6:52:43 AMJan 2
to Hans Otten, PAL 6502 computer
Thanks for the info, Hans! This kind of porting is far beyond my knowledge but it would be an interesting challenge for someone with the expertise. Playing Infocom games would be a nice addition to the KIM (PAL)-1 capabilities.

You received this message because you are subscribed to a topic in the Google Groups "PAL 6502 computer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pal6502/b8ZweOLZzNk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pal6502+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pal6502/63d5a210-f9b4-41a9-b0f8-92cc2d74f55bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages