Page 1 of 1

BITS and BYTES

Posted: Thu Jul 31, 2008 11:26 am
by rishu
in qb help file look for paint command. under tile$ folowing is written "8 bits wide and 64 bytes long". How the concept of bits and bytes apply here.

Posted: Thu Jul 31, 2008 1:44 pm
by TmEE
I guess the logic of memory chips apply here.... a memory chip is say 16 bits wide, and 2Mbytes in size... once "cell" of information is 16 bits... you have 1M information "cells" in the chip.

Posted: Fri Aug 01, 2008 11:57 am
by rishu
n = 1
DO
CLS
SCREEN 12
CIRCLE (160, 100), 40, 1
PAINT (160, 100), CHR$(n), 1
PRINT n
n = n + 1
SLEEP 2
LOOP UNTIL INKEY$ = CHR$(27) 'press esc to end
END



i am posting answer of my own question. :!:
let us consider screen 12. it 's 640x480
now the whole screen is divided into 80 parts across. Each part is again subdivided into 8 parts.

if we enter chr$(48). its binary form is 110000. where there is 1 the computer will paint a vertical line in each subparts upto ur boundry color that u specified.
whre there is 0, it'll remain black.
If there are consecutive two 1's it'll be a thicker line. if 3 then more thicker line.

if chr$(255) then the whole stuff will be filled bcuz its binary form is 11111111.

I am currently researching to find the color pattern it follows. eg. if we use only one CHR$ it prints onscreen in blue color and if we use CHR$(something)+CHR$(something), it uses a different color. i have got a lot forward may be after some hours i'll get it.

Posted: Fri Aug 01, 2008 2:38 pm
by burger2227
Here is another demo of how string characters are used in PAINT:

Code: Select all

SCREEN 13
PAINT (160, 100), CHR$(1) + CHR$(2), 15
PRINT "The pattern"
DO: LOOP WHILE INKEY$ = ""
CLS
LINE (0, 50)-(319, 50), 1
PRINT "A line"
DO: LOOP WHILE INKEY$ = ""
PAINT (160, 100), CHR$(1) + CHR$(2), 15
PRINT "The pattern is blocked by the line even"
PRINT "though the border color is white because"
PRINT "the destination pixel was already the"
PRINT "color the patternwould have set it to!"
DO: LOOP WHILE INKEY$ = ""
CLS
LINE (0, 50)-(319, 50), 1
PRINT "The same line"
DO: LOOP WHILE INKEY$ = ""
PAINT (160, 100), CHR$(1) + CHR$(2), 15, CHR$(1)
PRINT "The pattern was able to paint over the"
PRINT "blue line and continue because a"
PRINT "background string was specified!"
Ted

Posted: Fri Aug 01, 2008 3:35 pm
by Ralph
burger77:
Nice demonsstration!

I went through SCREEN modes 1, 2, and 7 through 13. I observed horizontal lines only for SCREEN mode 13. And, with the suitable change in line from horizontal to vertical, isaw blocking only in modes 2 and 13. By the way, the patterens change, according to the SCREN mode used!