Click here to Skip to main content
15,908,842 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Stephen Hawking warns of the end of Humanity Pin
Nelek2-Dec-14 21:57
protectorNelek2-Dec-14 21:57 
GeneralRe: Stephen Hawking warns of the end of Humanity Pin
User 101325462-Dec-14 22:03
User 101325462-Dec-14 22:03 
GeneralRe: Stephen Hawking warns of the end of Humanity Pin
User 592412-Dec-14 23:52
User 592412-Dec-14 23:52 
GeneralRe: Stephen Hawking warns of the end of Humanity Pin
ZurdoDev3-Dec-14 1:25
professionalZurdoDev3-Dec-14 1:25 
GeneralRe: Stephen Hawking warns of the end of Humanity Pin
newton.saber3-Dec-14 3:30
newton.saber3-Dec-14 3:30 
GeneralRe: Stephen Hawking warns of the end of Humanity Pin
Rage3-Dec-14 0:48
professionalRage3-Dec-14 0:48 
GeneralRe: Stephen Hawking warns of the end of Humanity Pin
Slacker0073-Dec-14 1:59
professionalSlacker0073-Dec-14 1:59 
GeneralBASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 9:57
newton.saber2-Dec-14 9:57 
I'm curious if there are any BASIC programmers around here?
I have an old BASIC structure that I'm curious about what it is doing.
This is from a piece of code that is 30 years old, last month.


10 READ T$ 
20 C=ASC(SEG$(T$,1,1))-64
30 N=ASC(SEG$(T$,2,1))-C
40 Y=N-26*(N<32)
5000 DATA THINBCHA

REM #### LINE 10  read DATA into T$ (THINBCHA)
REM #### LINE 20 get the first char stored in T$ (as a byte) and subtract 64 from that value, 
REM #### (cont') store value in var C
REM #### LINE 30 get 2nd char stored in T$, subtract value of C and store in N
REM #### LINE 40 Okay, what is the value of Y? 

REM #### The part I'm confused about is what does (N<32) do? I thought it was a bit shift, but why would it be 32 bits when I believe a byte on these old machines (APPLE II, TI-99) would've been only 8 bits max?

REM ### HINT: This code is doing some kind of XOR data encryption / decryption on those bytes, so that the final value of THINBCHA should be some valid English word after you convert the bits.


I just can't understand what that operation 26*(N<32)
It kind of makes you think it would be 26*(BOOLEAN) such as 26*(1) or 26*(0), but if that were true then I'm not sure why the dev didn't just do *1 or *0, so I don't think that is what it was doing.

Has anyone seen BASIC code like this?
It's just an interesting puzzle to me. I was able to figure out all the other things, like
1. weird data read syntax READ T$ just reads that data in
2. odd function called SEG$()
But this one I can't look up, because N<32 means something quite different when involved with an if statement.

Is anyone interested in this old puzzle?
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
R. Giskard Reventlov2-Dec-14 10:09
R. Giskard Reventlov2-Dec-14 10:09 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 10:29
newton.saber2-Dec-14 10:29 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Dave Kreskowiak2-Dec-14 10:10
mveDave Kreskowiak2-Dec-14 10:10 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 10:18
newton.saber2-Dec-14 10:18 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 10:40
newton.saber2-Dec-14 10:40 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
DaveX862-Dec-14 10:14
DaveX862-Dec-14 10:14 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
DaveAuld2-Dec-14 10:14
professionalDaveAuld2-Dec-14 10:14 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
ozTechnocrat2-Dec-14 10:18
ozTechnocrat2-Dec-14 10:18 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 10:19
newton.saber2-Dec-14 10:19 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Slacker0072-Dec-14 10:19
professionalSlacker0072-Dec-14 10:19 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 10:31
newton.saber2-Dec-14 10:31 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Jeremy Falcon2-Dec-14 10:49
professionalJeremy Falcon2-Dec-14 10:49 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 10:58
newton.saber2-Dec-14 10:58 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Kornfeld Eliyahu Peter2-Dec-14 10:50
professionalKornfeld Eliyahu Peter2-Dec-14 10:50 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
Jeremy Falcon2-Dec-14 10:52
professionalJeremy Falcon2-Dec-14 10:52 
GeneralRe: BASIC Puzzle (Beginner's All-purpose Symbolic Instructional Code) Pin
newton.saber2-Dec-14 11:00
newton.saber2-Dec-14 11:00 
GeneralRe: BASIC Puzzle FINAL ANSWER Pin
newton.saber2-Dec-14 11:29
newton.saber2-Dec-14 11:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.