Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Bitmap management for ARM-7

Name: Anonymous 2008-11-14 3:55

I haven't found any suitable log-like assembly instruction... so I've wrote this. Are you up to you to make it better? Maybe it could be improved by reading...


.code 32
.text
.align 0

  .global dw_bmp_msb_pos
dw_bmp_msb_pos:
  movs r1, r0
  moveq r0, #0
  bxeq lr
  mov r0, #33
getmsb_cycle:
  sub r0, r0, #1
  movs r1, r1, lsl #1
  bxcs lr
  b getmsb_cycle

  .global dw_bmp_set
dw_bmp_set:
  ldr r2, [r0, #0]
  mov r3, #1
  mov r3, r3, lsl r1
  orr r2, r2, r3
  str r2, [r0, #0]
  bx lr

  .global dw_bmp_reset
dw_bmp_reset:
  ldr r2, [r0, #0]
  mov r3, #1
  mov r3, r3, lsl r1
  bic r2, r2, r3
  str r2, [r0, #0]
  bx lr

Name: Anonymous 2008-11-14 7:18

OP here.

Actually this is ARM7 assembly. It's really awesome except it's very difficult to understand at the beginning... nothing you can't do with a good reference!

The big stuff about it is the optimization phase, since this assembly is very expressive, although IMHO building an optimized compiler is not a trivial task.

I've tryied to write the same semantics with C and then I've checked out the assembly produced by gcc... it's much more cumbersome!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List