Prev: 6DE6 Up: Map Next: 6EC5
6DE8: Draw a single column (8 pixels wide) of a bitmap using item data to calculate which column and where on the offscreen to draw.
Used by the routines at Vector_Main and Screen_DrawColumn.
Input
IX Scenery Item Data pointer.
HL Y pos offset (?)
BlitBmpColumn 6DE8 LD ($6DE6),HL Store
6DEB LD L,(IX+$02) Get bitmap data address from Item.BitmapIndex, offsetting to the width variable.
6DEE LD H,$00
6DF0 ADD HL,HL
6DF1 ADD HL,HL
6DF2 LD BC,BitmapData_Width
6DF5 ADD HL,BC
6DF6 PUSH HL
6DF7 LD A,(HL) Get x position on map for item and hero.
6DF8 LD L,(IX+$01)
6DFB LD H,$00
6DFD RRCA
6DFE ADC HL,HL
6E00 EX DE,HL
6E01 LD HL,(ManData_PosSecondary_dfc5)
6E04 EXX
6E05 LD L,(IX+$00) Get y position on map for item and hero.
6E08 LD H,$00
6E0A RLCA
6E0B ADC HL,HL
6E0D EX DE,HL
6E0E LD HL,(ManData_PosPrimary_dfc3)
6E11 LD A,(CamDirection_DFD2) Using camera decide which axis path runs along.
6E14 AND $01
6E16 JR Z,BlitBmpColumn_0
6E18 EXX
BlitBmpColumn_0 6E19 CALL abs(hl_minus_de) Starting with other axis, convert item position, offset from hero, and height into physical offscreen Y position.
6E1C EX DE,HL
6E1D POP BC
6E1E LD A,(BC)
6E1F AND $7F
6E21 LD L,A
6E22 LD H,$00
6E24 EX DE,HL
6E25 SBC HL,DE
6E27 JR C,BlitBmpColumn_1
6E29 LD A,L
6E2A CP $06
6E2C JR NC,BlitBmpColumn_2
BlitBmpColumn_1 6E2E LD HL,($6DE6)
6E31 JR BlitBmpColumn_3
BlitBmpColumn_2 6E33 DEC HL
6E34 DEC HL
6E35 ADD HL,HL
6E36 ADD HL,HL
BlitBmpColumn_3 6E37 DEC BC
6E38 LD A,(BC)
6E39 AND $7F
6E3B RLA
6E3C RLA
6E3D RLA
6E3E LD E,A
6E3F LD D,$00
6E41 ADD HL,DE
6E42 EX DE,HL
6E43 LD HL,$0040
6E46 AND A
6E47 SBC HL,DE
6E49 RET C
6E4A ADD HL,HL
6E4B LD E,L
6E4C LD D,H
6E4D ADD HL,HL
6E4E ADD HL,HL
6E4F ADD HL,HL
6E50 ADD HL,HL
6E51 ADD HL,DE
6E52 LD DE,(OffScrColPtr_6F14)
6E56 ADD HL,DE
6E57 LD (OffScrTempPtr_6F16),HL
6E5A PUSH BC
6E5B EXX
6E5C CALL abs(hl_minus_de) Using path axis, convert position, offset from hero's, into the column of bitmap to blit.
6E5F EX DE,HL
6E60 POP BC
6E61 INC BC
6E62 LD A,(BC)
6E63 AND $7F
6E65 LD L,A
6E66 LD H,$00
6E68 LD A,(ManWalkDirection_DFD4)
6E6B CP $02
6E6D JR Z,BlitBmpColumn_4
6E6F EX DE,HL
6E70 AND A
6E71 SBC HL,DE
6E73 EX DE,HL
6E74 LD HL,$0020
6E77 SBC HL,DE
6E79 JR BlitBmpColumn_5
BlitBmpColumn_4 6E7B ADD HL,DE
6E7C LD DE,$0022
6E7F AND A
6E80 SBC HL,DE
BlitBmpColumn_5 6E82 SRL H
6E84 RR L
6E86 EX DE,HL DE holds bytes offset for correct column, within image, to start blitting with.
6E87 LD L,(IX+$02) Get bitmap index from item data.
6E8A LD H,$00
HL=Bitmap Index
DE=Bytes offset to start blitting from. (Column to blit)
Blit_BmpColumn_Main 6E8C ADD HL,HL Calculate image address from bitmap data.
6E8D ADD HL,HL
6E8E LD BC, BitmapData_E
6E91 ADD HL,BC
6E92 LD C,(HL)
6E93 INC HL
6E94 LD B,(HL)
6E95 INC HL
6E96 EX DE,HL Get back the amount to offset the bitmap start by.
6E97 ADD HL,BC and add the start of the bitmap to it, not forgetting the start of the bitmaps for the true address.
6E98 LD BC,BmpStart_E
6E9B ADD HL,BC
6E9C PUSH HL
6E9D EX (SP),IX
6E9F LD HL,(OffScrTempPtr_6F16) Get offscreen address for item.
6EA2 LD A,(DE) Height of bitmap.
6EA3 AND $7F
6EA5 EX AF,AF'
6EA6 INC DE
6EA7 LD A,(DE) Width of bitmap.
6EA8 AND $7F
6EAA LD C,A
6EAB LD B,$00
6EAD LD DE,$0022 Number of bytes to skip for next line down in offscreen.
6EB0 EX AF,AF' Height * 8 for number of rows / pixels down.
6EB1 AND A
6EB2 RLA
6EB3 RLA
6EB4 RLA
Draw
BlitBmpColumn_Draw 6EB5 EX AF,AF'
6EB6 LD A,(IX+$00)
6EB9 XOR (HL)
6EBA LD (HL),A
6EBB ADD HL,DE
6EBC ADD IX,BC
6EBE EX AF,AF'
6EBF DEC A
6EC0 JR NZ,BlitBmpColumn_Draw
6EC2 POP IX
6EC4 RET
Prev: 6DE6 Up: Map Next: 6EC5