亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? xrect.asm

?? 視頻游戲開發C語言源程序
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
;-----------------------------------------------------------------------
; MODULE XRECT
;
; Rectangle functions all MODE X 256 Color resolutions
;
; Compile with Tasm.
; C callable.
;
;
; ****** XLIB - Mode X graphics library                ****************
; ******                                               ****************
; ****** Written By Themie Gouthas                     ****************
;
; egg@dstos3.dsto.gov.au
; teg@bart.dsto.gov.au
;-----------------------------------------------------------------------


include xlib.inc
include xrect.inc


	.data
; Plane masks for clipping left and right edges of rectangle.
        LeftClipPlaneMask       db      00fh,00eh,00ch,008h
	RightClipPlaneMask      db      00fh,001h,003h,007h
	.code

;---------------------------------------------------------------------------
; Mode X (320x240, 256 colors) rectangle solid colour fill routine.
;
; Based on code originally published in DDJ Mag by M. Abrash
;
; with TASM 2. C near-callable as:
;
;    void x_rect_fill_clipped(int StartX, int StartY, int EndX, int EndY,
;       unsigned int PageBase, unsigne int color);
;
;


_x_rect_fill_clipped proc
ARG     StartX:word,StartY:word,EndX:word,EndY:word,PageBase:word,Color:word
	push bp              ;preserve caller's stack frame
	mov  bp,sp           ;point to local stack frame
	push si              ;preserve caller's register variables
	push di

	mov   dx,[_TopClip]           ; Compare u.l. Y coord with Top
	mov   cx,[_BottomClip]
	mov   ax,[StartY]
	mov   bx,[EndY]
        cmp   dx,ax
        jle   @@CheckBottomClip
	cmp   dx,bx
	jg    @@NotVisible
	mov   [StartY],dx

@@CheckBottomClip:
	cmp   cx,bx
	jg    @@CheckLeftClip
	cmp   cx,ax
	jl    @@NotVisible
	mov   [EndY],cx

@@CheckLeftClip:
	mov   dx,[_LeftClip]           ; Compare u.l. Y coord with Top
	mov   cx,[_RightClip]
	mov   ax,[StartX]
	mov   bx,[EndX]
	sal   dx,2
	sal   cx,2
	cmp   dx,ax
	jle   @@CheckRightClip
	cmp   dx,bx
	jg    @@NotVisible
	mov   [StartX],dx

@@CheckRightClip:
	cmp   cx,bx
	jg    RFClipDone
	cmp   cx,ax
	jl    @@NotVisible
	mov   [EndX],cx
	jmp   RFClipDone

@@NotVisible:
	mov   ax,1
	pop   di                          ; restore registers
	pop   si
	pop   bp
	ret
_x_rect_fill_clipped endp



;---------------------------------------------------------------------------
; Mode X (320x240, 256 colors) rectangle solid colour fill routine.
;
; Based on code originally published in DDJ Mag by M. Abrash
;
; with TASM 2. C near-callable as:
;
;    void x_rect_fill(int StartX, int StartY, int EndX, int EndY,
;       unsigned int PageBase, unsigne int color);
;
;


_x_rect_fill proc
ARG     StartX:word,StartY:word,EndX:word,EndY:word,PageBase:word,Color:word
	push bp              ;preserve caller's stack frame
	mov  bp,sp           ;point to local stack frame
	push si              ;preserve caller's register variables
	push di

RFClipDone:
	cld
	mov  ax,[_ScrnLogicalByteWidth]
	mul  [StartY]            ;offset in page of top rectangle scan line
	mov  di,[StartX]
	sar  di,2                ;X/4 = offset of first rectangle pixel in scan
	add  di,ax               ;offset of first rectangle pixel in page
	add  di,[PageBase]       ;offset of first rectangle pixel in
			         ; display memory
	mov  ax,SCREEN_SEG       ;point ES:DI to the first rectangle
	mov  es,ax               ; pixel's address
	mov  dx,SC_INDEX         ;set the Sequence Controller Index to
	mov  al,MAP_MASK         ; point to the Map Mask register
	out  dx,al
	inc  dx                  ;point DX to the SC Data register
	mov  si,[StartX]
	and  si,0003h                    ;look up left edge plane mask
	mov  bh,LeftClipPlaneMask[si]    ; to clip & put in BH
	mov  si,[EndX]
	and  si,0003h                    ;look up right edge plane
	mov  bl,RightClipPlaneMask[si]   ; mask to clip & put in BL

	mov  cx,[EndX]                   ;calculate # of addresses across rect
	mov  si,[StartX]
	cmp  cx,si
	jle  @@FillDone                  ;skip if 0 or negative width
	dec  cx
	and  si,not 011b
	sub  cx,si
	sar  cx,2                 ;# of addresses across rectangle to fill - 1
	jnz  @@MasksSet           ;there's more than one byte to draw
	and  bh,bl                ;there's only one byte, so combine the left
                                  ; and right edge clip masks
@@MasksSet:
	mov  si,[EndY]
	sub  si,[StartY]            ;BX = height of rectangle
	jle  @@FillDone             ;skip if 0 or negative height
	mov  ah,byte ptr [Color]    ;color with which to fill
	mov  bp,[_ScrnLogicalByteWidth]  ;stack frame isn't needed any more
	sub  bp,cx                  ;distance from end of one scan line to start
	dec  bp                     ; of next
@@FillRowsLoop:
	push cx                     ;remember width in addresses - 1
	mov  al,bh                  ;put left-edge clip mask in AL
	out  dx,al                  ;set the left-edge plane (clip) mask
	mov  al,ah                  ;put color in AL
	stosb                       ;draw the left edge
	dec  cx                     ;count off left edge byte
	js   @@FillLoopBottom       ;that's the only byte
	jz   @@DoRightEdge          ;there are only two bytes
	mov  al,00fh                ;middle addresses drawn 4 pixels at a pop
	out  dx,al                  ;set the middle pixel mask to no clip
	mov  al,ah                  ;put color in AL
	rep  stosb                  ;draw middle addresses four pixels apiece
@@DoRightEdge:
	mov  al,bl                  ;put right-edge clip mask in AL
	out  dx,al                  ;set the right-edge plane (clip) mask
	mov  al,ah                  ;put color in AL
        stosb                       ;draw the right edge
@@FillLoopBottom:
	add  di,bp                  ;point to start of the next scan line of
                                    ; the rectangle
	pop  cx                     ;retrieve width in addresses - 1
	dec  si                     ;count down scan lines
	jnz  @@FillRowsLoop
@@FillDone:
	pop  di                     ;restore caller's register variables
	pop  si
	pop  bp                     ;restore caller's stack frame
        ret
_x_rect_fill endp



;---------------------------------------------------------------------------
; Mode X (320x240, 256 colors) rectangle 4x4 pattern fill routine.
; Upper left corner of pattern is always aligned to a multiple-of-4
; row and column. Works on all VGAs. Uses approach of copying the
; pattern to off-screen display memory, then loading the latches with
; the pattern for each scan line and filling each scan line four
; pixels at a time. Fills up to but not including the column at EndX
; and the row at EndY. No clipping is performed. All ASM code tested
;
;
; Based on code originally published in DDJ Mag by M. Abrash
;
;
;  C near-callable as:
;
;    void x_rect_pattern_clipped(int StartX, int StartY, int EndX, int EndY,
;       unsigned int PageBase, char far * Pattern);
;
;

_x_rect_pattern_clipped proc
ARG     StartX:word,StartY:word,EndX:word,EndY:word,PageBase:word,Pattern:dword
LOCAL   NextScanOffset:word,RectAddrWidth:word,Height:word=LocalStk
	push bp                       ;preserve caller's stack frame
	mov  bp,sp                    ;point to local stack frame
	sub  sp,LocalStk              ;allocate space for local vars
	push si                       ;preserve caller's register variables
	push di
	push ds

	mov   dx,[_TopClip]           ; Compare u.l. Y coord with Top
	mov   cx,[_BottomClip]
	mov   ax,[StartY]
	mov   bx,[EndY]
	cmp   dx,ax
	jle   @@CheckBottomClip
	cmp   dx,bx
	jg    @@NotVisible
	mov   [StartY],dx

@@CheckBottomClip:
	cmp   cx,bx
	jg    @@CheckLeftClip
	cmp   cx,ax
	jl    @@NotVisible
	mov   [EndY],cx

@@CheckLeftClip:
	mov   dx,[_LeftClip]           ; Compare u.l. Y coord with Top
	mov   cx,[_RightClip]
	mov   ax,[StartX]
	mov   bx,[EndX]
	sal   dx,2
	sal   cx,2
	cmp   dx,ax
	jle   @@CheckRightClip
	cmp   dx,bx
	jg    @@NotVisible
	mov   [StartX],dx

@@CheckRightClip:
	cmp   cx,bx
	jg    RPClipDone
	cmp   cx,ax
	jl    @@NotVisible
	mov   [EndX],cx
	jmp   RPClipDone

@@NotVisible:
	mov   ax,1
	pop   ds
	pop   di                          ; restore registers
	pop   si
	mov   sp,bp
	pop   bp
	ret

_x_rect_pattern_clipped endp

