Category : Files from Magazines
Archive   : DDJ8611.ZIP
Filename : MCN.NOV

 
Output of file : MCN.NOV contained in archive : DDJ8611.ZIP


Listing 1


Draw a rectangle with an 8086 on CGA.


;
; Draw a rectangle in the upper
; left corner of a CGA display
; in high-resolution mode. The code
; is hardwired to a 10x10 rectangle.
;
;
; Set up segment and offset registers
; to point to display memory.
;
mov AX, 0B800H
mov ES, AX
mov BX, 0
;
; Draw the top line by stuffing one byte
; and the first two bits of the next byte.
;
mov byte ptr [BX], 0FFH
mov byte ptr [BX+1], 0C0H
;
; Draw the bottom line the same way.
;
mov byte ptr [BX+800], 0FFH
mov byte ptr [BX+801], 0C0H

;
; Draw the first and last pixels on the next
; 4 even scan lines, then do the same on the
; odd scan lines.
;
mov SI, 50H
mov CX, 4
EOLoop: mov byte ptr [BX+SI], 80H
mov byte ptr [BX+SI+1], 40H
add SI, 80
loop EOLoop
cmp SI, 2000H
jg EODone
mov SI, 2050H
mov CX, 4
jmp EOLoop
EODone label byte
;
; Rectangle is finished.
;

*************************************************

Same rectangle drawn by 34010


;
; Draw a line from 0,0 to 0,10. The start
; point is in register B2 and the end point
; (delta X and delta Y) is in register B7.
;
; The > sign precedes a 32-bit hex constant.
;
MOVI >0,B2
MOVI >00100000,B7
LINE 0
;
; Repeat the process for the other sides.
;
MOVI >00100000,B2
MOVI >00000010,B7
LINE 0
MOVI >0,B2
MOVI >00000010,B7
LINE 0
MOVI >00000010,B2
MOVI >00100000,B7
LINE 0
;
; Finished!
;

*************************************************


Same rectangle drawn by 82786


;
; Move to the upper left corner and
; draw a 10x10 rectangle.
;
ABS_MOVE 0,0
RECT 10,10
;
; All finished!
;
[EOF]