Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-12

sound blaster

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Szilasi Róbert

Ahoi!

I would like to compile BP code into FREE P
but I can't translate the following rows:
mov ax, Seg @DATA

  port[DMA_mask] := SB_DMA or 4;

If somebody can help me to translate Seg @DATA and port[DMA_mask] into free pascal source, please send me an example to

thanks

Robert

procedure InitDMAcontroller(Transfermode : byte);
var p, s, l : word;
begin
  DMApage := DMApages[SB_DMA];
  DMAoffset := DMAoffsets[SB_DMA];
  DMAsize := DMAsizes[SB_DMA];
  port[DMA_mask] := SB_DMA or 4;
  port[DMA_bpt] := $00;
  port[DMA_mode] := Transfermode or SB_DMA;
  DMA_addr(DMAbuffer, p, s, l);
  port[DMApage] := p;
  port[DMAoffset] := LO(s);
  port[DMAoffset] := HI(s);
  port[DMAsize] := LO(BufferSize - 1);
  port[DMAsize] := HI(BufferSize - 1);
  port[DMA_mask] := SB_DMA and 3;
end;

procedure SB_AutoInitDMA_IRQ; interrupt;
begin
asm
push DS
push ax
push dx
mov ax, Seg @DATA
mov DS, ax
mov dx, SBbase
add dx, $0e
in al, dx
mov RfshRequest, TRUE
mov al, 020h
out 020h, al
pop dx
pop ax
pop DS
end {asm};
end;

John Coppens
to Szilasi Róbert
Show quoted text 5 lines
Ahoi! I would like to compile BP code into FREE P but I can't translate the following rows: mov ax, Seg @DATA

The 'Seg' sentence isn't available, see manual:

Description
Seg returns the segment of the address of a variable. This function is only supported for compatibility. In Free Pascal, it returns always 0, since Free Pascal is a 32 bit compiler, segments have no meaning.

Depending on what you need this line for, you'll have to change the code.

port[DMA_mask] := SB_DMA or 4;

The port function is implemented in the ports unit (see manual). You'll have to put that in your 'uses' statement, and take into account the portability problems that can arrise.

John

Show quoted text 54 lines
If somebody can help me to translate Seg @DATA and port[DMA_mask] into free pascal source, please send me an example to thanks Robert procedure InitDMAcontroller(Transfermode : byte); var p, s, l : word; begin DMApage := DMApages[SB_DMA]; DMAoffset := DMAoffsets[SB_DMA]; DMAsize := DMAsizes[SB_DMA]; port[DMA_mask] := SB_DMA or 4; port[DMA_bpt] := $00; port[DMA_mode] := Transfermode or SB_DMA; DMA_addr(DMAbuffer, p, s, l); port[DMApage] := p; port[DMAoffset] := LO(s); port[DMAoffset] := HI(s); port[DMAsize] := LO(BufferSize - 1); port[DMAsize] := HI(BufferSize - 1); port[DMA_mask] := SB_DMA and 3; end; procedure SB_AutoInitDMA_IRQ; interrupt; begin asm push DS push ax push dx mov ax, Seg @DATA mov DS, ax mov dx, SBbase add dx, $0e in al, dx mov RfshRequest, TRUE mov al, 020h out 020h, al pop dx pop ax pop DS end {asm}; end; _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Balogh, Karoly (Charlie/iNQ
to Szilasi Róbert: Ahoi! I would like to compile BP code into FREE P but I can't translate the following…

Hi,

Szilasi Róbert wrote
I would like to compile BP code into FREE P but I can't translate the following rows: mov ax, Seg @DATA port[DMA_mask] := SB_DMA or 4;

To use port[]/portw[] array, you need to use Ports unit. So simply add "Uses Ports;" to the header of your program.

The assembler part is a bit more difficult, and also you need to rework the whole IRQ and DMA handling stuff in protected mode. You need to use DPMI, and the GO32 unit for this. The documentation contains examples on this topic.

If somebody can help me to translate Seg @DATA and port[DMA_mask] into free pascal source, please send me an example to

I implemented a Sound Blaster handler for my XM module player available at http://scenergy.dfmk.hu/inqcoders/.

But there are other Sound Blaster programming examples , on the contributed units
page.

Bye,

Charlie/iNQ .:%[ Cybernetic Hydraulic Android Responsible for ]%:. .:%[ Logical Infiltration and Exploration ]%:. .:%[ Member of TeamOS/2 Hungary ]%:. .:%[ Member of Hungarian Amiga User Group ]%:.
John Coppens
to Szilasi Róbert: Ahoi! I would like to compile BP code into FREE P but I can't translate the following…
Show quoted text 5 lines
Ahoi! I would like to compile BP code into FREE P but I can't translate the following rows: mov ax, Seg @DATA

The 'Seg' sentence isn't available, see manual:

Description
Seg returns the segment of the address of a variable. This function is only supported for compatibility. In Free Pascal, it returns always 0, since Free Pascal is a 32 bit compiler, segments have no meaning.

Depending on what you need this line for, you'll have to change the code.

port[DMA_mask] := SB_DMA or 4;

The port function is implemented in the ports unit (see manual). You'll have to put that in your 'uses' statement, and take into account the portability problems that can arrise.

John

Show quoted text 54 lines
If somebody can help me to translate Seg @DATA and port[DMA_mask] into free pascal source, please send me an example to thanks Robert procedure InitDMAcontroller(Transfermode : byte); var p, s, l : word; begin DMApage := DMApages[SB_DMA]; DMAoffset := DMAoffsets[SB_DMA]; DMAsize := DMAsizes[SB_DMA]; port[DMA_mask] := SB_DMA or 4; port[DMA_bpt] := $00; port[DMA_mode] := Transfermode or SB_DMA; DMA_addr(DMAbuffer, p, s, l); port[DMApage] := p; port[DMAoffset] := LO(s); port[DMAoffset] := HI(s); port[DMAsize] := LO(BufferSize - 1); port[DMAsize] := HI(BufferSize - 1); port[DMA_mask] := SB_DMA and 3; end; procedure SB_AutoInitDMA_IRQ; interrupt; begin asm push DS push ax push dx mov ax, Seg @DATA mov DS, ax mov dx, SBbase add dx, $0e in al, dx mov RfshRequest, TRUE mov al, 020h out 020h, al pop dx pop ax pop DS end {asm}; end; _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal