lunes, 4 de agosto de 2014

A trip down memory lane - Basic for Macintosh Plus

Many years ago...in the good old days...my first computer was a Macintosh Plus...


Of course...back then I didn't have a clue about programming...but...thanks to the wonderful world of the Internet I was able to get my hands on a Macintosh Plus Emulator called Mini vMac.

I got it a couple of years ago but barely used it...so today...I wanted to get the feeling of old programming by using...


Yep...Microsoft Basic 2.0 for the Mac...

This is how the environment of the Mini vMac looks like...using MacOS 7.0.1


As I have been using the LED example for many programming languages...I thought it would be a good idea to use it here as well...


The output doesn't look to good...but who cares -;)



Here's the source code in case you're interested -:D

LED
Dim Five$(2)
Dim Six$(2)
Dim Seven$(2)
Dim Eight$(2)
Dim Nine$(2)
Zero$(0) = " _  "
Zero$(1) = "| | "
Zero$(2) = "|_| "
One$(0) = "  "
One$(1) = "| "
One$(2) = "| "
Two$(0) = " _  "
Two$(1) = " _| "
Two$(2) = "|_  "
Three$(0) = "_  "
Three$(1) = "_| "
Three$(2) = "_| "
Four$(0) = "    "
Four$(1) = "|_| "
Four$(2) = "  | "
Five$(0) = " _  "
Five$(1) = "|_  "
Five$(2) = " _| "
Six$(0) = " _  "
Six$(1) = "|_  "
Six$(2) = "|_| "
Seven$(0) = "_  "
Seven$(1) = "  |"
Seven$(2) = "  |"
Eight$(0) = " _  "
Eight$(1) = "|_| "
Eight$(2) = "|_| "
Nine$(0) = " _  "
Nine$(1) = "|_| "
Nine$(2) = " _| "
INPUT "Enter a Number: ", Number$
NumLen = LEN(Number$)
FOR i = 1 to NumLen
Digit$ = MID$(Number$,i,1)
IF Digit$ = "0" THEN line1$ = line1$ + Zero$(0):line2$ = line2$ + Zero$(1):line3$ = line3$+Zero$(2)
IF Digit$ = "1" THEN line1$ = line1$ + One$(0):line2$ = line2$ + One$(1):line3$ = line3$+One$(2)
IF Digit$ = "2" THEN line1$ = line1$ + Two$(0):line2$ = line2$ + Two$(1):line3$ = line3$+Two$(2)
IF Digit$ = "3" THEN line1$ = line1$ + Three$(0):line2$ = line2$ + Three$(1):line3$ = line3$+Three$(2)
IF Digit$ = "4" THEN line1$ = line1$ + Four$(0):line2$ = line2$ + Four$(1):line3$ = line3$+Four$(2)
IF Digit$ = "5" THEN line1$ = line1$ + Five$(0):line2$ = line2$ + Five$(1):line3$ = line3$+Five$(2)
IF Digit$ = "6" THEN line1$ = line1$ + Six$(0):line2$ = line2$ + Six$(1):line3$ = line3$+Six$(2)
IF Digit$ = "7" THEN line1$ = line1$ + Seven$(0):line2$ = line2$ + Seven$(1):line3$ = line3$+Seven$(2)
IF Digit$ = "8" THEN line1$ = line1$ + Eight$(0):line2$ = line2$ + Eight$(1):line3$ = line3$+Eight$(2)
IF Digit$ = "9" THEN line1$ = line1$ + Nine$(0):line2$ = line2$ + Nine$(1):line3$ = line3$+Nine$(2)
NEXT i
PRINT line1$
PRINT line2$
PRINT line3$

The code might not be the most optimal...but what can you expect? It's basic...old basic -:P

Greetings,

Blag.
Development Culture.

No hay comentarios: