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

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

?? xbezier.asm

?? 視頻游戲開發(fā)C語言源程序
?? ASM
字號:

;-----------------------------------------------------------------------
; MODULE XBEZIER
;
;
; Compile with TASM.
; C near-callable.
;
; This module was written by Matthew MacKenzie
; matm@eng.umd.edu
;-----------------------------------------------------------------------
include xlib.inc
include xbezier.inc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; _x_bezier
;
; Plot a Bezier curve, which is described by a box of two endpoints
; and two control points:
;                           C1--------C2
;                           /           \
;                          /             \
;                        E1..............E2
;
; All coordinates must be in the range -1024 to 3071.
; No clipping is performed.
;
; C near-callable as:
; x_bezier (int E1x, int E1y, int C1x, int C1y, int C2x, int C2y,
;           int E2x, int E2y, int levels, char color,
;           unsigned int PageOffset);
;
; All four main registers are totaled.
; This function may use as many as 162 bytes of stack space.

; Bezier curves need 32-bit precision, so we'll define macros and
; constants for operations on 32-bit virtual registers V0, V1, and V2.
; V0 is made up of DI and AX, V1 of SI and BX, and V2 of CX and DX.

LowWord         equ     0
HighWord        equ     2

; to load data --

LoadV0 macro loc, field
    mov ax, word ptr [bp + loc + field + LowWord]
    mov di, word ptr [bp + loc + field + HighWord]
    endm

LoadV1 macro loc, field
    mov bx, word ptr [bp + loc + field + LowWord]
    mov si, word ptr [bp + loc + field + HighWord]
    endm

LoadV2 macro loc, field
    mov dx, word ptr [bp + loc + field + LowWord]
    mov cx, word ptr [bp + loc + field + HighWord]
    endm

; to store data --

StoreV0 macro loc, field
    mov word ptr [bp + loc + field + LowWord], ax
    mov word ptr [bp + loc + field + HighWord], di
    endm

StoreV1 macro loc, field
    mov word ptr [bp + loc + field + LowWord], bx
    mov word ptr [bp + loc + field + HighWord], si
    endm


; to take the average of two registers (result is in first register) --

AverageV0nV1 macro
	add ax, bx
	adc di, si
	shr di, 1
	rcr ax, 1
	endm

AverageV0nV2 macro
	add ax, dx
	adc di, cx
	shr di, 1
	rcr ax, 1
	endm

AverageV1nV2 macro
	add bx, dx
	adc si, cx
	shr si, 1
	rcr bx, 1
	endm


; to take the average of a register and data --

AverageV1nData macro loc, field
    add bx, word ptr [bp + loc + field + LowWord]
    adc si, word ptr [bp + loc + field + HighWord]
    shr si, 1
    rcr bx, 1
    endm

AverageV2nData macro loc, field
    add dx, word ptr [bp + loc + field + LowWord]
    adc cx, word ptr [bp + loc + field + HighWord]
    shr cx, 1
    rcr dx, 1
    endm


; to turn a 32-bit fixed point data into a regular integer --

Extract macro reg, source, field
	mov reg, word ptr [bp + source + field + HighWord]
	shr reg, 3
	adc reg, 0          ; round
	endm


; to turn an integer argument into a 32-bit fixed point number
; and store it as local data --

Convert macro source, dest, field
	mov ax, source
	add ax, 1024
	shl ax, 3
	push ax
	push 0
	endm


; useful numbers for dealing with Bezier boxes (sets of four points) --

XCoord      equ     4
YCoord      equ     0

; stack offsets for splitting boxes
E1Src       equ     48
C1Src       equ     40
C2Src       equ     32
E2Src       equ     24

E1Dest      equ     48
P1Dest      equ     40
P4Dest      equ     32
P6Dest      equ     24
P5Dest      equ     16
P2Dest      equ     8
E2Dest      equ     0

; stack offsets for drawing boxes
E1Draw      equ     24
C1Draw      equ     16
C2Draw      equ     8
E2Draw      equ     0

    .data

    align 2

; depth of recursion at which to plot
WhenToDraw label byte
   db 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4
   db 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5


; since we'll be moving bp and sp in our recursion,
; we need to put local storage in the data segment
level           dw  (?)
gencount        dw  (?)
AdjustedOffs    dw  (?)
p1xt            dw  (?)
p1yt            dw  (?)
p2xt            dw  (?)
p2yt            dw  (?)
p4xt            dw  (?)
p4yt            dw  (?)
p5xt            dw  (?)
p5yt            dw  (?)
c1xt            dw  (?)
c1yt            dw  (?)
c2xt            dw  (?)
c2yt            dw  (?)
xdiff           dw  (?)
ydiff           dw  (?)
moveline        dw  (?)
stepper         dw  (?)
bptemp          dw  (?)

; by the same token we need a copy of this argument
Colort          dw  (?)


ColumnMasks label byte
    db 011h, 022h, 044h, 088h

    .code

    align 2
_x_bezier proc
ARG     E1x, E1y, C1x, C1y, C2x, C2y, E2x, E2y, Levels, Color, PageOffs:word

    push bp
    mov bp, sp          ; caller's stack frame
    push si
    push di
    push es

	; set local variables
    mov ax, -1024       ; 1024 rows
    imul [_ScrnLogicalByteWidth]
    add ax, PageOffs
    sub ax, 256         ; 1024 columns
    mov AdjustedOffs, ax ; subtract 1024 rows and 1024 columns

; copy color into data segment so we can change bp & sp
    mov ax, Color
	mov Colort, ax

	mov cx, Levels
	dec cx              ; gencount (number of boxes we will actually plot) =
	mov ax,1            ; 2^(Levels - 1)
	shl ax,cl
	dec ax
	mov gencount, ax

	mov [level], 0      ; variable to tell us where we are in the stack
	mov bptemp, bp		; when the dust settles at the end

; translate coordinates for adjusted offset, convert 'em to fixed-point
; with 13 bits for the integer part and 19 for the fractional part,
; and push them onto the stack in the right order to for a Bezier box

	Convert E2x
	Convert E2y

	Convert C2x
	Convert C2y

	Convert C1x
	Convert C1y

	Convert E1x
	Convert E1y

	mov bp, sp          ; we are using them as basically one pointer

	mov ax, 0a000h      ; point extra segment to VGA memory
    mov es, ax

    mov dx, SC_INDEX
    mov al, MAP_MASK
    out dx, al

MainLoop:
    mov si, gencount
    mov ax, 0
    mov al, WhenToDraw[si]
    cmp ax, level       ; are we at a terminal curve?
    jne Recurse
    jmp PlotCurve

Recurse:
; not at a terminal -- so expand this curve into two more and recurse

; start with:
;    C1___C2
;     |    |
;    E1...E2
;
; stack looks like:  E1 C1 C2 E2

; expand like this:
;    C1.....P3.....C2
;     .   .     .   .
;     . _P4_P6__P5_ .
;    P1-   .. ..   P2
;     |  ..     ..  |
;     |..         ..|
;    E1............E2
;
; stack looks like:  E1 P1 P4 P6 P5 P2 E2
; Since P6 is part of both new boxes, we use it twice.

    sub sp, 24
    sub bp, 24

; new points for X --
    LoadV0      E1Src, XCoord
    LoadV1      E2Src, XCoord
    StoreV1     E2Dest, XCoord
    LoadV2      C1Src, XCoord
    AverageV0nV2
    StoreV0     P1Dest, XCoord
    AverageV1nData C2Src, XCoord
    StoreV1     P2Dest, XCoord
    AverageV2nData C2Src, XCoord
    AverageV0nV2
    StoreV0     P4Dest, XCoord
    AverageV1nV2
    StoreV1     P5Dest, XCoord
    AverageV0nV1
	StoreV0     P6Dest, XCoord

