home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / sound / nh10src / vr.asm < prev    next >
Encoding:
Assembly Source File  |  1991-12-15  |  5.6 KB  |  349 lines

  1.     ifndef    ??version
  2. ?debug    macro
  3.     endm
  4. publicdll macro    name
  5.     public    name
  6.     endm
  7. $comm    macro    name,dist,size,count
  8.     comm    dist name:BYTE:count*size
  9.     endm
  10.     else
  11. $comm    macro    name,dist,size,count
  12.     comm    dist name[size]:BYTE:count
  13.     endm
  14.     endif
  15.     ?debug    S "vr.c"
  16.     ?debug    C E93B7D6D170476722E63
  17.     ?debug    C E900104D1615453A5C42435C494E434C5544455C737464696F2E68
  18.     ?debug    C E900104D1616453A5C42435C494E434C5544455C7374646C69622E+
  19.     ?debug    C 68
  20.     ?debug    C E900104D1613453A5C42435C494E434C5544455C646F732E68
  21. _TEXT    segment byte public 'CODE'
  22. _TEXT    ends
  23. DGROUP    group    _DATA,_BSS
  24.     assume    cs:_TEXT,ds:DGROUP
  25. _DATA    segment word public 'DATA'
  26. d@    label    byte
  27. d@w    label    word
  28. _DATA    ends
  29. _BSS    segment word public 'BSS'
  30. b@    label    byte
  31. b@w    label    word
  32. _BSS    ends
  33. _TEXT    segment byte public 'CODE'
  34.    ;    
  35.    ;    main()
  36.    ;    
  37.     assume    cs:_TEXT
  38. _main    proc    near
  39.     push    bp
  40.     mov    bp,sp
  41.    ;    
  42.    ;    {
  43.    ;      fontread(fontblock);
  44.    ;    
  45.     mov    ax,offset DGROUP:_fontblock
  46.     push    ax
  47.     call    near ptr _fontread
  48.     pop    cx
  49.    ;    
  50.    ;      fontwrite(fontblock);
  51.    ;    
  52.     mov    ax,offset DGROUP:_fontblock
  53.     push    ax
  54.     call    near ptr _fontwrite
  55.     pop    cx
  56.    ;    
  57.    ;       return;
  58.    ;    
  59.     jmp    short @1@50
  60. @1@50:
  61.    ;    
  62.    ;    }
  63.    ;    
  64.     pop    bp
  65.     ret    
  66. _main    endp
  67.    ;    
  68.    ;    fontread(unsigned *chunk)
  69.    ;    
  70.     assume    cs:_TEXT
  71. _fontread    proc    near
  72.     push    bp
  73.     mov    bp,sp
  74.     sub    sp,4
  75.     push    si
  76.    ;    
  77.    ;    {
  78.    ;      unsigned far *screen;
  79.    ;      int cnt;
  80.    ;    
  81.    ;       outportb (0x3ce, 5);    // Mode Ragister (index 5)
  82.    ;    
  83.     mov    dx,974
  84.     mov    al,5
  85.     out    dx,al
  86.    ;    
  87.    ;         outportb (0x3cf, 0);    // disable O/E bit for sequential addressing
  88.    ;    
  89.     mov    dx,975
  90.     mov    al,0
  91.     out    dx,al
  92.    ;    
  93.    ;    
  94.    ;       outportb (0x3c4, 4);
  95.    ;    
  96.     mov    dx,964
  97.     mov    al,4
  98.     out    dx,al
  99.    ;    
  100.    ;         outportb (0x3c5, 6);
  101.    ;    
  102.     mov    dx,965
  103.     mov    al,6
  104.     out    dx,al
  105.    ;    
  106.    ;    
  107.    ;       outportb (0x3ce, 4);
  108.    ;    
  109.     mov    dx,974
  110.     mov    al,4
  111.     out    dx,al
  112.    ;    
  113.    ;       outportb (0x3cf, 2);
  114.    ;    
  115.     mov    dx,975
  116.     mov    al,2
  117.     out    dx,al
  118.    ;    
  119.    ;    
  120.    ;       screen = MK_FP(0xb800, 0x0000);
  121.    ;    
  122.     mov    word ptr [bp-2],47104
  123.     mov    word ptr [bp-4],0
  124.    ;    
  125.    ;       for (cnt = 0; cnt < 0x2000; cnt++)
  126.    ;    
  127.     xor    si,si
  128.     jmp    short @2@98
  129. @2@50:
  130.    ;    
  131.    ;          chunk[cnt] = screen[cnt];
  132.    ;    
  133.     mov    ax,si
  134.     shl    ax,1
  135.     les    bx,dword ptr [bp-4]
  136.     add    bx,ax
  137.     mov    ax,word ptr es:[bx]
  138.     mov    dx,si
  139.     shl    dx,1
  140.     mov    bx,word ptr [bp+4]
  141.     add    bx,dx
  142.     mov    word ptr [bx],ax
  143.     inc    si
  144. @2@98:
  145.     cmp    si,8192
  146.     jl    short @2@50
  147.    ;    
  148.    ;    
  149.    ;       outportb (0x3ce, 4);
  150.    ;    
  151.     mov    dx,974
  152.     mov    al,4
  153.     out    dx,al
  154.    ;    
  155.    ;       outportb (0x3cf, 0);
  156.    ;    
  157.     mov    dx,975
  158.     mov    al,0
  159.     out    dx,al
  160.    ;    
  161.    ;    
  162.    ;         outportb (0x3c4, 4);
  163.    ;    
  164.     mov    dx,964
  165.     mov    al,4
  166.     out    dx,al
  167.    ;    
  168.    ;         outportb (0x3c5, 2);
  169.    ;    
  170.     mov    dx,965
  171.     mov    al,2
  172.     out    dx,al
  173.    ;    
  174.    ;    
  175.    ;       outportb (0x3ce, 5);    // Mode Ragister (index 5)
  176.    ;    
  177.     mov    dx,974
  178.     mov    al,5
  179.     out    dx,al
  180.    ;    
  181.    ;       outportb (0x3cf, 16);    // disable O/E bit for sequential addressing
  182.    ;    
  183.     mov    dx,975
  184.     mov    al,16
  185.     out    dx,al
  186.    ;    
  187.    ;    
  188.    ;       return;
  189.    ;    
  190.     jmp    short @2@146
  191. @2@146:
  192.    ;    
  193.    ;    }
  194.    ;    
  195.     pop    si
  196.     mov    sp,bp
  197.     pop    bp
  198.     ret    
  199. _fontread    endp
  200.    ;    
  201.    ;    fontwrite(unsigned *chunk)
  202.    ;    
  203.     assume    cs:_TEXT
  204. _fontwrite    proc    near
  205.     push    bp
  206.     mov    bp,sp
  207.     sub    sp,4
  208.     push    si
  209.    ;    
  210.    ;    {
  211.    ;      unsigned far *screen;
  212.    ;      int cnt;
  213.    ;    
  214.    ;       outportb (0x3c4, 4);    // Memory Mode (index 4)
  215.    ;    
  216.     mov    dx,964
  217.     mov    al,4
  218.     out    dx,al
  219.    ;    
  220.    ;       outportb (0x3c5, 6);    // enable O/E Bit for sequential addressing
  221.    ;    
  222.     mov    dx,965
  223.     mov    al,6
  224.     out    dx,al
  225.    ;    
  226.    ;    
  227.    ;       outportb (0x3ce, 5);    // Mode Ragister (index 5)
  228.    ;    
  229.     mov    dx,974
  230.     mov    al,5
  231.     out    dx,al
  232.    ;    
  233.    ;       outportb (0x3cf, 0);    // disable O/E bit for sequential addressing
  234.    ;    
  235.     mov    dx,975
  236.     mov    al,0
  237.     out    dx,al
  238.    ;    
  239.    ;    
  240.    ;       outportb (0x3c4, 2);    // Map mask for write mode 0 (index 2)
  241.    ;    
  242.     mov    dx,964
  243.     mov    al,2
  244.     out    dx,al
  245.    ;    
  246.    ;       outportb (0x3c5, 4);    // Plane mask, 4 = 0100 = plane 2
  247.    ;    
  248.     mov    dx,965
  249.     mov    al,4
  250.     out    dx,al
  251.    ;    
  252.    ;    
  253.    ;       screen = MK_FP(0xb800, 0x0000);
  254.    ;    
  255.     mov    word ptr [bp-2],47104
  256.     mov    word ptr [bp-4],0
  257.    ;    
  258.    ;       for (cnt = 0; cnt < 0x2000; cnt++)
  259.    ;    
  260.     xor    si,si
  261.     jmp    short @3@98
  262. @3@50:
  263.    ;    
  264.    ;          screen[cnt] = chunk[cnt];
  265.    ;    
  266.     mov    ax,si
  267.     shl    ax,1
  268.     mov    bx,word ptr [bp+4]
  269.     add    bx,ax
  270.     mov    ax,word ptr [bx]
  271.     mov    dx,si
  272.     shl    dx,1
  273.     les    bx,dword ptr [bp-4]
  274.     add    bx,dx
  275.     mov    word ptr es:[bx],ax
  276.     inc    si
  277. @3@98:
  278.     cmp    si,8192
  279.     jl    short @3@50
  280.    ;    
  281.    ;    
  282.    ;       outportb (0x3c4, 2);    // Map mask for write mode 0 (index 2)
  283.    ;    
  284.     mov    dx,964
  285.     mov    al,2
  286.     out    dx,al
  287.    ;    
  288.    ;       outportb (0x3c5, 3);    // Plane mask, 3 = 0011 = planes 0 and 1
  289.    ;    
  290.     mov    dx,965
  291.     mov    al,3
  292.     out    dx,al
  293.    ;    
  294.    ;    
  295.    ;       outportb (0x3ce, 5);    // Mode Ragister (index 5)
  296.    ;    
  297.     mov    dx,974
  298.     mov    al,5
  299.     out    dx,al
  300.    ;    
  301.    ;       outportb (0x3cf, 16);    // disable O/E bit for sequential addressing
  302.    ;    
  303.     mov    dx,975
  304.     mov    al,16
  305.     out    dx,al
  306.    ;    
  307.    ;    
  308.    ;       outportb (0x3c4, 4);    // Memory Mode (index 4)
  309.    ;    
  310.     mov    dx,964
  311.     mov    al,4
  312.     out    dx,al
  313.    ;    
  314.    ;       outportb (0x3c5, 2);    // disable O/E Bit for odd/even addressing
  315.    ;    
  316.     mov    dx,965
  317.     mov    al,2
  318.     out    dx,al
  319.    ;    
  320.    ;    
  321.    ;       return;
  322.    ;    
  323.     jmp    short @3@146
  324. @3@146:
  325.    ;    
  326.    ;    }
  327.    ;    
  328.     pop    si
  329.     mov    sp,bp
  330.     pop    bp
  331.     ret    
  332. _fontwrite    endp
  333. _TEXT    ends
  334. _BSS    segment word public 'BSS'
  335. _fontblock    label    word
  336.     db    16384 dup (?)
  337.     ?debug    C E9
  338. _BSS    ends
  339. _DATA    segment word public 'DATA'
  340. s@    label    byte
  341. _DATA    ends
  342. _TEXT    segment byte public 'CODE'
  343. _TEXT    ends
  344.     public    _main
  345.     public    _fontwrite
  346.     public    _fontblock
  347.     public    _fontread
  348.     end
  349.