Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mo 31.08.09 16:04 
user profile iconDonManfred hat folgendes geschrieben Zum zitierten Posting springen:
Die Dateinamensgebung bei Microsoft erschliesst sich mir auch nicht immer :D
Es ist Microsoft, da denke ich dann über solche Dinge nicht gross nach und nehme es hin wie gegeben :-)

Nur ist TurboPascal/Delphi leider von Borland...

Und damit sind wir völlig OT, oder?

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Dude566
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Mo 31.08.09 17:09 
user profile iconMartok hat folgendes geschrieben Zum zitierten Posting springen:
user profile iconDonManfred hat folgendes geschrieben Zum zitierten Posting springen:
Die Dateinamensgebung bei Microsoft erschliesst sich mir auch nicht immer :D
Es ist Microsoft, da denke ich dann über solche Dinge nicht gross nach und nehme es hin wie gegeben :-)

Nur ist TurboPascal/Delphi leider von Borland...

Und damit sind wir völlig OT, oder?


ich fands gerade amüsant zu lesen, aber natürlich passt es nicht hier her.

_________________
Es gibt 10 Gruppen von Menschen: diejenigen, die das Binärsystem verstehen, und die anderen.
Muck
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98
Erhaltene Danke: 8

Win 8, Win 7, Vista, Win XP
Delphi XE3, Delphi 2009, Delphi 2007, Delphi 5
BeitragVerfasst: Mo 31.08.09 17:54 
Hallo,

zurueck zur eigentlichen Frage der Cursorsteuerung in einer DOS BOX.

Habe damals viele Spiele (80er) fuer ne mailbox geschrieben. (2400 BAUD, falls sich andere erinnern GRINS)
Zur Steuerung von Farben und Cursor wurden dort Ansi-Escape Sequenzen genutzt.
Alles was man tun muss ist die ANSI.SYS mit passenden Parametern in der config.sys des Dos Fensters installieren. Google nach den ANSI Sequenzen. Und die ANSI.SYS gibt es noch, zumindest habe ich sie auf meinem XP Rechner.

Auch kann man sich eine Beschreibung des grafikkarten Assembler satzes besorgen und einfach den Textmodus der Grafikkarte direkt ansprechen durch Aufrufe des DOS Interrupt $10 mit passendem Parameter im Register AH.
Google nach DOS Interrupt Listen, da findet man eigentlich alles.

Und dann war da noch die unsaubere Methode einfach direkt in den Textmodusspeicher an der Adresse $B800:0000 zu schreiben. 80x25 Doppelbytes. Jeweils ein Byte fuer Farb Info und ein Byte Ascii.

cu

Markus
Muck
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98
Erhaltene Danke: 8

Win 8, Win 7, Vista, Win XP
Delphi XE3, Delphi 2009, Delphi 2007, Delphi 5
BeitragVerfasst: Mo 31.08.09 18:07 
Hallo,

habe mal in der alten Kiste gestoebert.

Hier meine CRT32.PAS, habe die mal unter Delphi im Jahr 2002 genutzt.
Ich weiss nicht, ob die mit Delphi 2009 rennt, Delphi 2007 sollte klappen.
Falls Interesse:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
CONST

  CheckBreak      = True;
  CheckEOF        = True;
  DirectVideo     = True;
  CheckSnow       = False;

VAR
StartAttr : Word;
CrtPipe : Boolean;
CrtInPipe : boolean;
German : Boolean;
Delphirun : Boolean;


PROCEDURE OEMCode;
begin
if AreFileApisANSI then SetFileApisToOEM;
//  if not AreFileApisANSI then SetFileApisToANSI;
end;