; same thing for Y --
    LoadV0      E1Src, YCoord
    LoadV1      E2Src, YCoord
    StoreV1     E2Dest, YCoord
    LoadV2      C1Src, YCoord
    AverageV0nV2
    StoreV0     P1Dest, YCoord
    AverageV1nData C2Src, YCoord
    StoreV1     P2Dest, YCoord
    AverageV2nData C2Src, YCoord
    AverageV0nV2
    StoreV0     P4Dest, YCoord
    AverageV1nV2
    StoreV1     P5Dest, YCoord
    AverageV0nV1
    StoreV0     P6Dest, YCoord

    inc level           ; one level further into stack
    jmp MainLoop

PlotCurve:
; pull 16-bit coordinates back out of 32-bit fixed-point coordinates;
; integer part is highest 13 bits

	Extract cx, C1Draw, XCoord
	Extract di, E1Draw, XCoord
    mov c1xt, cx
    add cx, di
    shr cx, 1
    mov p1xt, cx

    Extract ax, C1Draw, YCoord
    Extract si, E1Draw, YCoord
    mov c1yt, ax
    add ax, si
    shr ax, 1
	mov p1yt, ax
	call ShortLine      ; line from P1 to E1

	Extract cx, E2Draw, XCoord
	Extract di, C2Draw, XCoord
	mov c2xt, di
	add di, cx
	shr di, 1
	mov p2xt, di

	Extract ax, E2Draw, YCoord
	Extract si, C2Draw, YCoord
	mov c2yt, si
	add si, ax
	shr si, 1
	mov p2yt, si
	call ShortLine      ; line from E2 to P2

; P3 is not in any line we draw, so we'll use it now to find both P5
; for the line after this on, and P4 for this line, then discard it --
	mov bx, c1xt
	add bx, c2xt
	shr bx, 1
	mov dx, c1yt
	add dx, c2yt
	shr dx, 1

; find P5 x and save for later lines
	mov cx, p2xt
	add cx, bx
	shr cx, 1
	mov p5xt, cx
; find P4 x for this line
	mov cx, p1xt
	add cx, bx
	shr cx, 1
	mov p4xt, cx
	mov di, p1xt

; find P5 y and save for later lines
	mov ax, p2yt
	add ax, dx
	shr ax, 1
	mov p5yt, ax
; find P4 y for this line
	mov ax, p1yt
	add ax, dx
	shr ax, 1
	mov p4yt, ax
	mov si, p1yt
	call ShortLine      ; line from P4 to P1 -- finally!

; we've already done all the work for these last two --
	mov cx, p2xt
	mov di, p5xt
	mov ax, p2yt
	mov si, p5yt
	call ShortLine      ; line from P2 to P5

	mov cx, p5xt
	mov di, p4xt
	mov ax, p5yt
	mov si, p4yt
	call ShortLine      ; line from P5 to P4

; we've drawn our five lines; this bezier box
; can be dropped off the stack
    add bp, 24
    add sp, 24

    dec gencount
    mov cx, gencount
    cmp cx, -1

    je WrapUp           ; if we've generated all the terminal nodes we
                        ; are supposed to, we pack our bags and go.
	dec level
    jmp MainLoop

WrapUp:
; plot the final point, which is simply the original E1

    mov bp, bptemp      ; back where we started
    mov ax, E1y
    add ax, 1024
    mul [_ScrnLogicalByteWidth]
    mov di, E1x
    add di, 1024
    mov si, di
    shr di, 2
    add di, ax
    add di, AdjustedOffs
    and si, 3
    mov al, ColumnMasks[si]
    mov ah, byte ptr Color
    mov dx, SC_INDEX + 1
    out dx, al
    mov es:[di], ah

    pop es
    pop di
    pop si
    mov sp, bp
    pop bp
    ret                 ; git

