home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 255_01 / gpplot.asm < prev    next >
Encoding:
Assembly Source File  |  1988-03-30  |  3.0 KB  |  95 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  _gdtype:byte
  15.           extrn  _gdmaxcol:word,_gdmaxrow:word
  16.           extrn  _gdcolor:byte,_gdmerge:byte,_gdaspc1:word,_gdaspc2:word
  17.           extrn  _gdcur_x:word,_gdcur_y:word
  18.           extrn  _gdvw_x1:word,_gdvw_x2:word,_gdvw_x3:word
  19.           extrn  _gdvw_y1:word,_gdvw_y2:word,_gdvw_y3:word
  20.           extrn  _gdc_flg:byte,_gds_flg:byte,_gdw_flg:byte
  21.  
  22. _data     ends
  23.  
  24. _text     segment byte public 'code'
  25.  
  26.           assume cs:_text,ds:dgroup
  27.           public _gpplot
  28. _gpplot   proc   near
  29.  
  30.           push   bp
  31.           mov    bp,sp
  32.           push   si
  33.           push   di
  34.  
  35.           mov    _GDC_FLG,0
  36.  
  37.           mov    ax,[bp+6]
  38.           cmp    ax,_GDVW_Y1
  39.           jl     error
  40.           cmp    ax,_GDVW_Y2
  41.           jg     error
  42.           mov    di,[bp+4]
  43.           cmp    di,_GDVW_X1
  44.           jl     error
  45.           cmp    di,_GDVW_X2
  46.           jle    goodpt
  47. error:
  48.           mov    _GDC_FLG,2
  49.           jmp    short theend
  50. goodpt:
  51.           mov    _GDCUR_Y,ax           ;
  52.           shl    ax,1                  ;   byte that is to be changed
  53.           shl    ax,1                  ;   ES = A000 + (80 * Y) / 16;
  54.           add    ax,[bp+6]             ;   ...
  55.           add    ax,0A000h             ;   ...
  56.           mov    es,ax                 ;   ...
  57.           MOV    _GDCUR_X,di           ;
  58.           mov    cx,di                 ;   ... (Save for later)
  59.           shr    di,1                  ;   DI = X / 8;
  60.           shr    di,1                  ;   ...
  61.           shr    di,1                  ;   ...
  62.           mov    dx,03CEh              ; Load graphic controller's address port
  63.           mov    ah,_GDMERGE
  64.           mov    al,3
  65.           out    dx,ax
  66.           mov    ax,0205h
  67.           out    dx,ax
  68.           mov    al,8                  ; Mask value is in address three (3)
  69.           out    dx,al                 ; Point to the mask register
  70.           inc    dx                    ; Bump port addr to the mask register
  71.           mov    al,80h                ; Compute mask byte to change one bit
  72.           and    cl,7                  ;   ...  (It has to be done this way to
  73.           ror    al,cl                 ;   ...   use merge value in write)
  74.           out    dx,al                 ; Set mask byte to change only our bit
  75.           mov    al,es:[di]
  76.           mov    al,_GDCOLOR
  77.           mov    es:[di],al            ; Apply merge function to bit and store
  78.  
  79.           mov    al,0FFh
  80.           out    dx,al                 ; Restore the mask byte (for text)
  81.           dec    dx
  82.           mov    ax,5
  83.           out    dx,ax
  84.           mov    al,3
  85.           out    dx,ax
  86. theend:
  87.           pop    di
  88.           pop    si
  89.           pop    bp
  90.           ret
  91. _gpplot   endp
  92.  
  93. _text     ends
  94.           end
  95.