HackedMeeting Nights

Meeting Nights

-

- Advertisment -

Over the final three months, I’ve developed an uncommon small heart of the evening routine: after
studying bedtime tales to the children, I hop into bed and as a exchange of reaching for
a fiction e book, I’m turning on my 14-year outdated
Asus eeePC 701 little pc pc
and writing x86 assembly language. Here’s turning out to be an insanely honest
employ of my time…​

My faithful asus eeepc 701 waiting romantically on the bed

My faithful eeePC 701 is a 32 bit Celeron “netbook” mini-pc pc from 2007
on the second running Alpine Linux and is considered here bettering my very early
work-in-development NASM port of “JonesForth”. This small pc has trot extra
versions of Linux and BSD than I’m in a position to count! It’s moreover warm on a cool evening.

My hobby within the Zig programming language has pushed me true into a deeper hobby in “methods-diploma” programming and that, sooner or later, appears to lead to pc architecture, instruction sets, and assembly languages.

Studying environment

For reasons I’m in a position to’t show, it honest feels honest to make employ of my small pc with
its small keyboard to fashion small directions gradual at evening. I direct it stands
to reason that being in an absolutely completely different environment from my long-established
desktop fashion machines place me in a receptive studying temper.

- Advertisement -

Also, even though I did set up
Lynx,
here’s now not a colossal machine for neatly-liked Net
browsing (excluding for ratfactor.com, useless to suppose). So it’s a reasonably
distraction-free tool.

Since this small pc is extinct for nothing else, I’ve been slowly
customizing it for this one assignment: after I log in, my .bash_profile script
straight does a cd to my assembly project list.

I possess a bunch of small cryptic one and two-letter scripts and aliases that
initiating my project and connected documentation in Vim, or originate up up the GDB debugger
and trot a GDB script with a breakpoint on the final thing I develop into working on.

These small things secure it so powerful more straightforward to secure going after I’m tired and never
feeling relish expending powerful effort. Now I’m on the level the set grabbing the eeePC,
logging in, and opening the assembly project is automatic, relish brushing my
enamel.

So, what’s this project I’m working on?

Porting JonesForth

- Advertisement -

Straight away after finishing the classes on asmtutor.com (fetch out about NASM below
Sources below), I straight started on one in all the “bucket listing” tasks I’d
shelved many moons within the past: studying and idea Richard WM Jones’s
JONESFORTH.

Nonetheless now not drawl material to merely be taught it, I’ve decided to port it to NASM.

The event has been extremely slow because I’m recent to assembly in traditional
and NASM namely. JonesForth is written in GAS (the GNU Assembler) with a
entirely completely different syntax. Even the machine instruction mnemonics are
completely different because GAS normally involves the dimensions of the details being manipulated as
phase of the mnemonic.

The biggest initial difficulty develop into porting some a will deserve to possess macros from GAS to NASM.
Every body took weeks to note and convert.

Nonetheless it absolutely’s rather awesome and elegant to be working on something non-trivial,
even though it started reach over my head. I’ve wanted to present up on this so many
events, nevertheless I honest retain grinding away at it and the obstacles are slowly giving
reach. Every time I resolve out what a recent instruction does or fix a malicious program, it’s a
small triumph.

- Advertisement -

This part is an exchange:

I “by chance” place a slit abet-off date on the JonesForth port now not too long within the past. I
favor to enact off a bunch of the small tasks I’ve accrued for myself this
year so I’m in a position to extra single-mindedly focal level on a few higher ones going into the
subsequent year. Effectively, as rapidly as I had that slit abet-off date, you realize what took station? I
started looking out for to flow thru blocks of JonesForth assembly, changing them
to NASM as rapid as I’d. Tiresome, honest?

I knew I had to power myself slow down. Nonetheless that’s more straightforward said than performed. A
sense of urgency is without issues obtained, nevertheless now not so without issues misplaced.

