simple boarder, not fitting in window? Help!!!

ok i have a program where i wanna make a simple boarder around the screen using just the crt unit.

i have tried this on a screen

[code]
window(1,1,80,25)
gotoxy (1,1)
write('AAAAAAAAAAAA...); {80 times}
[/code]

then

[code]side boarders[/code]

then

[code]
gotoxy(1,25);
write('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); {80 TIMES}
[/code]

the top and sides come out ok for the boarder but when the program writes at gotoxy(80,25) the cursor moves forward making the entire scree go up this cuts of the line at the top can any one suggest a solution?

thanks

Comments

  • : the top and sides come out ok for the boarder but when the program writes at gotoxy(80,25) the cursor moves forward making the entire scree go up this cuts of the line at the top can any one suggest a solution?

    There are two solutions. One is to make the window either 24 rows or 79 columns (either way will avoid writing to 80,25). Another is to use Mem[] to write directly to the video memory. The screen wont scroll that way, so you can safely write to 80,25.

    If you are unfamiliar with the second method, google for SWAG. There is a lot of useful code in there.

  • : : the top and sides come out ok for the boarder but when the program writes at gotoxy(80,25) the cursor moves forward making the entire scree go up this cuts of the line at the top can any one suggest a solution?
    :
    : There are two solutions. One is to make the window either 24 rows or 79 columns (either way will avoid writing to 80,25). Another is to use Mem[] to write directly to the video memory. The screen wont scroll that way, so you can safely write to 80,25.
    :
    : If you are unfamiliar with the second method, google for SWAG. There is a lot of useful code in there.

    I agree with you on the Memory thing. I use it all the time. Try this code; it will write a char to the screen without moving the cursor or scrolling the screen.

    [code]
    PROCEDURE PutChar(X, Y :Byte; C : Char; Color : Byte);
    Begin
    { Don't allow writes outside of screen }
    If (X > 80) or (Y > 25) Then Exit;

    { $B800 is the memory buffer location of the screen }
    { Every line is 160 bytes wide. 80 characters, 80 Color Attributes }
    MemW[$B800: X*2 + Y*160] := Ord(Char) + Color Shl 8;
    End;

    PROCEDURE PutString(X,Y : Byte; S : String; Color : Byte);
    VAR Z : Byte;
    Begin
    For Z := 1 to Length(S) Do
    PutChar(X+Z,Y,S[Z],Color);
    End;
    [/code]

    Just call it like this:
    PutChar(40,12,'A',15);
    { Same as GOTOXY(41,13); Textcolor(15); TextBackground(0); Write('A'); }
    PutSting is used the same way, but with more than 1 character at a time.

    Enjoy,
    Phat Nat
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories