No Description

lcd_io_test.s 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. #include <config/core.h>
  2. .EQU BLDMOD,0x50
  3. .EQU LCD_WIN_IN,0x48
  4. .EQU COLEV,0x52
  5. .EQU WIN0_BG0,0x1
  6. .EQU WIN0_BG1,0x2
  7. .EQU WIN0_BG2,0x4
  8. .EQU WIN0_BG3,0x8
  9. .EQU WIN0_OBJ,0x10
  10. .EQU WIN0_FX,0x20
  11. .EQU WIN1_BG0,0x100
  12. .EQU WIN1_BG1,0x200
  13. .EQU WIN1_BG2,0x400
  14. .EQU WIN1_BG3,0x800
  15. .EQU WIN1_OBJ,0x1000
  16. .EQU WIN1_FX,0x2000
  17. .EQU WIN0_BG_OBJ,WIN0_BG0 | WIN0_BG1 | WIN0_BG2 | WIN0_BG3 | WIN0_OBJ
  18. .EQU WIN1_BG_OBJ,WIN1_BG0 | WIN1_BG1 | WIN1_BG2 | WIN1_BG3 | WIN1_OBJ
  19. @Testing
  20. .align 2
  21. .thumb
  22. .text
  23. get_flag_val:
  24. push {lr}
  25. ldr r0, =FLAG_ACTIVATE
  26. bl flag_decrypt
  27. pop {pc}
  28. .global trans_activate
  29. trans_activate:
  30. push {r0-r7}
  31. bl mug_create_on_variable
  32. bl get_flag_val
  33. cmp r0, #0
  34. bne no_activate
  35. mov r0, #LCD_WIN_IN
  36. ldrh r1, =WIN0_BG_OBJ | WIN1_BG_OBJ | WIN0_FX
  37. bl do_lcd_io_set
  38. mov r0, #BLDMOD
  39. ldrh r1, =0x3F41
  40. bl do_lcd_io_set
  41. mov r0, #COLEV
  42. ldrh r1, =0x0A0F
  43. bl do_lcd_io_set
  44. no_activate:
  45. pop {r0-r7}
  46. ldr r0, =0x08069371
  47. mov r1, #0x50
  48. bl task_add
  49. pop {r0}
  50. bx r0
  51. .global trans_deactivate
  52. trans_deactivate:
  53. push {r0-r3}
  54. bl mug_delete
  55. mov r0, #LCD_WIN_IN
  56. ldrh r1, =0x1F1F
  57. bl do_lcd_io_set
  58. mov r0, #BLDMOD
  59. ldrh r1, =0x1E40
  60. bl do_lcd_io_set
  61. mov r0, #COLEV
  62. ldrh r1, =0x0010
  63. bl do_lcd_io_set
  64. pop {r0-r3}
  65. ldr r1, =0x0203709C
  66. mov r0, #0
  67. strb r0, [r1]
  68. pop {r0}
  69. bx r0
  70. do_lcd_io_set:
  71. push {r3, lr}
  72. ldr r3, =lcd_io_set_func
  73. bl bxr3
  74. pop {r3}
  75. pop {r0}
  76. bx r0
  77. task_add:
  78. ldr r2, =task_add_func
  79. bx r2
  80. bxr3:
  81. bx r3
  82. .global pal_load_hook
  83. pal_load_hook:
  84. push {r0}
  85. bl get_flag_val
  86. mov r1, r0
  87. pop {r0}
  88. cmp r1, #0
  89. bne load_normal
  90. ldr r1, =box_zero_flag
  91. ldrb r1, [r1]
  92. cmp r1, #0
  93. beq load_normal
  94. ldr r0, =palette_override
  95. b load_hook_end
  96. load_normal:
  97. ldr r1, =0x08471DEC
  98. add r0, r1
  99. load_hook_end:
  100. pop {r1}
  101. bx r1
  102. .global pal_load_hook_2
  103. pal_load_hook_2:
  104. add r5, #4
  105. add r4, r5
  106. ldr r0, [r4]
  107. mov r1, r8
  108. ldr r2, =box_zero_flag
  109. ldrb r2, [r2]
  110. cmp r2, #0
  111. beq load_normal_2
  112. push {r0-r1}
  113. bl get_flag_val
  114. mov r2, r0
  115. pop {r0-r1}
  116. cmp r2, #0
  117. bne load_normal_2
  118. ldr r0, =palette_override
  119. load_normal_2:
  120. ldr r2, =0x08150009 @RETURN ADDRESS
  121. bx r2
  122. flag_decrypt:
  123. ldr r1, =flag_decrypt_func
  124. bx r1
  125. .align 2
  126. .global palette_override
  127. palette_override:
  128. .hword 0
  129. .hword 0
  130. .hword 0x7FFF
  131. .hword 0x0000
  132. .hword 0x7FFF
  133. .hword 0x7FFF
  134. .hword 0x7FFF
  135. .hword 0x7FFF
  136. .hword 0x7FFF
  137. .hword 0x7FFF
  138. .hword 0x7FFF
  139. .hword 0
  140. .hword 0
  141. .hword 0
  142. .hword 0
  143. .hword 0x0