PROCEDURE ClrEol;
VAR tC : TCoord;Len, Nw : LongWord;Cbi : TConsoleScreenBufferInfo;
BEGIN
GetConsoleScreenBufferInfo(hConsoleOutput, Cbi);
Len := Cbi.dwSize.x-Cbi.dwCursorPosition.x;
tC.x := Cbi.dwCursorPosition.x;
tC.y := Cbi.dwCursorPosition.y;
FillConsoleOutputAttribute(hConsoleOutput, TextAttr, Len, tC, Nw);
FillConsoleOutputCharacter(hConsoleOutput, ' ', Len, tC, Nw);
END;

PROCEDURE ClrScr;
VAR tC : TCoord; Nw : LongWord; Cbi : TConsoleScreenBufferInfo;
BEGIN
GetConsoleScreenBufferInfo(hConsoleOutput, Cbi);
tC.x := 0;
tC.y := 0;
FillConsoleOutputAttribute(hConsoleOutput, TextAttr, Cbi.dwSize.x*Cbi.dwSize.y, tC, Nw);
FillConsoleOutputCharacter(hConsoleOutput, ' ', Cbi.dwSize.x*Cbi.dwSize.y, tC, Nw);
SetConsoleCursorPosition(hConsoleOutput, tC);
END;

FUNCTION WhereX : Integer;
VAR Cbi : TConsoleScreenBufferInfo;
BEGIN
GetConsoleScreenBufferInfo(hConsoleOutput, Cbi);
Result := TCoord(Cbi.dwCursorPosition).x+1
END;

FUNCTION WhereY : Integer;
VAR Cbi : TConsoleScreenBufferInfo;
BEGIN
GetConsoleScreenBufferInfo(hConsoleOutput, Cbi);
Result := TCoord(Cbi.dwCursorPosition).y+1
END;

PROCEDURE GotoXY(CONST x, y : Integer);
VAR Coord : TCoord;
BEGIN
Coord.x := x-1;
Coord.y := y-1;
SetConsoleCursorPosition(hConsoleOutput, Coord)
END;

PROCEDURE InsLine;
VAR Cbi : TConsoleScreenBufferInfo;sSR : TSmallRect;Coord : TCoord;
 CI : TCharInfo;Nw : LongWord;
BEGIN
GetConsoleScreenBufferInfo(hConsoleOutput, Cbi);
Coord := Cbi.dwCursorPosition;
sSR.left := 0;
sSR.Top := Coord.y;
sSR.Right := Cbi.srWindow.Right;
sSR.Bottom := Cbi.srWindow.Bottom;
CI.AsciiChar := ' ';
CI.Attributes := Cbi.wAttributes;
Coord.x := 0;
Coord.y := Coord.y+1;
ScrollConsoleScreenBuffer(hConsoleOutput, sSR, NIL, Coord, CI);
Coord.y := Coord.y-1;
FillConsoleOutputAttribute(hConsoleOutput, TextAttr, Cbi.dwSize.x*Cbi.dwSize.y, Coord, Nw);
END;

PROCEDURE DelLine;
VAR Cbi : TConsoleScreenBufferInfo;sSR : TSmallRect;Coord : TCoord;
 CI : TCharInfo;Nw : LongWord;
BEGIN
GetConsoleScreenBufferInfo(hConsoleOutput, Cbi);
Coord := Cbi.dwCursorPosition;
sSR.left := 0;
sSR.Top := Coord.y+1;
sSR.Right := Cbi.srWindow.Right;
sSR.Bottom := Cbi.srWindow.Bottom;
CI.AsciiChar := ' ';
CI.Attributes := Cbi.wAttributes;
Coord.x := 0;
Coord.y := Coord.y;
ScrollConsoleScreenBuffer(hConsoleOutput, sSR, NIL, Coord, CI);
FillConsoleOutputAttribute(hConsoleOutput, TextAttr, Cbi.dwSize.x*Cbi.dwSize.y, Coord, Nw);
END;

