Hello, I'm new here and thanks for the help (in advance).

I was trying to get a simple 80x19 map to display in console mode and am getting runtime errors. I don't have the GNU debugger, nor do I know where to get it.

Here's the app:

[pascal]{
COLORS:
White,LightGray,DarkGray,Black
Brown
Yellow
Magenta,LightMagenta
Green,LightGreen
Red,LightRed
Blue,LightBlue
Cyan,LightCyan
}
program rpgmap;

uses crt,dos;

type
map_tile = record
tile: char;
color: integer;
move_cost: integer;
end;

function rolldie(size,addto: integer): integer;
begin
rolldie := (1+random(size))+addto;
end;

function rolldice(size,count,addto: integer): integer;
var i: integer;
begin
rolldice := addto;
for i := 1 to count do
rolldice := rolldice+(random(size)+1);
end;

const tiles: array[1..5] of map_tile = (
( tile: '.'; color: Green; move_cost: 250; ),
( tile: '*'; color: Brown; move_cost: 750; ),
( tile: 'v'; color: Green; move_cost: 500; ),
( tile: 'T'; color: Green; move_cost: 250; ),
( tile: 'f'; color: Brown; move_cost: 250; ));

desc: array[1..5] of string = ('You walk through the grass.',
'You slog through the mud.',
'You wander through the tall grass.',
'You pass beneath a green tree.',
'You walk under the dead tree.');
move_speed = 250;

procedure drawtile(n: byte; x,y: byte);
begin
gotoXY(X,Y);
TextColor(tiles[n].color);
write(tiles[n].tile);
end;

var map: array[1..80,1..19] of byte;
c,r: integer;
turn: integer = 0;
quit: boolean;
key: char;
x,y: byte;

begin
for r := 1 to 19 do
for c := 1 to 80 do
case rolldie(100,0) of
1..40: map[c,r] := 1;
41..50: map[c,r] := 2;
51..70: map[c,r] := 3;
71..100: if rolldie(100,0) >= 33 then map[c,r] := 4 else map[c,r] := 5;
default: map[c,r] := 1;
end;
repeat
key := ReadKey;
if key = 'Q' then quit := true;
turn := turn + 1;
gotoxy(1,20);
write(desc[map[x,y]]);
gotoxy(75,20);
write(turn);
until quit = true;
end.
[/pascal]

What did I do wrong? I know I'm not a good programmer, but I'm trying.

Robert