;---------------------------------------------------------------------------
; Mode X (320x240, 256 colors) rectangle 4x4 pattern fill routine.
; Upper left corner of pattern is always aligned to a multiple-of-4
; row and column. Works on all VGAs. Uses approach of copying the
; pattern to off-screen display memory, then loading the latches with
; the pattern for each scan line and filling each scan line four
; pixels at a time. Fills up to but not including the column at EndX
; and the row at EndY. No clipping is performed. All ASM code tested
;
;
; Based on code originally published in DDJ Mag by M. Abrash
;
;
;  C near-callable as:
;
;    void x_rect_pattern(int StartX, int StartY, int EndX, int EndY,
;       unsigned int PageBase, char far * Pattern);



_x_rect_pattern proc
ARG     StartX:word,StartY:word,EndX:word,EndY:word,PageBase:word,Pattern:dword
LOCAL   NextScanOffset:word,RectAddrWidth:word,Height:word=LocalStk
	push bp                       ;preserve caller's stack frame
	mov  bp,sp                    ;point to local stack frame
	sub  sp,LocalStk              ;allocate space for local vars
	push si                       ;preserve caller's register variables
	push di
	push ds

RPClipDone:
	cld
	mov  ax,SCREEN_SEG            ;point ES to display memory
	mov  es,ax
				      ;copy pattern to display memory buffer
	lds  si,dword ptr [Pattern]   ;point to pattern to fill with
	mov  di,PATTERN_BUFFER        ;point ES:DI to pattern buffer
	mov  dx,SC_INDEX              ;point Sequence Controller Index to
	mov  al,MAP_MASK              ; Map Mask
	out  dx,al
	inc  dx                       ;point to SC Data register
	mov  cx,4                     ;4 pixel quadruplets in pattern
