├── .gitattributes
├── .github
└── workflows
│ └── c-cpp.yml
├── .gitignore
├── .gitmodules
├── LICENSE
├── Makefile
├── README.md
├── a5200.md
├── cc65
├── LICENSE
├── README.md
├── ar65
│ ├── add.c
│ ├── add.h
│ ├── del.c
│ ├── del.h
│ ├── error.c
│ ├── error.h
│ ├── exports.c
│ ├── exports.h
│ ├── extract.c
│ ├── extract.h
│ ├── fileio.c
│ ├── fileio.h
│ ├── global.c
│ ├── global.h
│ ├── library.c
│ ├── library.h
│ ├── list.c
│ ├── list.h
│ ├── main.c
│ ├── objdata.c
│ ├── objdata.h
│ ├── objfile.c
│ └── objfile.h
├── asminc
│ ├── atari.inc
│ ├── atari5200.inc
│ ├── atari_antic.inc
│ ├── atari_gtia.inc
│ ├── atari_pokey.inc
│ └── target.inc
├── ca65
│ ├── anonname.c
│ ├── anonname.h
│ ├── asserts.c
│ ├── asserts.h
│ ├── condasm.c
│ ├── condasm.h
│ ├── dbginfo.c
│ ├── dbginfo.h
│ ├── ea.h
│ ├── ea65.c
│ ├── ea65.h
│ ├── easw16.c
│ ├── easw16.h
│ ├── enum.c
│ ├── enum.h
│ ├── error.c
│ ├── error.h
│ ├── expr.c
│ ├── expr.h
│ ├── feature.c
│ ├── feature.h
│ ├── filetab.c
│ ├── filetab.h
│ ├── fragment.c
│ ├── fragment.h
│ ├── global.c
│ ├── global.h
│ ├── incpath.c
│ ├── incpath.h
│ ├── instr.c
│ ├── instr.h
│ ├── istack.c
│ ├── istack.h
│ ├── lineinfo.c
│ ├── lineinfo.h
│ ├── listing.c
│ ├── listing.h
│ ├── macro.c
│ ├── macro.h
│ ├── main.c
│ ├── nexttok.c
│ ├── nexttok.h
│ ├── objcode.c
│ ├── objcode.h
│ ├── objfile.c
│ ├── objfile.h
│ ├── options.c
│ ├── options.h
│ ├── pseudo.c
│ ├── pseudo.h
│ ├── repeat.c
│ ├── repeat.h
│ ├── scanner.c
│ ├── scanner.h
│ ├── segdef.c
│ ├── segdef.h
│ ├── segment.c
│ ├── segment.h
│ ├── sizeof.c
│ ├── sizeof.h
│ ├── span.c
│ ├── span.h
│ ├── spool.c
│ ├── spool.h
│ ├── struct.c
│ ├── struct.h
│ ├── studyexpr.c
│ ├── studyexpr.h
│ ├── symbol.c
│ ├── symbol.h
│ ├── symentry.c
│ ├── symentry.h
│ ├── symtab.c
│ ├── symtab.h
│ ├── token.c
│ ├── token.h
│ ├── toklist.c
│ ├── toklist.h
│ ├── ulabel.c
│ └── ulabel.h
├── common
│ ├── abend.c
│ ├── abend.h
│ ├── addrsize.c
│ ├── addrsize.h
│ ├── alignment.c
│ ├── alignment.h
│ ├── assertion.c
│ ├── assertion.h
│ ├── attrib.h
│ ├── bitops.c
│ ├── bitops.h
│ ├── cddefs.h
│ ├── chartype.c
│ ├── chartype.h
│ ├── check.c
│ ├── check.h
│ ├── cmdline.c
│ ├── cmdline.h
│ ├── coll.c
│ ├── coll.h
│ ├── cpu.c
│ ├── cpu.h
│ ├── debugflag.c
│ ├── debugflag.h
│ ├── exprdefs.c
│ ├── exprdefs.h
│ ├── fileid.c
│ ├── fileid.h
│ ├── filepos.c
│ ├── filepos.h
│ ├── filestat.c
│ ├── filestat.h
│ ├── filetime.c
│ ├── filetime.h
│ ├── filetype.c
│ ├── filetype.h
│ ├── fname.c
│ ├── fname.h
│ ├── fragdefs.h
│ ├── gentype.c
│ ├── gentype.h
│ ├── hashfunc.c
│ ├── hashfunc.h
│ ├── hashtab.c
│ ├── hashtab.h
│ ├── hlldbgsym.h
│ ├── inline.h
│ ├── intstack.c
│ ├── intstack.h
│ ├── inttypes.h
│ ├── libdefs.h
│ ├── lidefs.h
│ ├── mmodel.c
│ ├── mmodel.h
│ ├── objdefs.h
│ ├── optdefs.h
│ ├── print.c
│ ├── print.h
│ ├── scopedefs.h
│ ├── searchpath.c
│ ├── searchpath.h
│ ├── segdefs.h
│ ├── segnames.c
│ ├── segnames.h
│ ├── shift.c
│ ├── shift.h
│ ├── strbuf.c
│ ├── strbuf.h
│ ├── strpool.c
│ ├── strpool.h
│ ├── strutil.c
│ ├── strutil.h
│ ├── symdefs.h
│ ├── target.c
│ ├── target.h
│ ├── tgttrans.c
│ ├── tgttrans.h
│ ├── va_copy.h
│ ├── version.c
│ ├── version.h
│ ├── xmalloc.c
│ ├── xmalloc.h
│ ├── xsprintf.c
│ └── xsprintf.h
└── ld65
│ ├── asserts.c
│ ├── asserts.h
│ ├── bin.c
│ ├── bin.h
│ ├── binfmt.c
│ ├── binfmt.h
│ ├── cfgexpr.c
│ ├── cfgexpr.h
│ ├── condes.c
│ ├── condes.h
│ ├── config.c
│ ├── config.h
│ ├── dbgfile.c
│ ├── dbgfile.h
│ ├── dbgsyms.c
│ ├── dbgsyms.h
│ ├── error.c
│ ├── error.h
│ ├── exports.c
│ ├── exports.h
│ ├── expr.c
│ ├── expr.h
│ ├── extsyms.c
│ ├── extsyms.h
│ ├── fileinfo.c
│ ├── fileinfo.h
│ ├── fileio.c
│ ├── fileio.h
│ ├── filepath.c
│ ├── filepath.h
│ ├── fragment.c
│ ├── fragment.h
│ ├── global.c
│ ├── global.h
│ ├── library.c
│ ├── library.h
│ ├── lineinfo.c
│ ├── lineinfo.h
│ ├── main.c
│ ├── mapfile.c
│ ├── mapfile.h
│ ├── memarea.c
│ ├── memarea.h
│ ├── o65.c
│ ├── o65.h
│ ├── objdata.c
│ ├── objdata.h
│ ├── objfile.c
│ ├── objfile.h
│ ├── scanner.c
│ ├── scanner.h
│ ├── scopes.c
│ ├── scopes.h
│ ├── segments.c
│ ├── segments.h
│ ├── span.c
│ ├── span.h
│ ├── spool.c
│ ├── spool.h
│ ├── tpool.c
│ ├── tpool.h
│ ├── xex.c
│ └── xex.h
├── compiler
├── LICENSE
├── USAGE.md
├── a5200.tgt
├── a800.tgt
├── atari-5200.tgt
├── atari-cart-fp.tgt
├── atari-cart-int.tgt
├── atari-cart.tgt
├── atari-fp.tgt
├── atari-int.tgt
├── default.tgt
├── fastbasic-a5200.cfg
├── fastbasic-cart.cfg
├── fastbasic.cfg
└── utf8.manifest
├── deps.mak
├── disk
└── dos
│ ├── bwdos-license.txt
│ ├── copy.com
│ ├── efast.asm
│ ├── efast.com
│ ├── efast.txt
│ ├── pause.com
│ └── xbw14d.dos
├── help.txt
├── make-release.sh
├── manual.md
├── readme
├── rules.mak
├── samples
├── fp
│ ├── ahlbench.bas
│ ├── draw.bas
│ ├── fedora.bas
│ ├── mastodon.bas
│ └── nc.bas
└── int
│ ├── carrera3d.bas
│ ├── dli.bas
│ ├── iospeed.bas
│ ├── joyas.bas
│ ├── pi.bas
│ ├── pmtest.bas
│ └── sieve.bas
├── src
├── a5200cart.asm
├── actions.asm
├── alloc.asm
├── cartridge.asm
├── cmdline.bas
├── cmdmenu.asm
├── comp_header.asm
├── compile.asm
├── compiler
│ ├── atarifp.cc
│ ├── atarifp.h
│ ├── codestat.cc
│ ├── codestat.h
│ ├── codew.h
│ ├── compile.cc
│ ├── compile.h
│ ├── ifile.cc
│ ├── ifile.h
│ ├── looptype.cc
│ ├── looptype.h
│ ├── main.cc
│ ├── os.cc
│ ├── os.h
│ ├── parser-actions.cc
│ ├── parser-actions.h
│ ├── parser.cc
│ ├── parser.h
│ ├── peephole.cc
│ ├── peephole.h
│ ├── synt-emit-asm.cc
│ ├── synt-emit-asm.h
│ ├── synt-optimize.cc
│ ├── synt-optimize.h
│ ├── synt-parser.cc
│ ├── synt-parser.h
│ ├── synt-preproc.cc
│ ├── synt-preproc.h
│ ├── synt-pstate.cc
│ ├── synt-pstate.h
│ ├── synt-sm-list.h
│ ├── synt-sm.cc
│ ├── synt-sm.h
│ ├── synt-symlist.cc
│ ├── synt-symlist.h
│ ├── synt-wlist.cc
│ ├── synt-wlist.h
│ ├── syntp.cc
│ ├── target.cc
│ ├── target.h
│ ├── vartype.cc
│ └── vartype.h
├── countlines.asm
├── deftok.inc
├── editor.bas
├── errors.asm
├── interp
│ ├── a5200
│ │ ├── drawto.asm
│ │ ├── getkey.asm
│ │ ├── graphics.asm
│ │ ├── input.asm
│ │ ├── locate.asm
│ │ ├── putchar.asm
│ │ ├── str.asm
│ │ └── val.asm
│ ├── a800
│ │ ├── bgetput.asm
│ │ ├── getkey.asm
│ │ ├── graphics.asm
│ │ ├── input.asm
│ │ ├── iochn.asm
│ │ ├── putchar.asm
│ │ ├── str.asm
│ │ ├── streol.asm
│ │ ├── val.asm
│ │ └── xio.asm
│ ├── absneg.asm
│ ├── addsub.asm
│ ├── atari
│ │ ├── color.asm
│ │ ├── pause.asm
│ │ ├── pmgraphics.asm
│ │ ├── position.asm
│ │ ├── print_tab.asm
│ │ ├── rand.asm
│ │ ├── soundoff.asm
│ │ └── time.asm
│ ├── atarifp
│ │ ├── fp_abs.asm
│ │ ├── fp_atn.asm
│ │ ├── fp_cmp.asm
│ │ ├── fp_coef.asm
│ │ ├── fp_const.asm
│ │ ├── fp_div.asm
│ │ ├── fp_evalpoly.asm
│ │ ├── fp_exp.asm
│ │ ├── fp_exp10.asm
│ │ ├── fp_int.asm
│ │ ├── fp_intfp.asm
│ │ ├── fp_ipow.asm
│ │ ├── fp_load.asm
│ │ ├── fp_log.asm
│ │ ├── fp_log10.asm
│ │ ├── fp_mul.asm
│ │ ├── fp_pop.asm
│ │ ├── fp_push.asm
│ │ ├── fp_rnd.asm
│ │ ├── fp_set1.asm
│ │ ├── fp_sgn.asm
│ │ ├── fp_sincos.asm
│ │ ├── fp_sqrt.asm
│ │ ├── fp_store.asm
│ │ ├── fp_str.asm
│ │ ├── fp_sub.asm
│ │ ├── fp_time.asm
│ │ ├── fp_val.asm
│ │ ├── fpmain.asm
│ │ └── mul6.asm
│ ├── bitand.asm
│ ├── bitexor.asm
│ ├── bitor.asm
│ ├── chr.asm
│ ├── clearmem.asm
│ ├── cmpstr.asm
│ ├── comp0.asm
│ ├── const.asm
│ ├── const_poke.asm
│ ├── copystr.asm
│ ├── dec.asm
│ ├── div.asm
│ ├── dpeek.asm
│ ├── dpoke.asm
│ ├── for.asm
│ ├── for_exit.asm
│ ├── inc.asm
│ ├── jump.asm
│ ├── land.asm
│ ├── lnot.asm
│ ├── lor.asm
│ ├── move.asm
│ ├── mset.asm
│ ├── mul.asm
│ ├── negax.asm
│ ├── nmove.asm
│ ├── peek.asm
│ ├── peekb.asm
│ ├── poke.asm
│ ├── pop.asm
│ ├── print_str.asm
│ ├── push.asm
│ ├── put.asm
│ ├── putbyte.asm
│ ├── return.asm
│ ├── saddr.asm
│ ├── sgn.asm
│ ├── shl8.asm
│ ├── strindex.asm
│ ├── ushl.asm
│ ├── usr.asm
│ ├── varadd.asm
│ ├── varaddr.asm
│ └── varstore.asm
├── interpreter.asm
├── memptr.asm
├── parse.asm
├── standalone.asm
├── syntax
│ ├── a5200.syn
│ ├── a800.syn
│ ├── basic.syn
│ ├── dli.syn
│ ├── extended.syn
│ ├── fileio.syn
│ ├── float.syn
│ ├── fujinet.syn
│ ├── gr-a5200.syn
│ ├── graphics.syn
│ ├── pm.syn
│ ├── sio.syn
│ └── sound.syn
└── vars.asm
├── startup.bat
├── template.tex
├── tests.mak
├── testsuite
├── README.md
├── src
│ └── fbtest.c
└── tests
│ ├── abbrev.bas
│ ├── abbrev.chk
│ ├── addr2str.bas
│ ├── addr2str.chk
│ ├── ahlbench.bas
│ ├── ahlbench.chk
│ ├── arrays.bas
│ ├── arrays.chk
│ ├── big-num.bas
│ ├── big-num.chk
│ ├── bug2.bas
│ ├── bug2.chk
│ ├── color.bas
│ ├── color.chk
│ ├── cstring.bas
│ ├── cstring.chk
│ ├── data-file.bas
│ ├── data-file.chk
│ ├── data-in-proc.bas
│ ├── data-in-proc.chk
│ ├── data-rom.bas
│ ├── data-rom.chk
│ ├── diskio.bas
│ ├── diskio.chk
│ ├── done.bas
│ ├── done.chk
│ ├── draw.bas
│ ├── draw.chk
│ ├── err-bad-pos.bas
│ ├── err-bad-pos.chk
│ ├── err-else.bas
│ ├── err-else.chk
│ ├── err-endif.bas
│ ├── err-endif.chk
│ ├── err-loop-1.bas
│ ├── err-loop-1.chk
│ ├── err-loop-2.bas
│ ├── err-loop-2.chk
│ ├── err-loop-3.bas
│ ├── err-loop-3.chk
│ ├── err-loop-4.bas
│ ├── err-loop-4.chk
│ ├── err-loop-5.bas
│ ├── err-loop-5.chk
│ ├── err-loop-6.bas
│ ├── err-loop-6.chk
│ ├── err-loop.bas
│ ├── err-loop.chk
│ ├── err-memory.bas
│ ├── err-memory.chk
│ ├── err-next.bas
│ ├── err-next.chk
│ ├── err-parse-bug.bas
│ ├── err-parse-bug.chk
│ ├── err-parse-overflow.bas
│ ├── err-parse-overflow.chk
│ ├── err-string1.bas
│ ├── err-string1.chk
│ ├── err-string2.bas
│ ├── err-string2.chk
│ ├── err-vdata.bas
│ ├── err-vdata.chk
│ ├── err-wend.bas
│ ├── err-wend.chk
│ ├── errlong.bas
│ ├── errlong.chk
│ ├── execdata.bas
│ ├── execdata.chk
│ ├── floatadr.bas
│ ├── floatadr.chk
│ ├── fp-array.bas
│ ├── fp-array.chk
│ ├── fp-fun.bas
│ ├── fp-fun.chk
│ ├── fp-input.bas
│ ├── fp-input.chk
│ ├── fpcomp.bas
│ ├── fpcomp.chk
│ ├── fpint.bas
│ ├── fpint.chk
│ ├── func-chr.bas
│ ├── func-chr.chk
│ ├── index.bas
│ ├── index.chk
│ ├── indexopt.bas
│ ├── indexopt.chk
│ ├── longstr.bas
│ ├── longstr.chk
│ ├── looperr.bas
│ ├── looperr.chk
│ ├── manyvars.bas
│ ├── manyvars.chk
│ ├── memerror.bas
│ ├── memerror.chk
│ ├── misc-fp.bas
│ ├── misc-fp.chk
│ ├── misc-int.bas
│ ├── misc-int.chk
│ ├── mset.bas
│ ├── mset.chk
│ ├── operator.bas
│ ├── operator.chk
│ ├── opt-poke.bas
│ ├── opt-poke.chk
│ ├── parsehex.bas
│ ├── parsehex.chk
│ ├── parsehex2.bas
│ ├── parsehex2.chk
│ ├── print-color.bas
│ ├── print-color.chk
│ ├── proc-line.bas
│ ├── proc-line.chk
│ ├── procerr.bas
│ ├── procerr.chk
│ ├── procerr2.bas
│ ├── procerr2.chk
│ ├── procerr3.bas
│ ├── procerr3.chk
│ ├── stmt-clr.bas
│ ├── stmt-clr.chk
│ ├── stmt-cls.bas
│ ├── stmt-cls.chk
│ ├── stmt-data.bas
│ ├── stmt-data.chk
│ ├── stmt-deg.bas
│ ├── stmt-deg.chk
│ ├── stmt-dli.bas
│ ├── stmt-dli.chk
│ ├── stmt-getk.bas
│ ├── stmt-getk.chk
│ ├── stmt-incdec.bas
│ ├── stmt-incdec.chk
│ ├── stmt-input.bas
│ ├── stmt-input.chk
│ ├── stmt-locate.bas
│ ├── stmt-locate.chk
│ ├── stmt-move.bas
│ ├── stmt-move.chk
│ ├── stmt-poke.bas
│ ├── stmt-poke.chk
│ ├── stmt-print.bas
│ ├── stmt-print.chk
│ ├── stmt-setcolor.bas
│ ├── stmt-setcolor.chk
│ ├── stmt-sio.bas
│ ├── stmt-sio.chk
│ ├── stmt-sound.bas
│ ├── stmt-sound.chk
│ ├── strarr1.bas
│ ├── strarr1.chk
│ ├── strerror.bas
│ ├── strerror.chk
│ ├── testcmp.bas
│ ├── testcmp.chk
│ ├── testif.bas
│ ├── testif.chk
│ ├── testloop.bas
│ ├── testloop.chk
│ ├── testproc.bas
│ ├── testproc.chk
│ ├── testusr.bas
│ ├── testusr.chk
│ ├── val.bas
│ ├── val.chk
│ ├── void.bas
│ └── void.chk
└── version.mk
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | testsuite/tests/* -text
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | temp/
3 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "testsuite/mini65"]
2 | path = testsuite/mini65
3 | url = https://github.com/dmsc/mini65-sim
4 | [submodule "mkatr"]
5 | path = mkatr
6 | url = https://github.com/dmsc/mkatr
7 |
--------------------------------------------------------------------------------
/cc65/LICENSE:
--------------------------------------------------------------------------------
1 | This software is provided 'as-is', without any express or implied warranty.
2 | In no event will the authors be held liable for any damages arising from
3 | the use of this software.
4 |
5 | Permission is granted to anyone to use this software for any purpose,
6 | including commercial applications, and to alter it and redistribute it
7 | freely, subject to the following restrictions:
8 |
9 | 1. The origin of this software must not be misrepresented; you must not
10 | claim that you wrote the original software. If you use this software in
11 | a product, an acknowledgment in the product documentation would be
12 | appreciated but is not required.
13 |
14 | 2. Altered source versions must be plainly marked as such, and must not
15 | be misrepresented as being the original software.
16 |
17 | 3. This notice may not be removed or altered from any source distribution.
18 |
--------------------------------------------------------------------------------
/cc65/README.md:
--------------------------------------------------------------------------------
1 | CC65 Tools
2 | ----------
3 |
4 | This is an extract of the CC65 Assembler and Linkers, without the compiler and
5 | libraries.
6 |
7 | If you need the full CC65 suite, it is available from
8 | [the main CC65 site](https://cc65.github.io/), and to get the last source code
9 | you can go to [the Github repository](https://github.com/cc65/cc65)
10 |
11 | Original Readme
12 | ---------------
13 |
14 | cc65 is a complete cross development package for 65(C)02 systems, including
15 | a powerful macro assembler, a C compiler, linker, librarian and several
16 | other tools.
17 |
18 | cc65 has C and runtime library support for many of the old 6502 machines,
19 | including
20 |
21 | - the following Commodore machines:
22 | - VIC20
23 | - C16/C116 and Plus/4
24 | - C64
25 | - C128
26 | - CBM 510 (aka P500)
27 | - the 600/700 family
28 | - newer PET machines (not 2001).
29 | - the Apple ]\[+ and successors.
30 | - the Atari 8-bit machines.
31 | - the Atari 2600 console.
32 | - the Atari 5200 console.
33 | - GEOS for the C64, C128 and Apple //e.
34 | - the Bit Corporation Gamate console.
35 | - the NEC PC-Engine (aka TurboGrafx-16) console.
36 | - the Nintendo Entertainment System (NES) console.
37 | - the Watara Supervision console.
38 | - the VTech Creativision console.
39 | - the Oric Atmos.
40 | - the Oric Telestrat.
41 | - the Lynx console.
42 | - the Ohio Scientific Challenger 1P.
43 |
44 | The libraries are fairly portable, so creating a version for other 6502s
45 | shouldn't be too much work.
46 |
--------------------------------------------------------------------------------
/cc65/ar65/error.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ar65/error.c
--------------------------------------------------------------------------------
/cc65/ar65/error.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ar65/error.h
--------------------------------------------------------------------------------
/cc65/asminc/atari_pokey.inc:
--------------------------------------------------------------------------------
1 | ;-------------------------------------------------------------------------
2 | ; POKEY Address Equates
3 | ;-------------------------------------------------------------------------
4 |
5 | ; Read Addresses
6 |
7 | POT0 = POKEY + $00 ;potentiometer 0
8 | POT1 = POKEY + $01 ;potentiometer 1
9 | POT2 = POKEY + $02 ;potentiometer 2
10 | POT3 = POKEY + $03 ;potentiometer 3
11 | POT4 = POKEY + $04 ;potentiometer 4
12 | POT5 = POKEY + $05 ;potentiometer 5
13 | POT6 = POKEY + $06 ;potentiometer 6
14 | POT7 = POKEY + $07 ;potentiometer 7
15 |
16 | ALLPOT = POKEY + $08 ;potentiometer port status
17 | KBCODE = POKEY + $09 ;keyboard code
18 | RANDOM = POKEY + $0A ;random number generator
19 | SERIN = POKEY + $0D ;serial port input
20 | IRQST = POKEY + $0E ;IRQ interrupt status
21 | SKSTAT = POKEY + $0F ;serial port and keyboard status
22 |
23 | ; Write Addresses
24 |
25 | AUDF1 = POKEY + $00 ;channel 1 audio frequency
26 | AUDC1 = POKEY + $01 ;channel 1 audio control
27 |
28 | AUDF2 = POKEY + $02 ;channel 2 audio frequency
29 | AUDC2 = POKEY + $03 ;channel 2 audio control
30 |
31 | AUDF3 = POKEY + $04 ;channel 3 audio frequency
32 | AUDC3 = POKEY + $05 ;channel 3 audio control
33 |
34 | AUDF4 = POKEY + $06 ;channel 4 audio frequency
35 | AUDC4 = POKEY + $07 ;channel 4 audio control
36 |
37 | AUDCTL = POKEY + $08 ;audio control
38 | STIMER = POKEY + $09 ;start timers
39 | SKRES = POKEY + $0A ;reset SKSTAT status
40 | POTGO = POKEY + $0B ;start potentiometer scan sequence
41 | SEROUT = POKEY + $0D ;serial port output
42 | IRQEN = POKEY + $0E ;IRQ interrupt enable
43 | SKCTL = POKEY + $0F ;serial port and keyboard control
44 |
--------------------------------------------------------------------------------
/cc65/asminc/target.inc:
--------------------------------------------------------------------------------
1 | ;
2 | ; FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | ; Copyright (C) 2017-2025 Daniel Serpell
4 | ;
5 | ; This program is free software; you can redistribute it and/or modify
6 | ; it under the terms of the GNU General Public License as published by
7 | ; the Free Software Foundation, either version 2 of the License, or
8 | ; (at your option) any later version.
9 | ;
10 | ; This program is distributed in the hope that it will be useful,
11 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ; GNU General Public License for more details.
14 | ;
15 | ; You should have received a copy of the GNU General Public License along
16 | ; with this program. If not, see
17 | ;
18 |
19 | ; Assembly include file depending on the target
20 | ; ---------------------------------------------
21 |
22 | .ifdef __ATARI5200__
23 | .include "atari5200.inc"
24 | .global MEMTOP, GPRIOR
25 | .globalzp COLCRS, ROWCRS
26 | .else
27 | .include "atari.inc"
28 | RTCLOK1 = $13
29 | RTCLOK2 = $14
30 | .endif
31 |
32 | ; vi:syntax=asm_ca65
33 |
--------------------------------------------------------------------------------
/cc65/ca65/ea.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ca65/ea.h
--------------------------------------------------------------------------------
/cc65/ca65/ea65.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ca65/ea65.h
--------------------------------------------------------------------------------
/cc65/ca65/easw16.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ca65/easw16.h
--------------------------------------------------------------------------------
/cc65/ca65/enum.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ca65/enum.h
--------------------------------------------------------------------------------
/cc65/ca65/struct.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ca65/struct.h
--------------------------------------------------------------------------------
/cc65/common/fragdefs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/common/fragdefs.h
--------------------------------------------------------------------------------
/cc65/common/inline.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/common/inline.h
--------------------------------------------------------------------------------
/cc65/common/optdefs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/common/optdefs.h
--------------------------------------------------------------------------------
/cc65/common/segnames.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/common/segnames.c
--------------------------------------------------------------------------------
/cc65/common/segnames.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/common/segnames.h
--------------------------------------------------------------------------------
/cc65/common/va_copy.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/common/va_copy.h
--------------------------------------------------------------------------------
/cc65/common/xmalloc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/common/xmalloc.c
--------------------------------------------------------------------------------
/cc65/common/xmalloc.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/common/xmalloc.h
--------------------------------------------------------------------------------
/cc65/ld65/dbgfile.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ld65/dbgfile.h
--------------------------------------------------------------------------------
/cc65/ld65/error.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ld65/error.h
--------------------------------------------------------------------------------
/cc65/ld65/o65.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/cc65/ld65/o65.h
--------------------------------------------------------------------------------
/compiler/LICENSE:
--------------------------------------------------------------------------------
1 | FastBasic - Fast basic interpreter for the Atari 8-bit computers
2 | Copyright (C) 2017-2025 Daniel Serpell
3 |
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License along
15 | with this program. If not, see
16 |
17 | In addition to the permissions in the GNU General Public License, the
18 | authors give you unlimited permission to link the compiled version of
19 | this file into combinations with other programs, and to distribute those
20 | combinations without any restriction coming from the use of this file.
21 | (The General Public License restrictions do apply in other respects; for
22 | example, they cover modification of the file, and distribution when not
23 | linked into a combine executable.)
24 |
25 |
--------------------------------------------------------------------------------
/compiler/a5200.tgt:
--------------------------------------------------------------------------------
1 | # Atari 5200 console
2 | syntax a5200.syn basic.syn dli.syn pm.syn gr-a5200.syn sound.syn extended.syn
3 | config fastbasic-a5200.cfg
4 | ca65 -tatari5200
5 | library fastbasic-5200.lib
6 | extension .bin
7 |
8 |
--------------------------------------------------------------------------------
/compiler/a800.tgt:
--------------------------------------------------------------------------------
1 | # Atari 8-bit computers, base file
2 | syntax a800.syn basic.syn dli.syn fileio.syn pm.syn graphics.syn sound.syn extended.syn sio.syn
3 | config fastbasic.cfg
4 | ca65 -tatari
5 | library fastbasic-int.lib
6 | extension .xex
7 |
--------------------------------------------------------------------------------
/compiler/atari-5200.tgt:
--------------------------------------------------------------------------------
1 | # Atari 5200 console
2 | include a5200
3 |
4 |
--------------------------------------------------------------------------------
/compiler/atari-cart-fp.tgt:
--------------------------------------------------------------------------------
1 | # Atari 8-bit computers, with floating point for cartridge output
2 | include atari-fp
3 | config fastbasic-cart.cfg
4 | library fastbasic-cart-fp.lib
5 | extension .rom
6 |
--------------------------------------------------------------------------------
/compiler/atari-cart-int.tgt:
--------------------------------------------------------------------------------
1 | # Atari 8-bit computers, integer-only for cartridge output
2 | include atari-int
3 | config fastbasic-cart.cfg
4 | library fastbasic-cart-int.lib
5 | extension .rom
6 |
--------------------------------------------------------------------------------
/compiler/atari-cart.tgt:
--------------------------------------------------------------------------------
1 | # Alias for atari-cart-fp
2 | include atari-cart-fp
3 |
--------------------------------------------------------------------------------
/compiler/atari-fp.tgt:
--------------------------------------------------------------------------------
1 | # Atari 8-bit computer, with floating point
2 | include a800
3 | syntax float.syn fujinet.syn
4 | library fastbasic-fp.lib
5 | extension .xex
6 |
--------------------------------------------------------------------------------
/compiler/atari-int.tgt:
--------------------------------------------------------------------------------
1 | # Atari 8-bit computers, integer only
2 | include a800
3 |
--------------------------------------------------------------------------------
/compiler/default.tgt:
--------------------------------------------------------------------------------
1 | # Default target: atari-fp
2 | include atari-fp
3 |
--------------------------------------------------------------------------------
/compiler/utf8.manifest:
--------------------------------------------------------------------------------
1 | UTF-8
2 |
--------------------------------------------------------------------------------
/disk/dos/bwdos-license.txt:
--------------------------------------------------------------------------------
1 | BW-DOS sources from:
2 | https://github.com/dmsc/bwdos-mads
3 |
4 | Original BW-DOS 1.3 by BEWESOFT
5 | Modifications by Holger Janz and Daniel Serpell.
6 |
7 | Sources released to public in Jun 2023.
8 |
9 | From:
10 | https://forums.atariage.com/topic/351486-bw-dos-v130/page/4/#comment-5319115
11 |
12 | I'm Jiří Bernášek, the only author of all Atari 8-bit software signed BEWESOFT,
13 | including BW-DOS up to version 1.30, and I release it all to the Public Domain,
14 | including sources where available.
15 |
16 |
--------------------------------------------------------------------------------
/disk/dos/copy.com:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/disk/dos/copy.com
--------------------------------------------------------------------------------
/disk/dos/efast.com:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/disk/dos/efast.com
--------------------------------------------------------------------------------
/disk/dos/efast.txt:
--------------------------------------------------------------------------------
1 | Fast E: accelerator
2 | -------------------
3 |
4 | Written by DMSC, loosely based on HYP.COM by Doug Wokoun and John Harris.
5 |
6 | Last version available over https://github.com/dmsc/e-accelerator
7 |
--------------------------------------------------------------------------------
/disk/dos/pause.com:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/disk/dos/pause.com
--------------------------------------------------------------------------------
/disk/dos/xbw14d.dos:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/disk/dos/xbw14d.dos
--------------------------------------------------------------------------------
/help.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/help.txt
--------------------------------------------------------------------------------
/readme:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmsc/fastbasic/19f41d41e527c1044dd99bc2a70cf82aa9148227/readme
--------------------------------------------------------------------------------
/samples/fp/ahlbench.bas:
--------------------------------------------------------------------------------
1 |
2 | start_time = TIME
3 | ' AHL'S SIMPLE BENCHMARK
4 | FOR N=1 TO 100
5 | A%=N
6 | FOR I=1 TO 10
7 | A%=SQR(A%):R%=R%+RND()
8 | NEXT I
9 | FOR I=1 TO 10
10 | A%=A%^2:R%=R%+RND()
11 | NEXT I
12 | S%=S%+A%
13 | NEXT N
14 |
15 | PRINT "ACCURACY ";ABS(1010-S%/5)
16 | PRINT "RANDOM ";ABS(1000-R%)
17 | end_time = TIME
18 | SC = end_time - start_time
19 | ? SC/60;" SECONDS"
20 |
21 |
--------------------------------------------------------------------------------
/samples/fp/draw.bas:
--------------------------------------------------------------------------------
1 | ' Graphics sample
2 | gr. 8+16
3 | color 1
4 |
5 | ' Sample line drawing
6 | for i=0 to 100 step 3
7 | plot 100-i,0
8 | dr. 0,i
9 | next i
10 |
11 | ' Plotting a function (in FP)
12 | for i=120 to 300
13 | y% = i * 0.05 - 11
14 | y% = y% * y% * (y% + 5)
15 | plot i, 160 - int(y%)
16 | next i
17 |
--------------------------------------------------------------------------------
/samples/fp/fedora.bas:
--------------------------------------------------------------------------------
1 |
2 | ' Record start time
3 | ETIME%=0
4 | @GetTime
5 | STIME%=ETIME%
6 |
7 | DIM RR(320)
8 | FOR I=0 TO 320:RR(I)=193:NEXT I
9 |
10 | GRAPHICS 8+16
11 | SETCOLOR 2,0,0
12 | COLOR 1
13 |
14 | XP=144:XR%=4.71238905:XF%=XR%/XP
15 |
16 | FOR ZI=64 TO -64 STEP -1
17 | ZT%=ZI*2.25:ZS%=ZT%*ZT%
18 | XL=INT(SQR(20736-ZS%))
19 | FOR XI=0 TO XL
20 | SXT% = SIN(SQR(XI*XI+ZS%)*XF%)
21 | YY = INT(SXT%*(123.2-89.6*SXT%*SXT%))
22 | X1=XI+ZI+160:Y1=90-YY+ZI
23 | IF RR(X1)>Y1
24 | RR(X1)=Y1
25 | PLOT X1,Y1
26 | ENDIF
27 | X1=-XI+ZI+160
28 | IF RR(X1)>Y1
29 | RR(X1)=Y1
30 | PLOT X1,Y1
31 | ENDIF
32 | NEXT XI
33 | NEXT ZI
34 |
35 | ' Read End time
36 | @GetTime
37 | ETIME%=ETIME%-STIME%
38 |
39 | ' Enable text window
40 | GRAPHICS 8+32 : SE.2,0,0
41 |
42 | ' Convert to seconds (NTSC, use 49.86074 for PAL)
43 | ESEC = INT(ETIME%/59.92271 + 0.5)
44 | EHOUR = ESEC / 3600
45 | EMIN = (ESEC MOD 3600) / 60
46 | ESEC = ESEC MOD 60
47 |
48 | ? "ELLAPSED:";EHOUR;":";EMIN;":";ESEC
49 | GET KEY
50 |
51 | PROC GetTime
52 | REPEAT
53 | QT = PEEK(18)
54 | ETIME% = TIME
55 | UNTIL QT = PEEK(18)
56 | IF ETIME%<0
57 | QT = QT + 1
58 | ENDIF
59 | ETIME% = 65536.0 * QT + ETIME%
60 | ENDPROC
61 |
--------------------------------------------------------------------------------
/samples/fp/mastodon.bas:
--------------------------------------------------------------------------------
1 | ' A Mastodon Client in FastBASIC
2 |
3 | ' N: Unit to use
4 | unit=8
5 |
6 | ' URL to Mastodon Server
7 | url$="N:HTTPS://oldbytes.space/api/v1/timelines/public?limit=1"$9B
8 |
9 | ' QUERY string
10 | query$=""
11 |
12 | ' QUERY result
13 | DIM result(1024) BYTE
14 |
15 | ' JSON channel mode
16 | JSON_MODE=1
17 |
18 | ' PROCEDURES '''''''''''''''''''''''''
19 | PROC nprinterror
20 | NSTATUS unit
21 | PRINT "ERROR- "; PEEK($02ED)
22 | ENDPROC
23 |
24 | PROC nsetchannelmode mode
25 | SIO $71, unit, $FC, $00, 0, $1F, 0, 12, JSON_MODE
26 | ENDPROC
27 |
28 | PROC nparsejson
29 | SIO $71, unit, $50, $00, 0, $1f, 0, 12, 0
30 | ENDPROC
31 |
32 | PROC njsonquery
33 | SIO $71, unit, $51, $80, &query$+1, $1f, 256, 12, 0
34 | ENDPROC
35 |
36 | PROC showresult
37 | @njsonquery
38 | NSTATUS unit
39 |
40 | IF PEEK($02ED) > 128
41 | PRINT "Could not fetch query:"
42 | PRINT query$
43 | EXIT
44 | ENDIF
45 |
46 | BW=DPEEK($02EA)
47 | NGET unit, &result, BW
48 | BPUT #0, &result, BW
49 | ENDPROC
50 |
51 | PROC mastodon
52 | ' Open connection
53 | NOPEN unit, 12, 0, url$
54 |
55 | ' If not successful, then exit.
56 | IF SERR()<>1
57 | PRINT "Could not open connection."
58 | @nprinterror
59 | EXIT
60 | ENDIF
61 |
62 | ' Change channel mode to JSON
63 | @nsetchannelmode JSON_MODE
64 |
65 | ' Ask FujiNet to parse JSON
66 | @nparsejson
67 |
68 | ' If not successful, then exit.
69 | IF SErr()<>1
70 | PRINT "Could not parse JSON."
71 | @nprinterror
72 | EXIT
73 | ENDIF
74 |
75 | ' Show latest post
76 | query$="N:/0/account/display_name"$9B
77 | @showresult
78 | query$="N:/0/created_at"$9B
79 | @showresult
80 | query$="N:/0/content"$9B
81 | @showresult
82 |
83 | NCLOSE unit
84 |
85 | PRINT
86 | PRINT " ---- "
87 | PRINT
88 |
89 | ENDPROC
90 |
91 | ' MAIN PROGRAM '''''''''''''''''''''''
92 | DO
93 | @mastodon
94 | PAUSE 1800
95 | LOOP
96 |
--------------------------------------------------------------------------------
/samples/fp/nc.bas:
--------------------------------------------------------------------------------
1 | ' -- #FUJINET NETCAT Example --
2 |
3 | ' Default unit # for connection
4 | CONN=2
5 | MODE=12
6 | TRANS=0
7 |
8 | ' RX Buffer
9 | DIM BUF(8192) BYTE
10 |
11 | ' Procedures '''''''''''''''''''''''''
12 | PROC BANNER
13 | PRINT "** NETCAT IN FASTBASIC **"
14 | PRINT
15 | ENDPROC
16 |
17 | PROC GETCONN
18 | URL$="N:"
19 | INPUT "URL: ", C$
20 | URL$=+C$
21 | INPUT "TRANS (0=none, 1=CR, 2=LF, 3=CR/LF): ", TRANS
22 | ENDPROC
23 |
24 | PROC INTCLR
25 | POKE $D302, PEEK($D302) & 127
26 | ENDPROC
27 |
28 | PROC CONNECT
29 | PRINT "Connecting to:"
30 | PRINT URL$
31 | NOPEN CONN,MODE,TRANS,URL$
32 | NSTATUS CONN
33 | ENDPROC
34 |
35 | PROC IN
36 | ' Clear interrupt and get status
37 | @INTCLR
38 | NSTATUS CONN
39 |
40 | ' Check if we need to read data
41 | BW = DPEEK($02EA)
42 | WHILE BW
43 | ' Needs to handle the case where
44 | ' BW > 32767, giving negative.
45 | IF BW > 8192 OR BW < 000
46 | LN = 8192
47 | ELSE
48 | LN = BW
49 | ENDIF
50 |
51 | NGET CONN,&BUF, LN
52 | BPUT #0, &BUF, LN
53 | BW = BW - LN
54 | WEND
55 | ENDPROC
56 |
57 | PROC OUT
58 | GET K
59 | NPUT CONN, &K, 1
60 | ENDPROC
61 |
62 | PROC NC
63 | DO
64 | IF PEEK($D302) & 128
65 | @IN
66 | ENDIF
67 |
68 | IF PEEK($02EC) = 0
69 | PRINT "Disconnected."
70 | NCLOSE CONN
71 | EXIT
72 | ENDIF
73 |
74 | IF KEY() THEN @OUT
75 | LOOP
76 | ENDPROC
77 |
78 | ''''''''''''''''''''''''
79 | ' Main Program
80 |
81 | POKE 65,0 ' quiet SIO
82 |
83 | @BANNER
84 | @GETCONN
85 | @CONNECT
86 |
87 | IF SErr() <> 1
88 | NSTATUS CONN
89 | PRINT "Could not Make Connection"
90 | PRINT "ERROR- "; PEEK($02ED)
91 | NCLOSE CONN
92 | ELSE
93 | PRINT "Connected!"
94 | @NC
95 | ENDIF
96 |
97 | POKE 65,3 ' noisy SIO
98 |
--------------------------------------------------------------------------------
/samples/int/dli.bas:
--------------------------------------------------------------------------------
1 | ' Define the DLI: set background
2 | ' color to $24 = dark red.
3 | DLI SET d1 = $24 INTO $D01A
4 | ' Setups screen
5 | GRAPHICS 0
6 | ' Alter the Display List, adds
7 | ' a DLI at line 11 on the screen
8 | POKE DPEEK(560) + 16, 130
9 | ' Activate DLI
10 | DLI d1
11 | ' Wait for any keyu
12 | ? "Press a Key" : GET K
13 | ' Disable the DLI
14 | DLI
15 |
16 | ? "Again..."
17 | GET K
18 |
19 | ' An array with color values
20 | DATA Colors() BYTE = $24,$46,$68
21 | ' Define the DLI: set background color
22 | ' from the Color() array and text back
23 | ' with value $8A in the same line and
24 | ' black in the next line
25 | DLI SET d2 = Colors INTO $D01A,
26 | DLI = $8A INTO $D018,
27 | DLI = $00 WSYNC INTO $D018
28 | ' Setups screen
29 | GRAPHICS 0
30 | ' Adds DLI at three lines:
31 | POKE DPEEK(560) + 13, 130
32 | POKE DPEEK(560) + 16, 130
33 | POKE DPEEK(560) + 19, 130
34 | ' Activate DLI
35 | DLI d2
36 | ' Wait for any keyu
37 | ? "Press a Key" : GET K
38 | ' Disable the DLI
39 | DLI
40 |
41 | ? "Again..."
42 | GET K
43 |
44 | ' Player shapes, positions and colors
45 | DATA p1() BYTE = $E7,$81,$81,$E7
46 | DATA p2() BYTE = $18,$3C,$3C,$18
47 | DATA pos() BYTE = $40,$60,$80,$A0
48 | DATA c1() BYTE = $28,$88,$C8,$08
49 | DATA c2() BYTE = $2E,$80,$CE,$06
50 | ' Our DLI writes the position and
51 | ' colors to Player 1 and Player 2
52 | DLI SET d3 = pos INTO $D000 INTO $D001,
53 | DLI = c1 INTO $D012, c2 INTO $D013
54 | GRAPHICS 0 : PMGRAPHICS 2
55 | ' Setup our 4 DLI and Players
56 | FOR I = 8 TO 20 STEP 4
57 | POKE DPEEK(560) + I, 130
58 | MOVE ADR(p1), PMADR(0)+I*4+5,4
59 | MOVE ADR(p2), PMADR(1)+I*4+5,4
60 | NEXT
61 | ' Activate DLI
62 | DLI d3
63 | ? "Press a Key"
64 | REPEAT
65 | PAUSE
66 | pos(0) = pos(0) + 2
67 | pos(1) = pos(1) + 1
68 | pos(2) = pos(2) - 1
69 | pos(3) = pos(3) - 2
70 | UNTIL KEY()
71 | DLI
72 |
73 | ? "Key to end..."
74 | GET K
75 |
76 |
--------------------------------------------------------------------------------
/samples/int/iospeed.bas:
--------------------------------------------------------------------------------
1 | ' Test speed of block I/O versus
2 | ' line oriented I/O.
3 |
4 | ' Get free memory
5 | DIM A(0) byte
6 | max = FRE()
7 |
8 | ? "---------------"
9 | ? "Memory:", max
10 |
11 | ' Test BGET speed:
12 | ? "--- Read with BGET --"
13 | ? "Err:",
14 | st = TIME
15 | OPEN #1, 4, 0, "D:CARRERA3.BAS"
16 | ? ERR(),
17 | BGET #1, ADR(A), max
18 | ? ERR(),
19 | total = DPEEK($358)
20 | CLOSE #1
21 | ? ERR()
22 | ? "Read:", total
23 |
24 | ' Count lines!
25 | ptr = ADR(A)
26 | pend = ptr + total
27 | lines = 0
28 |
29 | WHILE ptr < pend
30 | IF PEEK(ptr) = $9b
31 | INC lines
32 | ENDIF
33 | INC ptr
34 | WEND
35 | et = TIME
36 | ? "Lines:", lines
37 | ? "Time:", et-st
38 |
39 | ' Test INPUT speed:
40 | line$ = ""
41 | lines = 0
42 | ? "--- Read with INPUT --"
43 | ? "Err:",
44 | st = TIME
45 | OPEN #1, 4, 0, "D:CARRERA3.BAS"
46 | ? ERR(),
47 | WHILE ERR() < 128
48 | INPUT #1, line$
49 | INC lines
50 | WEND
51 | ? ERR(),
52 | CLOSE #1
53 | ? ERR()
54 | et = TIME
55 | ? "Lines:", lines
56 | ? "Time:", et-st
57 |
58 | ' Test GET speed:
59 | ? "--- Read with GET --"
60 | ? "Err:",
61 | st = TIME
62 | OPEN #1, 4, 0, "D:CARRERA3.BAS"
63 | ? ERR(),
64 |
65 | ' Count lines while reading
66 | total = 0
67 | lines = 0
68 | WHILE ERR() < 128
69 | GET #1, x
70 | IF x = $9b
71 | INC lines
72 | ENDIF
73 | INC total
74 | WEND
75 | ? ERR(),
76 | CLOSE #1
77 | ? ERR()
78 |
79 | et = TIME
80 | ? "Read:", total
81 | ? "Lines:", lines
82 | ? "Time:", et-st
83 |
84 |
--------------------------------------------------------------------------------
/samples/int/pmtest.bas:
--------------------------------------------------------------------------------
1 | ' P/M test program
2 |
3 | graphics 0 ' Setups graphics mode
4 | pmgraphics 2 ' And P/M mode
5 | P0Mem = pmadr(0) ' Get player 0 address
6 | oldPos = P0Mem ' and into "old position"
7 |
8 | mset P0Mem, 128, 0 ' Clears P/M 0 Memory
9 | setcolor -4, 1, 15
10 |
11 | ' P/M data and blank (to clear P/M)
12 | DATA PMdata() byte = $38,$44,$54,$44,$38
13 |
14 | ' Initial Conditions
15 | xPos = 6400 : yPos = 2560
16 | xSpd = 64 : ySpd = 0
17 |
18 | repeat
19 | xPos = xPos + xSpd : yPos = yPos + ySpd
20 | ySpd = ySpd + 2
21 | if (ySpd > 0) and (yPos > 12800)
22 | ySpd = -ySpd
23 | xSpd = Rand(512) - 256
24 | endif
25 | if xSpd > 0
26 | if xPos > 25600 Then xSpd = -xSpd
27 | else
28 | if xPos < 6400 Then xSpd = -xSpd
29 | endif
30 | @MovePm ' Move P/M Graphics
31 | until Key()
32 |
33 | graphics 0
34 |
35 | END
36 |
37 | proc MovePm
38 | x = xPos / 128 : y = P0Mem + yPos / 128
39 | poke $D01A,$74 ' Change background color
40 | pause
41 | pmhpos 0, x ' Set new horizontal position
42 | mset oldPos, 5, 0 ' Clear old sprite
43 | move adr(PMdata), y, 5 ' Draw at new vertical pos.
44 | oldPos = y
45 | endproc
46 |
--------------------------------------------------------------------------------
/samples/int/sieve.bas:
--------------------------------------------------------------------------------
1 | ? "Starting!"
2 | NumIter = 10
3 | sTime = TIME
4 | ' Arrays are initialized to 0
5 | DIM A(8190) Byte
6 | FOR Iter= 1 TO NumIter
7 | MSET Adr(A), 8190, 0
8 | Count = 0
9 | FOR I = 0 TO 8190
10 | IF NOT A(I)
11 | Prime = I + I + 3
12 | FOR K = I + Prime TO 8190 STEP Prime
13 | A(K) = 1
14 | NEXT K
15 | INC Count
16 | ENDIF
17 | NEXT I
18 | NEXT Iter
19 |
20 | eTime = TIME
21 | ? "End."
22 | ? "Elapsed time: "; eTime-sTime; " in "; NumIter; " iterations."
23 | ? "Found "; Count; " primes."
24 |
--------------------------------------------------------------------------------
/src/compiler/codestat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // codestat.h: Generate code statistics
20 |
21 | #include "codew.h"
22 | #include
23 |
24 | void do_opstat(std::vector &code);
25 |
--------------------------------------------------------------------------------
/src/compiler/compile.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // compile.h: Main compiler class
20 |
21 | #pragma once
22 |
23 | #include
24 |
25 | namespace syntax
26 | {
27 | class sm_list;
28 | }
29 |
30 | class compiler
31 | {
32 | public:
33 | std::string segname;
34 | bool do_debug;
35 | bool optimize;
36 | bool show_stats;
37 | bool show_text;
38 | unsigned short_text;
39 |
40 | compiler();
41 | int compile_file(std::string input_filename, std::string output_filename,
42 | const syntax::sm_list &sl, std::string listing_filename);
43 | };
44 |
--------------------------------------------------------------------------------
/src/compiler/ifile.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // ifile.h: Opens included file
20 |
21 | #pragma once
22 |
23 | #include
24 | #include
25 |
26 | // Opens "fname" searching first in the same path as the current file
27 | std::unique_ptr open_include_file(std::string current_file,
28 | std::string fname);
29 |
--------------------------------------------------------------------------------
/src/compiler/looptype.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // looptype.h: Defines types of loops and variables
20 |
21 | #pragma once
22 |
23 | #include
24 |
25 | enum LoopType
26 | {
27 | // First entries can't use "EXIT"
28 | LT_PROC_DATA = 0,
29 | LT_EXIT,
30 | // From here, loops don't push jump destinations
31 | LT_LAST_JUMP = 32,
32 | LT_PROC_2,
33 | LT_DO_LOOP,
34 | LT_REPEAT,
35 | LT_WHILE_1,
36 | LT_FOR_1,
37 | // And from here, loops push destinations and are ignored by EXIT
38 | LT_WHILE_2 = 128,
39 | LT_FOR_2,
40 | LT_IF,
41 | LT_ELSE,
42 | LT_ELIF
43 | };
44 |
45 | std::string get_loop_name(enum LoopType l);
46 | LoopType get_looptype(std::string t);
47 |
48 | bool loop_add_indent(enum LoopType l);
49 |
--------------------------------------------------------------------------------
/src/compiler/parser-actions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // parser-actions.h: parser functions called from the parsing tables
20 | #pragma once
21 | #include
22 |
23 | class parse;
24 | bool call_parsing_action(const std::string name, parse &s);
25 |
--------------------------------------------------------------------------------
/src/compiler/peephole.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // peephole.h: Peephole optimizer
20 |
21 | #pragma once
22 |
23 | #include "codew.h"
24 | #include
25 |
26 | void do_peephole(std::vector &code);
27 |
--------------------------------------------------------------------------------
/src/compiler/synt-emit-asm.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // synt-emit-asm.h: emit parser as an ASM file
20 | #pragma once
21 | #include "synt-sm-list.h"
22 |
23 | namespace syntax
24 | {
25 | const int max_emit_bytes = 28;
26 | bool syntax_emit_asm(std::ostream &hdr, std::ostream &out, sm_list &sml);
27 | } // namespace syntax
28 |
--------------------------------------------------------------------------------
/src/compiler/synt-optimize.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // synt-optimize.h: Optimizer for the parsing tables
20 | #pragma once
21 | #include "synt-sm-list.h"
22 |
23 | namespace syntax
24 | {
25 | bool syntax_optimize(sm_list &sml, bool verbose, bool merge);
26 | } // namespace syntax
27 |
--------------------------------------------------------------------------------
/src/compiler/synt-parser.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // synt-parser.h: Parse a syntax file
20 | #pragma once
21 | #include "synt-sm-list.h"
22 |
23 | namespace syntax
24 | {
25 | class parse_state;
26 |
27 | class syntax_parser
28 | {
29 | private:
30 | parse_state &p;
31 | sm_list &sl;
32 | bool parse_sm_name(const std::string &name);
33 |
34 | public:
35 | // Constructor, from a parser state
36 | syntax_parser(parse_state &p, sm_list &sl);
37 | // Parse one file
38 | bool parse_file();
39 | // Show final summary of parser files
40 | void show_summary() const;
41 | };
42 | } // namespace syntax
43 |
--------------------------------------------------------------------------------
/src/compiler/synt-preproc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // synt-preproc.h: Pre-processor for the syntax files
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace syntax
27 | {
28 | class preproc
29 | {
30 | private:
31 | std::set defs;
32 |
33 | public:
34 | // Reads from an input stream, pro-process and stores
35 | // the result in a string.
36 | std::string read_input(std::istream &in) const;
37 | // Adds a new definition
38 | void add_def(std::string def);
39 | };
40 | }; // namespace syntax
41 |
--------------------------------------------------------------------------------
/src/compiler/synt-sm-list.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FastBasic - Fast basic interpreter for the Atari 8-bit computers
3 | * Copyright (C) 2017-2025 Daniel Serpell
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see
17 | */
18 |
19 | // synt-sm-list.h: List of parsing tables, tokens and externals
20 | #pragma once
21 | #include "synt-sm.h"
22 | #include "synt-symlist.h"
23 | #include "synt-wlist.h"
24 | #include