|
|
|
|
|
by stusmith1977
4571 days ago
|
|
Reminds me fondly of the time I was writing assembler for the ARM2/3... it had such a nice instruction set that made hand-writing assembler pleasant. It had a "barrel shifter" that gave you free shifts of powers of two, so you could calculate screen byte offsets quickly: // offset = x + y * 320
ADD R0, R1, R2, LSL #8
ADD R0, R0, R2, LSL #5
// = 2 cycles
It also had bulk loads and stores that made reading/writing RAM cheaper. The trick there was to spill as many registers as you possibly could, so that you could transfer as many words as possible per bulk load/store. LDMIA R10!, {R0-R9}
STMIA R11!, {R0-R9}
// Transfers 40 bytes from memory pointed to by R10 to memory pointed to by R11,
// And updates both pointers to the new addresses,
// And only takes (3+10)*2 = 26 cycles to do the lot.
Happy days... |
|