home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / comm / ykh121.zip / YKHSRC.ZIP / GRAPH.ASM < prev    next >
Assembly Source File  |  1992-10-07  |  6KB  |  433 lines

  1. ;       3C4h index  2  (r/W): Sequencer: Map Mask Register
  2. ;         bit 0  Enable writes to plane 0 if set
  3. ;             1  Enable writes to plane 1 if set
  4. ;             2  Enable writes to plane 2 if set
  5. ;             3  Enable writes to plane 3 if set
  6. ;
  7. ;       3CEh index  4  (r/W): Graphics: Read Map Select Register
  8. ;       bit 0-1  Number of the plane read Mode 0 will read from.
  9.  
  10. .286c
  11.  
  12. INT_10H MACRO
  13.   PUSH BP
  14.   INT 10H
  15.   POP BP
  16. ENDM
  17.  
  18. INT_10HP MACRO
  19.   PUSH AX
  20.   PUSH BX
  21.   PUSH CX
  22.   PUSH DX
  23.   PUSH BP
  24.   PUSH DS
  25.   PUSH ES
  26.   PUSH SI
  27.   PUSH DI
  28.   INT 10H
  29.   POP DI
  30.   POP SI
  31.   POP ES
  32.   POP DS
  33.   POP BP
  34.   POP DX
  35.   POP CX
  36.   POP BX
  37.   POP AX
  38. ENDM
  39.  
  40.  
  41. VIDEOSEG EQU 0B800H
  42.  
  43. JISLIB_TEXT    segment byte public 'CODE'
  44. JISLIB_TEXT    ends
  45. DGROUP    group    _DATA,_BSS
  46.     assume    cs:JISLIB_TEXT,ds:DGROUP
  47. _DATA    segment word public 'DATA'
  48. _DATA    ends
  49. _BSS    segment word public 'BSS'
  50. _BSS    ends
  51. JISLIB_TEXT    segment byte public 'CODE'
  52.    ;
  53.  
  54. oldmode db ?
  55.  
  56. ;
  57. ;int far jis_deinit();
  58. ;
  59. _jis_deinit proc far
  60.             mov ax,3
  61.             int 10h
  62.  
  63.             xor ax,ax
  64.  
  65.             ret
  66. _jis_deinit endp
  67.  
  68.  
  69.  
  70. ;
  71. ;int far jis_init(unsigned scanlines,unsigned fg,unsigned bg,char far* filename);
  72. ;
  73. _jis_init proc far
  74.           push bp
  75.           mov bp,sp
  76.  
  77.           mov ax,3
  78.           int 10h
  79.  
  80.           xor ax,ax
  81.  
  82.           pop bp
  83.           ret
  84. _jis_init endp
  85.  
  86.  
  87. ;
  88. ; void far jis_put(unsigned jis,unsigned scanline, unsigned column)
  89. ;
  90. _jis_put proc far
  91.          push bp
  92.          mov bp,sp
  93.  
  94.          push es
  95.          push di
  96.  
  97.          mov ax,VIDEOSEG
  98.          mov es,ax
  99.  
  100.          mov ax,160
  101.          mul word ptr [bp+8]
  102.          add ax,[bp+10]
  103.          add ax,[bp+10]
  104.          mov di,ax
  105.  
  106.          mov ax,[bp+6]     ;AL = JIS character code
  107.          mov al,ah
  108.          mov ah,15
  109.          stosw
  110.          mov al,[bp+6]     ;AL = JIS character code
  111.          stosw
  112.  
  113.          pop di
  114.          pop es
  115.  
  116.          pop bp
  117.          ret
  118. _jis_put endp
  119.  
  120.  
  121. ;
  122. ; void far ascii_put(unsigned ascii,unsigned scanline, unsigned column)
  123. ;
  124. _ascii_put proc far
  125.          push bp
  126.          mov bp,sp
  127.  
  128.          push es
  129.          push di
  130.  
  131.          mov ax,VIDEOSEG
  132.          mov es,ax
  133.  
  134.          mov ax,160
  135.          mul word ptr [bp+8]
  136.          add ax,[bp+10]
  137.          add ax,[bp+10]
  138.          mov di,ax
  139.  
  140.          mov ax,[bp+6]     ;AL = ascii character code
  141.          mov ah,15
  142.          stosw
  143.  
  144.          pop di
  145.          pop es
  146.  
  147.          pop bp
  148.          ret
  149. _ascii_put endp
  150.  
  151.  
  152. ;
  153. ; void far jis_clear(unsigned scanline, unsigned column,
  154. ;                    unsigned scanlines, unsigned columns);
  155. ;
  156. _jis_clear proc far
  157.            push bp
  158.            mov bp,sp
  159.  
  160.            push es
  161.            push di
  162.  
  163.            mov ax,VIDEOSEG
  164.            mov es,ax
  165.  
  166.            mov ax,160
  167.            mul word ptr [bp+6]
  168.            add ax,[bp+8]
  169.            add ax,[bp+8]
  170.            mov di,ax
  171.  
  172.            mov dx,[bp+12]
  173.  
  174.            xor bx,bx
  175.            sub bx,dx
  176.            sub bx,dx
  177.            add bx,160
  178.  
  179.            xor ax,ax
  180.  
  181. @@clr:       mov cx,dx
  182. rep        stosw
  183.            add di,bx
  184.            dec word ptr [bp+10]
  185.            jnz @@clr
  186.  
  187.            pop di
  188.            pop es
  189.  
  190.            pop bp
  191.            ret
  192. _jis_clear endp
  193.  
  194.  
  195. ;
  196. ; void far jis_set(unsigned scanline, unsigned column,
  197. ;                  unsigned scanlines, unsigned columns);
  198. ;
  199. _jis_set proc far
  200.          push bp
  201.          mov bp,sp
  202.  
  203.          push es
  204.          push di
  205.  
  206.          mov ax,VIDEOSEG
  207.          mov es,ax
  208.  
  209.          mov ax,160
  210.          mul word ptr [bp+6]
  211.          add ax,[bp+8]
  212.          add ax,[bp+8]
  213.          mov di,ax
  214.  
  215.          mov dx,[bp+12]
  216.  
  217.          xor bx,bx
  218.          sub bx,dx
  219.          sub bx,dx
  220.          add bx,160
  221.  
  222.          mov ax,7fffh
  223.  
  224.          jmp @@clr
  225.          ;
  226.          ; NO RET
  227.          ;
  228. _jis_set endp
  229.  
  230.  
  231. ;
  232. ; void far jis_xor(unsigned scanline, unsigned column,
  233. ;                  unsigned scanlines, unsigned columns);
  234. ;
  235. _jis_xor proc far
  236.          push bp
  237.          mov bp,sp
  238.  
  239.          push es
  240.          push di
  241.  
  242.          mov ax,VIDEOSEG
  243.          mov es,ax
  244.  
  245.          mov ax,160
  246.          mul word ptr [bp+6]
  247.          add ax,[bp+8]
  248.          add ax,[bp+8]
  249.          mov di,ax
  250.  
  251.          mov dx,[bp+12]
  252.  
  253.          xor bx,bx
  254.          sub bx,dx
  255.          sub bx,dx
  256.          add bx,160
  257.  
  258. @@clx:     mov cx,dx
  259. @@cly:   xor byte ptr es:[di+1],7fh
  260.          add di,2
  261.          loop @@cly
  262.  
  263.          add di,bx
  264.          dec word ptr [bp+10]
  265.          jnz @@clx
  266.  
  267.          pop di
  268.          pop es
  269.  
  270.          pop bp
  271.          ret
  272. _jis_xor endp
  273.  
  274.  
  275. ;
  276. ; void far jis_gray(unsigned scanline, unsigned column,
  277. ;                   unsigned scanlines, unsigned columns);
  278. ;
  279. _jis_gray proc far
  280.          ret
  281. _jis_gray endp
  282.  
  283.  
  284. ;
  285. ; void far jis_bold8(unsigned scanline, unsigned column,
  286. ;                    unsigned scanlines, unsigned columns);
  287. ;
  288. _jis_bold8 proc far
  289.          ret
  290. _jis_bold8 endp
  291.  
  292.  
  293. ;
  294. ; void far jis_fcopy(unsigned srcy,   unsigned srcx,
  295. ;                    unsigned desty,  unsigned destx,
  296. ;                    unsigned height, unsigned width  );
  297. ;
  298. _jis_fcopy proc far
  299.          push bp
  300.          mov bp,sp
  301.  
  302.          push ds  ;save data and extra segments
  303.          push si  ;
  304.          push es  ;
  305.          push di  ;
  306.  
  307.          mov si,VIDEOSEG ;set up segments for video transfer
  308.          mov es,si       ;
  309.          mov ds,si       ;
  310.  
  311.          mov ax,160
  312.          mul word ptr [bp+6]
  313.          add ax,[bp+8]
  314.          add ax,[bp+8]
  315.          mov si,ax
  316.  
  317.          mov ax,160
  318.          mul word ptr [bp+10]
  319.          add ax,[bp+12]
  320.          add ax,[bp+12]
  321.          mov di,ax
  322.  
  323.          mov dx,[bp+16]
  324.  
  325.          mov bx,80
  326.          sub bx,dx
  327.          shl bx,1
  328.  
  329.          cld
  330. @@cop1:  mov cx,dx
  331. rep      movsw
  332.  
  333.          add si,bx
  334.          add di,bx
  335.          dec word ptr [bp+14]
  336.          jnz @@cop1
  337.  
  338. @@copend:
  339.          pop di
  340.          pop es
  341.          pop si
  342.          pop ds
  343.          pop bp
  344.          ret
  345. _jis_fcopy endp
  346.  
  347.  
  348. ;
  349. ; void far jis_bcopy(unsigned srcy,   unsigned srcx,
  350. ;                    unsigned desty,  unsigned destx,
  351. ;                    unsigned height, unsigned width  );
  352. ;
  353. _jis_bcopy proc far
  354.          push bp
  355.          mov bp,sp
  356.  
  357.          push ds  ;save data and extra segments
  358.          push si  ;
  359.          push es  ;
  360.          push di  ;
  361.  
  362.          mov di,VIDEOSEG ;set up segments for video transfer
  363.          mov es,di       ;
  364.          mov ds,di       ;
  365.  
  366.          mov ax,160
  367.          mul word ptr [bp+6]
  368.          add ax,[bp+8]
  369.          add ax,[bp+8]
  370.          mov si,ax
  371.  
  372.          mov ax,160
  373.          mul word ptr [bp+10]
  374.          add ax,[bp+12]
  375.          add ax,[bp+12]
  376.          mov di,ax
  377.  
  378.          mov ax,160
  379.          mul word ptr [bp+14]
  380.          sub ax,160
  381.          add ax,[bp+16]
  382.          add ax,[bp+16]
  383.          dec ax
  384.          dec ax
  385.  
  386.          add si,ax
  387.          add di,ax
  388.  
  389.          mov dx,[bp+16]
  390.  
  391.          mov bx,80
  392.          sub bx,dx
  393.          shl bx,1
  394.  
  395.          std
  396. @@bcop1: mov cx,dx
  397. rep         movsw
  398.  
  399.          sub si,bx
  400.          sub di,bx
  401.          dec word ptr [bp+14]
  402.          jnz @@bcop1
  403.  
  404.          cld
  405.          pop di
  406.          pop es
  407.          pop si
  408.          pop ds
  409.          pop bp
  410.          ret
  411. _jis_bcopy endp
  412.  
  413.  
  414.  
  415.    ;
  416. JISLIB_TEXT    ends
  417.  
  418.     public    _jis_init
  419.     public    _jis_deinit
  420.     public  _jis_put
  421.     public  _ascii_put
  422.     public  _jis_clear
  423.     public  _jis_set
  424.     public  _jis_xor
  425.     public  _jis_gray
  426.     public  _jis_bold8
  427.     public  _jis_fcopy
  428.     public  _jis_bcopy
  429.     end
  430.  
  431.  
  432.  
  433.