Oxaric’s Blog

A compendium of amazing things…

Posts Tagged ‘graphics’

QBASIC 4.5

Posted by oxaric on November 30, 2008




The first programming language I ever used was QBASIC. For a long time I used an early version of QBASIC that came free with DOS. It didn’t have the ability to compile code and you had to run all programs from within the QBASIC environment. I remember finding QBASIC 4.5 and thinking I had struck gold because it has the ability to compile code and create .exe files. Compiling not only gave a speed boost but allowed programs to be transportable to other computers. It was pretty amazing stuff.


I used to spend hours hacking away at QBASIC trying to create ’super awesome’ graphics programs. Ah the fond memories! :) I looked around and can only find one of my graphics program from the past. Unfortunately, it is an .exe file and not the source code. I’ve zipped and uploaded the program if you wish to check it out. It’s pretty cool so check it out! :)


It’s 2008 and there are a lot better languages to learn but QBASIC will always have a fond place in my heart. It’s still incredible to see what can be done with those old DOS graphics. I’ve zipped and uploaded QBASIC 4.5 so if you’ve never used it or have fond memories download it now and check it out. If you develop something cool I’d love to see it!


If you’re on a Linux machine you can run these programs using dosemu. On a Windows machine I believe you should be able to run them from the command prompt.



Click to directly download QBASIC45.zip


Click to directly download cloud.zip


Posted in Programming, QBASIC | Tagged: , , , , , , , , | Leave a Comment »

ASCII LCD Number Printer

Posted by oxaric on November 24, 2008

I took some time and hacked out an ascii lcd number printer. It is written in Ruby and contains no comments. The number you want printed must be passed as the first parameter. The size of the output can be changed by passing a second number. The default size is 2.

How to run:

~/test> ruby lcd.rb 0123456789 5


Click to directly download lcd.rb

# filename 'lcd.rb'
# Use: takes a number as the first parameter, 
#      a size value > 0 as the second parameter
# Output: Displays the number as ascii
# By: Louis Casillas, e-mail: oxaric@gmail.com

zero = [" - ",
        "| |",
        "   ",
        "| |",
        " - "]

one =  ["   ", 
        " | ",
        "   ",
        " | ",
        "   "]

two =  [" - ", 
        "  |",
        " - ",
        "|  ",
        " - "]

three = [" - ", 
         "  |",
         " - ",
         "  |",
         " - "]

four = ["   ", 
        "| |",
        " - ",
        "  |",
        "   "]

five = [" - ", 
        "|  ",
        " - ",
        "  |",
        " - "]

six =  [" - ", 
        "|  ",
        " - ",
        "| |",
        " - "]

seven = [" - ", 
         "  |",
         "   ",
         "  |",
         "   "]

eight = [" - ", 
         "| |",
         " - ",
         "| |",
         " - "]

nine = [" - ", 
        "| |",
        " - ",
        "  |",
        " - "]

numbers = ARGV[0].to_s
size = ARGV[1].to_i

output = ""
#1 or 3
for levels in (0...5)
   runs = 0
   
   if (size > 1) && (levels == 1) || (levels == 3)
      runs_for_this_level = size
   else
      runs_for_this_level = 1
   end

   while runs < runs_for_this_level
      for i in (0...numbers.size)
         case numbers[i, 1]
      
            when "0"
               line = zero[levels]
            when "1"
               line = one[levels]
            when "2"
               line = two[levels]
            when "3"
               line = three[levels]
            when "4"
               line = four[levels]
            when "5"
               line = five[levels]
            when "6"
               line = six[levels]
            when "7"
               line = seven[levels]
            when "8"
               line = eight[levels]
            when "9"
               line = nine[levels]
         end

         if (size > 1)
            if (line[1,1] == "-")
            
                  line = line[0,2]

                  for j in (1...size)
                     line += "-"
                  end
                  line += " "
            else
               if (line[0,1] == "|") || (line[2,1] == "|")
               
                  temp = line[2,1]
                  line = line[0,1]

                  for j in (1..size)
                     line += " "
                  end
                  if (temp == "|")      
                     line += "|"
                  else
                     line += " "
                  end
               else
                  if (line[1,1] == "|")
                     temp = (size / 2.0).ceil
                     
                     line = ""

                     for j in (0..temp)
                        line += " "
                     end
         
                     line += "|"
                     
                     if size == 3
                        temp = temp - 2
                     else
                        if size == 2
                           temp = 0

                        else
                           if ((temp % 2) == 0)
                              temp = temp - 1
                           else
                              temp = temp - 2
                           end
                        end
                     end

                     for j in (0..temp)
                        line += " "
                     end
                                       
                  else
                     for j in (1...size)
                        line += " "
                     end
                  end
               end

            end
            for k in (1...size)
               line += " "
            end
      end
   
         output += line

      end
      output += "\n"
      runs = runs + 1
   end
end
puts output

Posted in Programming, Ruby | Tagged: , , , , , , , | Leave a Comment »