Post subject: QBASIC clock!
Banned User
Joined: 12/23/2004
Posts: 1850
source (warning: sucks) *015010 <Bisqwit> If you're going to post/edit something, do it now, it'll be down for an estimated time of 3 hours Yes.
Perma-banned
Yrr
Joined: 8/10/2006
Posts: 289
Location: Germany, Bayern
Can you somehow copy the code directly into QBasic? Looks cool btw! Too bad QBasic programs can't be used as screen savers :)
SXL
Joined: 2/7/2005
Posts: 571
Actually, with QuickBasic you can compile it into an .exe, and then probably turn it into a .scr...
I never sleep, 'cause sleep is the cousin of death - NAS
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
# Segment naming:  Or bitmasks:
#    0                01
#   1 2             02  04
#    3                08
#   4 5             10  20
#    6                40
#            0    1    2    3    4     5    6    7    8    9     :     .
digits = [0x77,0x24,0x5D,0x6D,0x2E, 0x6B,0x7B,0x27,0x7F,0x6F, 0x80,0x100]

# Rendering of the individual cell:
$digit=[
  [0x00,0x03,0x01,0x01,0x01,0x05,0x00], #  31115
  [0x02,0x02,0x00,0x00,0x00,0x04,0x04], # 22   44
  [0x02,0x02,0x00,0x80,0x00,0x04,0x04], # 22   44
  [0x00,0x1A,0x08,0x08,0x08,0x2C,0x00], #  K888M
  [0x10,0x10,0x00,0x00,0x00,0x20,0x20], # 11   22
  [0x10,0x10,0x00,0x180,0x0,0x20,0x20], # 11   22
  [0x00,0x50,0x40,0x40,0x40,0x60,0x00]  #  54446
]

def render_digit(x,y, whichbits)
  $digit.each do |line|
    $stdout.putc 27
    $stdout.print "[#{y};#{x}H"
    line.each do |cell|
      if (cell&whichbits) != 0 then
        $stdout.putc 27
        $stdout.print "[1;37m#"
      elsif cell != 0 then
        $stdout.putc 27
        $stdout.print "[0;34m."
      else
        $stdout.putc " "
      end
    end
    y=y+1
    $stdout.putc 10
  end
end

$stdout.putc 27
$stdout.print "[2J\n"

$last={}
while now = Time.now
  clock = [ now.hour / 10, now.hour % 10,  10,
            now.min / 10, now.min % 10,    10,
            now.sec / 10, now.sec % 10,    11,
            now.usec / 100000]
  x,y = 5,3
  clock.each do |digit|
    render_digit x,y, $last[x] = digits[digit] unless $last[x] == digits[digit]
    x=x+8
  end
  Kernel.sleep 0.1
end
Banned User
Joined: 12/23/2004
Posts: 1850
Bisqwit wrote:
a sound stomping of original code
I can't even tell what language that's in. (And you don't have to paste it in; just save it and open it from within QB!)
Perma-banned