ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

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


5 - Mathematics

The math instructions generally work off of the t register in conjunction with another register. This register can be selected either via the RPTR index, or directly.

add rp; add pc; add sp addc rp addx4 rp dec rp; dec t
Addition of the t register and the current register via the RPTR index, the program counter, or the stack pointer, respectively. Same as 'add rp', but with the carry flag included. Addition to t of a register value. The 'x4' indicates the value is shifted before addition, effectively adding the value four times. Decrement the register pointed to by RPTR (or the t register) by one.
dec2 rp; dec2 t inc rp; inc t inc2 rp; inc2 t inc4 rp; inc4 t
Decrement the register pointed to by RPTR or the t register by two. Increment the register pointed to by RPTR or the t register by one. Increment the register pointed to by RPTR or the t register by two. Increment the register pointed to by RPTR or the t register by four.
neg rp; neg t sub rp subc rp subcr rp
Negate (two's complement) the value in the specified register or the t register. Subtract selected register's value from the t register, placing result in t afterwards. Subtract selected register's value from the t register with carry. Subtract t from the selected register's value with carry, placing the result into t.
subr rp sx8 rp sx16 rp zsub rp
Subtract t from the selected register without carry. Sign extend the specified register's 8 bits to 32 bits. Sign extend specified register's 16 bits to 32 bits. Subtract contents of specifed register from zero, placing in t.


Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice