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

  1.           page   80,132
  2.           page
  3. ;
  4. ;         Kent Cedola
  5. ;         2015 Meadow Lake Ct.
  6. ;         Norfolk, Virginia  23518
  7. ;
  8. ;         gpmovgtm(array,w,h,l);
  9. ;
  10.  
  11. dgroup    group  _data
  12.  
  13. _data     segment word public 'data'
  14.           assume ds:dgroup
  15.  
  16.           extrn  _gdcur_x:word,_gdcur_y:word
  17.  
  18. _data     ends
  19.  
  20. _TEXT     SEGMENT BYTE PUBLIC 'code'
  21.           assume cs:_text,ds:dgroup
  22.  
  23.           public _gpmovgtm
  24.  
  25. _gpmovgtm proc   near
  26.  
  27.           push   bp
  28.           mov    bp,sp
  29.  
  30.           push   di
  31.           push   si
  32.  
  33.           mov    ax,_gdcur_y
  34.           shl    ax,1
  35.           shl    ax,1
  36.           add    ax,_gdcur_y
  37.           add    ax,0A000h
  38.           mov    es,ax
  39.  
  40.           mov    cx,_gdcur_x           ; Copy X coordinate to a work register
  41.           mov    SI,CX                 ; Copy X corrdinate
  42.           SHR    SI,1                  ; Divide X corrdinate by three and
  43.           SHR    SI,1                  ;   ...
  44.           SHR    SI,1                  ;   ...
  45.           AND    CL,7                  ; Determine the starting bit to plot
  46.  
  47.           mov    di,[bp+4]
  48.  
  49.           mov    dx,03CEh
  50.           mov    al,4
  51.           out    dx,al
  52.           inc    dx
  53.  
  54. ; four plane code
  55. ;         SI    = address of first byte
  56. ;         DX    = address of memory read port (all set up)
  57. ;         DI    = address of output array
  58. ;         CL    = bit rotate
  59. ;         ES    = graphic segment
  60.  
  61. nextcol4:
  62.           push   si
  63.           push   cx
  64.           push   di
  65.           mov    ax,[bp+6]
  66.           mov    [bp+4],ax
  67. nextrow4:
  68.           mov    al,0
  69.           out    dx,al
  70.           mov    ah,es:[si]
  71.           rol    ah,cl
  72.           mov    al,1
  73.           out    dx,al
  74.           mov    bh,es:[si]
  75.           rol    bh,cl
  76.           mov    al,2
  77.           out    dx,al
  78.           mov    bl,es:[si]
  79.           rol    bl,cl
  80.           mov    al,3
  81.           out    dx,al
  82.           mov    ch,es:[si]
  83.           rol    ch,cl
  84.  
  85.           sub    cl,8
  86.           neg    cl
  87.  
  88. nextbit4:
  89.           xor    al,al
  90.  
  91.           rol    ch,1
  92.           adc    al,0
  93.           rol    al,1
  94.           rol    bl,1
  95.           adc    al,0
  96.           rol    al,1
  97.           rol    bh,1
  98.           adc    al,0
  99.           rol    al,1
  100.           rol    ah,1
  101.           adc    al,0
  102.  
  103.           mov    [di],al
  104.           inc    di
  105.  
  106.           dec    word ptr [bp+4]
  107.           jz     rowend4
  108.  
  109.           dec    cl
  110.           jnz    nextbit4
  111.           inc    si
  112.           mov    al,0
  113.           out    dx,al
  114.           mov    ah,es:[si]
  115.           mov    al,1
  116.           out    dx,al
  117.           mov    bh,es:[si]
  118.           mov    al,2
  119.           out    dx,al
  120.           mov    bl,es:[si]
  121.           mov    al,3
  122.           out    dx,al
  123.           mov    ch,es:[si]
  124.  
  125.           mov    cl,8
  126.  
  127.           jmp    short nextbit4
  128.  
  129. rowend4:
  130.           pop    di
  131.           pop    cx
  132.           pop    si
  133.           add    di,[bp+10]
  134.           add    si,80
  135.  
  136.           dec    word ptr [bp+8]
  137.           jz     colend4
  138.           jmp    nextcol4
  139.  
  140. colend4:
  141.           mov    al,0
  142.           out    dx,al
  143.  
  144.           pop    si
  145.           pop    di
  146.  
  147.           pop    bp
  148.           ret                          ; Return to caller
  149.  
  150. _gpmovgtm endp
  151.  
  152. _text     ends
  153.           END
  154.