HuDK icon indicating copy to clipboard operation
HuDK copied to clipboard

Coding guidelines

Open BlockoS opened this issue 8 years ago • 8 comments

Write coding guidelines!

BlockoS avatar Feb 12 '16 12:02 BlockoS

Keep in mind that the asm source should work with

BlockoS avatar Feb 12 '16 21:02 BlockoS

thanks! though I'd imagine anything involving zero page is going to be a nightmare to get working with both set{wla,cc65} and pceas.

freem avatar Feb 12 '16 21:02 freem

I think I'll drop wla-dx support for the time being.

Back on the guidelines : Labels are in snake case. Macro/routines should be named : target_action. Where target is the hardware, module on which the action is performed. For example, the routine setting the current PSG channel may be psg_set_chn, and the name of the routine that deletes a Backup RAM entry may be bm_delete. Exceptions to this rule are "standard" functions or algorithms. For example the routine to compare two string may be strcmp, and sorting two byte-arrays simply sort.

I didn't find a good alternative to doxygen for asm. If anyone has an idea, let me know.

BlockoS avatar Feb 15 '16 13:02 BlockoS

I found these two software. http://www.naturaldocs.org/languages.html (for assembly) I have not tested it but I know cpctelera uses it.(http://lronaldo.github.io/cpctelera/files/sprites/cpct_drawSpriteMasked-asm.html)

https://github.com/mrshankly/asm_doc I have no executable for asmdoc but it should be compilable under Windows

tonma avatar Feb 18 '16 08:02 tonma

Natural Docs looks cools. It can do both asm and C. I'll try it asap.

Anyway, let's not forgot to add a nifty header to the source files! C version:

/* 
 * HuDK
 * [small description]
 * Licensed under the MIT License
 * (c) 2016 {authors name}
 */

ASM version:

;;
;; HuDK
;; [small description]
;; Licensed under the MIT License
;; (c) 2016 {authors name}
;;

BlockoS avatar Feb 18 '16 14:02 BlockoS

I think I'll stick with Natural Docs. http://blockos.org/docs/HuDK/files/word-inc.html

BlockoS avatar Feb 18 '16 22:02 BlockoS

Cool. The doc seem easy to read.

tonma avatar Feb 19 '16 07:02 tonma

Code documentation is now accessible here: http://blockos.github.io/HuDK/doc

The hw docs are far from begin complete atm.

BlockoS avatar Feb 21 '16 14:02 BlockoS