Expanding Beyond 64kb of Memory with Bank Switching (16-Bit VM in JavaScript 012)

preview_player
Показать описание
In this episode we're learning about memory bank switching - a technique common in the retro game console days - that allows us to address more memory than the limited address space that 16 bits provides!

=[ ℹ About ℹ ]=

This series is all about building a powerful virtual machine in JavaScript with the following features:

- A flexible, extensible, register-based virtual machine
- Support for signed, unsigned and floating point operations
- A call stack
- Interrupt capabilities
- Ability to do memory mapping for IO
- An assembly language with macro and module support
- A higher level, C like language. We'll use and expand the library from the parser combinators from scratch series
- And finally, to be able to take the whole thing into the browser and extend it to create a sort of fantasy console - an emulator for a machine that never existed

=[ 🔗 Links 🔗 ]=

Рекомендации по теме
Комментарии
Автор

MP/M was a multi user version of CP/M that ran bank switched on Z-80. User space was 48KB, the kernel, BIOS, and BDOS ran in the lower 16KB, unswitched.

The system ran one 48KB bank for the control console, and one 48KB bank for each user.

I only ever saw four user versions, in the computer lab at school. Six systems total, running on an S100 chassis, Z-80 H running at 8Mhz.
Each had five ADM-3A terminals in a row on a long desk.
The main system storage was a eight inch hard drive, I cannot remember the capacity.
User storage was an eight inch dual sided, single density floppy drive, so 360KB per floppy.

Oh my! The web is weird and wonderful. Apparently it could scale to eight users.

dougfraser
Автор

Thanks for your amazing series, I have learnt a lot from them, and I have tried following along at home. You do an amazing job of explaining things thoroughly and clearly, I really like it.
A couple of things I would really like to see is a c compiler to actually be writing in an extensive programming language, though I do know this would probably be a very big task to make. And another thing I would really like to see is a way to add pheriphals like networking mouse and keyboard and a screen whith pixels instead of the text based output. And when you once in the future are done with this series some theory about other cpu architectures and multi core systems and memory sharing. This is just a couple of things I have been wondering about and would love to see and be explained in some of your videos.
Love your content.

filipbp
Автор

This video helped me understand memory banking and I was able to implement MBC1 for my gameboy emulator.

sussus
Автор

Great vid. At 0:43 it should say kB, though, kb with a lowercase b stands for kilobit.

Mad
Автор

What color scheme do you use bud??

Really amazing series btw!

iyappansriram
Автор

is the vm gonna get a low-level and/or high-level language before we make more devices for it? (ie. screens, keyboard, mouse)

ceorecdeclec
Автор

Here Is an Idea for how the rom format could be (very simple, allows specifying any devices the rom could have "built-in")

# ROM
`1B VERID`

## VERID: 0x00

### [Start]
`Instruction`:*

### Instruction
`1B IID`
`*B IData`


### IID: 0x00 /Copy Data/
`2B DataSize`

`2B DataAddr`

`(DataSize)B Data`

Copies `Data` to address `DataAddr`. Runs 8-bits simultaneously, and increments addr.

```typescript
type u16 = number;

const DataSize: u16 = 5;
const DataAddr: u16 = 5;
const Data: Uint8Array = new Uint8Array(DataSize);

for(let i=0; i < DataSize; i++) {
MM.setUint8(DataSize+i, Data[i]);
}

```

### IID: 0x01 /Define Device/
`2B DataAddr`

`2B DataSize`

`1b Mapped`

`7b PathLen`

`(PathLen)B Path`

Creates a new device found in `Path` (Relative) and assigns it the approprate range `DataAddr` - `DataAddr + DataSize`




# Spec
`:*` Suffix means 0 or more
`:+` Suffix means 1 or more

ceorecdeclec