A BASIC Emulator - Small Basic Featured Program
Published Feb 12 2019 04:06 PM 1,254 Views
Iron Contributor
First published on MSDN on Jun 04, 2015

Authored by Nonki Takahashi


Today, I'd like to introduce a ZX Spectrum Emulator written in Small Basic by Tryhest.  The ZX Spectrum is an 8-bit personal home computer released in the United Kingdom in 1982.


This program is introduced in following thread in Small Basic forum.


small basic graphic and animations and more




some notes for spectrum emul. usage:


updated version (RHB445-0)


-new LIST start, auto rem of invalid cmds


editing:



  • to delete a line just type line number and press enter

  • to edit a line, type its number and press ESC on ur phisical keyb

  • to continue prog running type cont (or press V screen key) and press enter

  • to list prog type list or L and press enter few times (some bugs, trying to correct soon)

  • use mousewheel to scroll listing, only way for now, or type LIST|nn, nn starting line (hint:use F1 to type | char)



programming:


as u may know, spectrum had immediate and run mode, thus u colud execute prog from cmd line without storing to ram.I dislike this way so I gave only a few cmds to be run from cmd line, other must be stored to line number prior to run. for the immediate cmds remained: LIST CLS NEW RUN BORDER PAPER INK CONT


to have a flickr border just type 10 FLCKR and run it. the border remains until next NEW cmd,as it's not refreshed, only if some object enters it by drawing(like CUBE or CUB2)


when using FOR cmd, the original spectrum syntax was e.g. FOR x=1 TO 10 STEP 2, as it gets difficult to parse such line I made shorten syntax FOR 1 10 2 meaning the same))



  • the "for" ctrl var X is referenced by %F1 in loop and cannot be accidently modified like in other prog.languages, which is a benefit for program stability. U can nest 6  loops and reference by %F1..%F6, thus one main for and 5 inside it no matther of deep

  • for now the FOR vars are the only vars to use in prg. I'll introduce vars and const soon))

  • using STOP cmd is  nice way to pause xsecuting of prg. then type CONT to proceed

  • for typing math/other chars use F1-F9 key and F11/F12 keyset modifier

  • delete by BS key. just the last word. Introducing cursors keys soon))

  • to load a prg type LOAD and press enter, select txt file from file dialog

  • progs are ordinary txt files, just must have the : column simbol after line numb in order to xsecute

  • max 300 prg lines allowed

  • introducing renumb cmd soon(originally very missing on spectrum)



new features added to spectrum:



  • turtle: can be  combined to DRAW, CIRCLE, RECT, CUBE... as staring point to draw

  • flickr pics as border

  • webbrowser

  • CUBE and CUB2 isometric cubes

  • shapes and sprites (soon)


obsolete cmds



  • microdrive cmds - replaced by standard open/save dlgs

  • VERIFY - unnecessary nowadays, once very often used as the tapes weren't of a good quality

  • LPRINT and LLIST - references to text window now, usefull to grab text output))

  • CAT,FORMAT - ref. to microdrive

  • POKE - not needed, as it isn't allowed to access direct mem. locations

  • PEEK -not needed too but might be useful sometimes to spy on direct mem. locations

  • USING - formated output, not easy to implement in SB, maybe as replace %S %F cmds

  • ATTR - text atributes as background and ink and flash

  • FLASH -not easy to implement nowadays, might be substituted to underlined text

  • OVER - not very usefull nowadays with modern fonts,once used on bitmap fonts to write accentuated chars



This emulator (RHB445-0) runs in desktop with LitDev extension .



  • You need to remove comments in lines with File objects.

  • Recommended screen size is larger than 800 px width and 1000 px height.

  • Type RUN and hit enter to run the BASIC program.



Thank you Tryhest for sharing this awesome program!

Version history
Last update:
‎Feb 12 2019 04:06 PM
Updated by: