home *** CD-ROM | disk | FTP | other *** search
/ GRIPS 2: Government Rast…rocessing Software & Data / GRIPS_2.cdr / dos / seq / src / no9.asm < prev    next >
Assembly Source File  |  1990-01-07  |  3KB  |  159 lines

  1. ;
  2. ;   Number Nine Revolution 512x8 
  3. ;   support routines for raster oriented graphics
  4. ;
  5. ;   Tim Krauskopf      July 1986
  6. ;
  7. ;   National Center for Supercomputing Applications, University of Illinois
  8. ;   153 Water Resources Building
  9. ;   605 E. Springfield Ave.
  10. ;   Champaign, IL  61820
  11. ;   (217)244-0072
  12. ;
  13. ;
  14.     TITLE      NUMBER 9 GRAPHICS SUPPORT
  15.     INCLUDE DOS.MAC
  16.     SETX
  17.     PSEG
  18.     PUBLIC    PUTCLR,PUTMAP,NO9LINE
  19. ;
  20. ;  take three arrays of color table entries and transfer them to the
  21. ;  board's Color registers at offset.
  22. ;
  23. ;  usage:  putclr(rmap,gmap,bmap,count,offset);
  24. ;
  25. PUTCLR    PROC    FAR
  26.     PUSH    BP
  27.     MOV    BP,SP
  28.     PUSH    DS
  29.     PUSH    ES
  30.  
  31.     MOV    AX,[BP+X+2]
  32.     MOV    DS,AX            ; where to get maps (seg)
  33.     MOV    AX,0C000H        ; control seg for #9
  34.     MOV    ES,AX                   ; where to put color (seg)
  35.  
  36.     MOV    SI,[BP+X]        ; where to get red
  37.     MOV    CX,[BP+X+12]        ; length of map
  38.     MOV    DI,0100H        ; red map
  39.         ADC    DI,[BP+X+14]            ; offset to correct entry
  40.     REP    MOVSB            ; mov red
  41. ;
  42.     MOV    SI,[BP+X+4]
  43.     MOV    CX,[BP+X+12]        ; length of map
  44.     MOV    DI,0200H        ; green map
  45.         ADC    DI,[BP+X+14]            ; offset to correct entry
  46.     REP    MOVSB
  47. ;
  48.     MOV    SI,[BP+X+8]        ; blue map
  49.     MOV    CX,[BP+X+12]        ; length of map
  50.     MOV    DI,0300H    
  51.         ADC    DI,[BP+X+14]            ; offset to correct entry
  52.     REP    MOVSB
  53. ;
  54.     POP    ES
  55.     POP    DS
  56.     POP    BP
  57.     RET
  58.  
  59. PUTCLR  ENDP
  60.  
  61. ;  take three arrays of color table entries and transfer them to the
  62. ;  board's registers
  63. ;
  64. ;  usage:  putmap(rmap,gmap,bmap);
  65. ;
  66. PUTMAP    PROC    FAR
  67.     PUSH    BP
  68.     MOV    BP,SP
  69.     PUSH    DS
  70.     PUSH    ES
  71.     MOV    AX,[BP+X+2]
  72.     MOV    DS,AX            ; where to get maps (seg)
  73.     MOV    SI,[BP+X]        ; where to get red
  74.     MOV    AX,0C000H        ; control seg for #9
  75.     MOV    ES,AX
  76.     MOV    DI,0100H        ; red map
  77.     MOV    CX,256            ; length of map
  78.     REP    MOVSB            ; mov red
  79. ;
  80.     MOV    SI,[BP+X+4]
  81.     MOV    DI,0200H        ; green map
  82.     MOV    CX,256
  83.     REP    MOVSB
  84. ;
  85.     MOV    SI,[BP+X+8]        ; blue map
  86.     MOV    DI,0300H    
  87.     MOV    CX,256
  88.     REP    MOVSB
  89. ;
  90.     POP    ES
  91.     POP    DS
  92.     POP    BP
  93.     RET
  94.  
  95. PUTMAP    ENDP
  96. ;
  97. ;  Transfer line to #9 screen, one byte per pixel
  98. ;
  99. ;   usage : no9line(x,y,buf,nbytes)
  100. ;
  101. NO9LINE    PROC    FAR
  102.     PUSH    BP
  103.     MOV    BP,SP
  104.     PUSH    DS
  105.     PUSH    ES
  106.     MOV    AX,0C000H    ; control regs
  107.     MOV    ES,AX
  108.  
  109.     MOV    AX,[BP+X+6]    ; ds of buffer
  110.     MOV    DS,AX
  111.     MOV    AX,[BP+X+2]    ; y location on screen
  112.     MOV    CL,7        ; divide by 128
  113.     SHR    AX,CL
  114.     MOV    BL,AL        ; make a copy
  115.     CMP    AL,CS:BANK    ; is it the same bank?
  116.     JZ    OKBANK
  117.  
  118.     MOV    CS:BANK,AL    ; bank will be this one
  119.     MOV    DH,00H        ; default, might be changed
  120.     AND    AL,02H        ; is high bit on?
  121.     JZ    NO706
  122.  
  123.     MOV    DH,0FFH        ;  setting for new bank
  124. NO706:
  125.     MOV    DL,00H        ; default setting for 705
  126.     MOV    AL,BL        ; get back copy
  127.     AND    AL,01H        ; is low bit on?
  128.     JZ    NO705
  129.  
  130.     MOV    DL,0FFH        ; other portion of new bank
  131. NO705:
  132.     MOV    DI,0705H    ; where bank reg is
  133.     MOV    AX,DX
  134.     STOSW            ; sets both bytes, lo then hi
  135. ;
  136. ;   READY TO PUT THE LINE
  137. ;
  138. OKBANK:
  139.     MOV    AX,0A000H    ; data buffer
  140.     MOV    ES,AX
  141.     MOV    SI,[BP+X+4]    ; where data will come from
  142.     MOV    AX,[BP+X+2]    ; get y value again
  143.     MOV    CL,9
  144.     SHL    AX,CL        ; get 16 bit pointer for this bank
  145.     ADD    AX,[BP+X]    ; x value of where on screen added in
  146.     MOV    DI,AX        ; prepare for movs
  147.     MOV    CX,[BP+X+8]    ; how many bytes?
  148. BLAST:
  149.     REP    MOVSB
  150.  
  151.     POP    ES
  152.     POP    DS
  153.     POP    BP
  154.     RET
  155. BANK    DB    0FFH        ; current bank number
  156. NO9LINE    ENDP
  157.     ENDPS
  158.     END
  159.