My “bathe epiphany” final evening (here’s days after penning this normal
article), develop into pointers on how to head about slowing down. And here it’s miles: I’m going to end
the set I’m at within the translation, fix any syntax errors so the article assembles,
and then stroll thru every single instruction I’ve got as a lot as now and secure particular
all of it works as anticipated. And to secure that extra fulfilling and genuinely possess
something to expose for my efforts after I’m performed, I’m going to log the total
session. I don’t even possess X on this pc, so the evident preference for
logging is GNU Show cloak cloak, the terminal multiplexer.

My first notion develop into, oh colossal, now I possess to be taught one other instrument and secure
entirely sidetracked!

Then my second notion develop into, consume on, that is colossal. Now I’m in a position to sooner or later be taught
one other colossal ubiquitous GNU application effectively and possess one other instrument I’m
confident the utilization of. Plus, I deem Show cloak cloak will be fantastic for every form of
comfort enhancements: I’m on the second the utilization of Linux’s digital terminals
(Alt-F1, Alt-F2, and plenty others.) to possess a Vim session and GDB session every initiating for
easy reference. I possess to retain watch over those manually. With Show cloak cloak, I’m rather certain I
can automate opening every things with a single narrate and then be in a utter to
toggle between them with Show cloak cloak’s Ctrl-a, Ctrl-a.

So I’m on the second studying the total
GNU Show cloak cloak Person’s Manual
and attempting all of it out so I know what my choices are. Then I’m going
to log a colossal outdated GDB session and flip it true into a transcript that can whisk into
the repo as one other artifact on the budge. Now I’m imagining a series of
transient session transcripts in which I discover every recent bit of efficiency. I
deem that is seemingly genuinely clean.

The level is, I selection of misplaced my reach for a second, thinking of the performed
Forth port as the “level” of this direct. It’s now not. The studying course of and
the talents I manufacture are the level. Plus, after the port is carried out, Meeting
Nights are going to flip into Forth Nights. I’ve got Leo Brodie’s Starting
Forth
and Thinking Forth on my nightstand. So this budge will purchase nonetheless
long it takes and this might perhaps well be aesthetic.

Sources

NASM

The NASM assembler comes with documentation within the diagram of a single text file. I possess this file initiating with my assembly provide file so it’s regularly honest a Vim buffer away.
It’s the identical drawl material as this HTML model.

Nonetheless the set to originate up?

My path (which I highly suggest, by the reach) has been to first be taught the
fundamentals of assembly with the elegant “Intel-style” syntax of NASM. For that, I
very highly suggest:

You’ll need a Linux pc (or I direct something digital relish WSL on
Windows) for the explanation that tutorials count on Linux scheme calls.

I did all of the exercises on the eeePC, below the covers, with asmtutor.com
initiating on my phone! It’s honest as prankish because it sounds.

What I relish about asmtutor.com (moreover being precisely what I develop into shopping for
and absolutely free) is that you just raze up protecting a ton of efficiency (from
Hello World to a multi-threaded Net server) in chunk-sized classes. You moreover
end up construct up a utility library of small functions that you just might perhaps employ as a
soar-originate up on completely different tasks.

I obtained a bunch of idea from these classes in a actually natural reach –
thru employ. Every lesson is a handful of explanatory paragraphs and then an
assembly program. I regularly tweak and adjust examples to secure particular I note
them, so my utility functions began to diverge from the originals rather
early on.

Anyway, the utilization of push, pop, call, and ret over and over in these exercises
did extra for concretizing these necessary ideas than years of theory and
programming in high-diploma languages. Wow, I kept thinking, I should possess taken
the assembly dive years within the past!

(In fact, I be taught a DOS-based x86 assembly e book and enjoyed writing DOS assembly
packages the utilization of nothing nevertheless debug waaaay abet in my early life, nevertheless that develop into sooner than
I’d genuinely performed a total lot of programming. So the journey hit and stuck
in but another diagram this time round.)

GDB

GDB is an mammoth and intimidating piece of tool (practically an running
scheme), so I went forward and purchased the bodily paper e book
Debugging with GDB: The GNU Provide-Degree Debugger
narrate from GNU Press/FSF.
I be taught the e book on weekends from the comfort of a sofa and bookmarked things
to strive after I got on the eeePC that evening.

