Skip to content
azertyfun edited this page Feb 12, 2016 · 1 revision
  • File and function names must start with a lower case letter.

  • Routines' structure is this way :

    :myRoutine
        SET B, 1
        SET B, 2
        :myRoutine_subroutine
            ADD B, 1
            MUl B, 5
            :myRoutine_subroutine_loop
                ADD B, 1
                IFN B, 100
                SET PC, myRoutine_subroutine_loop
        SET PC, POP
    
  • It is strongly suggested to comment the routine explaining how it works and what are its arguments / return values. (Ex: ;A : Pointer to a null-terminated string)

  • Instructions (set, add, mul, div, etc) must be in lower case.

  • Registers (A, B, C, I, J, X, Y, Z) must be written in upper case.

  • PUSH, POP and PEEK also must be written in upper case.

  • There is a space after the comma, but not before.

  • Operators + and - must be surrounded by spaces. Ex: SET [I + screen_address], C

  • define names must be in upper case. Ex: #define MY_DEFINE 42

  • Cold must be indented once for every step in the hierarchy of routines. The tab must be the character "\t" and not 4 spaces.

Correct code example

:myRoutine
    set PUSH, A
    set A, 0
    :myRoutine_loop
        add A, 1
        ifn A, 100
            set PC, myRoutine
    jsr anotherRoutine
    set [I + screen_address], C
    set PC, POP