NEW
  AUTO 3,1
				.LIST OFF	
*--------------------------------------
* HLINE X1,X2 at Y1  (XOR,SET,ORA)
*--------------------------------------
HLINE			lda CB.Cache+S.CB.M

				cmp #S.CB.M.MONO
				bne HLINE.C16
HLINE.MONO		>LDYA CB.Cache+S.CB.X1
				jsr LBUF.SetBounds1YA
				>LDYA CB.Cache+S.CB.X2
				jsr LBUF.SetBounds2YA

				lda CB.Cache+S.CB.COLOR
				beq .1
				lda #%01111111
.1				ldx LBUF.C1
.2				sta LBUF.DATA,x
				cpx LBUF.C2
				inx
				bcc .2	

				ldy CB.Cache+S.CB.Y1
				jmp LBUF.DrawAtY
HLINE.C16		lda CB.Cache+S.CB.X1
				and #%11111100
				tay
				lda CB.Cache+S.CB.X1+1
				jsr LBUF.SetBounds1YA

				lda CB.Cache+S.CB.X2
				ora #%00000011
				tay
				lda CB.Cache+S.CB.X2+1
				jsr LBUF.SetBounds2YA

				lda CB.Cache+S.CB.COLOR
				asl
				asl
				clc
				adc L.Color.Pixels
				sta ZPTmpWord
				lda L.Color.Pixels+1
				adc #0
				sta ZPTmpWord+1
				ldx LBUF.C1
.1				txa
				and #3					Compute index in Palette (Mod 4)
				tay
.2				lda (ZPTmpWord),y
				sta LBUF.DATA,x
				cpx LBUF.C2
				inx
				bcc .1	

				ldy CB.Cache+S.CB.Y1
				jmp LBUF.DrawAtY
*--------------------------------------
* VLINE Y1,Y2 at X1  (XOR,SET,ORA)
*--------------------------------------
VLINE			lda CB.Cache+S.CB.M
				cmp #S.CB.M.MONO
				bne VLINE.C16
			
VLINE.MONO		>LDYA CB.Cache+S.CB.X1

				jsr DIVMOD7YA			X = MOD 7
				tay
				lda COL.OFS,y
				sta ZPTmpByte			Save COL (DIV)
				lda COL.BANK,y
				tay
				sta $C000,y				Select proper BANK
				ldy CB.Cache+S.CB.Y1
				clc

				lda CB.Cache+S.CB.OP
*				cmp #S.CB.OP.XOR
				beq VLINE.MONO.XOR
				lda CB.Cache+S.CB.COLOR
				bne VLINE.MONO.WHITE

VLINE.MONO.BLACK
.1				lda BASEL,y
				adc ZPTmpByte
				sta ZPBasePtr
				lda BASEH,y
				sta ZPBasePtr+1
				lda (ZPBasePtr)
				and Mono.NMasks,x
				sta (ZPBasePtr)
				cpy CB.Cache+S.CB.Y2
				iny
				bcc .1
				rts

VLINE.MONO.WHITE
				lda #$1D				ORA abs,x
				.HS 2C					BIT ABS
VLINE.MONO.XOR
				lda #$5D				EOR abs,x
				sta .2
.1				lda BASEL,y
				adc ZPTmpByte
				sta ZPBasePtr
				lda BASEH,y
				sta ZPBasePtr+1
				lda (ZPBasePtr)
.2				eor Mono.Masks,x		SELF MODIFIED
				sta (ZPBasePtr)
				cpy CB.Cache+S.CB.Y2
				iny
				bcc .1
				rts
	
VLINE.C16		lda CB.Cache+S.CB.X1
				lsr CB.Cache+S.CB.X1+1			divide by 4
				ror
				lsr CB.Cache+S.CB.X1+1
				ror
				tay						Y=X/4 (range 0->139)

				ldx CB.Cache+S.CB.Y1

.1				phy
				phx
				jsr SETPIXEL.C16.YX
				plx
				ply

				cpy CB.Cache+S.CB.Y2
				iny
				bcc .1
				rts
*--------------------------------------
MAN
SAVE USR/SRC/DRV/DHGR.DRV.S.LINE
LOAD USR/SRC/DRV/DHGR.DRV.S
ASM