@@DownloadPatternLoop:
	mov  al,1                     ;
	out  dx,al                    ;select plane 0 for writes
        movsb                         ;copy over next plane 0 pattern pixel
	dec  di                       ;stay at same address for next plane
	mov  al,2                     ;
	out  dx,al                    ;select plane 1 for writes
	movsb                         ;copy over next plane 1 pattern pixel
	dec  di                       ;stay at same address for next plane
	mov  al,4                     ;
	out  dx,al                    ;select plane 2 for writes
        movsb                         ;copy over next plane 2 pattern pixel
	dec  di                       ;stay at same address for next plane
	mov  al,8                     ;
	out  dx,al                    ;select plane 3 for writes
        movsb                         ;copy over next plane 3 pattern pixel
                                      ; and advance address
        loop @@DownloadPatternLoop
        pop  ds

	mov  dx,GC_INDEX              ;set the bit mask to select all bits
	mov  ax,00000h+BIT_MASK       ; from the latches and none from
	out  dx,ax                    ; the CPU, so that we can write the
                                      ; latch contents directly to memory
	mov  ax,[StartY]              ;top rectangle scan line
	mov  si,ax
	and  si,011b                  ;top rect scan line modulo 4
	add  si,PATTERN_BUFFER        ;point to pattern scan line that
				      ; maps to top line of rect to draw
	mov  dx,[_ScrnLogicalByteWidth]
	mul  dx                       ;offset in page of top rect scan line
	mov  di,[StartX]

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品少妇一区二区三区日产乱码| 91精品国产综合久久小美女| 欧美婷婷六月丁香综合色| 日韩欧美中文字幕一区| 亚洲青青青在线视频| 卡一卡二国产精品| 在线国产亚洲欧美| 国产精品美女一区二区| 韩国精品主播一区二区在线观看| 日本乱人伦一区| 国产精品国产自产拍在线| 久久精品二区亚洲w码| 日本高清不卡视频| 亚洲欧洲一区二区在线播放| 国产精品资源在线看| 欧美一区二区黄色| 日韩精品国产精品| 91久久精品国产91性色tv| 国产精品你懂的在线欣赏| 精品一区免费av| 精品91自产拍在线观看一区| 免费日韩伦理电影| 在线不卡a资源高清| 亚洲宅男天堂在线观看无病毒| 99re热视频这里只精品| 中文字幕欧美激情| 成人激情小说乱人伦| 国产清纯在线一区二区www| 精品亚洲porn| 欧美精品一区二区三区久久久| 日韩综合一区二区| 欧美一级日韩一级| 美腿丝袜亚洲综合| wwwwxxxxx欧美| 丁香一区二区三区| 国产精品理论片| 91视视频在线观看入口直接观看www| 欧美国产丝袜视频| 91欧美激情一区二区三区成人| 亚洲少妇30p| 欧美色图片你懂的| 亚洲国产欧美另类丝袜| 欧美日韩精品高清| 日韩影院在线观看| 精品国内片67194| 国产成人综合自拍| 中文字幕亚洲精品在线观看| 在线中文字幕不卡| 免费看日韩精品| 国产欧美一区二区三区鸳鸯浴| 国产在线不卡一区| 亚洲色图制服诱惑| 欧美猛男超大videosgay| 午夜久久久久久| 欧美成人精品1314www| 国模冰冰炮一区二区| 中文字幕在线一区免费| 欧美性淫爽ww久久久久无| 蜜臀91精品一区二区三区| 欧美国产激情一区二区三区蜜月| www.在线成人| 午夜国产不卡在线观看视频| 精品国产电影一区二区| 成人国产视频在线观看| 亚洲综合色区另类av| 日韩视频在线你懂得| 99精品久久久久久| 日本三级韩国三级欧美三级| 欧美极品另类videosde| 欧美视频在线一区| 国产一区二区三区不卡在线观看 | 亚洲精品国久久99热| 欧美电影一区二区| 丰满白嫩尤物一区二区| 亚洲成人av资源| 亚洲图片激情小说| 精品国产乱码久久久久久久久 | aaa国产一区| 美女久久久精品| 一区二区三区四区中文字幕| 精品国产91乱码一区二区三区 | 国产欧美日韩视频一区二区 | 国产日产欧美精品一区二区三区| 欧美亚洲国产一卡| 成人三级伦理片| 久久精品国产99国产精品| 亚洲综合成人在线视频| 国产日韩欧美精品在线| 在线电影院国产精品| 色哟哟在线观看一区二区三区| 国产精品亚洲综合一区在线观看| 日韩在线观看一区二区| 亚洲天堂免费看| 久久久综合精品| 91精品在线免费| 91久久国产综合久久| www.亚洲人| 99久久婷婷国产| 成人国产精品免费观看视频| 粉嫩av一区二区三区在线播放| 麻豆91在线观看| 免费观看一级欧美片| 亚洲一区二区在线免费观看视频| 国产精品日日摸夜夜摸av| 国产无遮挡一区二区三区毛片日本| 精品久久一区二区| 精品日韩在线观看| 久久伊人中文字幕| 久久久国产一区二区三区四区小说| 精品久久久久久久久久久久久久久| 欧美一区二区女人| 精品免费视频.| 国产午夜精品福利| 国产精品久久久久一区二区三区共| 欧美国产一区在线| 中文字幕五月欧美| 亚洲精选视频在线| 亚洲综合av网| 天天做天天摸天天爽国产一区| 亚洲电影一级黄| 蜜臀av国产精品久久久久| 久久国产欧美日韩精品| 久久99日本精品| 成人网在线免费视频| 成人理论电影网| 欧美性猛交xxxx乱大交退制版| 欧美图区在线视频| 欧美一区午夜视频在线观看| 欧美大黄免费观看| 久久精品欧美日韩| 欧美高清在线精品一区| 日韩三级电影网址| www久久久久| 亚洲色图.com| 曰韩精品一区二区| 青青草91视频| 成人午夜激情在线| 色综合久久久久久久| 欧美一区二区三区小说| 日韩欧美一二区| 国产精品久线观看视频| 一区在线中文字幕| 日韩av一区二区在线影视| 国产主播一区二区| 99国产精品久久久| 欧美一区二区网站| 久久在线免费观看| 亚洲成年人影院| 日韩视频中午一区| 日韩理论片网站| 久久精品二区亚洲w码| 丁香一区二区三区| 日韩视频免费观看高清完整版在线观看| 五月婷婷激情综合| 国产在线精品一区二区三区不卡| 国产成人鲁色资源国产91色综| 91国内精品野花午夜精品| 精品久久久久99| 亚洲欧美二区三区| 国产综合一区二区| 91老师片黄在线观看| 26uuuu精品一区二区| 国产欧美久久久精品影院| 一区二区三区四区视频精品免费 | 蜜臀99久久精品久久久久久软件| 国产一区二区三区免费| 色哟哟精品一区| 色婷婷久久久久swag精品| 日韩三级高清在线| 一区二区三区中文字幕电影| 国产精品一区三区| 91久久久免费一区二区| 国产精品午夜在线观看| 亚洲国产精品久久久男人的天堂 | 日韩综合在线视频| 国产a级毛片一区| 欧美成人video| 亚洲综合一区二区三区| www.66久久| 国产午夜精品美女毛片视频| 五月婷婷久久丁香| 欧美三片在线视频观看| 中文字幕不卡在线播放| 国产一区三区三区| 欧美va亚洲va| 亚洲成人在线免费| 在线看国产一区| 中文字幕av在线一区二区三区| 国产盗摄一区二区三区| 久久综合九色综合欧美98| 亚洲成人免费在线| 欧美色综合影院| 亚洲欧美日韩国产手机在线 | 中文字幕免费观看一区| 国内国产精品久久| 欧美日韩一本到| 亚洲欧美电影院| 色哟哟一区二区在线观看| 国产精品久久久久久久久晋中| 成人福利视频在线看|