.module Large .include "Large.Scroll.asm" ;------------------------------------------------------------------------------- ;@doc:routine ; ; === GetBufferPixelAddress === ; ; Gets the address of the pixel data under the cursor. ; ; OUPTUTS: ; REGISTERS ; * HL - Address of the pixel under the cursor. ; * B - Bitmask for character. ; HARDWARE ; * LCD driver - points at correct row and column. ; ;@doc:end ;------------------------------------------------------------------------------- GetBufferPixelAddress.Routine ld a,(Cursor.Y) ; Row address = a * 96 ; 96 = 64 + 32 add a,a ; *2 add a,a ; *4 add a,a ; *8 add a,a ; *16 ld h,0 ld l,a add hl,hl ; *32 ld d,h ld e,l add hl,hl ; *64 add hl,de ; *96 ld de,(Lcd.Buffer) add hl,de ; hl -> row ld a,(Cursor.X) ld e,a ld d,0 add hl,de ; hl -> Lcd.Buffer ; Now, set LCD pointer. add a,$20 call Lcd.WriteInstruction ; Row ld a,(Cursor.Y) add a,a add a,a add a,a add a,$80 call Lcd.WriteInstruction ld b,$FF ret ;------------------------------------------------------------------------------- ;@doc:routine ; ; === PutMapNoWriteBuffer === ; ; Puts a character on the display at the current cursor position, ; but does not write to the underlying character buffer. ; ; INPUTS: ; REGISTERS ; * A - The code of the character to put on the display. ; ;@doc:end ;------------------------------------------------------------------------------- PutMapNoWriteBuffer.Routine push hl jr PutMap.Main ;------------------------------------------------------------------------------- ;@doc:routine ; ; === PutMap === ; ; Puts a character on the display and character buffer at the current cursor ; position. ; ; INPUTS: ; REGISTERS ; * A - The code of the character to put on the display and buffer. ; ;@doc:end ;------------------------------------------------------------------------------- PutMap.Routine push hl call GetBufferCharAddress.Routine ld (hl),a PutMap.Main push ix push de push bc push af ld l,a ld h,0 add hl,hl add hl,hl add hl,hl ld de,(Vdu.Text.UserDefinableFont) add hl,de push hl call GetBufferPixelAddress.Routine pop ix ld a,(Text.ForegroundColour) add a,a add a,a ld a,(Text.BackgroundColour) jr c,PutMap.BlackForeground PutMap.WhiteForeground ld c,$FF add a,a add a,a jr c,PutMap.SetColours ld ix,SolidBlock jr PutMap.SetColours PutMap.BlackForeground ld c,$00 add a,a add a,a jr nc,PutMap.SetColours ld ix,SolidBlock PutMap.SetColours ld de,12 ld b,8 - ld a,(ix) xor c inc ix ld (hl),a add hl,de call PutMapWriteLcdIndirection djnz - pop af pop bc pop de pop ix pop hl ret SolidBlock .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ;------------------------------------------------------------------------------- ;@doc:routine ; ; === GetBufferCharAddress === ; ; Gets the address of the character cell in the buffer under the cursor. ; ; OUPTUTS: ; REGISTERS ; * HL - Address of the character cell under the cursor. ; ;@doc:end ;------------------------------------------------------------------------------- GetBufferCharAddress.Routine push af push de ; Y*12+X ld a,(Cursor.Y) add a,a ; *2 add a,a ; *4 ld e,a add a,a ; *8 add a,e ; *12 ld e,a ld d,0 ld hl,Text.Buffer add hl,de ld a,(Cursor.X) ld e,a add hl,de pop de pop af ret Clear.Routine push hl push de push bc push af call Viewport.TextIsFullScreen jp z,Clear.FullScreen call Viewport.TextIsFullWidth jp z,Clear.FullWidth Clear.Subregion ld a,(Bounds.MinX) ld c,a ld a,(Bounds.MaxX) sub c inc a ld b,a - push bc call Clear.Column pop bc inc c djnz - jp Clear.Exit Clear.Column ; In: C = column to clear. ; Clear column on video buffer. ld a,(Bounds.MinY) call ATimes96 ld de,(Lcd.Buffer) add hl,de ld b,0 add hl,bc ld a,(Bounds.MinY) ld e,a ld a,(Bounds.MaxY) sub e inc a add a,a add a,a add a,a ld b,a ld a,(Vdu.Text.BackgroundColour) add a,a add a,a sbc a,a ld de,12 - ld (hl),a add hl,de djnz - ; Clear column on text buffer. ld a,(Bounds.MinY) call ATimes12 ld de,Text.Buffer add hl,de ld b,0 add hl,bc ld a,(Bounds.MinY) ld e,a ld a,(Bounds.MaxY) sub e inc a ld b,a ld a,' ' ld de,12 - ld (hl),a add hl,de djnz - ret Clear.FullWidth ; Clear video buffer. ld a,(Bounds.MinY) ld b,a ld a,(Bounds.MaxY) sub b inc a call ATimes96 push hl ld a,(Bounds.MinY) call ATimes96 ld de,(Lcd.Buffer) add hl,de ld d,h ld e,l inc de pop bc dec bc ld a,(Vdu.Text.BackgroundColour) add a,a add a,a sbc a,a ld (hl),a ldir ; Clear character buffer. ld a,(Bounds.MinY) ld b,a ld a,(Bounds.MaxY) sub b inc a call ATimes12 push hl ld a,(Bounds.MinY) call ATimes12 ld de,Text.Buffer add hl,de ld d,h ld e,l inc de pop bc dec bc ld (hl),' ' ldir jr Clear.Exit Clear.FullScreen ld a,(Vdu.Text.BackgroundColour) add a,a add a,a sbc a,a ld hl,(Lcd.Buffer) ld d,h \ ld e,l inc de ld bc,767 ld (hl),a ldir ld hl,Vdu.Text.Buffer ld de,Vdu.Text.Buffer+1 ld bc,12*8-1 ld (hl),' ' ldir Clear.Exit pop af pop bc pop de pop hl jp Modes.Clear.Exit .endmodule