Just for clarification, on the Spectrum Next the hardware only has the eight MMU registers which indicate what ram page is present in each 8k slot of the cpu's 64 space. The bottom two MMU pages (the first 16K) are special in that if the page selected is the out-of-range FF, then ROM appears there as on the original spectrum machines. Classic spectrum banking via ports 7FFD (128K) and 1FFD (+3 only) are implemented on top of the MMU registers. So for example, an OUT to port 7FFD will actually change the top 16K and the bottom 16K mapping (made FF) by writing into the affected (four) MMU registers in hardware. You do also have to think about how your programs are started on the spectrum next. If they are tap files or a basic program then they are started by the spectrum rom just like on the original models. In this case your program loads into the normal ROM / BANK 5 / BANK 2 / BANK 0 memory configuration that is present on the 128K when user programs run. Any extra parts for extra memory banks will have to be loaded separately by your program just like it was done on the 128K. If they are NEX programs, which is a format specific to the Spectrum Next, then your program is also loaded into the starting configuration but the NEX loader will also load up other memory banks for you, the contents of which are in the NEX file. Other types are DOT and SNX with the former meant for programs cooperating with basic and the latter a bit obsolete next to the NEX but suitable for toolchains that only know how to generate snapshots for 128K software. So if you are writing software that is meant to use the bottom 16K as ram you have the additional step to figure out how to start your program from the initial load which places your first executed code in 5/2/0. It's not difficult but there are some technical steps to worry about. Writing in C with Z88DK you are in exactly the same situation as in ASM, ie banking is all up to you; the compiler is not going to do it for you. But the Z88DK toolchain is aware of banking and will easily & automatically generate bankswitched binaries for you for NEX and DOT type programs. It separates the compile into two parts -- the "main binary" and stuff that goes into banks. If you don't take steps, code and data is going into the main binary which is the stuff loaded into banks 5, 2, 0. From assembler you specify what banks or memory pages things go into with the SECTION directive. For the C code, you tell the compiler to change where it places code/rodata/data/bss to specific banks instead of the main binary. As you can see the C compiler has four main targets for stuff it generates which corresponds to romable code, intiialized data in ram and intially zero data in ram. The necessity for this is clear if you think a bit about what happens when you create a program destined to be stored in ROM. Only read-only code can go there; you can't store variables there. So the compiler must be able to output these areas separately so that stuff that can be in rom is in rom and stuff that cannot is mapped to ram and properly initialized. When you're banking, like you pointed out, you have to worry about where your interrupts are going, where your stack is and where your common code is. If you bank in some new code and it uses the library function "strlen", well, strlen better still be visible after the bank is changed. You normally have a section of memory that is common that never gets banked out to hold these sorts of routines. Z88DK has a default memory map that makes the most common good choices automatically but if you depart from that, you might find it necessary to make your own memory map to replace the default. I think for almost all cases the default will do.
Just getting into the 8 bit homebrew hobby. Watching these videos is a great way to learn hw these systems work. Hopefully I'll engineer one of my own one day
Just an FYI. On the ZX81, the screen didn't blank when typing as the SLOW keyword was introduced and the computer ran in that mode by default - it was the ZX80 that blanked the screen when typing. You could place the ZX81 In FAST mode, where it would basically work like a ZX80 in these terms and the screen would blank unless the screen was being addressed - great for computational programming where results were more important than looking at the screen 👍 In answer to your question, I primarily watch the videos to learn new things or refresh my knowledge. This is with a view to return to programming, be that BASIC or Machine Code. Having a detailed understanding of how the architecture works is invaluable to the programming endeavour and I found it is essential to understand the hardware when I used to program in the 80s and 90s.
I used to have a special modified spectrum 48/80k version in the 80's. All we did was remove the bad 32k chips and placed good 64k chips and added a flipflop with an address/out selection circuit so we could already use bank switching before the 128k was out in the Netherlands. It was fun to use your own "hidden" programma's at that time. To bad it got completely cooked due to a Lightning strike in 1986 😢
As a builder of homebrew 6502 rigs, It's always helpful to see how the other camp did things. 64K is plenty enough for most purposes but with clever bank switching, it's possible to do some awesome stuff, like stuffing a powerful dedicated graphics processor right on the side of a bog-standard 64k map. or using a modern SBC to act as a bridge to the big wide world or colossal storage capacity. and it's relatively easy to do IF the hardware allows for flexible use of the memory map. (like using an EEPROM or even SRAM for the addressing logic, so it can be re-jiggered on the fly without having to physically change anything) There's so many cool things a humble 8-bit CPU is capable of if you've got the imagination to use it,
Hey there! Just wanted to drop a line that these videos are great. I don't have any experience with the Speccy's as I'm in the US, but I find it fascinating. :D
I don’t have any nostalgia for the home computers of the 80s but I like your videos for general crossover with 8 and 16 bit retro game console programming. 👍
ZX81 screen blanking only in fast mode, the ZX80 however screen blanked on key presses always. the '81 used an isr to drive the screen, the '80 did drove the screen with waiting for keypress.
My spectrum was 80K of ram. Enabling the "faulty" upper half of the 64Kram chips. Sinclair bought those chips because 32 k was nor working. Never had any faults switching the upper 32K from low ti high.
Thanks for the explanation! I had a Superfo 128 Rev 3H that would run 48K ROM but not 128K and would fail video and bank tests of RAM in the 128 tests. Your video helped me figure out which part of the schematic was doing the bank switching. The HC138 at U4 decoded the port and the HC174 at U50 latched the banking lines and more. Diode D3 was in backwards. DOH! Swapped it around and the computer worked properly.
My hobby is to find new pokes for infinity lives etc. in new ZX Spectrum from itch and other places. And understand the loader for 128k games in part of that process.
Well I accomplished this (bank switching) about 35yrs ago on my self-build Z80 system and yes, it was simple. I used an LS373 latch to select one of a bank of 62128 static ram chips. I kept the CE low on every chip as that halves the response time of the chip. The bank required was selected by an I/O write to the LS373.
So when you show the banking diagrams in 7:30 - the bank 2 and 5 are permanently in two slots (0400 and 0800), but you can select them also to be in the same slot at 0C00? Seems odd how they didn't use contiguous memory but used bank 5 and 2 for the two permanent allocations. I guess it came down to selecting certain chips with the chip select line on the hardware on the original Spectrum? The other 8-bit machine that people had at the time had an interesting approach to bank switching in that you could swap out pretty much everything liberating the machine giving you access to nearly all the memory. The successor to the machine uses various tricks to access this memory including DMA and various banking approaches using the Z register. I'm writing a game for the TI-99/4a at the moment and the memory map is such that the only way you can get extra memory into the machine is through the cartridge port (8K) but to bank this out, you need to run the banking code outside of the cartridge (to switch the code bank) and the only memory you have (without a ram expansion) is in the 256 bytes of chip ram. They certainly made that machine easy to work with!
why not use Z180 in the PLLC pakage that support 1MB of RAM and is Z80 backward cmpatible? It;s allow to use old ZX software and write new one more advanced
"I know you can describe any logic circuit using FPGA, but is the reverse true? Can you describe every FPGA circuit using real hardware?" Yes, you can. Doing such was how computers were built before microprocessors were invented. Rather than having the logic gates in the FPGA and selecting and connecting them with software, you can take logic gates made from 7400 series ICs and wire them up into the desired logic circuit. Such computers formed the third generation of computers. An example of a computer that was built in this way was the Data General Eclipse, as related in the classic book Soul Of A New Machine by Tracy Kidder. en.m.wikipedia.org/wiki/7400-series_integrated_circuits Alternatively you can just take discrete transistors, resistors, diodes etc, and build logic gates from them, wiring them all into the desired logic circuit. Such computers formed the second generation of computers, taking over from the first generation of computers, which used vacuum tubes to create logic circuits with. An example of such a computer is the IBM System/360. en.m.wikipedia.org/wiki/Transistor%E2%80%93transistor_logic The disadvantages of using such kinds of larger components for creating logic circuits are size (obviously), power usage, and (lack of) speed.