Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- keyreaderplus:
- ;The original scheme was a "FlexInt" that ran the menu code twice per cycle,
- ;allowing or running the keyreader twice each game cycle. Really ingenious.
- ;And very fast.
- ; call keyreader
- ; ld hl,(keyread)
- ; ld a,(keyoutput)
- ; push hl
- ; push af
- ; ld hl,$FFFF
- ; ld (keyread),hl
- ; ld a,$FF
- ; ld (keyoutput),a
- ; ld hl,_
- ; push hl
- ; ld hl,(islotbank+3)
- ; jp (hl)
- ;_ pop af
- ; pop hl
- ; ld (keyread),hl
- ; ld (keyoutput),a
- ; ret
- keyreader:
- push hl
- call getkey
- cpl
- or a
- jr nz,$+6
- res keyprimed,(iy+sysflags)
- cpl
- bit keyprimed,(iy+sysflags)
- jr nz,gkwreset-2 ;wait until keypad is completely released
- ld l,a
- ld a,(keyread)
- cp L
- jr nz,gkwreset ;if previous key does not match, set this key instead.
- ld hl,(keyread) ;H=keywait. A=copy
- dec h
- jr nz,gkwdonotdokey ;reset key if counter isn't up.
- ld h,5
- ld (keyread),hl
- ld a,l
- ld (keyoutput),a
- pop hl
- ret
- ld l,$FF
- gkwreset:
- ld a,14
- ld (keywait),a
- ld a,l
- ld (keyread),a
- ld (keyoutput),a
- pop hl
- ret
- gkwdonotdokey:
- ld a,$FF
- ld (keyread),hl
- ld (keyoutput),a
- pop hl
- ret
- getkey:
- ld a,$FF
- out (1),a
- push hl \ pop hl
- ld a,$BE
- out (1),a
- push hl \ pop hl ;11 ;| / 7 6 5 4 3 2 1 0
- in a,(1) ;11 22 ;|/ del mode 2nd y= up right left down
- ret
Advertisement
Add Comment
Please, Sign In to add comment