x86 Meeting Language

There’s an excellent overview with a listing of traditional directions written by
Adam Ferrari. I now not too long within the past came upon that it exists in “Intel-style” on the
University of Virginia:

and in GAS/AT&T syntax at Yale:

…​Nonetheless I genuinely imagine the e book is going to stick so seriously better now that
I’ve already realized some of this the laborious reach. Which perfectly fits my
pet theory about studying:
The Phenomena of the Recreation Manual.

Join the pack! Join 8000+ others registered customers, and secure chat, secure groups, post updates and secure pals round the field!
www.knowasiak.com/register

- Advertisement -

1 Comment

  1. That's somewhat similar to what I'm doing with Miniforth [0]. Programming in a minimal environment is fun. I don't have a separate machine, so I'm booting my main laptop from a thumbdrive. The difference in boot time is staggering – after BIOS loads the boot sector, everything else is instant. This is instrumental to my strategy for tricking myself into working on the project – normally, I'm very prone to going off into a research rabbit hole after taking a look at the wrong browser tab. So, instead, I make sure to power off my machine in the evenings. That way, booting into miniforth becomes the option with less friction (:

    Unfortunately, this does not work for writing the blog about the project. Hopefully this will change soon, once I write an editor and filesystem…

    [0]: https://niedzejkob.p4.team/bootstrap/

You might also likeRELATED
Recommended to you

Hydrogen Is Now not a Gas, It’s a Cult

The sales pitch for hydrogen is heating up, although not as much as the Hindenburg did in 1937. In the UK, there are even advertisements for the fuel on the London Underground, which is quite an odd thing to see next to posters about the latest iPhone and vitamin supplements. It’s not like the average…

Apple to Apple Comparison: M1 Max vs. Intel

This will be a story about many things: about computers, about their (memory)...

Show HN: Appwrite 0.12 – Open Source alternative to Google’s Firebase

We’re excited to share that Appwrite 0.12 is now officially available! The new Appwrite version includes our biggest ever performance improvements, enhanced developer experience, and many new features designed to make developers’ lives easier. Trust us, this one’s a biggie! In addition, the latest release includes over 1,500 commits and contributions from 29 new contributors…

Welcome to Waifu Labs v2: How Do AIs Create?

If you haven't already had a chance to try out the new Waifulabs v2 Model, check it out now! In the two years since we first launched our our anime portraits AI project, Waifu Labs, our inhuman artist has been hard at work. Recently, it finished drawing its 20-millionth commission (quite an achievement for any…
- Advertisement -

Billionaire Chamath Palihapitiya: ‘nobody cares’ about China’s Uyghur genocide

WASHINGTON – Billionaire investor Chamath Palihapitiya triggered a backlash on social media after saying during a recent episode of his podcast that "nobody cares" about the ongoing human rights abuses against the Uyghurs in China.During a 90-minute episode, Palihapitiya told co-host Jason Calacanis on their "All-In" podcast that he would be lying if he said that…

Show HN: Declarative Instrumentation for Python

Pyccolo is a library for declarative instrumentation in Python; i.e., it lets you specify the what of the instrumentation you wish to perform, and takes care of the how for you. It aims to be ergonomic, composable, and portable, by providing an intuitive interface, making it easy to layer multiple levels of instrumentation, and allowing…

Must read

Cryptocurrency scams charge homeowners $7.7B in 2021, driven by DeFi-based mostly “rug pulls”

This blog is a preview of our 2022 Crypto Crime Report. Sign up here to reserve your copy and we’ll email you the full report when it comes out in February! Scams were once again the largest form of cryptocurrency-based crime by transaction volume, with over $7.7 billion worth of cryptocurrency taken from victims worldwide.…

Show HN: Python decorator that enables arbitrarily-deep tail/non-tail recursion

Fiber implements an proof-of-concept Python decorator that rewrites a function so that it can be paused and resumed (by moving stack variables to a heap frame and adding if statements to simulate jumps/gotos to specific lines of code). Then, using a trampoline function that simulates the call stack on the heap, we can call functions…
- Advertisement -