Prev: 8379 Up: Map Next: 839B
8380: Read one cell of the city map
Used by the routines at GATHER_VIEW0, GATHER_VIEW1, GATHER_VIEW2 and GATHER_VIEW3.
The map is 128 x 128 bytes at CITY_MAP, a bit for each of six heights. Coordinates run $80-$FF; below that is outside the walls and reads as empty. Cell (x, y) is at CITY_MAP + 128(y - $80) + (x - $80).
Input
E x
D y
IX Where to write the byte; moved on one
READ_MAP_CELL 8380 LD H,D Outside the walls if either coordinate is below $80.
8381 BIT 7,H
8383 JR Z,READ_MAP_CELL_0
8385 LD A,E
8386 RLA
8387 JR NC,READ_MAP_CELL_0
8389 RR H HL = CITY_MAP + 128 x (y AND $7F) + (x AND $7F).
838B RRA
838C LD L,A
838D LD A,(HL) Store the cell.
838E LD (IX+$00),A
8391 INC IX
8393 RET
READ_MAP_CELL_0 8394 XOR A Outside: store 0.
8395 LD (IX+$00),A
8398 INC IX
839A RET
Prev: 8379 Up: Map Next: 839B