![]() |
Routines |
Prev: 31435 | Up: Map | Next: 31509 |
The barriers are built from UDGs. Each barrier is 3 rows of chars high, and each row is printed as a string using a special "font".
Used by the routine at start.
|
||||
draw_barriers | 31436 | LD A,(_BARRIERS_SUPPRESSED) | Barriers suppressed flag, this has to be zero otherwise the barriers aren't drawn | |
31439 | OR A | |||
31440 | RET NZ | |||
31441 | LD HL,(_CURRENT_FONT) | Stash default font address on stack | ||
31444 | PUSH HL | |||
31445 | LD HL,30987 | Switch to the UDGs here. In theory this is the start of the "font", but we only use UDGs starting at char '0'. Char '0' is 48 decimal, 48*8 is 384, 30987+384=31371 | ||
31448 | LD (_CURRENT_FONT),HL | |||
31451 | LD A,3 | We need to draw 3 barriers | ||
31453 | LD (_DRAW_BARRIER_COUNT),A | |||
31456 | LD BC,5125 | Y=20, X=05 | ||
draw_barriers_0 | 31459 | LD HL,_BARRIER_TOP | Sequence of UDGs which display a row of the barrier | |
31462 | PUSH BC | |||
31463 | LD A,3 | The graphic is 3 rows per barrier | ||
31465 | LD (_BARRIER_ROWS_TO_DRAW),A | |||
draw_barriers_1 | 31468 | CALL print_string_at_hl | Draw a barrier row using the UDG printer code | |
31471 | DEC C | X=X-4 | ||
31472 | DEC C | |||
31473 | DEC C | |||
31474 | DEC C | |||
31475 | INC B | Y=Y+1 | ||
31476 | LD A,(_BARRIER_ROWS_TO_DRAW) | Barrier row drawn | ||
31479 | DEC A | |||
31480 | LD (_BARRIER_ROWS_TO_DRAW),A | |||
31483 | JR NZ,draw_barriers_1 | Back for next row | ||
31485 | POP BC | |||
31486 | LD A,C | Move X along 9 chars ready for next barrier | ||
31487 | ADD A,9 | |||
31489 | LD C,A | |||
31490 | LD A,(_DRAW_BARRIER_COUNT) | One more barrier has been drawn | ||
31493 | DEC A | |||
31494 | LD (_DRAW_BARRIER_COUNT),A | |||
31497 | JR NZ,draw_barriers_0 | Back to do the next one | ||
31499 | POP HL | Recover default font address and put it back | ||
31500 | LD (_CURRENT_FONT),HL | |||
31503 | LD A,1 | Barriers are drawn, flag not to redraw them. | ||
31505 | LD (_BARRIERS_SUPPRESSED),A | |||
31508 | RET |
Prev: 31435 | Up: Map | Next: 31509 |