diff --git a/src/interrupts.s b/src/interrupts.s index 699c33c..c271652 100644 --- a/src/interrupts.s +++ b/src/interrupts.s @@ -70,6 +70,12 @@ cop_handler_native: ; right handler for the particular function being called, without ; modifying anything but the X register. + ; Note that if a COP function takes a single 8/16-bit argument, it will be + ; in A; if it takes two 8/16-bit arguments, they will be in A and Y. + ; If the function takes more arguments, then the arguments will be packed + ; into a structure, with the bank of the structure in A, and the + ; address in that bank of the structure in Y. + ; Now, we do an indirect, indexed jump through the jump table. jmp (.kbank(cop_jump_table),x) @@ -86,14 +92,10 @@ cop_exit: ; ----------------------------------------------------------------------------- - .extern version_major, version_minor, version_micro + .extern version_number cop_get_version: - lda long:version_micro - tay - lda long:version_minor - tax - lda long:version_major + lda long:version_number cop_rti ; ----------------------------------------------------------------------------- diff --git a/src/main.c b/src/main.c index 6c7687f..2809012 100644 --- a/src/main.c +++ b/src/main.c @@ -11,9 +11,19 @@ #include "interrupts.h" #include "drivers/vera.h" -const uint16_t version_major = 0; -const uint16_t version_minor = 1; -const uint16_t version_micro = 1; +// This structure essentially divides a uint16_t into four +// fields, each of which holds a version number. +struct version_number_s { + const uint8_t version_micro: 8; + const uint8_t version_minor: 4; + const uint8_t version_major: 4; +}; + +struct version_number_s version_number = { + .version_major = 0, + .version_minor = 0, + .version_micro = 1, +}; void main(void)