cokedasm is dasm with certain CokeOS- and Libcoke-specific additions. It can:
The standard dasm command line options are supported and are described in the dasm documentation. Here are the new options:
-r | generate a relocatable module. (It is recommended that
the output file ("-o" option) end with the suffix ".rel".)
The format of a reloctable module is:
|
-cpath | generate ".c" and ".h" files with wrapper functions for the modules in the file. path is where the ".c" file should go; if path is unspecified, the ".c" file is put in the current directory. |
-hpath | specifies where to put the ".h" file, if the -c option is given. If the -h option is not given, the ".h" file is put in the current directory. |
-nfile.h | generate a c header file that "#define"s symbols that begin with the following: COKE_, ID_, CMD_, ERROR_, MESSAGE_, and EGFX_. |
reldasm button
The script will first assemble coke.inc with the -n option, so any changes that you made to user.inc will be reflected in cokedef.h. It will then issue the command:
cokedasm button.asm -r -obutton.rel -lbutton.lst -c
If the assembly fails because of undefined symbols, you can enter
reldasm button -v3
to list undefined symbols. Be sure to note that reldasm's argument is just the module name by itself, without the ".asm" suffix.
The header of the file should consist of comment lines that begin with the '!' character. It is similar to ';' but cokedasm may look at it to see if it's interesting. If cokedasm finds a line of the form
! Module name: Blah
it starts generating "blah.c" and "blah.h" files, after closing any wrapper files it was generating before for another module. It then looks for a line of the form
! Commands:
It will then interpret the following lines as command descriptions until a blank line is found. I think. A command description is of the form:
[special] [returnType] CommandName ( [ parameterType parameterName [, ...]] )
where the things in [ ] are optional. If special is specified, cokedasm ignores the rest of the line and does not generate a wrapper function for the command. The wrapper functions for special commands should be written by hand and put in "special.c".
If returnType is given,
the command is assumed to return COKE_QUERY
when successful. returnType can be one of the following:
byte | the query result is one byte, and will be put into a variable of type cokebyte. |
word | the query result is two bytes (lobyte, hibyte) and will be put into a variable of type cokeword. |
string | the query result is a variable number of bytes, and will be put into a buffer given by a char*, with a null-terminator. |
If the command has parameters, they should be specfied within the parentheses
and separated by commas. parameterType must be one of the
following:
byte | one byte parameter, given as type cokebyte |
word | two byte parameter (lobyte, then hibyte), given as type cokeword |
cstring | variable-length parameter that ends with a zero byte, given as type char* |
pstring | variable-length parameter where the first byte is a length byte and specifies the number of bytes that follow, given as type char* |
byte[num] | fixed-length parameter of length num, given as type cokebyte* |
word[num] | fixed-length parameter of num words, given as type cokeword* |