📄 turbo.imp
字号:
{ Turbo Pascal standard units. For use with p2c. }{ Only partially complete! }{-------------------------------------------------------------------------}unit printer;interfacevar lst : text;end;{-------------------------------------------------------------------------}unit dos;interfaceconst FCarry = $0001; { 8086 flags } FParity = $0004; FAuxiliary = $0010; FZero = $0040; FSign = $0080; FOverflow = $0100; fmClosed = $D7B0; { File modes } fmInput = $D7B1; fmOutput = $D7B2; fmInOut = $D7B3; ReadOnly = $01; { File attributes } Hidden = $02; SysFile = $04; VolumeID = $08; Directory = $10; Archive = $20; AnyFile = $3F;type PathStr = string[79]; DirStr = PathStr; NameStr = string[8]; ExtStr = string[3]; FileRec = record Handle: Word; Mode: Word; RecSize: Word; Private: array [1..26] of Byte; UserData: array [1..16] of Byte; Name: array [0..79] of char; end; TextBuf = array [0..127] of char; TextRec = record Handle: Word; Mode: Word; BufSize: Word; Private: Word; BufPos: Word; BufEnd: Word; BufPtr: ^TextBuf; OpenProc: Pointer; InOutProc: Pointer; FlushProc: Pointer; CloseProc: Pointer; UserData: array [1..16] of Byte; Name: array [0..79] of char; Buffer: TextBuf; end; Registers = record case integer of 0: (AX,BX,CX,DX,BP,SI,DI,ES,Flags: word); 1: (AL,AH,BL,BH,CL,CH,DL,DH: byte); end; DateTime = record Year, Month, Day, Hour, Min, Sec: word; end; SearchRec = record Fill: array [1..21] of byte; Attr: byte; Time: longint; Size: longint; Name: string[12]; end;var DosError: integer;procedure GetTime(var hour, minute, second, csec : word);procedure GetDate(var year, month, day, dow : word);procedure FSplit(fn : PathStr; var dir, name, ext : string);{WarnNames=1}procedure Exec(path, cmdLine : PathStr);{WarnNames}end;{-------------------------------------------------------------------------}unit crt;interface{FuncMacro KeyPressed=kbhit()}{FuncMacro Readkey=getch()}function KeyPressed : boolean;function ReadKey : char;procedure clrscr;procedure clreol;procedure delay(ms : word);procedure textbackground(i : integer);procedure textcolor(Color : byte);procedure window(a, b, c, d : integer);const BLACK = 0; BLUE = 1; GREEN = 2; CYAN = 3; RED = 4; MAGENTA = 5; BROWN = 6; LIGHTGRAY = 7; DARKGRAY = 8; LIGHTBLUE = 9; LIGHTGREEN = 10; LIGHTCYAN = 11; LIGHTRED = 12; LIGHTMAGENTA = 13; YELLOW = 14; WHITE = 15; BLINK = 128;var wherex, wherey : integer; TextAttr : byte;end;{-------------------------------------------------------------------------}unit graph;interfaceconst gr0k = 0; grNoInitGraph = -1; grNotDetected = -2; grFileNotFound = -3; grInvalidDriver = -4; grNoLoadMem = -5; grNoScanMem = -6; grNoFloodMem = -7; grFontNotFound = -8; grNoFontMem = -9; grInvalidMode = -10; grError = -11; grIOerror = -13; grInvalidFontNum = -14; Detect = 0; CGA = 1; MCGA = 2; EGA = 3; EGA64 = 4; EGAMono = 5; IBM8514 = 6; HercMono = 7; ATT400 = 8; VGA = 9; PC3270 = 10; CurrentDriver = -128; CGAC0 = 0; CGAC1 = 1; CGAC2 = 2; CGAC3 = 3; CGAHi = 4; MCGAC0 = 0; MCGAC1 = 1; MCGAC2 = 2; MCGAC3 = 3; MCGAMed = 4; MCGAHi = 5; EGALo = 0; EGAHi = 1; EGA64Lo = 0; EGA64Hi = 1; EGAMonoHi = 3; HercMonoHi = 0; ATT400C0 = 0; ATT400C1 = 1; ATT400C2 = 2; ATT400C3 = 3; ATT400Med = 4; ATT400Hi = 5; VGALo = 0; VGAMed = 1; VGAHi = 2; PC3270Hi = 0; IBM8514LO = 0; IBM8514HI = 1; Black = 0; Blue = 1; Green = 2; Cyan = 3; Red = 4; Magenta = 5; Brown = 6; LightGray = 7; DarkGray = 8; LightBlue = 9; LightGreen = 10; LightCyan = 11; LightRed = 12; LightMagenta = 13; Yellow = 14; White = 15; SolidLn = 0; DottedLn = 1; CenterLn = 2; DashedLn = 3; UserBitLn = 4; NormWidth = 1; ThickWidth = 3;type ArcCoordsType = record X, Y: integer; Xstart, Ystart: integer; Xend, Yend: integer; end;const MaxColors = 15;type PaletteType = record Size: byte; Colors: array[0..MaxColors] of shortint; end; FillPatternType = array[1..8] of byte; FillSettingsType = record Pattern: word; Color: word; end; LineSettingsType = record LineStyle: word; Pattern: word; Thickness: word; end; TextSettingsType = record Font: word; Direction: word; CharSize: word; Horiz: word; Vert: word; end; ViewPortType = record x1, y1, x2, y2: integer; Clip: boolean; end;const LeftText = 0; CenterText = 1; RightText = 2; BottomText = 0; TopText = 2;const ClipOn = true; ClipOff = false;const EmptyFill = 0; SolidFill = 1; LineFill = 2; LtSlashFill = 3; SlashFill = 4; BkSlashFill = 5; LtBkSlashFill = 6; HatchFill = 7; XHatchFill = 8; InterleaveFill = 9; WideDotFill = 10; CloseDotFill = 11; UserFill = 17;const NormalPut = 0; CopyPut = 0; XORPut = 1; OrPut = 2; AndPut = 3; NotPut = 4;procedure Arc(X, Y: integer; StAngle, EndAngle, Radius: word);procedure Bar(x1, y1, x2, y2: integer);procedure Bar3D(x1, y1, x2, y2: integer; Depth: word; Top: boolean);procedure Circle(X, Y: integer; Radius: word);procedure ClearDevice;procedure ClearViewPort;procedure CloseGraph;procedure DetectGraph(var GraphDriver, GraphMode: integer);procedure DrawPoly(NumPoints: word; var PolyPoints);procedure Ellipse(X, Y: integer; StAngle, EndAngle: word; XRadius, YRadius: word);procedure FillEllipse(X, Y: integer; XRadius, YRadius: word);procedure FillPoly(NumPoints: word; var PolyPoints);procedure FloodFill(x, y: integer; Border: word);procedure GetArcCoords(var ArcCoords: ArcCoordsType);procedure GetAspectRatio(var Xasp, Yasp: word);function GetBkColor: word;function GetColor: word;function GetDefaultPalette(var Palette: PaletteType): PaletteType;function GetDriverName: string;procedure GetFillPattern(var FillPattern: FillPatternType);procedure GetFillSettings(var FillInfo: FillSettingsType);function GetGraphMode: integer;procedure GetImage(x1, y1, x2, y2: integer; var BitMap);procedure GetLineSettings(var LineInfo: LineSettingsType);function GetMaxColor: word;function GetMaxMode: word;function GetMaxX: integer;function GetMaxY: integer;function GetModeName(ModeNumber: integer): string;procedure GetModeRange(GraphDriver: integer; var LoMode, HiMode: integer);procedure GetPalette(var Palette: PaletteType);function GetPaletteSize: integer;function GetPixel(X,Y: integer): word;procedure GetTextSettings(var TextInfo: TextSettingsType);procedure GetViewSettings(var ViewPort: ViewPortType);function GetX: integer;function GetY: integer;procedure GraphDefaults;function GraphErrorMsg(ErrorCode: integer): string;function GraphResult: integer;function ImageSize(x1, y1, x2, y2: integer): word;procedure InitGraph(var GraphDriver: integer; var GraphMode: integer; PathToDriver: string);function InstallUserDriver(Name: string; AutoDetectPtr: pointer): integer;function InstallUserFont(FontFileName: string): integer;procedure Line(x1, y1, x2, y2: integer);procedure LineRel(Dx, Dy: integer);procedure LineTo(x, y: integer);procedure MoveRel(Dx, Dy: integer);procedure MoveTo(x, y: integer);procedure OutText(TextString: string);procedure OutTextXY(X,Y: integer; TextString: string);procedure PieSlice(x, y: integer; StAngle, EndAngle, Radius: word);procedure PutImage(x, y: integer; var BitMap; BitBlt: word);procedure PutPixel(x, y: integer; Pixel: word);procedure Rectangle(x1, y1, x2, y2: integer);function RegisterBGIdriver(driver: pointer): integer;function RegisterBGIfont(font: pointer): integer;procedure RestoreCrtMode;procedure Sector(x, y: integer; StAngle, EndAngle, XRadius, YRadius: word);procedure SetActivePage(Page: word);procedure SetAllPalette(var Palette);procedure SetAspectRatio(Xasp, Yasp: word);procedure SetBkColor(ColorNum: word);procedure SetColor(Color: word);procedure SetFillPattern(Pattern: FillPatternType; Color: word);procedure SetFillStyle(Pattern: word; Color: word);procedure SetGraphBufSize(BufSize: word);procedure SetGraphMode(Mode: integer);procedure SetLineStyle(LineStyle: word; Pattern: word; Thickness: word);procedure SetPalette(ColorNum: word; Color: shortint);procedure SetRGBPalette(ColorNum, RedValue, GreenValue, BlueValue: integer);procedure SetTextJustify(Horiz, Vert: word);procedure SetTextStyle(Font: word; Direction: word; CharSize: word);procedure SetUserCharSize(MultX, DivX, MultY, DivY: word);procedure SetViewPort(x1, y1, x2, y2: integer; Clip: boolean);procedure SetVisualPage(Page: word);procedure SetWriteMode(WriteMode: integer);function TextHeight(TextString: string): word;function TextWidth(TextString: string): word;end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -