Prev: 75fc Up: Map Next: 76a6
7638: Displays platforms on screen.
Used by the routine at 6094.
7638 ld b,$04 Loop counter (4 platforms for draw)
763a ld hl,$6003 Platform location/size params
763d push bc Backup loop counter
763e ld a,(hl) Process next platform if sprite colour is black/unused
763f and a
7640 jp z,$769e
7643 inc hl C=X position
7644 ld c,(hl)
7645 inc hl
7646 inc hl
7647 ld a,(hl) A=platform width
7648 and $fc
764a neg
764c add a,c A += platform X position
764d add a,$10 A += 16
764f push hl
7650 dec hl H=Y position byte
7651 ld h,(hl)
7652 ld l,a L=new X position
7653 call $72d0 HL=coord to screen address (using HL)
7656 ld de,$76ad DE=address for LEFT platform sprite
7659 call $76a6 Draw LEFT platform tile pixels
765c ex (sp),hl Does this fetch the platform width value?
765d ld a,(hl)
765e ex (sp),hl
765f srl a
7661 srl a
7663 sub $04
7665 ld b,a B=loop counter for # of middle platform sprites
7666 ld de,$76b5 DE=address for MIDDLE platform sprite
7669 call $76a6 Draw (all) MIDDLE platform tiles pixels
766c djnz $7669
766e ld de,$76bd DE=address for RIGHT platform sprite
7671 call $76a6 Draw RIGHT platform tile pixels
7674 pop hl
7675 ld a,(hl) A=platform width
7676 and $fc
7678 neg
767a add a,c A += X position
767b add a,$10 A += 16
767d push hl
767e dec hl B=Y position
767f ld b,(hl)
7680 dec hl C=colour attribute
7681 dec hl
7682 ld c,(hl)
7683 ld h,b HL=Y,X position
7684 ld l,a
7685 push bc
7686 call $71d6 HL=coord to attribute file address (using HL)
7689 pop bc
768a ex (sp),hl Does this fetch the platform width value?
768b ld a,(hl)
768c ex (sp),hl
768d srl a
768f srl a
7691 sub $02
7693 ld b,a B=loop counter for # of middle platform sprites
7694 ld a,c Apply platform colour to ATTRIBUTE_FILE
7695 ld (hl),a
7696 inc hl HL=next sprite position
7697 djnz $7695 Repeat until all sprites are coloured
7699 pop hl Restore HL=platform object at "width" byte
769a inc hl HL=beginning of next platform struct
769b pop bc Restore BC for loop counter
769c jr $76a3 Loop back and processing next platform
These instructions are only called if current platform colour was black. Why would a platform colour be black?
769e pop bc restore loop counter
769f inc hl Place HL to beginning of next platform struct
76a0 inc hl
76a1 inc hl
76a2 inc hl
76a3 djnz $763d Loop back and process next platform
76a5 ret
Prev: 75fc Up: Map Next: 76a6