2 ;; requires: WinSys, WinArrow, WinStick, WinMouse, WinInput
5 lastSelectedItem: db #ff
7 lastItemSA: dw 0 ; last inverted item's screen address
13 __TEST_INTR_TIME__ EQU 0
16 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17 ;; ÉÎ×ÅÒÔÉÒÕÅÍ ÐÕÎËÔ ÍÅÎÀÈÉ
19 ;; hl: pointer to item data (curItemSA, curItemWdt)
21 ;; af', af, bc, de, hl: destroyed
54 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
55 ;; calc address for the given item
58 ;; hl: pointer to item data (curItemSA, curItemWdt)
107 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
112 ;; a: selected item or #ff
113 ;; af,bc,de,hl: destroyed
119 ld d,0 ; item counter
137 jr c,.next ; if x < menu_x: continue
139 jr nc,.next ; if x >= menu_x+menu_width: continue
140 ; selected item found
143 ld (lastSelectedItem),a
146 ; advance to the next item
148 ; increase item counter
153 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
154 ;; check if arrow is inside window
156 ;; carry: =1 if outsize
183 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
184 ;; ÎÁÍÁÌÀÅÍ ÓÔÒÅÌÏÞËÕ. ÐÒÅÄÙÄÕÝÅŠţ ÓÏÓÔÏÑÎÉÅ ÐÏÆÉÇÕ
187 ;; af,af',bc,de,hl,bc',de',hl': ÄÏÈÌÙÅ
189 call WinMouse.Scan ; ÜÔÏ ÞÔÏÂÙ ÍÙÛØ ÎÅ ÅÌÏÚÉÌÁÓØ
190 ld hl,(WinArrow.curX)
191 ld (WinArrow.newX),hl
195 tmpItemSA: dw 0 ; current item's screen address
198 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
200 ;; af,af',bc,de,hl,bc',de': destroyed
202 ld bc,(WinArrow.newX)
203 ld hl,(WinArrow.curX)
206 jr nz,ForcedRedrawArrow
211 ld bc,(WinArrow.newX)
217 IFX __TEST_INTR_TIME__
226 ld hl,(WinArrow.newX)
227 ld (WinArrow.curX),hl
229 IFX __TEST_INTR_TIME__
240 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
241 ;; redraw arrow from interrupt handler
243 ;; af,af',bc,de,hl,bc',de': destroyed
246 ld (redrawArrowHalt),a
249 ld (redrawArrowHalt),a
253 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
254 ;; ÓÐÒÑÞÅÍ ÓÔÒÅÌÏÞËÕ. ÐÒÅÄÙÄÕÝÅŠţ ÓÏÓÔÏÑÎÉÅ ÐÏÆÉÇÕ
256 ;; af',bc,de,hl: ÄÏÈÌÙÅ
268 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
269 ;; ÐÒÏÉÎÉÔÉÍ ÍÅÎÀÈÕ, ÐÏÄÓ×ÅÔÉÍ ÎÕÖÎÙÊ ÐÕÎËÔ, ÚÁÄ×ÉÎÅÍ ÎÁ ÎÅÇÏ ÓÔÒÅÌËÕ
271 ;; hl: ptr to "menu info" (can be 0)
272 ;; a: item to set cursor on (#ff: none)
274 ;; af,af',bc,de,hl,bc',de': destroyed
285 ld (lastSelectedItem),a
288 ; set arrow to item a
316 ld (WinArrow.curX),de
325 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
326 ;; ÏÄÉÎ ÃÉËÌ "ÍÅÎÀÈÉ"
328 ;; a: menu item number/#ff (carry set); dirt (carry reset)
329 ;; carry flag: fire pressed on an item or outside the window
330 ;; carry reset: fire not pressed or not an any item
331 ;; f,af',bc,de,hl,bc',de',hl': destroyed
335 call WinInput.StickMoves
338 ret z ; return if no stick events
342 ld a,(WinInput.joystate)
344 ret nc ; return if fire isn't pressed
347 ld a,(lastSelectedItem)
351 ; the arrow is outside the window
353 ld (lastSelectedItem),a
358 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
359 ;; ÂÅÇÁÅÍ ÐÏ ÍÅÎÀÈÅ, ÖÄ£Í "fire"
361 ;; a: selected item (or #ff ÅÖÅÌÉ ×ÎÅ ÏËÏÛËÁ)
362 ;; f,af',bc,de,hl,bc',de',hl': destroyed
369 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
370 ;; ÓÐÒÑÞÅÍ ÓÔÒÅÌÏÞËÕ. ÐÒÅÄÙÄÕÝÅŠţ ÓÏÓÔÏÑÎÉÅ ÐÏÆÉÇÕ
371 ;; ÖÄ£Í, ÐÏËÁ ÀÚ×ÅÒØ ÏÔÐÕÓÔÉÔ "fire"
373 ;; af',bc,de,hl: ÄÏÈÌÙÅ
378 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
379 ;; ÖÄ£Í, ÐÏËÁ ÀÚ×ÅÒØ ÏÔÐÕÓÔÉÔ "fire"
385 call WinMouse.ScanButtons
386 ; ÅÓÌÉ ÍÙÛËÉ ÎÅÔ, ÔÏ ÂÉÔ 0 ÓÂÒÏÛÅÎ, ÉÎÁÞÅ ÕÓÔÁÎÏ×ÌÅÎ ÐÒÉ ÎÁÖÁÔÏÊ ËÎÏÐËÅ
389 call WinInput.SticksInput
396 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
397 ;; ÖÄ£Í, ÐÏËÁ ÀÚ×ÅÒØ ÎÁÄÁ×ÉÔ "fire"
403 call WinMouse.ScanButtons
404 ; ÅÓÌÉ ÍÙÛËÉ ÎÅÔ, ÔÏ ÂÉÔ 0 ÓÂÒÏÛÅÎ, ÉÎÁÞÅ ÕÓÔÁÎÏ×ÌÅÎ ÐÒÉ ÎÁÖÁÔÏÊ ËÎÏÐËÅ
407 call WinInput.SticksInput
415 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
416 ;; ÕÓÔÁÎÏ×ÉÔØ ÎÏ×ÙÅ ËÏÏÒÄÉÎÁÔÙ ÓÔÒÅÌÏÞËÉ, ÐÏÄÓ×ÅÔÉÔØ ÍÅÎÀ, ÅÓÌÉ ÎÁÄÏ
417 ;; ÅÓÌÉ ÒÉÓÕÅÍ ÓÔÒÅÌÏÞËÕ, ÔÏ ÄÅÌÁÅÍ É halt
421 ;; carry flag set: draw arrow
423 ;; af,af',bc,de,hl,bc',de',hl': ÄÏÈÌÙÅ
425 ld (WinArrow.curX),de
426 jp c,ForcedRedrawArrow
430 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
431 ;; ÕÓÔÁÎÏ×ÉÍ ÎÏ×ÙÊ ÓÐÒÁÊÔ ÓÔÒÅÌÏÞËÉ
432 ;; ÅÓÌÉ ÒÉÓÕÅÍ ÓÔÒÅÌÏÞËÕ, ÔÏ ÄÅÌÁÅÍ É halt
434 ;; hl: ptr to arrow sprite
435 ;; carry flag set: draw arrow
437 ;; af,af',bc,de,hl,bc',de',hl': ÄÏÈÌÙÅ
439 ld (WinArrow.sprAddr),hl
440 jp c,ForcedRedrawArrow
444 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
450 ;; hl: word in table at given index (or 00 for #ff)
451 ;; zero flag: set if hl is zero
475 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;