28 weeks later...

After deciding on the syntax for a Hello World example and then having that converted to assembly. I hit my first brick wall, and I hit it hard!

Trying to internally keep the structure for the Hello World source code wasn't that hard. But then turning that into assembly while maintaining said structure done me in big time!

I'm what like a week into this (not been working every day on it) but yesterday burnt me out.

My advice to those looking to do this, start super simple, nice easy procedural language and build up from there. Don't do what I've done and start off with this "super" complex OOP style lang unless you have two brains and plenty of caffeine or something stronger ;-)


When you hit this point, walk away for a bit or you'll just fall deeper in.

I find on most projects I'm a 3 month sprint guy when it comes to burnout. You get 1000% out of me for 3 months then I enter

The Burnout Zone

and I become a grumpy snail dev unless I can jump onto something else.

I'm sure we've all faced it. Your on top of the world then you hit that crash and burnout phase begins.

For me I'm having the day off from it. I learnt a stupid amount over the last few days and welcomed my best friend segfaulty back into my life for a few days on and off. C people, why say a command allocates memory when it clearly doesn't?

Anyways, C is fun and I love the old school stuff. Like I've stressed before, doing this in higher level lang would be far far less time consuming but the challenge was set to be C and I'm sticking with it, for now, and THAT's THAT!

Show me some source code already!

I'll open the repo up for the project when I feel it's at a point that isn't just me cursing in the commit logs. But here's what I've managed to get to compile so far.


HelloWorld {
    print "Hello World!";
    FlatEarth {
        print "The Earth Is Flat, and That's That!";
        InnerEarth {
            print "Hello From Inner Earth!";
        }
        InnerEarth();
    }
    FlatEarth();
}

Which once compiled I get the following assembly. Assembly devs, I've forgotten most of it and I'm relearning what I can. I've picked 64bit (tho I may go with 32bit for older machines) and I know there are better ways of writing that source... probably... answers on a postcode please.


global _start

STDOUT equ 1 ; standard output
SYS_write equ 1 ; call code for write

section .data
  iCfebKHvianDBJz db "Hello World!", 0X0A, 0X0D
  iCfebKHvianDBJzlen equ $-iCfebKHvianDBJz

  znjwcxpKyrkHruE db "The Earth Is Flat, and That's That!", 0X0A, 0X0D
  znjwcxpKyrkHruElen equ $-znjwcxpKyrkHruE

  bFupGKyvKGCvkfw db "Hello From Inner Earth!", 0X0A, 0X0D
  bFupGKyvKGCvkfwlen equ $-bFupGKyvKGCvkfw


section .text
HelloWorld:
  mov rax, 1
  mov rdi, 1
  mov rsi, iCfebKHvianDBJz
  mov rdx, iCfebKHvianDBJzlen
  syscall

  call FlatEarth
  ret

FlatEarth:
  mov rax, 1
  mov rdi, 1
  mov rsi, znjwcxpKyrkHruE
  mov rdx, znjwcxpKyrkHruElen
  syscall

  call InnerEarth
  ret

InnerEarth:
  mov rax, 1
  mov rdi, 1
  mov rsi, bFupGKyvKGCvkfw
  mov rdx, bFupGKyvKGCvkfwlen
  syscall

  ret

_start:
  call HelloWorld
  syscall
  ;exit
  mov rax, 60
  mov rdi, 0
  syscall

For now I know I can compile something and get it running so I'm happy... in The Burnout Zone... but happy :-D

Images