Giter VIP home page Giter VIP logo

bbcmicrobot-codec's Introduction

bbcmicrobot-codec

Uses Eben Upton's base64-encoding and the dasm assembler to assemble 6502 and encode it into a BASIC-wrapped tweet for Dominic Pajak's @bbcmicrobot.

Installation

npm install

Example usage

Test message

./codec.js examples/test.asm

This should generate the following

$3097="HM^cgxx@vGBWOGdzizBzfdIjt~ut~"
F.I=3105TO3125:?I=?I*4+(?(2062+I/3)/4^(I MOD3)):N.
CA.3105

Running this (e.g. by pasting it into jsbeeb or the BBCMicroBot editor) should print **OK** and return to the BASIC prompt.

Note there are three lines: the first pokes the data, the second does the base64-decoding, and the third runs the code. You can introduce additional lines of BASIC if you want, e.g. to print text, clear the screen, change MODE, etc.

Wright-Fisher model

./codec.js examples/wright-fisher.asm --exec INIT

This is a simulation of a Wright-Fisher model (or, more precisely, a Moran model: see the Genetic Drift page on Wikipedia for more info).

Note the use of --exec to change the start of execution.

The code calls the BBC BASIC RND subroutine at $af87 (documented here), as well as OSWRCH at $ffee.

Diffusion

./codec.js examples/diffusion.asm

This implements a simple diffusion, shown in action here.

Spam filter

Unfortunately some of the generated strings don't work when you give them to the bot, because of things in the code that look like Twitter handles (@...), which the bot strips out. You can work around this by specifying the --unspam option, which breaks these strings with quotes (at a cost of 3 bytes per case).

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.