New improved Reverse Polish Notation calculator

New improved Reverse Polish Notation calculator

Announcing the latest version of the Superdecade Games RPN Calculator.  If you can contain your excitement, please visit the link below.

Visit the Downloads page for the full source code and executable version.

What's new in version 3?
* COPY command added.  Copies the accumulator to the Windows Clipboard.
* ACC ON/ACC OFF comands added.  Turning on forces the accumulator not to clear after a calculation.  The following result is added to the accumulator following each calculation.
* HEX/DEN/BIN/OCT commands added to switch between base 16, base 10, base 2 and base 8.
* LAST special variable added which stores the current value of the accumulator, allowing the previous result to be treated as a variable in proceeding calculations.
* INV function added.  Returns 1/x where x is the argument.
New Improved Little Man Computer

New Improved Little Man Computer

Following some user feedback with a class of students following the OCR GCSE Computing low-level programming module (A451), I have made the following improvements to the Little Man Computer Simulator:

LMC version 1.0.0.5

  • Scroll-bars have been added to the input window.
  • Lower-case input is accepted (the LMC is not case-sensitive, so 'y' and 'Y' are same label name).
  • Improved step-through mode (there is now time to click the mouse to halt the program)

Please follow this link to the DOWNLOADS page to update your version of the LMC Simulator.

Reverse Polish Notation Calculator in BBC BASIC for Windows

A BBC BASIC for Windows implementation of a simple RPN Calculator.  We've just finished version 1.01 and is available to download from here.

Reverse Polish notation is a parenthesis-free algebraic notation, known as post-fix notation.  We are all familiar with standard algebraic notation (or in-fix notation):

(1 + 2) * 3  < in-fix notation >

In RPN, this is expressed:

1 2 + 3  *  < post-fix notation >

The parentheses are used to avoid ambiguity over the order of operations (often taught as BODMAS in school).  For example, the first expression could be confused with the literal expression 1 + (2 * 3) which would give a different result.  Parentheses are not required in post-fix notation.  For example, 1 + ( 2 * 3 ) is expressed as:

1 2 3 * +




Dementia Clock

The Dementia Clock is a Windows application designed to help people living with dementia by simply displaying the time of day as morning, afternoon, evening or night.


Follow this link to DOWNLOAD the Dementia Clock (including source code).

BBC BASIC for Windows source code follows.  Please modify and share freely.

     REM A clock for dementia sufferers
     REM T Street
     REM 2013-11-21
     REM this is a very simple program for displaying a simple clock
     REM the functionality is limited to only displaying the current
     REM day of the week
     REM and whether it is morning, afternoon, evening, or night
     REM with the intention of being an aid for people with memory problems

     REM requires BBC BASIC for Windows
     REM select Options -> lowercase keywords

     
(_Version_Info_)
     GAME_NAME$ = "Dementia Clock"
     VERSION$ = "1.01"

     (_Initialising_)
     REM error handling (displays message and quits)
     
ON ERROR SYS "MessageBox", @hwnd%, REPORT$ + " at line " + STR$ERL, "Error", 48:QUIT
     
REM event handler for quit button
     
ON CLOSE PROC_quit : RETURN
     
REM set size of window
     
VDU 23,22,880;186;32,32,2,0
     REM set window text
     
SYS "SetWindowText", @hwnd%, GAME_NAME$+" version "+VERSION$+" tinyurl.com/superdecade"
     PROC_preventResize
     OFF  : REM turn text cursor
     
*esc off
     COLOUR 1, 255, 255, 0   : REM yellow
     
COLOUR 2, 0, 0, 0       : REM black
     
*font Times New Roman, 48b
     VDU 5 :REM allow text to be printed at graphics cursor


     REM =========== MAIN LOOP =============
     
REPEAT
       PROC
_display(" It is "+FN_getDay( TIME$ )+" "+FN_getTimeFrame( FN_getHours( TIME$ ) )+".")
       SYS "Sleep", 1000 : REM sleep for 1 second
     
