⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vs1024a.asm

📁 象编程序用 Turbo C 一样, 现在有很多人设计电路图和电路板仍然在用 DOS 版本的 Protel 3.31. 可惜当时的软件支持的分辨率只有 640x480, 通过对 Protel 驱动程
💻 ASM
📖 第 1 页 / 共 2 页
字号:
        js      Houtside
        Jmp     CoordsOK

Houtside:jmp    Hfinish

CoordsOK:
        mov     cx, hlx1
        or      cx, cx
        jns     hl01
        mov     word ptr hlx1, 0
hl01:   mov     cx, MaxX-1
        cmp     hlx2, cx
        jbe     hl02
        mov     word ptr hlx2, cx
hl02:
        mov     si,hlcolor      ;si = color
        Call    SetGraph

        mov     ax, hlx2
        sub     ax, hlx1
        jnz     HLbegin
        inc     ax

HLbegin:mov     cx, hlx1        ;x
        mov     dx, hly         ;y
        mov     si, hlcolor     ;c
hllp1:  call    ppoint          ;(x,y,c) = cx, dx, si
        inc     cx
        dec     ax
        jnz     hllp1

Hfinish:call    ResetGraph
	pop	bp
	ret     8
_HLINE  endp


;*******************************************;
_VLINE proc NEAR                            ;
; Draws a vertical line between 2 points    ;
;(vlx,vly1) and (vlx,vly2)                  ;
;********************************************
vlx	equ	[bp+10]
vly1	equ	[bp+8]
vly2	equ	[bp+6]
vlcolor	equ	[bp+4]

	push	bp
	mov	bp,sp
	mov	si,vlcolor		;si = color
        Call    SetGraph

        mov     ax, vly2
        sub     ax, vly1
        jnz     VLbegin
        inc     ax

VLbegin:mov     cx, vlx
        mov     dx, vly1
        mov     si, vlcolor
vlppl1: call    ppoint          ;(x,y,c) = cx, dx, si
        inc     dx
        dec     ax
        jnz     vlppl1

Vfinish:call    ResetGraph
	pop	bp
	ret     8
_VLINE  endp

;******************************************;
_ARROWCURSOR proc NEAR                     ;
; Draws a cursor on the screen at location ;
; (acx,acy)                                ;
;******************************************;
acx   equ      [bp+6]
acy   equ      [bp+4]
      push     bp
      mov      bp,sp

      mov      si,-1
      Call     SetGraph

      mov     cx,acx	               ;get x
      mov     dx,acy		       ;get y

      mov      bx,1                    ;y := 0
      call     ArrowPoints

      inc      dx                      ;y := 1
      mov      bx,2
      call     ArrowPoints

      inc      dx                      ;y := 2
      mov      bx,3
      call     ArrowPoints

      inc      dx                      ;y := 3
      mov      bx,4
      call     ArrowPoints

      inc      dx                      ;y := 4
      mov      bx,5
      call     ArrowPoints

      inc      dx                      ;y := 5
      mov      bx,6
      call     ArrowPoints

      inc      dx                      ;y := 6
      mov      bx,7
      call     ArrowPoints

      inc      dx                      ;y := 7
      mov      bx,8
      call     ArrowPoints

      inc      dx                      ;y := 8
      mov      bx,9
      call     ArrowPoints

      inc      dx                      ;y := 9
      mov      bx,10
      call     ArrowPoints

      inc      dx                      ;y := 10
      mov      bx,11
      call     ArrowPoints

      inc      dx                      ;y := 11
      mov      bx,12
      call     ArrowPoints

      inc      dx                      ;y := 12
      mov      bx,6
      call     ArrowPoints

      inc      dx                      ;y := 13
      mov      bx,5
      call     ArrowPoints

      inc      dx                      ;y := 14
      mov      bx,4
      call     ArrowPoints

      inc      dx                      ;y := 15
      mov      bx,3
      call     ArrowPoints

      inc      dx                      ;y := 16
      mov      bx,2
      call     ArrowPoints

      inc      dx                      ;y := 17
      call     Point                   ;x := 0

      call    ResetGraph
      pop     bp
      ret     4
_ARROWCURSOR endp


;*****************************************
ArrowPoints Proc Near
; Sub_Routine for ArrowCursor
; X = cx
; Yoffset = Dx
; bx = count of x
;*****************************************
      Push    cx
Ploop:
      call    Point
      inc     cx       ;next x
      dec     bx
      jnz     Ploop
      pop     cx
      ret
ArrowPoints endp

;********************************************************;
_SETBACKGROUND Proc Near                                 ;
; Sets the current background color to BackColor         ;
; Procedure SetBackGround(BackColor,ColorSet : integer); ;
;********************************************************;
BackColor equ      [bp+6]
ColorSet  equ      [bp+4]

        push     bp
        mov      bp,sp

        mov cx, BackColor
        cmp cx, 6
        jne sbcl01
        mov cx, 20
        jmp sbcset

