Prev: 42105 Up: Map Next: 42220
42157: Take an object routine: Have current character take object A in exchange for Newspaper
Used by the routine at 42105.
Input
A Index of object of interest
42157 LD (42208),A Store index of object of interest as operand of instruction at 42207
42160 CALL 45510 If Magic Knight is not carrying the object of interest...
42163 RET NZ ...then return
42164 POP AF Remove return address of calling routine from top of stack
42165 LD A,(42208) Load C with index of object of interest...
42168 LD C,A ...
42169 LD B,5 Load B with 5 (five inventory slots)
42171 LD HL,24848 Point HL at start of Magic Knight's current inventory (carrying)
42174 CALL 48341 Remove object of interest from Magic Knight's current inventory (carrying)
42177 LD A,33 Load C with 33 (index of Newspaper)...
42179 LD C,A ...
42180 LD B,5 Load B with 5 (five inventory slots)
42182 LD HL,24848 Wait for interrupt then load object in C into Magic Knight's first empty inventory (carrying) slot...
42185 CALL 45380 ...
42188 LD A,(41937) Point IX at current inventory of Current Character...
42191 CALL 45450 ...
42194 PUSH IX Copy address from IX to HL...
42196 POP HL ...
42197 PUSH HL Store HL (address of Current Character's current inventory)
42198 LD A,33 Load C with 33 (index of Newspaper)...
42200 LD C,A ...
42201 LD B,5 Load B with 5 (five inventory slots)
42203 CALL 48341 Remove object of interest from Current Character's current inventory
42206 POP HL Restore HL (address of Current Character's current inventory)
The operand of the instruction at 42207 represents the index of the object of interest. This is modified by the instruction at 42157.
42207 LD C,0 Load C with index of object of interest
42209 LD B,5 Load B with 5 (five inventory slots)
42211 CALL 45380 Wait for interrupt then load object in C into Current Character's first empty inventory slot
42214 LD HL,52076 Point HL at "[Current Character's short name] HAS [Current Command]N AN EGG..." text
42217 JP 64261 Display "[Current Character's short name] HAS [Current Command]N AN EGG..." window (13) and return to game
Prev: 42105 Up: Map Next: 42220