ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

sections
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9


9 - Programing Topics

9.01 - Are their any macros I need in assembly code?
9.02 - How do stack operations work?
9.03 - How do I determine stack space?
9.04 - How do I do assembly language comments?
9.05 - How do I use macro defines for assembly code?
9.06 - How do I use #define for specific code?
9.07 - What banks are available to program in?
9.08 - What happens when I pass a more than 7 values to a function?
9.09 - What happens when I pass a parameter by structure (not pointer)?
9.10 - What are delay slots?



9.01 - Are their any macros I need in assembly code?
Actually called psuedo-ops, several useful ones are; ldo, to load an offset; ldc, to load a constant; lda, to load an address; and ld# (ld1, ld2, ld3 etc) to load a constant using a specific number of bytes. Aside from the last one (ldc is easier to use, and is more general-purpose), examples of their use can be found in the tutorials on this site.

9.02 - How do stack operations work?
The user stack goes down, so pushing lowers the stack pointer address, and popping values increases it.

9.03 - How do I determine stack space?
You allocate it with the MAINSTACK_STACKSPACE value in the makefile - this value is inserted into the .fxe file.

9.04 - How do I do assembly language comments?
The supported method is with a semicolon.

9.05 - How do I use macro defines for assembly code?
In your source (.S) file, you can do the following, which uses macros for r0 and r2:
.a      define  "r0"
.b      define  "r2"

; ... later on ... 

func
        mov     {.a},t  ; or mov  r0,t
        rptr    {.b}    ; or rptr r2


9.06 - How do I use #define for specific code?
Franklin defines the __sneak__ and __sneak32__ macros for code that needs to be ebm-specific; __sneak__ refers to the Franklin chip family in general, while __sneak32__ is unique to the ebm.

9.07 - What banks are available to program in?
You can only access Bank 0.

9.08 - What happens when I pass a more than 7 values to a function?
If you pass more than seven 32 bit values to a function, the stack is used.

9.09 - What happens when I pass a parameter by structure (not pointer)?
Of course, no one would ever pass a structure by value, would they? However, if the urge hits, then the compiler tries to accommodate, unless all parameters total more than seven 32 bit values, in which case a pointer is passed.

9.10 - What are delay slots?
The Snk32 increases throughput by processing more than one instruction at a time (that is, decoding one while executing the previous). In the case of a branch, the flow would be interrupted and the second instruction needn't be decoded or executed (and shouldn't be). To avoid problems in this case, place nop instructions after all branches, except rts.



Previous Section


Copyright © 2001-2006 ebmDevMag.com - Legal Notice