I love how thin the layer above assembly is: without knowing B, is my interpretation correct that this function effectively “inherits” the stack of the calling function? In other words, rather than passing function arguments and let the compiler deal with it, you’re supposed to push the string you want to lcase onto the top of the stack?
Reminds me a lot of writing my own compiler/assembler in university, where it’s expected that all this happens automatically nowadays.
Hmm, don’t think so. The function does not operate on a string, it seems to read a character using read() and write it back, transformed, using write(). Given that the function is named main, it’s probably the top level function anyway (from the programmer’s point of view, often the OS actually calls into a different function that is part of the language runtime, e.g. _start, which in turn calls main eventually, but that is usually hidden from the programmer).
Reminds me a lot of writing my own compiler/assembler in university, where it’s expected that all this happens automatically nowadays.