INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

QBASIC FOR and POKE

QBASIC FOR and POKE

(OP)
Can someone explain me this ?
I have to know what those lines are doing :(.
I know already that it's something with video memory, and this

CODE

  POKE (i% - 1) * 160 + j% + 1, 128 + 14
is changing text and backgroud color, also &HB800 is something with video ram?
But what does

CODE

FOR j% = 0 TO 158 STEP 2
  POKE (i% - 1) * 160 + j%, ASC(MID$(rida(i%), j% / 2 + 1, 1))
those lines do.
And if someone help, thanks to him.


CODE

DEF SEG = &HB800
FOR i% = 1 TO 20
 FOR j% = 0 TO 158 STEP 2
  POKE (i% - 1) * 160 + j%, ASC(MID$(rida(i%), j% / 2 + 1, 1))
  POKE (i% - 1) * 160 + j% + 1, 128 + 14
 NEXT j%
NEXT i%
END

RE: QBASIC FOR and POKE

It should be obvious that rida() is an array of strings - 20 strings of 80 characters each. Yeah, right, I spent all morning Google-ing variations of BASIC and rida trying to figure out what the rida function did.

At any rate, this code snippet is pulling 20 line of 80 characters out of the array, applying the 0x8e color attribute to each, and poking it directly into the display memory. Note that there doesn't appear to be any error checking to make sure that the array has 20 strings, nor that each string has 80 characters.  

RE: QBASIC FOR and POKE

<BUMP>

Was I correct (or even close)???

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close