UNTIL FALSE
     
REM ===================================


     
DEFPROC_quit
     REM quit handler
     REM user gets 4 seconds to press ENTER key or program continues
     
LOCAL g%
     PROC_display("Now press Enter to quit.")
     g% = INKEY(400)
     IF g% = 13 THEN
       QUIT
     ENDIF
     ENDPROC


     
DEFPROC_display( t$ )
     REM displays text at approx half way along screen
     REM no time to code a proper centering routine
     
COLOUR 1+128 : CLS  : REM clear background to yellow
     
GCOL 2     : REM set graphics colour to red (text counts as graphics after vdu 5)
     
MOVE 190,290
     PRINT t$
     ENDPROC


     
DEFFN_getHours( t$ )
     REM returns the number of hours from the string passed
     REM assuming t$ is a string obtained from time$
     
= VAL( MID$(t$, 17, 2) )


     DEFFN_getTimeFrame( n% )
     REM returns a time such as "morning" etc depending on the string passed
     REM midnight - 6am = night
     REM 6am - noon     = morning
     REM noon - 6pm     = afternoon
     REM gpm - midnight = evening
     
LOCAL a$
     CASE TRUE OF
       WHEN
n% >= 0 AND n% < 6 a$ = "night"
       WHEN n% >= 6 AND n% < 12 a$ = "morning"
       WHEN n% >= 12 AND n% <18 a$ = "afternoon"
       WHEN n% >= 18 AND n% <= 23 a$ = "evening"
       OTHERWISE a$ = "undefined"
     ENDCASE
     
= a$


     DEFFN_getDay( t$ )
     REM returns a string representing the current day
     REM assuming t$ is a string obtained from time$
     
LOCAL part$
     part$ = LEFT$( t$, 3)
     CASE part$ OF
       WHEN
"Mon" a$ = "Monday"
       WHEN "Tue" a$ = "Tuesday"
       WHEN "Wed" a$ = "Wednesday"
       WHEN "Thu" a$ = "Thursday"
       WHEN "Fri" a$ = "Friday"
       WHEN "Sat" a$ = "Saturday"
       WHEN "Sun" a$ = "Sunday"
     ENDCASE
     
= a$


     DEF PROC_preventResize
     REM prevent user resizing window
     
PRIVATE ws%
     SYS "GetWindowLong", @hwnd%, -16 TO ws%
     REM prevent user maximising window
     
SYS "SetWindowLong", @hwnd%, -16, ws% AND NOT &50000
     ENDPROC


Create your own ASCII heading

Someone has asked me for the code that produces the coloured ASCII heading in GOLIATH, like this:

Well, it is here:

     MODE 10
     *font Courier New, 14
     PROC_3dname( " HELLO", 6, 4 )

     PROC_3dname( " WORLD", 6, 4 )

     END


     
DEF PROC_3dname(name$, col%, bcol%)
     REM produces 3d text in ascii graphics
     REM NOTE: uses ASCII characters 255, 254
     REM
     REM modified from:
     REM http://rosettacode.org/wiki/Write_language_name_in_3D_ASCII#BBC_BASIC
     REM by Richard Russell
     
LOCAL A%, X%, Y%, char%, row%, patt%, bit%
     DIM X% 8 : A% = 10 : Y% = X% DIV 256
     VDU 23,255,255,255,255,255,255,255,255,255

     COLOUR bcol%
     *refresh off
     FOR row% = 1 TO 8
       FOR char% = 1 TO LEN(name$)
         ?X% = ASCMID$(name$,char%)
         CALL &FFF1
         patt% = X%?row%
         FOR bit% = 7 TO 0 STEP -1
           VDU23,254,RND(128),RND(128),RND(128),RND(128),RND(128),RND(128),RND(128),RND(128)
           CASE TRUE OF
             WHEN
(patt% AND 2^bit%) <> 0 :COLOUR col%: PRINTCHR$(255);
             WHEN GET$(POS-1,VPOS-1) = CHR$(255): COLOUR bcol%: PRINTCHR$(254);
             OTHERWISE: PRINT " ";
           ENDCASE
         NEXT
       NEXT
char%
       PRINT
     NEXT
row%
     *refresh on
     ENDPROC


GET LAMP: The Text Adventure Documentary

A film that brought back a few memories: GET LAMP is a documentary filmed by computer historian Jason Scott of textfiles.com
 

The film explores the people behind the first IF games (Colossal Cave, and Zork); the legacy and future of the IF medium.  Scott describes this film as The first and last IF documentary.  Enjoy!

Here is a link to the Lost Pig game mentioned at the end. (screenshot is below)

Introducing....GOLIATH

This one is for anyone who remembers the COLOSSAL CAVE adventure game, or is a fan of Interactive Fictions games, or just wants to learn some BASIC programming for the fun of it.


Presented here you will find the BB4W source code and executable versions of the program - GOLIATH.  Currently there are only 11 locations and 12 objects, and various features are not yet fully implemented, which I may get round to completing one day....

It you need some help understanding the source code, then please feel free to use the "Email Me" tab above.

Happy wandering....

(Go to the main GOLIATH page for the downloads)

New version of the Little Man Computer

We are proud to announce a new update to the our Little Man Computer.

Follow this link to the downloads page.

What's new in version 0.4?
  • Comments.  Lines beginning with a hash '#' are ignored by the compiler.
  • System reset.  This feature allows you to 'roll back' the LMC memory to its post-compile state.  Handy if you want to run your program again without recompiling.  A useful tool for beginning students of LMC who might forget to properly initialize their variables.
  • Ouput log.  The value of the OUT register is saved to a temporary text file.  Useful if you want to see the intermediate steps of a calculation.
  • New demo programs: addition, multiply

Asteroid Belt

Asteroid Belt

This is the fourth game from Usborne's Computer Space Games.

In Asteroid Belt you must avoid crashing into the asteroids by pressing the number key that corresponds to the number of stars in the asteroid.  You only have a limited time to hit each asteroid.


      rem Asteroid Belt
      rem by Daniel Isaaman and Jenny Tyler
      rem translated to BB4Win by T Street
     
      mode 6
      print "ASTEROID BELT"
      print"-------------"
      print"Your spaceship is travelling through"
      print"an asteroid belt. Try to shoot the"
      print"asteroids with your laser. The force"
      print"required depends on the number of stars"
      print"In the asteroid."
      print'"Press the number key that corresponds"
      print"to the the number of stars that you"
      print"see."
      print'"You only have a limited time to hit"
      print"each one."
      print'"(press any key to begin...)"
     
     
      g% = get
     
      delay% = 400 : rem how long to wait each time
      score% = 0
     
      for go% = 1 to 10
        cls
        x% = rnd(30) : rem x position
        y% = rnd(12) : rem y position
        n% = rnd(9) : rem number of *
       
        for i% = 1 to n%
          if i%<>1 and i%<>4 and i%<>7 then
            print"*";
          else
            printtab(x%);"*";
          endif
        next
       
        ok% = false
        hit% = val(inkey$(delay%))
        if hit% <> 0 then
          print'"HIT IT!"
          ok% = true
        else
          rem did not press a key
          print'"YOU CRASHED INTO IT!"
        endif
       
        rem was there enough power?
        if ok% then
          rem was there enough power?
          case true of
            when hit% = n%
              print "YOU DESTROYED IT!"
            when hit%<n%
              print"NOT ENOUGH POWER!"
            when hit%>n%
              print"TOO MUCH POWER!"
          endcase
        endif
       
       
        wait 200
      next
     
      cls
      print"Final Score : "str$(score%)



Label