Don't like ads? PRO users don't see any ads ;-)
Guest

calc84maniac

By: a guest on Nov 28th, 2010  |  syntax: None  |  size: 0.68 KB  |  hits: 112  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. @ void setPixel(void* buffer, unsigned x, unsigned y, unsigned color);
  2. .global setPixel
  3.  
  4. @ Notes:
  5. @  Only bottom 4 bits of color are used, the rest can be garbage.
  6. @  This routine will not write pixels offscreen.
  7. @  Cycle timing (not including function call):
  8. @  * Offscreen pixel:        5 cycles
  9. @  * Onscreen pixel, x%2==0: 16 cycles
  10. @  * Onscreen pixel, x%2==1: 15 cycles
  11. @  Code size: 68 bytes
  12. setPixel:
  13.         cmp r1,#320
  14.         cmplo r2,#240
  15.         bxhs lr
  16.         add r2,r2,r2,lsl #2
  17.         add r0,r0,r2,lsl #5
  18.         movs r1,r1,lsr #1
  19.         ldrb r2,[r0,r1]
  20.         bcc 1f
  21.         and r3,r3,#0x0F
  22.         bic r2,r2,#0x0F
  23.         orr r2,r2,r3
  24.         strb r2,[r0,r1]
  25.         bx lr
  26. 1:
  27.         bic r2,r2,#0xF0
  28.         orr r2,r2,r3,lsl #4
  29.         strb r2,[r0,r1]
  30.         bx lr