Celius wrote:
I'm sorry, the explanation of the "Int" leaves me still confused. What do you mean by "the calling subroutine"?
Subroutine A calls subroutine B by doing 'jsr B'. In this case, subroutine A is the calling subroutine, and subroutine B is the called subroutine.
Celius wrote:
I just don't see why "Int" needs to be there. That's short for integer, right?
Subroutines may pass a value back to the caller. On many CPUs, this is done by leaving it in the CPU's counterpart to the A register, hence the 'lda #0' in the translation. In the C programming language, the main subroutine is specified to return an integer.
Bregalad wrote:
And why would a reset code return something ? Since nobody ever calls the rest code (aka main procedure).
I'll try to explain what kyuusaku was talking about: At a higher level than subroutines calling subroutines, programs call programs. These programs return a value of zero for success or nonzero for failure. For instance, 'make' the dependency manager calls 'gcc' the compiler frontend, and 'gcc' calls 'cpp' the preprocessor, 'cc1' the compiler proper, 'as' the assembler, and 'ld' the linker. The only way that 'make' can know whether or not there was an error in one of the source code files that make up a project is the number that 'gcc' returns. (MS-DOS batch files called this number the ERRORLEVEL.)