Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QBASIC FOR and POKE

Status
Not open for further replies.

Roltsuuu

Technical User
Mar 30, 2011
1
EE
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top