Implementing Stack Mechanics (16-Bit VM in JavaScript 004)

preview_player
Показать описание


=[ ℹ 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 exend it to create a sort of fantasy console - an emulator for a machine that never existed

=[ 🔗 Links 🔗 ]=

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

I've been counting the days since the last video, the only channel where I'm actually excited for new content 😁

FallDownTS
Автор

I want to say thank you for this series. This is some high-quality educational content. Last time I was so excited to discover a new channel, was when I found 3blue1brown. You have a talent for explaining complex things simple. Keep going!

siemarell
Автор

This is great. I hate JavaScript and I love low level stuff so I'm going to implement in a different high level language. All that stuff said, this is amazing and I wish there were more stuff on YT like this.

naikrovek
Автор

It just hit me, I finally understand what stack overflow is 😅

MattRose
Автор

I'm writing a simple compiler for the assembly code you are using in your videos, it is not finished yet, but it already recognizes and correctly runs the code with all the instructions we have seen so far !

knevari
Автор

Loving the content. Keep it up. You have become my favorite YT channel.

mladjo
Автор

I'm a little confused about how the subroutine would receive the arguments pushed to the stack?

ashtynmorel-blake
Автор

Best programming channel. You make this things look easy :)

gabrielbucsan
Автор

Loving these videos, I'm using these to create a functional version with immutable.js and ramda, probably the overheads are going to kill it, but will be interesting to be able to time travel through the code execution.

MattyLaws
Автор

how does a subroutine get the arguments passed?

rad
Автор

I was wondering if there was a reason you chose to explicitly keep track of the stack frame size, rather than just pushing/popping the frame pointer when calling/returning from a subroutine? The two approaches seem to yield the same result, but the latter appears simpler. Also, I really appreciate the effort you put into creating these videos. So good!

PeterHinchley
Автор

Hi, just wondering why you don't just push/pop the frame pointer address to the stack instead of bothering with stackFrameSize? Isn't that what x86 does?

clearz
Автор

I feel stupid, I am at around 3 minutes and I do not understand the way you fetch register indices. You call fetch, which returns the byte of whatever the ip is pointing at, and then you modulo with the number of registers, and then you multiply that with 2, and you get the register index?.. I must have missed something, how is the register index derived, is there a relationship between all those things in the formula? (Obviously but I must have missed it)
Cheers

MitchKarajohn
Автор

I think there is a bug in popState

the pop of the stackframesize from the stack didn't decrement this.stackFrameSize,
because it was first decremented but than set to a new value.
it can be fixed simply by decrementing it after this line
const stackFrameSize = this.stackFrameSize;
this.stackFrameSize -= 2;

dankman
Автор

I was wondering if it is possible to create "virtual cores" in a VM like that to be able to compute asynchronously

lucasa
Автор

How do I receive the input values for my subroutine if I save the internal state "after" I pushed the input values?

lateAutumn
Автор

Low Level is the super-core.
Quick question: Are the ones from 0x00 to 0x09 and 0x16 going to be reserved?

beepbeepimasheepbeepbee
Автор

Can't a "malicious" user break the stack if it is in memory? By explicitly reading and writing from/to the last adresses.

aboutdogs
Автор

Intel x86 don't push all on call and don't push stackFrameSize this are programmer depended, as if the programmer don't use PUSHA the register will not be "save on the stack" some for the stackFrameSize and more.

LiranUziel