Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- call Set_Pixel
- mov cx, [x1]
- cmp cx, [x0] ; compare x0 with x1
- jne Type1
- jmp Type2
- goloop:
- jmp start_loop ; re-start loop
- ret ; exit
- Done:
- ret
- OneX:
- mov [sx], word 1
- jmp CheckY
- MinusOneX:
- mov [sx], word -1
- jmp CheckY
- OneY:
- mov [sy], word 1
- jmp BackY
- MinusOneY:
- mov [sy], word -1
- jmp BackY
- ErrMinusDY:
- mov dx,[difY]
- sub [err],dx
- jmp return1
- ErrMinusDY2:
- mov dx,[difY]
- sub [err],dx
- jmp return3
- ErrPlusDX:
- mov dx,[difX]
- add [err],dx
- jmp return2
- LessThanX:
- neg ax ; if
- mov [difX], ax
- jmp AfterLessThanCheckX
- LessThanY:
- neg bx
- mov [difY], bx
- jmp AfterLessThanCheckY
- ExitCondition:
- cmp cx, ax
- je ExitY
- jmp AssignSXvalues
- ExitY:
- cmp dx, bx
- je Done
- jmp AssignSXvalues
- CheckY:
- cmp dx, bx ; compare y0 with y1
- jl OneY
- jmp MinusOneY ; if they are the same exit loop
- Type1:
- mov ax, [y1]
- cmp ax, [y0]
- je startthis
- mov cx, [err]
- add cx, [err]
- mov [e2], cx
- neg word[difY]
- cmp [difY],cx ; compare e2 with negative difference of Y
- jg ErrMinusDY ; if e2 greater than -dy, err now equals dx - 2dy
- return1:
- mov dx, [x0]
- add dx, [sx] ; add 1 to x0
- mov [x0], dx
- cmp [difX], cx
- jl ErrPlusDX
- return2:
- mov dx, [y0]
- add dx, [sy] ;
- mov [y0], dx
- jmp goloop
- Type2:
- mov dx, [y1] ; if x0,x1 and y0 and y1 are both equal exit code
- cmp dx, [y0]
- je Done
- mov cx, [err] ; assign 2 * err to e2
- add cx, [err]
- mov [e2], cx
- neg word[difY] ; make difference of y negative
- mov bx,[difY]
- cmp [e2], bx ; compare e2 with negative difference of Y
- jl comp2 ; if it is less go to second comparison function
- sub [err], bx
- mov dx, [x0]
- add dx, [sx] ; add 1 to x0
- mov [x0], dx
- comp2:
- mov ax,[difX]
- cmp [e2],ax
- jg Done
- add [err], ax
- mov dx, [y0]
- add dx, [sy] ;
- mov [y0], dx
- jmp goloop
- startthis:
- mov cx, [err] ; assign 2 * err to e2
- add cx, [err]
- mov [e2], cx
- neg word[difY]
- cmp [difY],cx ; compare e2 with negative difference of Y
- jg ErrMinusDY2 ; if e2 greater than -dy, err now equals dx - 2dy
- return3:
- mov dx, [x0]
- add dx, [sx] ; add 1 to x0
- mov [x0], dx
- jmp goloop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement