The Mythical Mac 256K!

Snial

Well-known member
This MacGUI blog post covers the boot process for the early System Software on a Mac 512K (or Mac 128K). In part of it, he talks about the Mythical 256KB Mac:

At the beginning of the boot blocks are several stored parameters. The version number is two bytes. Another two bytes hold flags for the secondary sound and video pages. Then come a series of seven, 16-byte long file names. These are the names of the System resource file, Finder (or shell), debugger, disassembler, startup screen, initial application to run, and clipboard.

Following the names is a value for how many open files there may be at once, and the event queue size. Then come three, 4-byte values which are system heap size for a Mac with 128K of RAM, 256K, and 512K of RAM, respectively. If you could find me a Mac with 256K of RAM, I'd sure be impressed.
Wink

<snip>
If you landed from planet Krypton with a Mac 256K, your system heap size would be $8000 (decimal 32,768).
Disappointingly, as he also covers in this blog post, the 64K ROM only checks for the 128K or 512K Mac models

Code:
FindMemSize:
4002DE:                  LEA     $0007FFFC,A0      ; 512K RAM
4002E4:                  LEA     $0001FFFC,A1      ; 128K RAM
4002EA:                  CLR.L   (A0)+
4002EC:                  TST.L   (A1)+
4002EE:                  BNE.S   *+$02             ; branch if 512K
4002F0:                  MOVE.L  A1,A0         ; this is a 128K machine
4002F2:                  MOVE.L  A0,$0108      ; set MemTop

But, I am interested in the Mythical Mac 256K and I was wondering how easy it is to create one using the miniVMac emulator. It turns out it is indeed possible!

Here's the proof:

MPScreen02.pngMPScreen01.png


On a Mac 128K, this 19kB MacWrite 1.0 document of scintillating prose takes up 87% of the remaining RAM (13% free) - it's pretty much the largest document you can write without 'Disk-based' MacWrite. On a Mac 512kB it takes up 5%, leaving 95% free (because 19kB/512kB = 3.7%), but on a Mac 256kB it takes up 23% with 77% free.

Amazing! So, how was it done? It wasn't really that hard. First I had to change a bit of the 64K ROM so that if the Mac didn't have 128kB, it defaulted to 256kB. This involved changing byte 0x2e1 to 0x3 (instead of 0x7 as per the "LEA $0007FFFC,A0 ; 512K RAM" above); then I had to change the ROM checksum so that it would match, which involved changing byte 3 to 0x4c. (The Checksum merely involves adding up all the (32-bit zero-extended) 16-bit words in the ROM and then XORING it with the 32-bit value at the beginning of the ROM at 0x400000).

So, a real Mac 256kB with this ROM will pass the checksum. However it won't run on miniVMac, because it modifies the ROM and then changes the standard ROM checksum to match what it would be. So, I had to modify miniVMac a bit too.

The setup needs to properly support 256kB and I had to change setup/SPBLDOPT.i. I think it already supported a 256K message option.:

