We already have a question about default I/O for general code-golf submissions. However, entries in machine code have different built-in I/O capabilities from entries in high-level languages. Should they be allowed by default to input/output differently?
In this question, consider a machine code function to be a program that includes a ret
urn or similar command. (Classifying machine code entries into programs vs. functions is a separate issue; if you disagree, respond in comments.)
The current consensus is that functions and full programs may do I/O using the same methods, but just in case that changes, I'm making a distinction. Some options for input and output (to be considered separately):
- Through any port
- Through a specified port
- In any register
- In a specified register (e.g. the accumulator)
- Using cdecl/stdcall conventions (thanks, @feersum)
I was inspired to ask this question by my answer to the Truth Machine catalog, which uses the single data bus on a Motorola MC14500 microcontroller as I/O. The OP ruled that valid, but we should have defaults for the future.