; ShortLine subfunction --
;
; This is designed for short line segments.  For longer lines,
; especially horizontal ones, the x_line routine in the XLINE module
; would be faster.  But calling that from here it would be a lot of
; extra complication.  This is part of the x_bezier routine because
; it has no particular outside use, and we can call it much faster
; through registers than through the stack.
;
; Since our line segments overlap, the second endpoint is not drawn.
; These routines are all out of order for the sake of conditional jumps.

LRHorz:
	dec di
LRHorzLoop:
	rol al, 1
	adc bx, 0
	out dx, al
	mov es:[bx], ah
	sub di, 1
	jg LRHorzLoop
	retn

; You are in a maze of little subroutines, all alike...


LR45Deg:
    dec si
LR45DegLoop:
    add bx, cx
    rol al, 1
    adc bx, 0
    out dx, al
    mov es:[bx], ah
    sub si, 1
    jg LR45DegLoop
	retn


LRXMajor:
    mov cx, di
    dec cx
    shr di, 1
LRXMajorLoop:
    sub di, si
    jge LRXMajorIterate
    add di, xdiff
    add bx, moveline
LRXMajorIterate:
    rol al, 1
    adc bx, 0
    out dx, al
    mov es:[bx], ah
    sub cx, 1
    jg LRXMajorLoop
	retn


LeftToRight:
    mov xdiff, di       ; store distance across line

    mov cx, [_ScrnLogicalByteWidth]
    cmp si, 0           ; check if height is positive, negative, or zero
    je LRHorz
    jg LRTopToBottom
    neg si
    neg cx
LRTopToBottom:
    mov ydiff, si
    mov moveline, cx
    cmp di, si
    jg LRXMajor
    je LR45Deg


LRYMajor:
    mov cx, si
    dec cx
    shr si, 1
LRYMajorLoop:
    add bx, moveline
    sub si, di
    jge LRYMajorIterate
    add si, ydiff
    rol al, 1
    adc bx, 0
LRYMajorIterate:
    out dx, al
    mov es:[bx], ah
    sub cx, 1
    jg LRYMajorLoop
	retn


; This is the actual starting point.
; On entry, registers look like this:
; X1: cx
; Y1: ax
; X2: di
; Y2: si
ShortLine:
    sub si, ax          ; height goes out in si
    sub di, cx          ; width goes out in di

    mul [_ScrnLogicalByteWidth]
    mov dx, cx
    shr dx, 2
    add ax, dx
    add ax, AdjustedOffs
    mov bx, ax          ; starting byte of X1, Y1 goes out in bx
    and cx, 3
    mov ax, 011h
    shl al, cl          ; column mask goes out in al
    mov dx, SC_INDEX + 1
    mov ah, byte ptr Colort; color goes out in ah
    out dx, al
    mov es:[bx], ah     ; plot first point

    cmp di, 0

    jg LeftToRight
    je VerticalLine


RightToLeft:
    neg di              ; much more useful this way
    mov xdiff, di

    mov cx, [_ScrnLogicalByteWidth]
    cmp si, 0           ; check if height is positive, negative, or zero
    je RLHorz
    jg RLTopToBottom
    neg si
    neg cx
RLTopToBottom:
    mov ydiff, si
    mov moveline, cx
    cmp di, si
    jg RLXMajor
    je RL45Deg


RLYMajor:
    mov cx, si
    dec cx
    shr si, 1
RLYMajorLoop:
    add bx, moveline
    sub si, di
    jge RLYMajorIterate
    add si, ydiff
    ror al, 1
    sbb bx, 0
RLYMajorIterate:
    out dx, al
    mov es:[bx], ah
    sub cx, 1
    jg RLYMajorLoop
	retn


VerticalLine:
    mov cx, [_ScrnLogicalByteWidth]
    cmp si, 0           ; check if height is positive
    jg VTopToBottom
    neg si
    neg cx
