| Code: ;************************** ; Interrupt - enable ; Stack, Program & Data - in (8000h..BFFFh) ; Video-RAM - in (C000h..FFFFh) ; Video-Data - (0000h..BFFFh) ; ; Screen_offset EQU 0C000h ; or 0C140h for second grafic screen
Video_Data EQU *** ; 0000h..BFFFh Color_for_fill EQU *** ; 0..255
Horizontal_offset EQU *** ; 0...319 Vertical_offset EQU *** ; 0...255 Horizontal_size EQU *** ; 1...256 Vertical_size EQU *** ; 1...256
;**************************
Open_video_page:
IN A,(PORT_Y) LD (SAVE_PY),A ; save port_y IN A,(PAGE3) LD (SAVE_PG3),A ; save page3 LD A,50h ; Use 50h for normal mode ; 54h for "no copy in main shadow RAM" mode ; 58h for "FF is transparent" mode ; 5Ch for "no copy in main shadow RAM" and ; "FF is transparent" mode OUT (PAGE3),A RET
SAVE_PG3: DB 0FFh SAVE_PY: DB 0C0h
;**************************
Close_video_page:
LD A,(SAVE_PG3) OUT (PAGE3),A LD A,(SAVE_PY) OUT (PORT_Y),A RET
;**************************
Horizontal_Line_copy:
LD HL,Video_Data LD DE,Screen_Offset+Horizontal_Offset LD A,Vertical_Offset OUT (PORT_Y),A ; Set vertical offset DI LD D,D ; Switch the Accelerator to define block size mode LD A,Horizontal_size ; Use direct data or (HL),(BC),(DE) only! ; !!! not ld A,C !!! LD B,B ; Stop the Accelerator LD L,L ; Switch the Accelerator to copying a data block mode LD A,(HL) ; Get data line LD (DE),A ; Put data line LD B,B ; Stop the Accelerator EI RET
;**************************
Vertical_Line_copy:
LD HL,Video_Data LD DE,Screen_Offset+Horizontal_Offset LD A,Vertical_Offset OUT (PORT_Y),A ; Set vertical offset DI LD D,D ; Switch the Accelerator to define block size mode LD A,Vertical_size ; Use direct data or (HL),(BC),(DE) only! ; !!! not ld A,C !!! LD B,B ; Stop the Accelerator LD A,A ; Switch the Accelerator to copying a graphic data block mode LD A,(HL) ; Get data line LD (DE),A ; Put data line LD B,B ; Stop the Accelerator EI RET
;**************************
Horizontal_Line_Fill:
LD DE,Screen_Offset+Horizontal_Offset LD A,Vertical_Offset OUT (PORT_Y),A ; Set vertical offset DI LD D,D ; Switch the Accelerator to define block size mode LD A,Horizontal_size ; Use direct data or (HL),(BC),(DE) only! ; !!! not ld A,C !!! LD B,B ; Stop the Accelerator LD A,Color_for_fill LD C,C ; Switch the Accelerator to filling by one byte mode LD (DE),A ; Put line of color LD B,B ; Stop the Accelerator EI RET
;**************************
Vertical_Line_Fill:
LD DE,Screen_Offset+Horizontal_Offset LD A,Vertical_Offset OUT (PORT_Y),A ; Set vertical offset DI LD D,D ; Switch the Accelerator to define block size mode LD A,Vertical_size ; Use direct data or (HL),(BC),(DE) only! ; !!! not ld A,C !!! LD B,B ; Stop the Accelerator LD A,Color_for_fill LD E,E ; Switch the Accelerator to filling by one byte mode LD (DE),A ; Put line of color LD B,B ; Stop the Accelerator EI RET
;**************************
Draw_Restangle_Data:
LD HL,Video_Data LD DE,Screen_Offset+Horizontal_Offset LD A,Vertical_Offset OUT (PORT_Y),A ; Set vertical offset LD B,Vertical_size ; 0 is 256 LD C,Horizontal_Size ; 0 is 256
DI LD D,D ; Switch the Accelerator to define block size mode LD A,Horizontal_Size ; Use direct data or (HL),(BC),(DE) only! ; !!! not ld A,C !!! LD B,B ; Stop the Accelerator EI
drd_loop: DI LD L,L ; Switch the Accelerator to copying a data block mode LD A,(HL) ; Get data line LD (DE),A ; Put data line LD B,B ; Stop the Accelerator EI
LD A,C ; Next line data AND A JR Z,drd_inc ADD A,L LD L,A JR NC,drd_no_inc drd_inc: INC H drd_no_inc:
IN A,(PORT_Y) ; Next line INC A OUT (PORT_Y),A
DJNZ drd_loop ; Loop
RET
;**************************
Draw_Restangle_Fill:
LD HL,Screen_Offset+Horizontal_Offset LD A,Vertical_Offset OUT (PORT_Y),A ; Set vertical offset LD B,Vertical_size ; 0 is 256
DI LD D,D ; Switch the Accelerator to define block size mode LD A,Horizontal_Size ; Use direct data or (HL),(BC),(DE) only! ; !!! not ld A,C !!! LD B,B ; Stop the Accelerator EI
LD C,Color_for_fill
IN A,(PORT_Y) drf_loop: DI LD L,L ; Switch the Accelerator to copying a data block mode LD (HL),C ; Put data line LD B,B ; Stop the Accelerator EI INC A OUT (PORT_Y),A DJNZ drf_loop ; Loop
RET
;************************** ;**************************
| |