Howdy, Stranger!

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

Categories

Could someone please help me with my Qbasic Word Processor

Hello there,


I am currently attempting a QBASIC word processor. I am not

an expert on Qbasic and so I require someone's help.


The first question is how can I store information over a certain number of lines,

whilst giving the user the ability to press 'backspace' at the beggining of the line and go back a line.

In other words have an area of say 20 lines which

users can go back and forth through. I know

input does not work. Could somebody help me?


The second question is irrevalent to the topic, but a)what

does PEEK and POKE do in laments terms, and what does DEFSEG

and DEFINT A-Z do?


Any help is greatly appreciated, and people can either

e-mail me or type it on the message board,


Thanking you sincerely,

Andrew







Comments

  • The best text input method with QBasic is INKEY, which checks

    the keyboard buffer for a character, returning nothing if no

    key is ready, thus requiring a loop. Notice, however, it doesn't

    echo the key, so you'll need to print out the actual character

    yourself. I suggest an array of strings for the memory of the

    word processor.


    Ok, PEEK, POKE, and DEFSEG all are methods of addressing low-level

    memory manually. Conventional memory is 1MB, requiring 20-bits to

    address every byte. Since the registers where originally 16-bits wide,

    two have to be used, a segment and offset. For simplicities sake, you

    can define the segments as 0000h,1000h,2000h..9000h, each containing

    64k bytes, which make up lower 640k memory. DEFSEG sets which segment

    you are going to use, while PEEK examines the byte WITHIN THAT SEGMENT

    defined by DEFSEG and returns the contents. POKE simply puts something

    into memory just as PEEK examines it.


    Besides interfacing with assembly language, you can use segments as extra

    space beyond what QBasic gives you, just be careful you don't overwrite

    anything... I'm sorry if that was confusing, but it's a difficult topic

    to explain briefly.


    I used to program in Turbo Basic, which is about 90% compatable with QBASIC,

    much of my work is posted on my page at the URL below, take a look, it may

    be useful.


    Matthew Gross

    Acheron@Hotmail.com


    P.S: For the life of me, I can't remember what DEFINT does... ;)




    URL:http://acheronx.ml.org/home/

  • : The best text input method with QBasic is INKEY, which checks

    : the keyboard buffer for a character, returning nothing if no

    : key is ready, thus requiring a loop. Notice, however, it doesn't

    : echo the key, so you'll need to print out the actual character

    : yourself. I suggest an array of strings for the memory of the

    : word processor.


    : Ok, PEEK, POKE, and DEFSEG all are methods of addressing low-level

    : memory manually. Conventional memory is 1MB, requiring 20-bits to

    : address every byte. Since the registers where originally 16-bits wide,

    : two have to be used, a segment and offset. For simplicities sake, you

    : can define the segments as 0000h,1000h,2000h..9000h, each containing

    : 64k bytes, which make up lower 640k memory. DEFSEG sets which segment

    : you are going to use, while PEEK examines the byte WITHIN THAT SEGMENT

    : defined by DEFSEG and returns the contents. POKE simply puts something

    : into memory just as PEEK examines it.


    : Besides interfacing with assembly language, you can use segments as extra

    : space beyond what QBasic gives you, just be careful you don't overwrite

    : anything... I'm sorry if that was confusing, but it's a difficult topic

    : to explain briefly.


    : I used to program in Turbo Basic, which is about 90% compatable with QBASIC,

    : much of my work is posted on my page at the URL below, take a look, it may

    : be useful.


    : Matthew Gross

    : Acheron@Hotmail.com


    : P.S: For the life of me, I can't remember what DEFINT does... ;)


    Hi Andrew and Mathew,


    Just for the sake of completeness, here is what DEFINT does:


    Normally, variables in Qbasic default to the single precision variable type (a 4-byte float), unless you explicitly tell Qbasic otherwise. This can be done in a DIM statement (DIM x AS INTEGER), or with suffixes (x%). To skip this explicit stuff, you can tell Qbasic to default to another type of variable. DEFINT means that Qbasic uses the integer type as a default. Like DEFINT, there is DEFSNG, DEFDBL and DEFLNG to tell Qbasic to default to single precision, double precision, long integer, or string, respectively. DEFINT A-Z means that all variables (and functions) that start with any character from A to Z (all of'em, that is) to default to integer. You could also use DEFINT D-E, which would cause Qbasic to apply DEFINT only to variables starting with D or E.


    Greets,

    Mark


Sign In or Register to comment.