I can not decipher your code without runnable version to test, but here is the last version of my playing with my Lazarus code. It has not all pieces and only rotation hard coded in procedure without shadowing the current buffer for collision detection.

I attach that as zip file.

Maybe you like this, so you do not worry about shadowing the screen contents (from Turbo Pascal FAQ):
Q: How can I read a text character from the screen (e.g. xy 5,2)?

A: The code for the task is given below

Uses Dos;
  (* Read an individual character from the screen *)
  function VDCHXYFN (column, row : byte) : char;
  var regs : registers;
      videocolumns : byte;
      videobase : word;
      offset : word;
  begin
    { Get the video base address }
    FillChar (regs, SizeOf(regs), 0);
    regs.ah := $0F;  Intr ($10, regs);
    if regs.al = 7 then videobase := $B000 else videobase := $B800;
    {}
    { Get the screen width }
    FillChar (regs, SizeOf(regs), 0);
    regs.ah := $0F;
    Intr ($10, regs);
    videocolumns := regs.ah;
    {}
    { Get the character }
    offset := (((row-1)*videocolumns)+(column-1))*2;
    vdchxyfn := chr(mem[videobase:offset]);
  end;  (* vdchxyfn *)

  begin
     writeln ('Character at 5, 2 is ascii ', Ord(VDCHXYFN(5,2)));
  end.

--------------------------------------------------------------------

i dont know how to open it... i placed a text document with the source... (sorry about the comm, they are in my country language...)

Your file looks garbled, right in beginning definition does not make sense:

var tip,x,y,x1,y1,x2,y2,jbyte;
    counter,i,speed,maxword;
    lovit,linie,gmaxboolean;
    zinteger;
    ftext;
    cchar;
    regsregisters ;
    cagearray[0..100,0..100] of byte;
                                                         {--desenarea celor 7 obiecte}

All end part is inside comment.

See addition in my previous post on reading the screen for text.

The main pas file was missing from my zip :(

it seems that doc doesn't do what i wanted.... here's the correct one

and i cant see where the full line is destroyed and then the hole system comes down...(in your file)

I did not implement collision or full line removal, only played little with rotation of the pieces and stopping them correctly in sides and down as box would be empty.

Logic of dropping should be simple as you have the lines above in your array cage, just copy over the removed line until hit empty line or top, only thing to check is that it could be more than one line filled at once and doing the connected book keeping for points. But also Lazarus version of Crt I think has command to delete line from window without needing to write all content again. I do not know if it is Turbo Pascal compatible. Generally there is cross platform unit called video in Lazarus, which could be used instead of CRT to give reading and writing to screen, but can not be used simultaneously with CRT.

that's what i tried to do at the final lines... to make permutation between the deleted line and the rest ones... execept the part with multiple full lines... and it makes a square in the left-down corner as you can see(only if the full line is at the bottom of the cage)... and i don't know how to fix it

The way you had swapped coordinates for cage to y,x instead of x,y made things very confusing. I also could not understand your two loops so I did this single loop from your first one for the redraw. I did not implement early finish for the drop until first empty line (looks like you are not updating the top line of cage) and I did not test the case that top line has pieces to drop, but seems to work for me with your code. I put it to draw the redrawn pieces in green so it would be more obvious which squares are repainted.

Your 'I' piece seems long and dropping faster than others and I had some problem turning the pieces near left side (at least the 'I' piece). I think it is clear, where this code should go (x2 and y2 variables also become unused, so I removed the definition in beginning). In my file the start line of this code is 977 in your code. Maybe I did some other changes to make code more understandable, so may be different in original file.

textcolor(green); {mark redrawn peaces with green}
                    if gmax then                      {permutari ale liniilor in matrice}
                    begin for i:=x1 downto 1 do
                         for j:=1 to 16 do
                         begin
                              gotoxy(j, i);
                              cage[i,j]:=cage[i-1,j];
                              if cage[i,j]=1 then write('Û')
                              else write(' ');
                         end;
                    end;
                    textcolor(4); {return the color}

i was trying to fix some issues that's why i make lower the delay of the "I" shape, and i only make it drop, to make things work faster.... and it works!! you are a genuis! thank you for everywhing! now i have to make an algorithm for points and an interface of the game:D

It is always possible to upvote and give reputation if you like something ;)

Looks like you could benefit of how to combine draw and undraw in same procedure (of course you must also change value put to cage accordingly) from my version of code. It had little strange shape for full block as I was earlier experimenting to find character to work both in Windows and Linux. chr(219) works well in Windows, like you use, but better to use constant instead of direct literal.

where can i find
1. tutorials about using images or other files(i saw in one code that he was using .dat in another one .pcx)?
2. tutorials about how to make an intro to a game, program it doesnt matter(in graphics)?
3. how to combine pascal or c++ with a 3d program?

May I ask why you are limiting yourself with command line programs, when Lazarus environment for example is free and you can do stuff more fancy even easier than with command line programs?

Of course Turbo Pascal 6 is also freeware now, but still...

And also Turbo Pascal 7 now, looks like

I checked for nostalgy real Turbo Pascal as it is very simple to install now from net (oh, those university days 1985).

Looks the example programs like BreakOut(hopelessly too fast these days) , BGIDemo could offer good tips if you really consider it worthwhile. For me learning say Python, my main language, and PyGame would be more sensible than going very deep in Pascal in DOS environment nowadays.

So I installed the Turbo Pascal 7 and applied the speed patch.

Here is as text file my code which run in it. No collisions or completed lines, down arrow works to speed things up.

i tried to make the game with graph so that i can make two or three cages, and to make a game interface, but now i have a problem... i dont know how to stop the graph..i made a game interface and then i made two cages... and now i don't want to use graph anymore.... i tried with closegraph, cleardevice... but it didnt word... i tried to make the whole game with graph but i dont know how to delete a '*' because it's not working with outtext(' ');....

I think you must Xor the text from screen or change text color to bacground color.

what is Xor? is that thing with asm at first?

if you xor paint two times you remove painted figure. it is bitwise exclusive or operation used in boolean logic and graphics painting modes.

http://en.wikipedia.org/wiki/Exclusive_or

and how can i do that? give me an example ...

you mean PutImage(ulx, uly, Saucer^, XORput); { erase image } ?

or

for I := 1 to 2 do { erase image }
PutImage(Pos.XOld, Pos.YOld, Saucer^, XORput);

i don'y know what are and how to use pointers.... and i dont know how to use putimage and getimage... so here's the code

i made the game without the gameinterface, and i want to know.... how can i put sounds in background?(i know how to make sounds, but its hard to synchronize and i don't have any ideas about how to put sounds in background)
and if it's another way to make sounds... i mean the sound() procedure makes sounds from the pc and i want to make or put my own songs.. if you understand..

i dont know how to use it, and i dont know how to make or open .muz files

some soundpas source here also for Midi.

i found in one syte how to make back sound, but i downloaded from there .ppu and .o files, they say that they are units, but when im runing the program it sais that i can't fint .tpu....

i think i figured out what it's happening... my pascal has the height and width modified so that when i tried to run my game on other pascal it didn't look like on my pascal... so here's what i'm thinking...
When i use graph the program modifies some of the pascal properties and it cannot be reversed until you exit the program and start it again... so if i can find out how to make these modifies manualy i think that the problem will be solved...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.