mainmenu.a65 2.7 KB

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