ebmDevMag.com home
ebm Developer's Magazine

developer's mag
main page

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

1 - Assembly on the ebm - Part 3

    (download tutorial source .zip file)
    (download tutorial program .seb file only)

The past two articles have reviewed assembly language on the ebm, discussing the opcodes and programming, as well as getting into some simple code. With the groundwork laid for assembly programming on the ebm, it's time to cap off the series. Although three articles won't do justice to the Snk32 processor, we'll try to tie up all the loose ends in this column.

Side Effects

Besides the obvious effect an instruction has, additional less-obvious changes in the registers can be beneficial, making code smaller and more compact. For example, a side effect of many instructions involves the t register. Data movements often place a copy in t as well as the destination, and also set flags. This allows moves and testing to be combined, thus saving instructions.

With subroutines the side effects are particularly interesting. In calling a routine, jmp, jsr, and bsr set the RPTR register to r8. By setting RPTR automatically, functions are ready to push the registers from r8 on if they need to reclaim register space for their own use. push also has the side effect of incrementing RPTR, meaning a series of push commands will push r9, r10, and so on, providing very simple register saving. Likewise, pop works in reverse, by decrementing RPTR.

Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice