Git Product home page Git Product logo

ctbasic's People

Contributors

hornc avatar

Stargazers

 avatar

Watchers

 avatar

ctbasic's Issues

ANIMTEST001.bas broken on master

xterm -hold -t -e "./ct.py --hold 130 <(./CTBASIC.py examples/ANIMTEST001.bas)"

displays only the first frame at commit bded805

The examples work on the graphics branch and the recent (now deleted) ink branch.

Smooth CLS animation

Make animations smoother by changing the interpreter's handling of the -hold parameter.

Some kind of double buffering which minimises the amount of blank screen time that might arise if the screen is cleared while the next 'frame' is still being assembled.

Can't assume every program is an animation, nor even that every program with a CLS is an animation.

The -hold parameter could be replaced by an -fps, if that seems appropriate.

Strobing on CLEAR using Tek4010 emulator / How to do Tektronix animation properly?

Using https://github.com/rricharz/Tek4010 static graphics work perfectly:

tek4010 -noexit ./ct.py <(./CTBASIC.py examples/teapot.bas)

but the animations cause the screen to strobe white on CLEAR, which is very jarring.

tek4010 ./ct.py --hold 130 <(./CTBASIC.py examples/CUBE.BAS)

and

tek4010 ./ct.py --hold 130 <(./CTBASIC.py examples/ANIMTEST003.bas)

It's not because of the extra ANSI / RIS code I added (surprisingly), but it appears that the Tektronix ESC + FF causes the screen flash on reset, and that is the authentic behaviour -- which does not occur under xterm.

It looks like using ESC+FF between frames in not the standard way to run animations on a Tektronix display.

TODO:

Is is using "Write-Thru" mode, or specific erasing? I couldn't find clear descriptions of these features in the manual.

review context switching

relates to d901511

Now that all PRINT commands end with an ETX, the context transitions between GRAPHICS and TEXT output are not so important. Does the current context system still make sense?

Do PRINTs inside GFX behave as expected?

are CLEAR, BIN, and DATA treated correctly in all contexts?

What are the relevant cases?

Example: rotating cube

Requirements:

  • (At least) 20 frames
  • pre-calculated rotating cube loop.
  • clean looping (data string never exceeds some finite length)

Allow, but ignore, BASIC line numbers

Accept line numbered code when parsing.

Line numbers don't really add anything (CT-BASIC code runs in an implicit loop), but allowing them in source would allow for ZX-BASIC / CT-BASIC polyglots.

Interactive mode

In interactive mode: when the datastring is fully consumed (normally the HALT condition) the interpreter will prompt for input, and if any (non-empty) is received, it will continue to evaluate productions using the current program string.

END = CLEAR 10 ?

Output frames all have 0 bits in position 10, if all other data structures could ensure every 10th bit was also 0, CLEAR 10 at the end of a program would cleanly exit without having to use large runs of ; clear symbols, like the CLEAR 600 code used in some early code examples.

END could be an alias for CLEAR 10 if this convention was followed, and END would have the effect of eventually terminating a program by reducing the datastring over multiple iterations, without triggering any new additions.

List bit/(frame?) length of each command in COMMANDS.md

In order to calculate CLEAR lengths correctly, the number of bits or frames each command adds to the data-string should be listed in the COMMANDS reference.

for example:

PRINT "<string>"

len(<string>) + 2 frames

or

(len(<string>) + 2) * 10 bits

PLOT and DRAW have the same fixed length.

CLS's length depends on the exact clear commands used (which may change).

DATA will depend on the different formats... ASM also depends.

  • Figure out a useful notation.
  • Document

Related idea:

  • Some kind of block markup which tags a code block with an id,
  • code blocks intended to be the same length can be tagged with the same id
  • compiler can issue a warning if block-lengths don't match
  • CLEAR can take an id which will be substituted for the actual block length
  • basic arithmetic so the compiler can add id lengths

This will save the developer having to keep track of various code lengths and having to adjust corresponding CLEARs to get clean behaviour.

This feature isn't very BASIC-like. Investigate prior art.

Add a command to change pen / line style

The Tektronix 401x has various vector style drawing modes:

  • Normal
  • Dotted
  • Dot-dash
  • Short-dash
  • Long-dash

To investigate:

  • Is there an erase vector drawing mode?
  • What does 'defocused' Z axis mean (Tektronix 4014 terminology), and does xterm support it to visually differentiate the lines?

Add a CT-BASIC command to select which mode / pen is to be used when drawing. (Default is Normal)

Suggested ZX-BASIC command to use:

INK <value>

https://zxbasic.readthedocs.io/en/docs/ink/

Describe and document

Update readme with a description of what this thing is. The proof of concept basic idea seems to be working.

It mixes at least three obscure concepts that on the surface have very little to do with each other:

  • Cyclic tag systems (production rules of three symbols: { 0, 1, ;})
  • serial data transmission
  • Tektronix 4010/4014 vector graphics
  • Sinclair BASIC

Describe them, and explain why...

Frame in terms of a fantasy console architecture / virtual machine.

Underlying architecture and command set: cyclic tag (but with the flexibility to run on any cyclic tag equivalent implementation, hence the multiple compile targets)

Tag systems: https://en.wikipedia.org/wiki/Tag_system
and Cyclic tag: https://en.wikipedia.org/wiki/Tag_system#Cyclic_tag_systems

The virtual machine provides output via a memory data store convention which sends blocks of serial data to a hypothetical "display terminal" (VT100 or Tektronix (for lightweight serial graphical output) compatible).

A reduced BASIC-like command subset is used as a "high level" language which is compiled down to cyclic tag 'machine code'. The BASIC keywords really only provide shortcuts for encoding text and graphics into the required serial transmission format. (At least currently) flow control is performed directly as it would be in raw cyclic tag, with an implicit loop over the productions, and output only occurring if the leftmost bit of the current datastring is 1.

The purpose is to create a somewhat usable Turing complete 'computer' from a very simple foundation, and to produce a range of interesting code examples for cyclic tag systems, that will run in any cyclic tag context (down to rule 110 cellular automata), regardless of whether the output extension exists. Even if it is not implemented, the output will get encoded in the datastring memory, and the intended computations and intermediate data states will all be realized.

Optimise interpreter to process whole productions at a time based on datastring, instead of bit-by-bit.

Instead of processing the program string symbol-by-symbol (current method), we can speed things up by dividing the program string into different length productions (by splitting on ;) and examining the datastring for runs of 0s followed by a 1 to find the next production to append to the right of the datastring and delete n bits from the left.

This means than we won't be doing processing for every command in an inactive production.

Some compiled ABCT behaves incorrectly when compared to CT output

A)

./ct.py <(./CTBASIC.py examples/ANIMTEST001.bas) 1

vs.

B)

../abct/abct-cli $(./CTBASIC.py examples/ANIMTEST001.bas -tABCT) 2 | cut -f5 | grep -v '^$'

Expect:
Both should produce identical output: endlessly repeating output
with 2 occurrences of

Tektronix 4010 animation in bitwise cyclic tag.

every iteration.

Actual:
Only A works as expected. B gives one-and-a-half iterations, then halts.

Either:

  1. The ABCT compilation is incorrect and differs from the CT version
    or
  2. There is a bug in the ABCT interpreter which only triggers when the datastring is relatively large.

Test 1 by confirming CT:

10000001001010101000101100101010110101101011101000101110010010110111101011011100101101001010111100001001000000100110100010011000001001100010100110000010010000001011000010101101110010110100101011011010101100001010111010001011010010101101111010110111001001000000101101001010110111001001000000101100010010110100101011101000101110111010110100101011100110101100101010010000001011000110101111001010110001101011011000101101001010110001101001000000101110100010110000101011001110100101110010000001101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1000000100100011101010010100101011000100100110000010100000001001011110101101010010011000001010000000100011111010000001101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10000001001000110110100001100010000001101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10000001001010101000101100101010110101101011101000101110010010110111101011011100101101001010111100001001000000100110100010011000001001100010100110000010010000001011000010101101110010110100101011011010101100001010111010001011010010101101111010110111001001000000101101001010110111001001000000101100010010110100101011101000101110111010110100101011100110101100101010010000001011000110101111001010110001101011011000101101001010110001101001000000101110100010110000101011001110100101110010000001101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1000000100100011101010010110001011001100100101100010101001001001011000101100110010011001101010011100100011111010000001101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10000001001000110110100001100010000001101;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

converts to ABCT:

2725982173686371546601146872886478949676848343266687991455439775039246418566991564641072288886220641561220670417516878231337933182184221424474093486845123125288670924515227783347655713180738218612886808832567033405941261870209198197499335522520203793089647883525078726559522656322780833408305628209269451473841003952210357194804200927150864610020756488192140187415701229030023952457438960925517992085597157234115289733115229439541089867784618086421793464268100833257701933775660453143156550120230674427663139648925188894161008175666402137753021069691834098297645921724202153242602931770834033441974631172949352571451809476181649397847949984029722320500590490703749618295737914214793876366690181800306882307438513493238780477058778118173082607282107530831688589902108332787303323549563264682736128778696218029374094176060567774168320432597567000188014389411028017637004562908145413670119998291596935662982757593568414959308475684205073026516105003125317845476108577246127248204080999031261611309305491371624651666947921800000150020852464221004167616123654694382655473799426045366673852202654542189718580937791357707916724009533567448290513254034560106021425092655860067769504879958

For conversion comparison the compiled BCT is

111010101010101110101110111011101110101011101111101011101110111011111011101111101110111111101110101011101111111010111010111011111011111111101110111110111111101011101111101110101110111011111111101010101110101110101010101011101011111011101010111010111110101010101110101111101010111011101011111010101010111010111010101010101110111110101010111011101111101111111010111011111011101011101110111110111110111011101111101010101110111011111110111010101110111110111010111011101111101111111110111011111011111110101110101110101010101011101111101110101110111011111011111110101110101110101010101011101111101010111010111011111011101011101110111111101110101011101111111011111110111011111011101011101110111111101011111011101111101011101110111010111010101010101110111110101011111011101111111110101110111011111010101111101110111110111110101011101111101110101110111011111010101111101110101110101010101011101111111011101010111011111010101011101110111110101111111011101011101111111010111010101010101111101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111010101010101110101110101011111110111011101011101110101110111011111010101110101110101111101010101011101110101010101010111010111011111111101110111110111011101011101011111010101010111011101010101010101110101011111111111011101010101010111110110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111010101010101110101110101011111011111011101010101111101010111010101010101111101100000000000000000000000000000000000000000111010101010101110101110111011101110101011101111101011101110111011111011101111101110111111101110101011101111111010111010111011111011111111101110111110111111101011101111101110101110111011111111101010101110101110101010101011101011111011101010111010111110101010101110101111101010111011101011111010101010111010111010101010101110111110101010111011101111101111111010111011111011101011101110111110111110111011101111101010101110111011111110111010101110111110111010111011101111101111111110111011111011111110101110101110101010101011101111101110101110111011111011111110101110101110101010101011101111101010111010111011111011101011101110111111101110101011101111111011111110111011111011101011101110111111101011111011101111101011101110111010111010101010101110111110101011111011101111111110101110111011111010101111101110111110111110101011101111101110101110111011111010101111101110101110101010101011101111111011101010111011111010101011101110111110101111111011101011101111111010111010101010101111101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111010101010101110101110101011111110111011101011101111101010111011111010111110101110101110111110101011101110111010111010111010111011111010101110111110101111101011101011111010111110111011101011111110101110101011111111111011101010101010111110110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111010101010101110101110101011111011111011101010101111101010111010101010101111101100000000000000000000000000000000000000000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.