Re: It works fine if you PSET it...

by Ben (Login qben1)

After some experimenting, I found out
that the reason it didn't work is because the
binary to decimal converter would always add
to the previous number so all I had to do
was add dec&=0 (line 4).

I still can't figure out how to get line 22
and line 24 to work.

Why does QBasic let me do this:
s$="1"+s$ 'add something to beginnig of string

but not this:
s$=s$+"1" 'add something to the end

Also, I want to learn more about OUTing to
&h3c6. I was playing around with OUT (bad idea probably),
and when OUTing something to &h3c5 it changed the screen
resolution. WTF?

Off-topic question:
How come whenever I post code here all the spaces
are gone and my code becomes double spaced?

Thanks for all your help,
Ben

'*** START ***

DEFINT A-Z

DEF FnBIN2DEC& (binary$)

dec& = 0

DIM ex AS LONG

ex = LEN(binary$)

FOR i = 1 TO LEN(binary$)

IF MID$(binary$, i, 1) = "1" THEN dec& = dec& + 2 ^ ex / 2

ex = ex - 1

NEXT

FnBIN2DEC& = dec&

END DEF

DIM bytes(11) AS STRING * 8

SCREEN 12

DEF SEG = &HA000

OUT &H3C4, 2

OUT &H3C5, 10

FOR y = 1 TO 11

FOR x = 1 TO 8

READ z

IF z <> 0 THEN

bytes(y) = "1" + bytes(y) 'line 22

ELSE

bytes(y) = "0" + bytes(y) 'line 24

END IF

NEXT

POKE y * 80&, FnBIN2DEC&(bytes(y))

NEXT

SYSTEM

DATA 0,0,0,0,0,0,0,0

DATA 0,0,0,0,0,0,0,0

DATA 0,0,0,0,0,0,0,0

DATA 0,1,1,1,1,1,1,0

DATA 1,0,0,0,0,0,1,1

DATA 0,1,1,1,1,1,1,1

DATA 1,1,0,0,0,0,1,1

DATA 1,1,0,0,0,0,1,1

DATA 0,1,1,1,1,1,1,0

DATA 0,0,0,0,0,0,0,0

DATA 0,0,0,0,0,0,0,0

'*** END ***



Posted on Jul 20, 2008, 10:36 PM
from IP address 142.161.180.48

Respond to this message   

Goto Forum Home


Response TitleAuthor and Date
Ok then... on Jul 20