mainmenu.a65 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. rep #$20 : .al
  83. pla
  84. clc
  85. adc #$08
  86. tax
  87. sep #$20 : .as
  88. inc mm_tmp
  89. lda mm_tmp
  90. cmp @main_entries
  91. bne mm_entloop
  92. stz mm_tmp
  93. stz mm_refresh
  94. mm_menuloop
  95. lda isr_done
  96. lsr
  97. bcc mm_menuloop
  98. jsr printtime
  99. stz isr_done
  100. lda mm_refresh
  101. beq +
  102. jsr mm_do_refresh
  103. stz mm_refresh
  104. +
  105. jsr read_pad
  106. lda #$80
  107. and pad1trig
  108. bne mmkey_a
  109. lda #$04
  110. and pad1trig+1
  111. bne mmkey_down
  112. lda #$08
  113. and pad1trig+1
  114. bne mmkey_up
  115. lda #$80
  116. and pad1trig+1
  117. bne mmkey_b
  118. bra mm_menuloop
  119. mmkey_b
  120. jsr restore_screen
  121. plp
  122. rts
  123. mmkey_a
  124. jsr mmkey_a_2
  125. jmp mm_redraw
  126. mmkey_down
  127. jsr mmkey_down_2
  128. bra mm_menuloop
  129. mmkey_up
  130. jsr mmkey_up_2
  131. bra mm_menuloop
  132. mmkey_down_2
  133. lda @main_entries
  134. dec
  135. cmp mm_sel
  136. beq +
  137. inc mm_sel
  138. inc mm_refresh
  139. +
  140. rts
  141. mmkey_up_2
  142. lda mm_sel
  143. beq +
  144. dec mm_sel
  145. dec bar_yl
  146. dec bar_yl
  147. +
  148. rts
  149. mmkey_a_2
  150. jsr restore_screen
  151. phk ; push return bank for subroutine
  152. per mmkey_a_2_return-1 ; push return addr for subroutine
  153. xba
  154. lda #$00
  155. xba
  156. lda mm_sel
  157. asl
  158. asl
  159. asl
  160. tax
  161. lda @main_enttab+5, x
  162. pha ; push subroutine bank
  163. rep #$20 : .al
  164. lda @main_enttab+3, x
  165. pha ; push subroutine addr
  166. sep #$20 : .as
  167. rtl ; jump to subroutine
  168. mmkey_a_2_return
  169. rts
  170. mm_do_refresh
  171. lda mm_sel
  172. asl
  173. clc
  174. adc @main_win_y
  175. inc
  176. sta bar_yl
  177. lda @main_win_x
  178. inc
  179. inc
  180. sta bar_xl
  181. lda @main_win_w
  182. sec
  183. sbc #$04
  184. sta bar_wl
  185. rts