home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / maj / 4383 / point.asm < prev    next >
Assembly Source File  |  1994-01-01  |  1KB  |  82 lines

  1.  
  2.     include    model.inc
  3.  
  4. ;
  5. ;    VGAKIT Version 6.0
  6. ;
  7. ;    Copyright 1988,89,90,91,92,93,94 John Bridges
  8. ;    Free for use in commercial, shareware or freeware applications
  9. ;
  10. ;    POINT.ASM
  11. ;
  12. ;
  13. .data
  14.  
  15.     extrn    curbk:word,adrtbl:dword,ourseg:word
  16.     extrn    maxx:word,maxy:word,scanline:word
  17.  
  18. .code
  19.  
  20.     extrn    newbank:proc
  21.  
  22.     public    point
  23.     public    point13x
  24.  
  25. point    proc    xpos:word,ypos:word,color:word
  26.     mov    dx,[xpos]
  27.     cmp    dx,0
  28.     jl    nope1
  29.     cmp    dx,[maxx]
  30.     jge    nope1
  31.     mov    bx,[ypos]
  32.     cmp    bx,0
  33.     jl    nope1
  34.     cmp    bx,[maxy]
  35.     jge    nope1
  36.     shl    bx,1
  37.     shl    bx,1
  38.     add    dx,word ptr adrtbl[bx]
  39.     mov    ax,word ptr adrtbl[bx+2]
  40.     adc    ax,0
  41.     mov    bx,dx
  42.     cmp    ax,[curbk]
  43.     jz    nonew
  44.     call    newbank            ;switch banks if a new bank entered
  45. nonew:    mov    es,[ourseg]        ;setup screen segment
  46.     mov    al,byte ptr [color]    ;get color of pixel to plot
  47.     mov    es:[bx],al
  48. nope1:    ret
  49. point    endp
  50.  
  51. point13x proc    xpos:word,ypos:word,color:word
  52.     mov    dx,[xpos]
  53.     cmp    dx,0
  54.     jl    nope2
  55.     cmp    dx,[maxx]
  56.     jge    nope2
  57.     mov    bx,[ypos]
  58.     cmp    bx,0
  59.     jl    nope2
  60.     cmp    bx,[maxy]
  61.     jge    nope2
  62.     shl    bx,1
  63.     shl    bx,1
  64.     mov    cx,dx
  65.     shr    dx,1
  66.     shr    dx,1
  67.     add    dx,word ptr adrtbl[bx]
  68.     mov    bx,dx
  69.     mov    ax,102h
  70.     and    cl,3
  71.     shl    ah,cl            ;create bit plane mask
  72.     mov    dx,3c4h
  73.     out    dx,ax            ;set EGA bit plane mask register
  74.     mov    es,[ourseg]        ;setup screen segment
  75.     mov    al,byte ptr [color]    ;get color of pixel to plot
  76.     mov    es:[bx],al
  77. nope2:    ret
  78. point13x endp
  79.  
  80.     end
  81.  
  82.