home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / ddjmag / ddj8611.zip / MCN.NOV < prev    next >
Text File  |  1986-12-01  |  2KB  |  101 lines

  1.  
  2. Listing 1
  3.  
  4.  
  5. Draw a rectangle with an 8086 on CGA.
  6.  
  7.  
  8. ;
  9. ;          Draw a rectangle in the upper 
  10. ;          left corner of a CGA display
  11. ;          in high-resolution mode.  The code
  12. ;          is hardwired to a 10x10 rectangle.
  13. ;
  14. ;
  15. ; Set up segment and offset registers
  16. ; to point to display memory.
  17. ;
  18.            mov       AX, 0B800H
  19.            mov       ES, AX
  20.            mov       BX, 0
  21. ;           
  22. ; Draw the top line by stuffing one byte
  23. ; and the first two bits of the next byte.
  24. ;
  25.            mov       byte ptr [BX], 0FFH
  26.            mov       byte ptr [BX+1], 0C0H
  27. ;           
  28. ; Draw the bottom line the same way.
  29. ;
  30.            mov       byte ptr [BX+800], 0FFH
  31.            mov       byte ptr [BX+801], 0C0H
  32.  
  33. ;           
  34. ; Draw the first and last pixels on the next
  35. ; 4 even scan lines, then do the same on the
  36. ; odd scan lines.
  37. ;
  38.            mov       SI, 50H
  39.            mov       CX, 4
  40. EOLoop:    mov       byte ptr [BX+SI], 80H
  41.            mov       byte ptr [BX+SI+1], 40H
  42.            add       SI, 80
  43.            loop      EOLoop
  44.            cmp       SI, 2000H
  45.            jg        EODone
  46.            mov       SI, 2050H
  47.            mov       CX, 4
  48.            jmp       EOLoop
  49. EODone     label     byte           
  50. ;
  51. ; Rectangle is finished.
  52. ;
  53.  
  54. *************************************************
  55.  
  56.    Same rectangle drawn by 34010
  57.    
  58.   
  59. ;   
  60. ; Draw a line from 0,0 to 0,10.  The start
  61. ; point is in register B2 and the end point
  62. ; (delta X and delta Y) is in register B7.
  63. ;
  64. ; The > sign precedes a 32-bit hex constant.
  65. ;
  66.            MOVI      >0,B2
  67.            MOVI      >00100000,B7
  68.            LINE      0
  69. ;           
  70. ; Repeat the process for the other sides.
  71. ;
  72.            MOVI      >00100000,B2
  73.            MOVI      >00000010,B7
  74.            LINE      0
  75.            MOVI      >0,B2
  76.            MOVI      >00000010,B7
  77.            LINE      0
  78.            MOVI      >00000010,B2
  79.            MOVI      >00100000,B7
  80.            LINE      0
  81. ;           
  82. ; Finished!
  83. ;
  84.  
  85. *************************************************
  86.            
  87.            
  88.    Same rectangle drawn by 82786           
  89.    
  90.    
  91. ;
  92. ; Move to the upper left corner and
  93. ; draw a 10x10 rectangle.
  94. ;
  95.            ABS_MOVE  0,0
  96.            RECT      10,10
  97. ;           
  98. ; All finished!
  99. ;
  100.                                 [EOF]
  101.