Category : Assembly Language Source Code
Archive   : ASM-SUBR.ZIP
Filename : XORPT

 
Output of file : XORPT contained in archive : ASM-SUBR.ZIP
;-------------------------xorpt routine begins--------------------------+
;
; FROM Bluebook of Assembly Routines for the IBM PC & XT
; Page : 133
;
; NAME XORPT
;
; ROUTINE FOR XOR plotting a point on med-res color screen
;
; FUNCTION: This routine plots a point on the medium resolution
; color screen using the "exclusive OR" operation. The pixel at the
; specified location is colored with a color obtained by "exclusive or-ing"
; its original color with a specified color. This function is useful for
; making cursors.
;
; INPUT: Upon entry:
; x-coordinate (0-319) of the point is in SI
; y-coordinate (0-199) of the point is in DI
; color (0-3) is in DX
;
; OUTPUT: Just to the screen
;
; REGISTERS USED: No registers modified. SI,DI,DX are used for
; input.
; SEGMENTS REFERENCED: Upon entry ES: must point to the video RAM
; at B8000h and DS: must point to a data segment containing the fol-
; lowing look-up table of rotated color masks:
;
;ctable dw 0003Fh,0403Fh,0803Fh,0C03Fh
; dw 000CFh,010CFh,020CFh,030CFh
; dw 000F3h,004F3h,008F3h,00CF3h
; dw 000FCh,001FCh,002FCh,003FCh
;
; ROUTINES CALLED: None
;
; SPECIAL NOTES: No bounds checking is performed. The user must
; make sure that the coordinates and the color are in the proper
; ranges.
;
; ROUTINE TO XOR A POINT ONTO MEDIUM RESOLUTION COLOR SCREEN
;
xorpt proc far
;
push bx ; save registers
push si
push ax
;
; multiply y-coord by bytes per row and adjust for even/odd lines
mov ax,di ; get y-coord into low part
mov ah,al ; and into high part.
and ax,01FEh ; mask off unwanted parts
sal ax,1 ; times 4
sal ax,1 ; times 8
sal ax,1 ; times 16
mov bx,ax ; goes into adddress
and bh,7 ; without adjustment
sal ax,1 ; times 32
sal ax,1 ; times 64
add bx,ax ; adress gets y-coord times 80
;
; add x-coordinate to address
mov ax,si ; get x coordinate
sar ax,1 ; divide
sar ax,1 ; by 4
add bx,ax ; here is the address
;
; compute rotated mask and color
and si,3 ; adjust pixel position into the index
sal si,1 ; index times 2
sal si,1 ; index times 4
add si,dx ; 4*pixel position + color
sal si,1 ; 8*pixel position + 2*color
mov ax,ctable[si] ; look up rotated color mask
xor es:[bx],ah ; xor the byte withthe color
;
pop ax ; restore registers
pop si
pop bx
ret ; return
;
xorpt endp
;-------------------------xorpt routine ends---------------------------+


  3 Responses to “Category : Assembly Language Source Code
Archive   : ASM-SUBR.ZIP
Filename : XORPT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/