mainmenu.a65 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #include "memmap.i65"
  2. ;number of menu entries
  3. main_entries .byt 2
  4. ;menu entry data
  5. main_enttab ;Set Clock
  6. .word !text_mm_time
  7. .byt ^text_mm_time
  8. .word !time_init-1
  9. .byt ^time_init
  10. .byt 1, 0
  11. ;System Information
  12. .word !text_mm_sysinfo
  13. .byt ^text_mm_sysinfo
  14. .word !show_sysinfo-1
  15. .byt ^show_sysinfo
  16. ;SuperCIC
  17. .word !text_mm_scic
  18. .byt ^text_mm_scic
  19. .word !time_init
  20. .byt ^time_init
  21. .byt 1, 0
  22. ;Menu vmode
  23. .word !text_mm_vmode_menu
  24. .byt ^text_mm_vmode_menu
  25. .word !time_init
  26. .byt ^time_init
  27. .byt 1, 0
  28. ;Game vmode
  29. .word !text_mm_vmode_game
  30. .byt ^text_mm_vmode_game
  31. .word !time_init
  32. .byt ^time_init
  33. .byt 1, 0
  34. mainmenu:
  35. php
  36. sep #$20 : .as
  37. stz mm_sel
  38. mm_redraw
  39. stz mm_tmp
  40. jsr backup_screen
  41. lda #^text_mainmenu
  42. sta window_tbank
  43. ldx #!text_mainmenu
  44. stx window_taddr
  45. lda @main_win_x
  46. sta window_x
  47. lda @main_win_y
  48. sta window_y
  49. lda @main_win_w
  50. sta window_w
  51. lda @main_win_h
  52. sta window_h
  53. jsr draw_window
  54. jsr mm_do_refresh
  55. stz print_pal
  56. ldx #!main_enttab
  57. mm_entloop
  58. lda #^main_enttab
  59. phb
  60. pha
  61. plb
  62. lda !0, x
  63. sta @print_src
  64. lda !1, x
  65. sta @print_src+1
  66. lda !2, x
  67. sta @print_bank
  68. lda @mm_tmp
  69. asl
  70. clc
  71. adc @main_win_y
  72. inc
  73. inc
  74. sta @print_y
  75. lda @main_win_x
  76. inc
  77. inc
  78. sta @print_x
  79. plb
  80. phx
  81. jsr hiprint
  82. plx
  83. inx
  84. inx
  85. inx
  86. inx
  87. inx
  88. inx
  89. inx
  90. inx
  91. inc mm_tmp
  92. lda mm_tmp
  93. cmp @main_entries
  94. bne mm_entloop
  95. stz mm_tmp
  96. stz mm_refresh
  97. mm_menuloop
  98. lda isr_done
  99. lsr
  100. bcc mm_menuloop
  101. jsr printtime
  102. stz isr_done
  103. lda mm_refresh
  104. beq +
  105. jsr mm_do_refresh
  106. stz mm_refresh
  107. +
  108. jsr read_pad
  109. lda #$80
  110. and pad1trig
  111. bne mmkey_a
  112. lda #$04
  113. and pad1trig+1
  114. bne mmkey_down
  115. lda #$08
  116. and pad1trig+1
  117. bne mmkey_up
  118. lda #$80
  119. and pad1trig+1
  120. bne mmkey_b
  121. bra mm_menuloop
  122. mmkey_b
  123. jsr restore_screen
  124. plp
  125. rts
  126. mmkey_a
  127. jsr mmkey_a_2
  128. jmp mm_redraw
  129. mmkey_down
  130. jsr mmkey_down_2
  131. bra mm_menuloop
  132. mmkey_up
  133. jsr mmkey_up_2
  134. bra mm_menuloop
  135. mmkey_down_2
  136. lda @main_entries
  137. dec
  138. cmp mm_sel
  139. beq +
  140. inc mm_sel
  141. inc mm_refresh
  142. +
  143. rts
  144. mmkey_up_2
  145. lda mm_sel
  146. beq +
  147. dec mm_sel
  148. dec bar_yl
  149. dec bar_yl
  150. +
  151. rts
  152. mmkey_a_2
  153. jsr restore_screen
  154. phk ; push return bank for subroutine
  155. per mmkey_a_2_return-1 ; push return addr for subroutine
  156. xba
  157. lda #$00
  158. xba
  159. lda mm_sel
  160. asl
  161. asl
  162. asl
  163. tax
  164. lda @main_enttab+5, x
  165. pha ; push subroutine bank
  166. rep #$20 : .al
  167. lda @main_enttab+3, x
  168. pha ; push subroutine addr
  169. sep #$20 : .as
  170. rtl ; jump to subroutine
  171. mmkey_a_2_return
  172. rts
  173. mm_do_refresh
  174. lda mm_sel
  175. asl
  176. clc
  177. adc @main_win_y
  178. inc
  179. sta bar_yl
  180. lda @main_win_x
  181. inc
  182. inc
  183. sta bar_xl
  184. lda @main_win_w
  185. sec
  186. sbc #$04
  187. sta bar_wl
  188. rts