logoalt Hacker News

thatxlinertoday at 3:25 AM1 replyview on HN

My first question would be where should I start reading? It seems like you modularized it into multiple assembly files (how does that even work?)


Replies

imtomttoday at 3:36 AM

Honestly, read the main file, ymawky.S first. Then I'd read through get.S maybe, checking parse.S on an as-needed basis for parsing-related functions. delete.S or options.S are pretty short, too, so give those a read too.

Modularizing it into multiple files was easier than I expected it to be, you basically have other functions/labels in other files, and mark them as .global at the top. The Makefile compiles each file into their own .o, which you then link all together. You can "b" or "bl" to any label from any other file, as long as it's global and linked together. Same with data in .bss or .data, mark them as .global and they can be accessed from elsewhere.