Giter VIP home page Giter VIP logo

brainfuck128's Introduction

How to run brainfuck

Interpreter

For the interpreter, just execute make run

If you don't know what cool things you could do in Brainfuck, how about trying this? ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

Compiler

There is also a brainfuck compiler that generates native Commodore 128 "prg"s that can be loaded via dload.

To run the compiler, execute make bfc128.prg; then dload "bfc128.prg" in VICE and just run it.

The compiler will ask you for the program, as well as the file name of the prg it should create

Limitations

The data pointer is 8 bit, so you're limited to 256 bytes of data.

Memory layout

$1c01 - $1cff: Standard BASIC header and padding $1d00 - $1dff: 256 bytes of data $1e00 - ...: Executable code

Register usage

The X register is used as the data pointer

Code patterns

Code generation

> | INX
< | DEX
'+' | INC $1D00,X
'-' | DEC $1D00,X
'.' | LDA $1D00,x; JSR $FFD2
',' | JSR $FFCF; STA $1D00,X
'[' | LDA $1D00,X; BNE +3; JMP XXXX
']' | LDA $1D00,X; BEQ +3; JMP XXXX

Random other bits

How to start the emulator with "file system drive"

x128 \
    -fs8 `pwd` \
    -fs8convertp00 \
    -iecdevice8

Writing to floppy images in x128

It seems that you can only write to disk images in x128 if you set "Use IEC drive" to true.

brainfuck128's People

Contributors

asig avatar

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.