VTopToBottom:
    dec si
VLoop:
    add bx, cx
    mov es:[bx], ah
    sub si, 1
    jg VLoop
	retn


RLHorz:
    dec di
RLHorzLoop:
    ror al, 1
    sbb bx, 0
    out dx, al
    mov es:[bx], ah
    sub di, 1
    jg RLHorzLoop
	retn


RL45Deg:
    dec si
RL45DegLoop:
    add bx, cx
    ror al, 1
    sbb bx, 0
    out dx, al
    mov es:[bx], ah
    sub si, 1
    jg RL45DegLoop
	retn


RLXMajor:
    mov cx, di
    dec cx
    shr di, 1
RLXMajorLoop:
    sub di, si
    jge RLXMajorIterate
    add di, xdiff
    add bx, moveline
RLXMajorIterate:
    ror al, 1
    sbb bx, 0
    out dx, al
    mov es:[bx], ah
    sub cx,1
    jg RLXMajorLoop
	retn


_x_bezier endp

    end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩久久久一区| 日韩美女一区二区三区四区| 免费人成精品欧美精品| 美女网站视频久久| 亚洲黄色小视频| 国产日韩欧美精品电影三级在线| 欧美人牲a欧美精品| 北岛玲一区二区三区四区| 麻豆精品新av中文字幕| 亚洲欧美日韩国产手机在线| 久久免费视频色| 91精品国产91久久久久久一区二区 | 国产精品99久久久| 亚洲成人你懂的| 国产在线一区二区综合免费视频| 亚洲人吸女人奶水| 久久久久久久久久电影| 日韩欧美亚洲国产另类| 91.麻豆视频| 欧美亚洲动漫精品| 91麻豆产精品久久久久久| 国产·精品毛片| 国产麻豆9l精品三级站| 毛片av一区二区三区| 亚洲国产精品一区二区尤物区| 亚洲丝袜美腿综合| 国产精品久久毛片| 国产精品美日韩| 国产欧美一区二区三区在线老狼| 午夜在线成人av| 亚洲第一主播视频| 一区二区三区不卡视频| 一区二区三区成人| 亚洲国产精品一区二区尤物区| 亚洲裸体在线观看| 亚洲日本丝袜连裤袜办公室| 国产精品美女视频| 亚洲欧洲日韩av| 亚洲天堂网中文字| 亚洲久本草在线中文字幕| 亚洲视频免费看| 亚洲黄色尤物视频| 亚洲成人自拍一区| 奇米精品一区二区三区在线观看一| 欧美在线高清视频| 欧美系列亚洲系列| 91精品视频网| 亚洲精品一区在线观看| 日本一区二区久久| 亚洲欧美日韩国产综合在线| 夜夜操天天操亚洲| 日本一道高清亚洲日美韩| 喷白浆一区二区| 国产成人精品亚洲777人妖 | 日韩电影在线一区| 美女一区二区视频| 国产一区二区91| 久久久综合激的五月天| 国产日韩欧美亚洲| 亚洲人被黑人高潮完整版| 亚欧色一区w666天堂| 另类小说图片综合网| 国产二区国产一区在线观看| 一本色道亚洲精品aⅴ| 欧美日韩国产高清一区二区| 欧美刺激午夜性久久久久久久 | 亚洲aaa精品| 久久成人羞羞网站| 国产精品一区二区在线播放| 99久久精品免费精品国产| 欧美美女激情18p| 国产婷婷色一区二区三区四区| 国产成人精品午夜视频免费| 91小视频免费观看| 日韩欧美精品在线视频| 国产精品丝袜一区| 午夜精品福利在线| 国产高清视频一区| 欧美怡红院视频| 国产午夜精品福利| 性做久久久久久久久| 国产成人精品免费在线| 欧美日韩一区二区在线观看视频| 久久久www免费人成精品| 一区二区在线电影| 国产一区二区在线观看免费 | 色综合天天在线| 亚洲一区二区三区四区五区黄| 另类小说综合欧美亚洲| 日本高清成人免费播放| 精品少妇一区二区三区视频免付费 | 欧美高清视频一二三区| 国产日产亚洲精品系列| 免费av网站大全久久| 色综合久久中文综合久久97| 精品少妇一区二区三区免费观看| 亚洲一区免费视频| 丰满放荡岳乱妇91ww| 日韩精品中午字幕| 亚洲成av人片在www色猫咪| 成人av在线一区二区三区| 欧美大胆一级视频| 天天综合色天天| 日本高清不卡视频| 日本一区免费视频| 紧缚奴在线一区二区三区| 7777精品伊人久久久大香线蕉最新版| 中文字幕日韩一区二区| 国产成人精品免费在线| 日本在线不卡视频一二三区| 91精品1区2区| 亚洲天堂福利av| 成人黄页在线观看| 国产欧美精品一区| 国产乱对白刺激视频不卡| 欧美大片拔萝卜| 麻豆91在线看| 日韩一区二区麻豆国产| 日本最新不卡在线| 欧美区一区二区三区| 亚洲一级二级三级| 欧洲视频一区二区| 亚洲精品国产第一综合99久久| 成人毛片老司机大片| 国产免费久久精品| 成人免费看的视频| 国产精品伦理在线| 久久久亚洲综合| 国产一区不卡视频| 国产亚洲制服色| 国产精品一二三| 日本一区二区三区视频视频| 国产91精品露脸国语对白| 国产日韩三级在线| 成人av电影在线播放| 18欧美乱大交hd1984| 99精品欧美一区二区蜜桃免费 | 94色蜜桃网一区二区三区| 国产精品国产三级国产有无不卡| 国产成a人无v码亚洲福利| 国产女人18毛片水真多成人如厕| 成人黄色网址在线观看| 国产不卡视频一区二区三区| 国产欧美日韩久久| 成人一区在线观看| 亚洲视频图片小说| 欧美图区在线视频| 日本成人在线看| 2020国产精品自拍| 粉嫩aⅴ一区二区三区四区五区| 国产蜜臀97一区二区三区| 国产欧美视频在线观看| 韩国中文字幕2020精品| 一本大道久久精品懂色aⅴ| 成人免费在线视频观看| 欧美日免费三级在线| 奇米精品一区二区三区在线观看一| 欧美大片一区二区| 久久午夜免费电影| 亚洲色图在线看| 在线免费亚洲电影| 日韩精品一区二区三区视频播放 | 国产一区二区三区在线观看免费| av不卡在线观看| 精品日韩一区二区三区| 亚洲伊人伊色伊影伊综合网| 国产成人一级电影| 欧美一区二区三区在线电影| 亚洲日本va午夜在线电影| 国产一区欧美日韩| 欧美一级黄色录像| 亚洲综合视频网| 91丨九色丨国产丨porny| 久久新电视剧免费观看| 免费成人美女在线观看.| 欧美日韩一区二区电影| 国产精品你懂的在线欣赏| 欧美日韩免费不卡视频一区二区三区| 国产女人18毛片水真多成人如厕 | 亚洲欧美一区二区三区极速播放| 国产一区二区久久| 精品少妇一区二区三区免费观看 | 日韩国产一二三区| 一本久久a久久精品亚洲| 国产精品久久久久一区| 国产精品1区二区.| 久久这里只有精品视频网| 成人动漫一区二区三区| 国产精品欧美一区二区三区| 国产一区二区三区电影在线观看 | 亚洲高清视频中文字幕| 91福利小视频| 亚洲男同性视频| 日本乱码高清不卡字幕| 亚洲欧美电影一区二区| 色综合一区二区三区| 一区二区三区蜜桃网| 在线观看一区不卡| 天天av天天翘天天综合网色鬼国产| 欧美在线免费播放|