Code:
enum {
    gbk_msz_128K,
    gbk_msz_256K,
//...etc

But it didn't really process the message properly, so I had to add a bit to:

Code:
LOCALFUNC char * GetMemSizName(int i)
{
    char *s;

    switch (i) {
        case gbk_msz_128K:
            s = "128K";
            break;
        case gbk_msz_256K:
            s = "256K";
            break;

to support 256kB as a memory size; and then similarly a bit later:

Code:
LOCALFUNC tMyErr ChooseMemBankSizes(void)
{
    tMyErr err;
    RAMa_Size = 0;
    RAMb_Size = 0;

    switch (cur_mdl) {
        case gbk_mdl_Twig43:
        case gbk_mdl_Twiggy:
        case gbk_mdl_128K:
        case gbk_mdl_512Ke:
            if (cur_msz == gbk_msz_128K) {
                RAMa_Size = ln2_msz_128K;
            } else
            if (cur_msz == gbk_msz_256K) {
                RAMa_Size = ln2_msz_256K;
            } else

To support 256K. Then I hacked 2 files in the main source code, because I couldn't be bothered to figure out the options for disabling RAM or ROM checking properly. In CONTROLM.h:

Code:
LOCALFUNC tMacErr ROM_IsValid(void)
{
#if 0 //CheckRomCheckSum

and in ROMEMDEV.c I forced DisableRomCheck:

Code:
GLOBALFUNC blnr ROM_Init(void)
{
#if 1 // DisableRomCheck

With these changes I was able to setup miniVMac:

./setup_t -t larm -m 128K -mem 256K > setup128K256K.sh
sh ./setup128K256K.sh
make

Then boot up from a 410kB disk containing System 1.1 and MacWrite 1.0 with that document:
./minivmac Blank2.img
 

Attachments

  • MiniVMac256KChanges.zip
    290.2 KB · Views: 3

Snial

Well-known member
It probably seems pretty odd that someone would want to create a 256kB Mac when many GB of RAM are the order of the day and every Mac after the original one had at least twice as much RAM as that. But I do have a reason, which I might explore in a future post. In the meantime though I just wanted to add a bit about why, most likely, the Mac 256kB never existed.

For people well versed in early 80's hardware it's pretty obvious. The underlying reason is that the 68000 had a 16-bit data bus and the RAM chips (DRAM chips in 1984) were only 1-bit wide. Therefore, to create 16-bit wide memory you needed 16 DRAM chips. In 1984, the most common chips were 64kbit DRAMs, so the first Mac had 16 x 1-bit x 64kBit = 1MBit of RAM = 128kB of RAM.

Also, the design of the chips meant that the address bus was multiplexed: address lines A0..A7 were also used for A8..A15 and the interpretation was set by another couple of pins: /RAS (Row Address Select for A8..A15) and /CAS (Column Address Select). So, this meant that when chip density was improved, adding another address line would effectively add two: A0..A7,A8 for /CAS and then A9..A16,A17 for /RAS. A Macintosh using those chips would then have 512kB instead of 128kB (16 x 1-bit x 256kBit = 4MBit of RAM = 256kB of RAM).

Which is indeed why the first upgrade for a Mac 128K was to boost it to 512K. In fact these chips could simply replace the previous set of chips if a solder bridge was also made on the motherboard. There was an article in Personal Computer World (UK) at the time which explained how to do it for the brave Mac DIYer!

Now, it turns out that 1-bit x 256kBit RAM chips weren't the only choices available in the mid to late 1980s, there was also a 4-bit x 64kBit RAM chip. With these chips Apple could have made a Mac 256K, but it would have required a Motherboard redesign; whereas the upgrade to 512K didn't. Hence, no Mac 256K.

UNTIL NOW :) !

But what will you do with all that RAM?
The sky's the limit mate ;-) ! I can MacWrite 1.0 a document about 148k long for a start!
 

tcole

Well-known member
Love seeing this, mostly becuase I worked with both Randy and Ed for quite a few years somewhat recently.
 

Jockelill

Well-known member
It probably seems pretty odd that someone would want to create a 256kB Mac when many GB of RAM are the order of the day and every Mac after the original one had at least twice as much RAM as that. But I do have a reason, which I might explore in a future post. In the meantime though I just wanted to add a bit about why, most likely, the Mac 256kB never existed.

For people well versed in early 80's hardware it's pretty obvious. The underlying reason is that the 68000 had a 16-bit data bus and the RAM chips (DRAM chips in 1984) were only 1-bit wide. Therefore, to create 16-bit wide memory you needed 16 DRAM chips. In 1984, the most common chips were 64kbit DRAMs, so the first Mac had 16 x 1-bit x 64kBit = 1MBit of RAM = 128kB of RAM.

Also, the design of the chips meant that the address bus was multiplexed: address lines A0..A7 were also used for A8..A15 and the interpretation was set by another couple of pins: /RAS (Row Address Select for A8..A15) and /CAS (Column Address Select). So, this meant that when chip density was improved, adding another address line would effectively add two: A0..A7,A8 for /CAS and then A9..A16,A17 for /RAS. A Macintosh using those chips would then have 512kB instead of 128kB (16 x 1-bit x 256kBit = 4MBit of RAM = 256kB of RAM).

Which is indeed why the first upgrade for a Mac 128K was to boost it to 512K. In fact these chips could simply replace the previous set of chips if a solder bridge was also made on the motherboard. There was an article in Personal Computer World (UK) at the time which explained how to do it for the brave Mac DIYer!

Now, it turns out that 1-bit x 256kBit RAM chips weren't the only choices available in the mid to late 1980s, there was also a 4-bit x 64kBit RAM chip. With these chips Apple could have made a Mac 256K, but it would have required a Motherboard redesign; whereas the upgrade to 512K didn't. Hence, no Mac 256K.

UNTIL NOW :) !


The sky's the limit mate ;-) ! I can MacWrite 1.0 a document about 148k long for a start!
Awesome writeup! Now you "just" need to recreate that redesigned logic board :D
 

rieSha.

Well-known member
This MacGUI blog post covers the boot process for the early System Software on a Mac 512K (or Mac 128K). In part of it, he talks about the Mythical 256KB Mac:
[…]

So, a real Mac 256kB with this ROM will pass the checksum. However it won't run on miniVMac, because it modifies the ROM and then changes the standard ROM checksum to match what it would be. So, I had to modify miniVMac a bit too.
[…]

To support 256K. Then I hacked 2 files in the main source code, because I couldn't be bothered to figure out the options for disabling RAM or ROM checking properly. […]

A Mac 256k could come in handy again with the new Raspberry Pi Pico 2 with its 520 KB RAM – not enough for a 512k Mac with emulation code next to it, but more than enough for a 256 KB Mac! (Maybe it could do a 512 KB Mac still, with some light RAM compression through lz4 or similar)
 

Snial

Well-known member
A Mac 256k could come in handy again with the new Raspberry Pi Pico 2 with its 520 KB RAM – not enough for a 512k Mac with emulation code next to it, but more than enough for a 256 KB Mac! (Maybe it could do a 512 KB Mac still, with some light RAM compression through lz4 or similar)
I'm working on an emulator called M0Bius, written in 100% Cortex M0+ (or M33) assembler, which will indeed fit entirely within the 16kB XIP cache. So, yes, a 512kB Mac is possible with a Pico 2 and a 256kB Mac is possible with an original Pico.
 

Snial

Well-known member
Returning to this old question:
@Arbee
I can do that even faster in MAME (and emulate a 256K Mac, if I understood why you'd want to)
Can you actually demonstrate how you managed (or could manage) to do this? My original attempt with miniVMac wasn't correct.
 

olePigeon

Well-known member
Was the Macintosh used at the premiere a 512K fat Mac? Or was it a 256K Mac? Because it only need a little bit more to do the demo.
 

Snial

Well-known member
Was the Macintosh used at the premiere a 512K fat Mac? Or was it a 256K Mac? Because it only need a little bit more to do the demo.
It was a 512kB Mac.


256kBit DRAM chips started to appear in late 1983 (by Japanese companies, not TI, which had a large market for the 64kBit chips).


"While samples are being circulated among possible customers, shipments of the 256K RAM chips in significant volume are not expected to begin until 1985"

At the time of the demo in January 1984, there were about 2 or 3 512kB Macs. I explained why it jumped from 128kB to 512kB earlier in this thread, but basically it's because DRAM halved the number address pins, sending one half at a time (with "/RAS" and "/CAS" signals to differentiate). So, when they added a new address pin, it resulted in 4x the amount of address space for the chip. Hence, DRAM chips jumped from 4kb to 16kb to 64kb to 256kb to 1Mb etc.

The Mac used 1-bit data bus DRAM chips, so it needed 16 x 64kb chips to achieve 128kB of RAM (16x64k/8). The next step up was therefore 16x 256kb chips to give 512kB.

However, they could have designed it differently to make increments of 64kB possible. This is because some DRAM chips (e.g. the ones used in the 8-bit Acorn Electron from early 1983) used 64kbit, 4-bit wide DRAMs (16k nybbles). So, 4 give 32kB x 8-bits; 8 give 64kB x 16-bits and 16 give two banks of 64kB x 16-bits = 128kB. They would still have needed 16 chips for 128kB, but would only have needed 8 x 256kbit 4-bit wide DRAMs for 256kB.
 

Snial

Well-known member
OK, wow! I've finally managed to boot up the mythical 256kB Mac. Take a look at this program, running my FreeMem application:

1731876862607.png

Instead of reporting 75kB, it reports 188kB, which is 113kB larger, but that's due to the system heap being bigger for the 256kB Mac. I then took the previous 19kB MacWrite file and opened it under MacWrite 1.0, which then reported:

1731877049303.png

86% memory free is different to 23% available on a 128kB Mac and the 95% available on a 512kB Mac. We have a mythical 256kB Mac!

This is how I did it. This time I'm doing the testing on pce-mac-plus. I built a standard version, which would normally run a Mac Plus ROM. However, you can substitute a 64KB Mac ROM and set some configuration lines to tell it that it's got 256kB of RAM.

Code:
system {
    # The Macintosh model to emulate. Valid models are:
    # mac-plus:    A Macintosh 128K, 512K, 512Ke or Plus
    # mac-se:      A Macintosh SE or SE-FDHD
    # mac-classic: A Macintosh Classic
    model = "mac-plus"

    # Enable or disable the startup memory test.
    memtest = 1
}
later
Code:
# Multiple "ram" sections may be present.
ram {
    # The base address
    address = 0

    # The memory block size
    size = 256K

    # The memory block is initialized with this value.
    default = 0x00
}


# Multiple "rom" sections may be present.
rom {
    # The file from which the rom code is loaded
    #file = "mac-plus.rom"
    file = "Mac-128K.ROM"

    # The base address
    address = 0x400000

    # The rom size
    size = (system.model == "mac-classic") ? 512K : 256K

    # The memory block is initialized with this value.
    default = 0xff
}

I also got it to accept a couple of mfs disks.

Code:
disk {
    drive    = 1
    type     = "auto"
    file = "Blank2.img"
    optional = 1
}

disk {
    drive    = 2
    type     = "auto"
    file = "mfs400Kb.dsk"
    optional = 1
}

There's System1.1 on Blank2.img and my memory test app on mfs400Kb.dsk.

One of the nicer things about Pce-Mac is that you can do a lot of nice debugging stuff. You can read and write memory (including ROM) and disassemble memory. So, all I did for my first 256kB Mac is run: ./pce-macplus -c pce-mac-plus.cfg . Then at its command line:

Code:
mem rw
e 3 c8
e 2e1 1

To modify the ROM. What this does is change the memory testing, to say that it's always going to be a 128kB Mac (which you might not expect, eh?). Then what happens is that it will initially ROM boot up mostly with a black screen and a flashing [?] disk icon. Then it'll load the boot sector. The boot sector contains this strange code at address $1008A:


0001008A 2238 0108 MOVE.L $0108, D1
0001008E 4841 SWAP D1
00010090 0C41 0004 CMPI.W #$0004, D1
00010094 6E2C BGT.S $000100C2
00010096 7200 MOVEQ #$00000000, D1
00010098 50F9 0001 FFF0 ST $0001FFF0
0001009E 42B9 0003 FFF0 CLR.L $0003FFF0
000100A4 4AB9 0001 FFF0 TST.L $0001FFF0

000100AA 6716 BEQ.S $000100C2
000100AC 7002 MOVEQ #$00000002, D0

000100AE 4840 SWAP D0
000100B0 D1B8 0108 ADD.L D0, $0108
000100B4 D1B8 0824 ADD.L D0, $0824
000100B8 D1B8 0266 ADD.L D0, $0266
000100BC D1B8 010C ADD.L D0, $010C

000100C0 7204 MOVEQ #$00000004, D1

Initially it checks for a 512kB Mac at $10090 and if it isn't falls through to the clever, but weird section at $10098 to $100A4. This code sets the top of RAM for a 128KB Mac to -1, then explicitly clears the top of RAM for a 256KB Mac and if the address at the top of a 128kB Mac has become 0, then it knows that the address range from $20000 to $3FFFF mirrored $00000 to $1FFFF and therefore it's a 128KB Mac. It will then execute the BEQ skipping the code in red. And the code in red adds $20000 to all the key system variables, starting with MemTop, which had been set to the 128KB version's allocation, and adding 128KB makes them a 256kB Mac values.

So, finally I've triumphed! I'll post an updated ROM, but if I can it'll be a ROM that works for 128kB, 256kB and 512kB if I can somehow squeeze it into the same instruction space.

What it looks like is this: Apple originally wanted to be able to support a 128KB, 256KB and 512KB Mac, or at least for development purposes some of the engineers wanted to be able to bolt on another 128KB just for a bit of space. That made sense in 1983, because 256kBit RAM chips didn't yet exist and a 512kB Mac would need 64 RAM chips; whereas a 256kB Mac would only need 32.

However, either they made a mistake in the ROM, which they tried, but failed to correct in the disk Boot block, which prevented them from doing that, or some developers had a special ROM which worked like my mod, defaulting to 256kB. Or... here's another possibility: they used the normal ROM and had some kind of toggle switch to enable the upper 128kB of RAM. The Mac would be allowed to boot and while it was waiting for a disk to be inserted, they toggled the RAM enable, which could have simply been an OR gate ( A17 OR Toggle )=> RAM256kB_CS.

But part of the upshot is that a PICO Mac based on the new PICO2350 should be able to support 256kB now!
 

Snial

Well-known member
OK, I said yesterday that I'd try and modify the 64KB Mac ROM to work correctly for 128kB, 256kB and 512kB. At the time, I had merely hacked the ROM so that it would work specifically for the Mythical Mac 256K. The challenge for any more versatile ROM is that I've got to create a test that works for a 128kB, 256kB and 512kB Mac, but then pretends a 256kB Mac is a 128kB Mac and do that in the same number of bytes as the original, already pretty compact code!

The original ROM code looked like this (addresses reflect the original ROM address before it's remapped to 4MB):


000002DE 41F9 0007 FFFC LEA $0007FFFC, A0
000002E4 43F9 0001 FFFC LEA $0001FFFC, A1
000002EA 4298 CLR.L (A0)+
000002EC 4A99 TST.L (A1)+
000002EE 6602 BNE.S $000002F2
000002F0 2049 MOVEA.L A1, A0

000002F2 21C8 0108 MOVE.L A0, $0108
000002F6 90FC 0300 SUBA.W #$0300, A0
000002FA 21C8 0266 MOVE.L A0, $0266
000002FE 90FC 5600 SUBA.W #$5600, A0
00000302 21C8 010C MOVE.L A0, $010C
00000306 42B8 0110 CLR.L $0110
0000030A 21FC 00EF E1FE 01D4 MOVE.L #$00EFE1FE, $01D4
00000312 21FC 00DF E1FF 01E0 MOVE.L #$00DFE1FF, $01E0
0000031A 41FA 0DA8 LEA $000010C4(PC), A0
0000031E 43F8 08F4 LEA $08F4, A1
00000322 7202 MOVEQ #$00000002, D1


It's quite a nifty test. It sets up A0 and A1 to point to the last long words of the 128kB RAM and 512kB RAM. Clears the end of the 512kB and tests it against the end of the 128kB; while advancing A0 and A1 to contain the actual sizes of the respective RAMs. The long word at the end of 128kB will only get changed for a 128kB model, because the RAM memory map get repeated every 128kB on that model, so changing the end of 512kB also changes the end of 128kB; while that doesn't happen on a true 512kB, because the bytes are genuinely different.

So, then, if they're different (the 512kB case), you just use the address in A0, which = 512kB now; whereas if they were the same, you copy the 128kB memory size now in A1 to A0.

This doesn't work for the Mac 256kB, because the Ram isn't duplicated on 128kB boundaries, but on 256kB boundaries; so when the long word at the end of 512kB gets changed, the long word at the end of 128kB doesn't get changed: so normally the ROM would think it's a 512kB Mac in that case. But if we changed the address to 256kB, then we'd return a memory size of 256kB. That means we need to check the 256kB address and return 128kB!

But the code is already very tight, how do we do it?

000002DE 7204 MOVEQ #$00000004, D1
000002E0 4841 SWAP D1
000002E2 2241 MOVEA.L D1, A1
000002E4 D281 ADD.L D1, D1
000002E6 2041 MOVEA.L D1, A0
000002E8 42A0 CLR.L -(A0)
000002EA 4AA1 TST.L -(A1)
000002EC 6602 BNE.S $000002F0
000002EE E489 LSR.L #$2, D1
000002F0 2041 MOVEA.L D1, A0


The answer is to save bytes on the LEA instructions. It's possible in some cases to generate large values in data registers by using the sequence MOVEQ, then SWAP. It takes just 2 words instead of 3 and because 128kB, 256kB and 512kB all have 0s in the bottom 16-bits, we can use this technique (the boot block uses this technique to test for 256kB too!). However, we need a data register to do this and I can't be sure it won't corrupt a useful data register value unless the execution path later overwrites a data register.

Fortunately, it does. At 0x322, there's a MOVEQ #2,d1. So, now we know we can use D1. The trick then is to set up both A1 and A0 to point to 256kB and 512kB respectively. This sequence is 1 word shorter than the original. Then, instead of clearing and testing the last words and post-incrementing to get the sizes; we pre-decrement from the sizes to get to the last words of RAM and test them. This will return the same result for both 128kB and 256kB Macs, but a different result for the 512kB Mac.

We don't need A0 and A1 now, because the actual size (for a 512kB Mac) is already in D1 so we can use our word of ROM space saved to move D1 to A0. And for the 256kB or 128kB cases, we can take the 512kB value; divide by 4 (by shifting right twice) to get 128kB, which is also a 1 word instruction substituting the MOVEA A1,A0 in the original code.

So here we have it! If you're able to use the PCE-Mac emulator... or somehow con miniVMac into thinking it has 256kB (@mihai - is this possible?), then it can be added to Infinite Mac, with the new ROM!
 

Attachments

  • MythMacD.rom.zip
    45.7 KB · Views: 1

David Cook

Well-known member
000002DE 7204 MOVEQ #$00000004, D1 ; D1=$4 000002E0 4841 SWAP D1 ; D1=$40000 aka 256K 000002E2 2241 MOVEA.L D1, A1 ; A1=$40000 aka 256K 000002E4 D281 ADD.L D1, D1 ; D1=$80000 aka 512K 000002E6 2041 MOVEA.L D1, A0 ; A0=$80000 aka 512K 000002E8 42A0 CLR.L -(A0) ; write zero to $7FFFC. Last four bytes of 512K 000002EA 4AA1 TST.L -(A1) ; check for zero at $3FFFC. Last four bytes of 256K and 128K 000002EC 6602 BNE.S $000002F0 ; Not zero. Therefore, this is a Mac 512K. D1 is $80000 000002EE E489 LSR.L #$2, D1 ; Divide D1 by 4. D1=$20000 aka 128K. If this is a 256K Mac, then disk boot code will adjust, not the ROM 000002F0 2041 MOVEA.L D1, A0 ; Either 512K or 128K at this point

Nice code! Amazing that you could fit that in perfectly to the existing space.

Question: What happens if the last four bytes of 256K or 128K memory is already zero? Won't the original and revised checks fail?
 

Snial

Well-known member
000002DE 7204 MOVEQ #$00000004, D1 ; D1=$4 000002E0 4841 SWAP D1 ; D1=$40000 aka 256K 000002E2 2241 MOVEA.L D1, A1 ; A1=$40000 aka 256K 000002E4 D281 ADD.L D1, D1 ; D1=$80000 aka 512K 000002E6 2041 MOVEA.L D1, A0 ; A0=$80000 aka 512K 000002E8 42A0 CLR.L -(A0) ; write zero to $7FFFC. Last four bytes of 512K 000002EA 4AA1 TST.L -(A1) ; check for zero at $3FFFC. Last four bytes of 256K and 128K 000002EC 6602 BNE.S $000002F0 ; Not zero. Therefore, this is a Mac 512K. D1 is $80000 000002EE E489 LSR.L #$2, D1 ; Divide D1 by 4. D1=$20000 aka 128K. If this is a 256K Mac, then disk boot code will adjust, not the ROM 000002F0 2041 MOVEA.L D1, A0 ; Either 512K or 128K at this point

Nice code! Amazing that you could fit that in perfectly to the existing space.
Thanks, I used to have a ZX81 ;) !

The back story: I've been embarrassed about my failure to really boot a Mac 256K for about a year. I thought someone would notice from the MacWrite screenshot that I hadn't achieved anything! I couldn't really debug my error on miniVMac: no step debugger. and MAME always seems a bit heavyweight to me. So I left it for a while, but the PICO Mac project referenced it so I thought I'd take it up again, but using pce-mac.

Going back to the Mac Gui description of the boot blocks I realised that it performed its own hack to check for actual 256kB RAM, recongfiguring a 128kB Mac setup as a 256K one. But I only worked this out because every time I tried to get the ROM to default to a 256kB Mac, MemTop etc kept saying it was a 384kB Mac. I managed to fudge the existing 64K ROM code to basically pick 128K by default even though it had 256kB, and then later in the evening I tried a ROM hack that could correctly pick all 3, but it didn't work.

It might sound a bit dumb, but to an extent I find that it's often possible to squeeze more functionality out of limited code space than I ever thought possible. Have you ever read the Righto.com blog post about the Sinclair Scientific Calculator? It's probably some kind of Shannon Law thing where you can trade off effort or efficiency for other priorities, in this case space. Instruction sets have information 'holes' in them, which can be exploited. Now I'm rambling, but the upshot is that overnight I just started to try and imagine how the code might look if I could do it properly: assume space can be squeezed out and then work out the other bits until you discover how.
Question: What happens if the last four bytes of 256K or 128K memory is already zero? Won't the original and revised checks fail?
I've thought about that too. I assume that memory has already been filled with non-zero bytes. This seems plausible given the screen starts off black.

Nifty stuff! Well done
Thank you too!
 
Top