PROCEDURE TextBackground(CONST Color : Word);
BEGIN
LastMode := TextAttr;
TextAttr := (Color SHL 4OR (TextAttr AND $f);
SetConsoleTextAttribute(hConsoleOutput, TextAttr);
END;

PROCEDURE TextColor(CONST Color : Word);
BEGIN
LastMode := TextAttr;
TextAttr := (Color AND $fOR (TextAttr AND $f0);
SetConsoleTextAttribute(hConsoleOutput, TextAttr);
END;

PROCEDURE RestoreCrt;
BEGIN
Normvideo;
END;

Procedure CRTLesen;
VAR Cbi:TConsoleScreenBufferInfo;tC : TCoord;
begin
IF GetConsoleScreenBufferInfo(hConsoleOutput, Cbi) THEN BEGIN
  TextAttr := Cbi.wAttributes;
  StartAttr := Cbi.wAttributes;
  LastMode  := Cbi.wAttributes;
  tC.x := Cbi.srWindow.left+1;
  tC.y := Cbi.srWindow.Top+1;
  WindMin := tC;
  ViewMax := Cbi.dwSize;
  tC.x := Cbi.srWindow.Right+1;
  tC.y := Cbi.srWindow.Bottom+1;
  WindMax := tC;
  CrtPipe := False;
END ELSE CrtPipe := True;
end;

PROCEDURE TextMode(Cols,Rows:Word);
var X:TCoord;Y:Small_rect;
BEGIN
X.X:=Cols;X.Y:=Rows;
Y.Left:=0;Y.Top:=0;Y.Right:=Cols-1;Y.Bottom:=Rows-1;
SetConsoleScreenBufferSize(hConsoleOutput,X);
SetConsoleWindowInfo(hConsoleOutput,true,Y);
CrtLesen;
X80:=ViewMax.X;
END;

PROCEDURE TextAttribut(CONST Color, Background : Word);
BEGIN
LastMode := TextAttr;
TextAttr := (Color AND $fOR (Background SHL 4);
SetConsoleTextAttribute(hConsoleOutput, TextAttr);
END;

PROCEDURE HighVideo;
BEGIN
LastMode := TextAttr;
TextAttr := TextAttr OR $8;
SetConsoleTextAttribute(hConsoleOutput, TextAttr);
END;

PROCEDURE LowVideo;
BEGIN
LastMode := TextAttr;
TextAttr := TextAttr AND $f7;
SetConsoleTextAttribute(hConsoleOutput, TextAttr);
END;

PROCEDURE NormVideo;
BEGIN
LastMode := TextAttr;
TextAttr := StartAttr;
SetConsoleTextAttribute(hConsoleOutput, TextAttr);
END;

PROCEDURE FlushInputBuffer;
BEGIN
FlushConsoleInputBuffer(hConsoleInput)
END;

FUNCTION KeyPressed : Boolean;
VAR NumberOfEvents : LongWord;
BEGIN
GetNumberOfConsoleInputEvents(hConsoleInput, NumberOfEvents);
Result := (NumberOfEvents > 0or SendKeyDa or (Wiederholen>0);
END;

Procedure SetCursorSize(WieGross:Byte;IstDa:Boolean);
var CCI:TConsoleCursorInfo;
begin
CCI.dwSize:=WieGross;CCI.bVisible:=IstDa;
SetConsoleCursorInfo(hConsoleOutput,CCI);
end;

PROCEDURE Init;
BEGIN
SetActiveWindow(0);
OEMCode;
hConsoleInput := GetStdHandle(STD_INPUT_HANDLE);
hConsoleOutput := GetStdHandle(STD_OUTPUT_HANDLE);
HConsoleError := GetStdHandle(STD_ERROR_HANDLE);
CrtInPipe := getfiletype(hConsoleInput) = FILE_TYPE_PIPE;
AssignFile(StdError, '');
ReWrite(StdError);
TTextRec(StdError).Handle := HConsoleError;
CrtLesen;
GetConsoleCursorInfo(hConsoleOutput,CI);
GetConsoleMode(hConsoleOutput,lpMode);
SetConsoleMode(hConsoleOutput,lpMode-Enable_Wrap_at_eol_output);
GetConsoleMode(hConsoleInput,ipMode);
SetConsoleMode(hConsoleInput,(ipMode-ENABLE_PROCESSED_INPUT) or ENABLE_WINDOW_INPUT or ENABLE_MOUSE_INPUT);
END;
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 31.08.09 22:56 
user profile iconMuck hat folgendes geschrieben Zum zitierten Posting springen:
Zur Steuerung von Farben und Cursor wurden dort Ansi-Escape Sequenzen genutzt.
Alles was man tun muss ist die ANSI.SYS mit passenden Parametern in der config.sys des Dos Fensters installieren. Google nach den ANSI Sequenzen. Und die ANSI.SYS gibt es noch, zumindest habe ich sie auf meinem XP Rechner.

Die Konsole hat nichts mit DOS und 16-Bit Anwendungen zu tun. Die Konsole dient nur dazu 32-Bit Windows Programme ohne Benutzeroberfläche auszuführen.
Muck
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98
Erhaltene Danke: 8

Win 8, Win 7, Vista, Win XP
Delphi XE3, Delphi 2009, Delphi 2007, Delphi 5
BeitragVerfasst: Mo 31.08.09 23:12 
Hi,

ich habe die alte CRT32.pas hier angegeben, um zu zeigen, dass man sehr wohl eine Benutzerobeflaeche im ALTEN DOS Stil in eine 32 BIT EXE packen kann. Ich zeige hier was geht, nicht wozu die Konsole dient.

Jeder kann dann selbst entscheiden, was er damit machen will.


bis denne
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 01.09.09 00:15 
Schon klar. das sind ja auch alles Windows API Funktionen. Mein verlinkte Include-Datei macht auch nichts anderes, als die Win-API Funktionen zu kapseln.
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Di 01.09.09 09:36 
user profile iconMuck hat folgendes geschrieben Zum zitierten Posting springen:

Auch kann man sich eine Beschreibung des grafikkarten Assembler satzes besorgen und einfach den Textmodus der Grafikkarte direkt ansprechen durch Aufrufe des DOS Interrupt $10 mit passendem Parameter im Register AH.
Google nach DOS Interrupt Listen, da findet man eigentlich alles.

Und dann war da noch die unsaubere Methode einfach direkt in den Textmodusspeicher an der Adresse $B800:0000 zu schreiben. 80x25 Doppelbytes. Jeweils ein Byte fuer Farb Info und ein Byte Ascii.

Ja, mit dem int 10h hab ich häufig rumgespielt, aber weder das noch der Zugriff auf den Textmodusspeicher wird unter 32-Bit-Windows funktionieren.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 01.09.09 14:36 
user profile iconTimosch hat folgendes geschrieben Zum zitierten Posting springen:
Ja, mit dem int 10h hab ich häufig rumgespielt, aber weder das noch der Zugriff auf den Textmodusspeicher wird unter 32-Bit-Windows funktionieren.

... weil Windows direkte Hardwarezugriffe unterbindet, aus Sicherheitsgründen.
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Di 01.09.09 16:36 
...Aber Unser Luckie könnte dafür sicherlich einen Treiber basteln, wenn er wirklich wollte...

So großes Vertrauen in deine Fähigkeiten haben wir...
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 01.09.09 17:20 
Könnte wohl jeder. Der Unterschied liegt nur darin, wie lange man braucht, sich das nötige Wissen und die nötigen Fähigkeiten anzueignen.
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Di 01.09.09 17:42 
Hab noch ein etwas längeres "Tutorial", was meiner Meinung nach wirklich gut ist und genau bei den Konsolen anfängt:

de.wikibooks.org/wiki/Delphi
de.wikibooks.org/wik...nes_Delphi-Programms