Program VGA_to_SCART; { This program sets VGA 80x25 color text mode to PAL frequencies for VGA to TV adapter. This program is written to be an exaple how to get PAL frequencies out of VGA card. This program outputs noninterlaced picture at PAL frequencies (15625 Hz horizonal and 50 Hz vertical). There is a small error in frequencies, but TVs can handle this easily. I have not done anything to change then font size according the TV resolition, so part of the picture will remain out of visible TV screen area. This sourcecode compiles with Turbo Pascal and Borland Pascal compilers versions 4.0 and up. Copyright Tomi Engdahl 1994-1996 } Uses Dos,Crt; Const DirectVideo=False; {forces CRT unit to use BIOS calls for output} crtc_index=$3d4; crtc_data=$3d5; atc_index=$3c0; atc_data=$3c0; graph_index=$3ce; graph_data=$3cf; seq_index=$3c4; seq_data=$3c5; status_1=$3da; VideoSegment=$A000; DAC_addr=$3c8; DAC_data=$3c9; misc_out_write=$3C2; misc_out_read=$3CC; Procedure SetBiosMode(mode:byte); Var regs:registers; Begin regs.AH:=$00; regs.AL:=mode; Intr($10,regs); End; Procedure SetBiosCursorType(startline,endline:byte); Var regs:registers; Begin regs.AH:=$01; regs.CH:=startline; regs.CL:=endline; Intr($10,regs); End; Procedure Offset(bytes_per_line:byte); Begin Port[crtc_index]:=$13; Port[crtc_data]:=bytes_per_line; End; Procedure sync_reset_on; Begin Port[seq_index]:=$00; Port[seq_data]:=Port[seq_data] and 253; End; Procedure sync_reset_off; Begin Port[seq_index]:=$00; Port[seq_data]:=Port[seq_data] or 2; End; Procedure enable_timing_writes; Begin Port[crtc_index]:=$11; Port[crtc_data]:=Port[crtc_data] and 127; Port[crtc_index]:=$3; Port[crtc_data]:=Port[crtc_data] or 128; End; Procedure set_positive_syncs; Begin Port[misc_out_write]:=Port[misc_out_read] and 63; End; Begin SetBiosMode($01); sync_reset_on; Port[seq_index]:=$01; Port[seq_data]:=Port[seq_data] or 8; sync_reset_off; enable_timing_writes; Port[crtc_index]:=$00; {crtc horizonal total} Port[crtc_data]:=96; {u96} Port[crtc_index]:=$06; {crtc vertical total} Port[crtc_data]:=55; {u55} Port[crtc_index]:=$10; {crtc vertical start register} Port[crtc_data]:=30; {u30} Port[crtc_index]:=$05; {crtc end horizonal retrace} Port[crtc_data]:=129; {129} Port[crtc_index]:=$11; {crtc end vertical retrace} Port[crtc_data]:=33; {46} Port[crtc_index]:=$12; {crtc} Port[crtc_data]:=2; {143} Port[crtc_index]:=$15; {crtc end} Port[crtc_data]:=45; {150} Port[crtc_index]:=$16; {crtc end} Port[crtc_data]:=30; {185} Port[crtc_index]:=$04; {horizonal retrace start} Port[crtc_data]:=83; set_positive_syncs; Writeln; Writeln; Writeln; Writeln('VGA text mode to TV driver version 0.1'); Writeln('Copyright by Tomi Engdahl 1994-1996'); End.