Prev: 83F5 Up: Map Next: 8448
8400: Turn the view with 0, P, ENTER or SPACE
Used by the routine at GAME_FRAME.
Each key picks one of the four views and re-centres VIEW_ORIGIN on the player for it, the view origin being the player's position less an offset that depends on the view. No key: nothing changes.
READ_VIEW_KEYS 8400 LD BC,$EFFE L = $FF: no key yet.
8403 LD L,$FF
8405 IN A,(C) 0: view 3.
8407 RRA
8408 JR C,READ_VIEW_KEYS_0
840A LD L,$03
840C LD DE,$0312
READ_VIEW_KEYS_0 840F LD B,$DF P: view 2.
8411 IN A,(C)
8413 RRA
8414 JR C,READ_VIEW_KEYS_1
8416 LD L,$02
8418 LD DE,$EE03
READ_VIEW_KEYS_1 841B LD B,$BF ENTER: view 1.
841D IN A,(C)
841F RRA
8420 JR C,READ_VIEW_KEYS_2
8422 LD L,$01
8424 LD DE,$FDEE
READ_VIEW_KEYS_2 8427 LD B,$7F SPACE: view 0.
8429 IN A,(C)
842B RRA
842C JR C,READ_VIEW_KEYS_3
842E LD L,$00
8430 LD DE,$12FD
READ_VIEW_KEYS_3 8433 LD A,L None of them.
8434 CP $FF
8436 JR Z,READ_VIEW_KEYS_4
8438 LD (VIEW),A Set the view...
843B LD HL,(PLAYER) ...and its origin, the player less the offset.
843E LD A,H
843F SUB D
8440 LD H,A
8441 LD A,L
8442 SUB E
8443 LD L,A
8444 LD (VIEW_ORIGIN),HL
READ_VIEW_KEYS_4 8447 RET
Prev: 83F5 Up: Map Next: 8448