home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / bluebook / asm-subr / xorpt < prev   
Encoding:
Text File  |  1985-12-28  |  2.5 KB  |  83 lines

  1. ;-------------------------xorpt routine begins--------------------------+
  2. ;
  3. ; FROM Bluebook of Assembly Routines for the IBM PC & XT
  4. ;      Page : 133
  5. ;
  6. ; NAME XORPT
  7. ;
  8. ; ROUTINE FOR XOR plotting a point on med-res color screen
  9. ;
  10. ; FUNCTION: This routine plots a point on the medium resolution
  11. ; color screen using the "exclusive OR" operation.  The pixel at the
  12. ; specified location is colored with a color obtained by "exclusive or-ing"
  13. ; its original color with a specified color.  This function is useful for
  14. ; making cursors.
  15. ;
  16. ; INPUT: Upon entry:
  17. ;        x-coordinate (0-319) of the point is in SI
  18. ;     y-coordinate (0-199) of the point is in DI
  19. ;     color (0-3) is in DX
  20. ;
  21. ; OUTPUT: Just to the screen
  22. ;
  23. ; REGISTERS USED:  No registers modified.  SI,DI,DX are used for
  24. ;                  input.
  25. ; SEGMENTS REFERENCED:  Upon entry ES: must point to the video RAM
  26. ; at B8000h and DS: must point to a data segment containing the fol-
  27. ; lowing look-up table of rotated color masks:
  28. ;
  29. ;ctable    dw    0003Fh,0403Fh,0803Fh,0C03Fh
  30. ;    dw    000CFh,010CFh,020CFh,030CFh
  31. ;    dw    000F3h,004F3h,008F3h,00CF3h
  32. ;    dw    000FCh,001FCh,002FCh,003FCh
  33. ;
  34. ; ROUTINES CALLED:  None
  35. ;
  36. ; SPECIAL NOTES: No bounds checking is performed.  The user must
  37. ; make sure that the coordinates and the color are in the proper
  38. ; ranges.
  39. ;
  40. ; ROUTINE TO XOR A POINT ONTO MEDIUM RESOLUTION COLOR SCREEN
  41. ;
  42. xorpt    proc    far
  43. ;
  44.     push    bx        ; save registers
  45.     push    si
  46.     push    ax
  47. ;
  48. ; multiply y-coord by bytes per row and adjust for even/odd lines
  49.     mov    ax,di        ; get y-coord into low part
  50.     mov    ah,al        ;   and into high part.
  51.     and    ax,01FEh    ; mask off unwanted parts
  52.     sal    ax,1        ; times 4
  53.     sal    ax,1        ; times 8
  54.     sal    ax,1        ; times 16
  55.     mov     bx,ax        ; goes into adddress
  56.     and    bh,7        ; without adjustment
  57.     sal    ax,1        ; times 32
  58.     sal    ax,1        ; times 64
  59.     add    bx,ax        ; adress gets y-coord times 80
  60. ;
  61. ; add x-coordinate to address
  62.     mov    ax,si        ; get x coordinate
  63.     sar    ax,1        ; divide
  64.     sar    ax,1        ; by 4
  65.     add    bx,ax        ; here is the address
  66. ;
  67. ; compute rotated mask and color
  68.     and    si,3        ; adjust pixel position into the index
  69.     sal    si,1        ; index times 2
  70.     sal    si,1        ; index times 4
  71.     add    si,dx        ; 4*pixel position + color
  72.     sal    si,1        ; 8*pixel position + 2*color
  73.     mov    ax,ctable[si]    ; look up rotated color mask
  74.     xor    es:[bx],ah    ; xor the byte withthe color
  75. ;
  76.     pop    ax        ; restore registers
  77.     pop    si
  78.     pop    bx
  79.     ret            ; return
  80. ;
  81. xorpt    endp
  82. ;-------------------------xorpt routine ends---------------------------+
  83.