Microsoft Small Basic

Program Listing:
Embed this in your website
' RomanNumeralClock.sb
'This program was written by Glennium

GraphicsWindow.Show()
GraphicsWindow.Title = "Roman Numeral Digital Clock"
Bloc()
GraphicsWindow.Width =555
GraphicsWindow.Height = 75

Start:
GetTime()
TestTime()' Tests the time and sets a few variables.

Stack.PushValue("Time",Time3)
Stack.PushValue("Time",Time2)
Stack.PushValue("Time",Time1a)
'= = = = = = = = = =

For a = 1 To 3
  N[a]= stack.PopValue("Time")
  Len[a] = Text.GetLength(N[a])

  StripAndLoad()
EndFor
' = = = = = = = = =
For b = 1 to 3
  Stack.PushValue("Time2",N[b])
Endfor
'= = = = = = = = = =

Roman3 = Stack.PopValue("Times2")
Roman2 = Stack.PopValue("Times2")
Roman1 = Stack.PopValue("Times2")

GraphicsWindow.FontName = "Times New Roman"
GraphicsWindow.FontSize = 50

If Time2 = "0" Then
Roman2 = "---"
endif

If Time3 = "0" Then
Roman3 = "---"
endif

GraphicsWindow.DrawText(10,10  Roman1 + " : " + Roman2 + " : " + Roman3  )
Goto Start

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub GetTime
  Time1 = Clock.Hour
  Time2 = Clock.Minute
  Time3 = Clock.Second
EndSub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub TestTime

  Time1a = Time1

  If Time1 > 12 Then
    Time1a = Time1 - 12
  Endif
  If Time1 = 0 Then
    Time1a = 12
  Endif
  If Time1 <> T1 Then
    GraphicsWindow.Clear()
  EndIf
  If Time2<> T2 Then
    GraphicsWindow.Clear()
  EndIf
  If Time3 <> T3 Then
    GraphicsWindow.Clear()
  EndIf

  T1 = Time1
  T2 = Time2
  T3 = Time3

EndSub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Sub StripAndLoad

  If Len[a] = 1 Then
    D2 = N[a]
    Stack.PushValue("Times2",Letters[1][D2])
  ElseIf Len[a]= 2 Then
    D1 =  Math.Floor(N[a]/10)
    D2 = Math.Remainder(N[a],(D1*10))
    Stack.PushValue("Times2",(Letters[2][D1]+Letters[1][D2]))

  EndiF

EndSub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Sub Bloc
  Letters [1] [1] = "I"
  Letters [1] [2] = "II"
  Letters [1] [3] = "III"
  Letters [1] [4] = "IV"
  Letters [1] [5] = "V"
  Letters [1] [6] = "VI"
  Letters [1] [7] = "VII"
  Letters [1] [8] = "VIII"
  Letters [1] [9] = "IX"
  Letters [1] [0] = ""
  Letters [2] [1] = "X"
  Letters [2] [2] = "XX"
  Letters [2] [3] = "XXX"
  Letters [2] [4] = "XL"
  Letters [2] [5] = "L"
  Letters [2] [0] = ""
EndSub

Copyright (c) Microsoft Corporation. All rights reserved.