Layout Programs in My Assembler - Superscalar 8-Bit CPU #24

Поділитися
Вставка
  • Опубліковано 27 чер 2024
  • The assembler for my 8 bit CPU can already read a program in human-readable assembly instructions and parse it into an internal data structure. In this video we make our assembler compute the exact addresses of every instruction, and print the entire program together with its address layout to the terminal.
    This video series explores the concepts and techniques that make modern computer processors so incredibly fast and powerful. I build my very own 8-bit processor from individual logic gates and gradually evolve it to become a superscalar out-of-order machine. Along the way, we take a deep dive into contemporary computer architecture in a hands-on fashion and rediscover some of the foundations of modern computing.
    Previous Video: • Parse Instructions int...
    Series Playlist: • Build a Superscalar CPU
    Assembler Playlist: • Assembler from Scratch
    GitHub Repository: github.com/fabianschuiki/supe...
    - Assembly Language: en.wikipedia.org/wiki/Assembl...
    00:00 - Intro
    01:10 - Printer Class
    02:39 - LDI Instruction
    04:14 - Operands
    05:38 - MV Instruction
    05:52 - JABSR Instruction
    06:06 - JRELI Instruction
    06:24 - Better Offset Immediates
    07:09 - Better Operand Alignment
    07:43 - JRELR Instruction
    07:57 - HALT Instruction
    08:07 - ORG Directive
    08:34 - Better Address Immediates
    09:32 - Instruction Addresses
    12:33 - Laying Out Instructions
    17:15 - Better Error Reporting
    20:05 - Outro
    #assembly #coding #tutorial
    #homebrew #8bit #breadboard #superscalar #computer
  • Наука та технологія

КОМЕНТАРІ • 19

  • @RogerBarraud
    @RogerBarraud Рік тому +4

    Another Fab-ulously clear and engaging video - keep it up please! 🙂

  • @Nunya58294
    @Nunya58294 11 місяців тому +1

    I decided to take on making my own Chip-8 emulator/VM in C so this stuff really helps me learn! Accept im applying this knowledge to the C world. Thank you for sharing this good sir

  • @sarmadgulzar
    @sarmadgulzar Рік тому +4

    This is such beautiful and elegant Python code!

    • @fabianschuiki
      @fabianschuiki  Рік тому +1

      Thanks! 🙂 Trying to keep it compact and streamlined such that it's somewhat easier to explain.

  • @LaSchui
    @LaSchui Рік тому +1

    another masterpiece. period.

  • @jqaxyz
    @jqaxyz Рік тому +2

    Just caught up with the series! Super interesting, keep up the amazing work.

  • @tmbarral664
    @tmbarral664 Рік тому +1

    Quick thought: I'd rather put the org address check in the assembler. You may not want to display the disasm each time you assemble your code. And this is where it would make more sense.
    For the org, I would have like to display the line w/o the address (as its a directive).
    Thx very much for those videos. Very entertaining.

    • @fabianschuiki
      @fabianschuiki  Рік тому +1

      Yes you're totally right! 🙂 The check is currently in the `Layouter`, which runs independently from the printer. So you'll get this error even if you decide to not print the assembly back to the terminal at all.
      Good point about the directive. Could just skip the address prefix there. I wonder if this works for all directives, or if some actually want an address to be printed 🤔

    • @jqaxyz
      @jqaxyz Рік тому +1

      @@fabianschuiki I agree that the .org directive seems like it shouldn't have an address. My non-expert intuition is that any individual address should appear only once, and only instructions that actually will be stored in memory should have addresses prefixed. Maybe a directive like .zero could be prefixed since it is taking up space in memory, but I think it could also be skipped without too much confusion. Great video, looking forward to the next one!

  • @BerndSchymanski
    @BerndSchymanski Рік тому +3

    Hmm, lets see if my implementation of how i wired the eprom chip will work in the future. I ommitted wirering the A0 pin to the program counter and started with A1. So each step of the program counter jumps two bytes ahead. Made it easier to know where i was in the program.

    • @fabianschuiki
      @fabianschuiki  Рік тому +3

      Yeah that definitely works, especially if you plan on keeping all your instructions 2 bytes long, or a multiple of 2 bytes! 🙂 You could even cook up schemes where you always fetch 2 bytes, but then define compressed instructions that are 1 byte, and you'd stuff them into the 2 bytes that you fetch. You could probably get your instruction decoder to decode the two 1 byte instructions separately 😀

  • @SivakD
    @SivakD Рік тому +3

    Interesting stuff. I've been building a 6502 assembler in Python myself. I didn't write anything to print the output though (the program counter and instructions).

    • @fabianschuiki
      @fabianschuiki  Рік тому +1

      Cool that sounds very interesting! Do you have the code available somewhere? 🙂

    • @SivakD
      @SivakD Рік тому +2

      @@fabianschuiki I'm still working on it, so it's not available at this time. It has been an interesting project though. It definitely gives one a greater appreciation for the bigger languages that are out there and the work needed to parse all those.

  • @thepinback
    @thepinback Рік тому +3

    Nice! Can you provide a github link for the source code?

    • @fabianschuiki
      @fabianschuiki  Рік тому +3

      Coming up! I have one or two additions to make, then I'll push this to GitHub 👍