asm_utils.s 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. @ vim:filetype=armasm
  2. .global cache_flush_d_inval_i
  3. cache_flush_d_inval_i:
  4. mov r2, #0x0 @ must be 0 ???
  5. swi 0x9f0002
  6. bx lr
  7. .global clut_line @ void *dest, void *src, unsigned short *pal, int pixels_mask
  8. clut_line:
  9. stmfd sp!, {r4-r11,lr}
  10. and lr, r3, #0xff0000
  11. mov lr, lr, lsr #15 @ mask
  12. mov r3, r3, lsr #3
  13. and r3, r3, #0xff @ counter
  14. add r11,r0, #800*2
  15. clut_line_loop:
  16. ldmia r1!, {r10,r12}
  17. and r4, lr, r10, lsl #1
  18. ldrh r4, [r2, r4]
  19. and r5, lr, r10, lsr #7
  20. ldrh r5, [r2, r5]
  21. orr r4, r4, r4, lsl #16
  22. and r6, lr, r10, lsr #15
  23. ldrh r6, [r2, r6]
  24. orr r5, r5, r5, lsl #16
  25. and r7, lr, r10, lsr #23
  26. ldrh r7, [r2, r7]
  27. orr r6, r6, r6, lsl #16
  28. and r8, lr, r12, lsl #1
  29. ldrh r8, [r2, r8]
  30. orr r7, r7, r7, lsl #16
  31. and r9, lr, r12, lsr #7
  32. ldrh r9, [r2, r9]
  33. orr r8, r8, r8, lsl #16
  34. and r10,lr, r12, lsr #15
  35. ldrh r10,[r2, r10]
  36. orr r9, r9, r9, lsl #16
  37. and r12,lr, r12, lsr #23
  38. ldrh r12,[r2, r12]
  39. orr r10,r10,r10, lsl #16
  40. subs r3, r3, #1
  41. orr r12,r12,r12, lsl #16
  42. stmia r0!, {r4-r10,r12}
  43. stmia r11!,{r4-r10,r12}
  44. bne clut_line_loop
  45. ldmfd sp!, {r4-r11,pc}