title vgabox1.asm ; variation on vgabox.asm ; creates a complete checker pattern ; calls solid_box procedure (prog085.asm) ; uses graphics mode 12h .model small if1 include ..\..\mac\basic.mac endif .data xx0 dw 0 ;(xx0,yy0)=top left corner of (first) box yy0 dw 0 width_ equ 64 ; dimensions of boxes height equ 48 no_boxes_per_row equ 10 no_boxes_per_col equ 10 ccolor dw 1 ; color of first box xoffset equ 64 yoffset equ 48 xx1 dw ? ; (xx1,yy1)=bottom right corner of boxes yy1 dw ? .code main proc initdata ; macro ; mov ah,0 ; set screen mode mov al,12h ; mode 12h int 10h ; display_it 'Using mode 12h to display checker board in 16 default colors' newline ; mov cx,no_boxes_per_col repeat_col: push cx ; cx is messed up by someone, so must save it mov ax,yy0 ; begin update yy1 add ax,height mov yy1,ax ; yy1 = yy0+width mov cx,no_boxes_per_row repeat_row: push cx mov ax,xx0 ; begin update xx1 add ax,width_ mov xx1,ax ; xx1 = xx0+width save ; setting up arguments call _solid_box ; before calling _solid_box add sp,10 ; i.e., restore add xx0,xoffset inc ccolor pop cx loop repeat_row add yy0,yoffset pop cx loop repeat_col ; pause "press any key to terminate" ; restore mode mov ah,0 mov al,3 int 10h ; exitdos main endp ;************************************************************************ ; solid_box(x0,y0,x1,y1,color) fill a rectangle defined by * ; upper-left 'x0,y0', and lower-right 'x1,y1' * ; with the specified color 'Color'. * ; Each pixel on the display corresponds to one bit in memory. * ; Thus one byte represents 8 different pixles. * ; A rectangle, in general, will consist of three vertical * ; strips. The midle strip will be composed entirely from pixels * ; forming a complete byte. The left strip has pixels only in * ; last few bits of a byte, and right strip only in first few bits * ; This routine will draw each strip in a separate loop. * ;************************************************************************ x0 EQU [BP+4] y0 EQU [BP+6] x1 EQU [BP+8] y1 EQU [BP+10] Color EQU [BP+12] ; PUBLIC _Solid_Box _Solid_Box PROC NEAR PUSH BP MOV BP,SP PUSH DI ;Preserve segment registers PUSH SI PUSH DS PUSH ES ;--- Rearrange corners so that x0