Software engineering #3- Progression
Ho dear! Oh dear! I shall be too late!,
Ho dear, I’m 3 days late.
Short version:
-
I spent time in the wla-dx (the assembler) doc to find how the make modular code. And this doc is, well, let’s says it’s lacking some informations. For instance I know there are namespaces, but first the syntax use in the doc doesn’t compile, and second, they are no information about how to access a global value from a namespace. So no namespace. Instead each module has a struct with it’s variables as fields. This struct is implemented once, with the name
my_module_
. With this method, the variables can be accessed withmy_module_.my_var
. For the label, the modules use child label, which are kinda like sublabels. The only issue here is that defines and struct names are not separated by modules. -
Then I refactored, again, the pong game to find a good way to cut the code into small and modular files.
-
Now, the
module.var.s
contains the definition of the structs and the defines of the module. -
The variables are declared in the main file, by implementing the main struct of the module (
my_module_
) in the enum. -
During the initialization, the
.init.s
files are included. They contain the code of the module that need to be executed only one time. -
During the VBlanck interruption, the files
display.s
andbody.s
are called. The other codes that need to be executed on each iteration are included inbody.s
. This is because the VBlank time when we can edit the screen is short, so we need to use it before doing a lot of computation. -
Then we include, at the end of the file, the
.lib.s
files, which contains code that is not run directly, like function or sprites.
After defining the structure of the code, I made a canvas for the ŧesting
branch.
Next steep was defining the global variables (Thomas did the structs, I declared the variables). I haded .stub
files to test the code. .stub
are undocumented ugly code, hopefully short, that do stuff like moving the character, or displaying it. Stubs are inefficient and not modular. The main goal for now is to replace them with proper modules.
Virgile and Pascal quickly made a pull request with a display module. Now we can see Isaac on the screen, and a stub allow the buttons to update the isaac variable so we can move it.
Last update on testing
yesterday: now Isaac plays animations when moving, and the buttons’ stub is replaced by the module check_inputs
. And other stub was added to check if the direction variable is correctly update (yes, that’s why there is a half head in the middle of the nowhere ), and if the flags are correctly updated when A or B is pressed.
That’s it for now, see you late hour
JM