Routines |
Prev: F01A | Up: Map | Next: F07F |
|
||||
F02B | CALL $F000 | Close any doors that need closing, decrement and check the blown fuse delay counters, update the on-screen message if necessary, and increment the score and decrement Sam's cash supply at regular intervals | ||
F02E | CALL $F080 | Update the icon panel, draw the bullets, and scan the event table at 5FE0 | ||
F031 | CALL $F1FC | Move the characters | ||
F034 | LD A,($7FFC) | Pick up Sam's status flags from 7FFC | ||
F037 | AND A | Is Sam in the middle of an action? | ||
F038 | JR Z,$F045 | Jump if not | ||
F03A | CALL $74D8 | Otherwise deal with Sam | ||
F03D | JR NZ,$F06D | Jump if Sam has not finished the action yet | ||
This entry point is used by the routines at 6152 and F0BE.
|
||||
F03F | LD HL,$0005 | Reset Sam's main action timer and midstride/mid-action timer (in bytes 0x08 and 0x09 of his buffer) to 5 and 0 now that he's finished the action | ||
F042 | LD ($E608),HL | |||
F045 | LD HL,$E609 | Collect Sam's midstride/mid-action timer from byte 0x09 of his buffer | ||
F048 | LD A,(HL) | |||
F049 | AND A | Is Sam midstride or in the middle of a short action at the moment? | ||
F04A | JR NZ,$F069 | Jump if so | ||
F04C | DEC L | Point HL at Sam's main action timer in byte 0x08 of his buffer | ||
F04D | DEC (HL) | Decrement it | ||
F04E | JR NZ,$F06D | Jump unless it's time to check the keyboard | ||
F050 | LD (HL),$02 | Reset Sam's main action timer to 2 | ||
F052 | CALL $7996 | Check for keypresses | ||
F055 | JR Z,$F06D | Jump if there haven't been any | ||
F057 | LD ($7FFD),A | Store the offset of the last keypress in 7FFD | ||
F05A | LD H,$ED | Point HL at the appropriate entry in the table of keypress handling routines at ED00 | ||
F05C | LD L,A | |||
F05D | LD DE,$F06D | Push the address F06D (see below) onto the stack so we return there after dealing with the keypress | ||
F060 | PUSH DE | |||
F061 | LD B,(HL) | Copy the address of the routine for dealing with the keypress into BC | ||
F062 | DEC L | |||
F063 | LD C,(HL) | |||
F064 | PUSH BC | Push this address onto the stack | ||
F065 | LD HL,$E600 | Point HL at byte 0x00 of Sam's buffer | ||
F068 | RET | Make an indirect jump to the relevant keypress-handling routine, and then return to F06D | ||
Sam is midstride or in the middle of a short action (which involves raising his arm or bending his knees) at the moment.
|
||||
F069 | DEC (HL) | Decrement Sam's midstride/mid-action timer in byte 0x09 of his buffer | ||
F06A | CALL Z,$EC7B | If it's now zero, move Sam from the midstride/mid-action position, update the SRB, and scroll the screen if necessary | ||
Now that Sam's movements have been dealt with, the main loop continues.
|
||||
F06D | CALL $EA80 | Update the display | ||
This next section of code ensures that we don't pass through the main loop more than once every 1/50th of a second.
|
||||
F070 | LD HL,$7FC8 | HL=7FC8 (which holds the LSB of the system variable FRAMES as it was when the last pass through the main loop was completed) | ||
F073 | LD A,($5C78) | A=LSB of the system variable FRAMES, which is incremented every 1/50th of a second | ||
F076 | SUB (HL) | Now A=0 if FRAMES hasn't been incremented since the last pass through the main loop | ||
F077 | CP $01 | Was FRAMES incremented? | ||
F079 | JR C,$F073 | Jump back if not to check again | ||
F07B | ADD A,(HL) | Store the current value of the LSB of FRAMES at 7FC8 | ||
F07C | LD (HL),A | |||
F07D | JR $F02B | Jump back to the start of the main loop |
Prev: F01A | Up: Map | Next: F07F |