home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 255_01 / gprdcol.asm < prev    next >
Encoding:
Assembly Source File  |  1988-03-30  |  2.6 KB  |  106 lines

  1.           page   80,132
  2.           page
  3. ;
  4. ;         Kent Cedola
  5. ;         2015 Meadow Lake Court
  6. ;         Norfolk, Virginia  23518
  7. ;
  8.  
  9. dgroup    group  _data
  10.  
  11. _data     segment word public 'data'
  12.           assume ds:dgroup
  13.  
  14.           extrn  _gdmerge:byte
  15.           extrn  _gdcur_x:word,_gdcur_y:word
  16.           extrn  _gdvw_x1:word,_gdvw_x2:word,_gdvw_x3:word
  17.           extrn  _gdvw_y1:word,_gdvw_y2:word,_gdvw_y3:word
  18.           extrn  _gdc_flg:byte
  19.  
  20. _data     ends
  21.  
  22. _text     segment byte public 'code'
  23.  
  24.           assume cs:_text,ds:dgroup
  25.           public _gprdcol
  26. _gprdcol  proc   near
  27.  
  28.           push   bp
  29.           mov    bp,sp
  30.           push   si
  31.           push   di
  32.  
  33.           mov    ax,_GDCUR_Y           ; Compute the segment of the graphic
  34.           shl    ax,1                  ;   byte that is to be changed
  35.           shl    ax,1                  ;   ES = A000 + (80 * Y) / 16;
  36.           add    ax,_GDCUR_Y           ;   ...
  37.           add    ax,0A000h             ;   ...
  38.           mov    es,ax                 ;   ...
  39.           mov    si,_GDCUR_X           ; Compute the column byte offset
  40.           mov    cx,si                 ;   ... (Save for later)
  41.           shr    si,1                  ;   SI = X / 8;
  42.           shr    si,1                  ;   ...
  43.           shr    si,1                  ;   ...
  44.           and    cl,7                  ;   ...  (It has to be done this way to
  45.           mov    ah,080h
  46.           ror    ah,cl
  47.  
  48.           mov    cx,[bp+6]
  49.           mov    di,[bp+4]
  50.  
  51.           mov    dx,03CEh
  52.           mov    al,4
  53.           out    dx,al
  54.           inc    dx
  55.  
  56.  
  57. ; four plane code
  58. ;         SI    = address of first byte
  59. ;         DX    = address of memory read port (all set up)
  60. ;         DI    = address of output array
  61. ;         CX    = count
  62. ;         ES    = graphic segment
  63.  
  64. colnext:
  65.           xor    bl,bl
  66.  
  67.           mov    al,0
  68.           out    dx,al
  69.           test   es:[si],ah
  70.           jz     bit1
  71.           or     bl,1
  72. bit1:
  73.           mov    al,1
  74.           out    dx,al
  75.           test   es:[si],ah
  76.           jz     bit2
  77.           or     bl,2
  78. bit2:
  79.           mov    al,2
  80.           out    dx,al
  81.           test   es:[si],ah
  82.           jz     bit3
  83.           or     bl,4
  84. bit3:
  85.           mov    al,3
  86.           out    dx,al
  87.           test   es:[si],ah
  88.           jz     bit4
  89.           or     bl,8
  90. bit4:
  91.           mov    [di],bl
  92.           inc    di
  93.           add    si,80
  94.           loop   colnext
  95.  
  96. colend4:
  97.           pop    di
  98.           pop    si
  99.  
  100.           pop    bp
  101.           ret
  102. _gprdcol  endp
  103.  
  104. _text     ends
  105.           END
  106.