sbcl01: cmp cx, 8
        jb  sbcset
        and cx, 0fh
        add cx, 48

sbcset: mov dx,3c7h
        mov al,cl
        out dx,al
        inc dx
        inc dx
        in  al,dx
        mov bh,al
        in  al,dx
        mov bl,al
        in  al,dx
        mov ah,al
        dec dx
        xor al,al
        out dx,al
        inc dx
        mov al,bh
        out dx,al
        mov al,bl
        out dx,al
        mov al,ah
        out dx,al

        pop      bp
        ret 4
_SETBACKGROUND endp

;********************************************;
Point Proc Near                              ;
; X = Cx                                     ;
; Y = Dx                                     ;
; SI = color                                 ;
; Internal procedure called by Draw,PlotPixel;
; and others to set a pixel to givan color.  ;
; If the hardware can draw vectors DRAW may  ;
; not need to call this routine.             ;
;********************************************;
      or      cx,0
      js      outside
      or      dx,0
      js      outside
      cmp     dx,MaxY-StatusLine       ;if y bigger than 329 then no carry
      jnb     outside                  ;Jump if carry not set
      cmp     cx,MaxX                  ;if x bigger than 639 then no carry
      jnb     outside                  ;Jump if carry not set

      call    ppoint
outside:
      ret
Point endp


;******************************************;
TEXTPOINT Proc Near                        ;
; X = Cx                                   ;
; Y = Dx                                   ;
; SI = color                               ;
; Variation of point routine that allows   ;
; plotting in the status line at the base  ;
; of the screen.                           ;
;******************************************;
      or      cx,0
      js      Toutside
      or      dx,0
      js      Toutside
      cmp     dx,MaxY                  ;if y bigger then no carry
      jnb     Toutside                 ;Jump if carry not set
      cmp     cx,MaxX                  ;if x bigger then no carry
      jnb     Toutside                 ;Jump if carry not set

      call    ppoint
Toutside:
      ret
TEXTPOINT endp

;-------------------------------------------------
ppoint proc near ; cx,dx,si
;-------------------------------------------------
       Push    dx
       Push    cx
       push    bx
       push    ax

       mov     ax, 0a000h
       mov     es, ax
       mov     ax, MaxX
       mul     dx        ;y
       mov     bx, cx    ;x
       add     ax, bx    ;bx = offset
       adc     dx, 0     ;dx:ax = address
       call    setseg
       mov     bx, ax
       mov     ax, si
      
       and     al,0fh
       test    ah,80h
       jnz     pptxor
       mov     es:[bx],al
       jmp     pptend
pptxor:xor     es:[bx],al

pptend:pop      ax
       pop      bx
       pop      cx
       pop      dx

       ret
ppoint endp
;-------------------------------------------------

setseg proc near ;dx = VRAM seg (64k/seg)
       push di
       push ax

       call coadj
coadj: pop  di
       sub  di, offset coadj

       cmp  dx, cs:[di+WINSG]
       je   ssend
       mov  cs:[di+WINSG], dx

       push bx
       push cx
       push dx

       mov  ax, dx
       xor  dx, dx
       mov  bx, offset WinGranu
       add  bx, di
       mov  cx, cs:[bx]
       shl  ax, 6                      ;AX *= 64
       div  cx
       mov  dx, ax                     ;DX = WinPos

       ;-------------------------------------------
       mov  al, cs:[di+WinAAttr]
       test al, 1
       jz   sswae
       mov  bx, 0                      ;Select WinA
       call dword ptr cs:[di+WinF5Ptr]
sswae: ;-------------------------------------------
       mov  al, cs:[di+WinBAttr]
       test al, 1
       jz   sswbe
       mov  bx, 1                      ;Select WinB
       call dword ptr cs:[di+WinF5Ptr]
sswbe: ;-------------------------------------------

       pop  dx
       pop  cx
       pop  bx

ssend: pop  ax
       pop  di
       ret
setseg endp
;-------------------------------------------------

WINSG    dw 0

MODEINF label byte
ModeAttr dw 0
WinAAttr db 0
WinBAttr db 0
WinGranu dw 0
WinSize  dw 0
WinASeg  dw 0
WinBSeg  dw 0
WinF5Ptr dd 0
LnBytes  dw 0

SMBUF    db MenuMem dup(0)

;-------------------------------------------------
; Force the assembler to produce 4096 byte Binary file.
;-------------------------------------------------

CodeLength = $ - GETDRIVERTYPE
db 4096-CodeLength DUP(0)

CODE  ends
      end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -