ll_char_wr.S 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * linux/arch/arm26/lib/ll_char_wr.S
  3. *
  4. * Copyright (C) 1995, 1996 Russell King.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Speedups & 1bpp code (C) 1996 Philip Blundell & Russell King.
  11. *
  12. * 10-04-96 RMK Various cleanups & reduced register usage.
  13. * 08-04-98 RMK Shifts re-ordered
  14. */
  15. @ Regs: [] = corruptible
  16. @ {} = used
  17. @ () = do not use
  18. #include <linux/linkage.h>
  19. #include <asm/assembler.h>
  20. .text
  21. #define BOLD 0x01
  22. #define ITALIC 0x02
  23. #define UNDERLINE 0x04
  24. #define FLASH 0x08
  25. #define INVERSE 0x10
  26. LC0: .word bytes_per_char_h
  27. .word video_size_row
  28. .word acorndata_8x8
  29. .word con_charconvtable
  30. ENTRY(ll_write_char)
  31. stmfd sp!, {r4 - r7, lr}
  32. @
  33. @ Smashable regs: {r0 - r3}, [r4 - r7], (r8 - fp), [ip], (sp), [lr], (pc)
  34. @
  35. eor ip, r1, #UNDERLINE << 9
  36. /*
  37. * calculate colours
  38. */
  39. tst r1, #INVERSE << 9
  40. moveq r2, r1, lsr #16
  41. moveq r3, r1, lsr #24
  42. movne r2, r1, lsr #24
  43. movne r3, r1, lsr #16
  44. and r3, r3, #255
  45. and r2, r2, #255
  46. /*
  47. * calculate offset into character table
  48. */
  49. mov r1, r1, lsl #23
  50. mov r1, r1, lsr #20
  51. /*
  52. * calculate offset required for each row [maybe I should make this an argument to this fn.
  53. * Have to see what the register usage is like in the calling routines.
  54. */
  55. adr r4, LC0
  56. ldmia r4, {r4, r5, r6, lr}
  57. ldr r4, [r4]
  58. ldr r5, [r5]
  59. /*
  60. * Go to resolution-dependent routine...
  61. */
  62. cmp r4, #4
  63. blt Lrow1bpp
  64. eor r2, r3, r2 @ Create eor mask to change colour from bg
  65. orr r3, r3, r3, lsl #8 @ to fg.
  66. orr r3, r3, r3, lsl #16
  67. add r0, r0, r5, lsl #3 @ Move to bottom of character
  68. add r1, r1, #7
  69. ldrb r7, [r6, r1]
  70. tst ip, #UNDERLINE << 9
  71. eoreq r7, r7, #255
  72. teq r4, #8
  73. beq Lrow8bpplp
  74. @
  75. @ Smashable regs: {r0 - r3}, [r4], {r5 - r7}, (r8 - fp), [ip], (sp), {lr}, (pc)
  76. @
  77. orr r3, r3, r3, lsl #4
  78. Lrow4bpplp: ldr r7, [lr, r7, lsl #2]
  79. mul r7, r2, r7
  80. tst r1, #7 @ avoid using r7 directly after
  81. eor ip, r3, r7
  82. str ip, [r0, -r5]!
  83. LOADREGS(eqfd, sp!, {r4 - r7, pc})
  84. sub r1, r1, #1
  85. ldrb r7, [r6, r1]
  86. ldr r7, [lr, r7, lsl #2]
  87. mul r7, r2, r7
  88. tst r1, #7 @ avoid using r7 directly after
  89. eor ip, r3, r7
  90. str ip, [r0, -r5]!
  91. subne r1, r1, #1
  92. ldrneb r7, [r6, r1]
  93. bne Lrow4bpplp
  94. LOADREGS(fd, sp!, {r4 - r7, pc})
  95. @
  96. @ Smashable regs: {r0 - r3}, [r4], {r5 - r7}, (r8 - fp), [ip], (sp), {lr}, (pc)
  97. @
  98. Lrow8bpplp: mov ip, r7, lsr #4
  99. ldr ip, [lr, ip, lsl #2]
  100. mul r4, r2, ip
  101. and ip, r7, #15 @ avoid r4
  102. ldr ip, [lr, ip, lsl #2] @ avoid r4
  103. mul ip, r2, ip @ avoid r4
  104. eor r4, r3, r4 @ avoid ip
  105. tst r1, #7 @ avoid ip
  106. sub r0, r0, r5 @ avoid ip
  107. eor ip, r3, ip
  108. stmia r0, {r4, ip}
  109. LOADREGS(eqfd, sp!, {r4 - r7, pc})
  110. sub r1, r1, #1
  111. ldrb r7, [r6, r1]
  112. mov ip, r7, lsr #4
  113. ldr ip, [lr, ip, lsl #2]
  114. mul r4, r2, ip
  115. and ip, r7, #15 @ avoid r4
  116. ldr ip, [lr, ip, lsl #2] @ avoid r4
  117. mul ip, r2, ip @ avoid r4
  118. eor r4, r3, r4 @ avoid ip
  119. tst r1, #7 @ avoid ip
  120. sub r0, r0, r5 @ avoid ip
  121. eor ip, r3, ip
  122. stmia r0, {r4, ip}
  123. subne r1, r1, #1
  124. ldrneb r7, [r6, r1]
  125. bne Lrow8bpplp
  126. LOADREGS(fd, sp!, {r4 - r7, pc})
  127. @
  128. @ Smashable regs: {r0 - r3}, [r4], {r5, r6}, [r7], (r8 - fp), [ip], (sp), [lr], (pc)
  129. @
  130. Lrow1bpp: add r6, r6, r1
  131. ldmia r6, {r4, r7}
  132. tst ip, #INVERSE << 9
  133. mvnne r4, r4
  134. mvnne r7, r7
  135. strb r4, [r0], r5
  136. mov r4, r4, lsr #8
  137. strb r4, [r0], r5
  138. mov r4, r4, lsr #8
  139. strb r4, [r0], r5
  140. mov r4, r4, lsr #8
  141. strb r4, [r0], r5
  142. strb r7, [r0], r5
  143. mov r7, r7, lsr #8
  144. strb r7, [r0], r5
  145. mov r7, r7, lsr #8
  146. strb r7, [r0], r5
  147. mov r7, r7, lsr #8
  148. tst ip, #UNDERLINE << 9
  149. mvneq r7, r7
  150. strb r7, [r0], r5
  151. LOADREGS(fd, sp!, {r4 - r7, pc})
  152. .bss
  153. ENTRY(con_charconvtable)
  154. .space 1024