- Notifications
You must be signed in to change notification settings - Fork4
MIRROR ofhttps://codeberg.org/catseye/SixtyPical : A 6502-oriented low-level programming language supporting advanced static analysis
catseye/SixtyPical
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Version 0.21|See also:Bubble Escape 2K∘SITU-SOL
NOTE: Having met the majority of its goals, the SixtyPical projectmight not undergo much more development going forward. SeeFuture directions for SixtyPicalfor more information.
SixtyPical brings advanced static analysis to the6502.
SixtyPical is alow-level programming languagesupporting some advancedstatic analysis methods.Its reference compiler can generateefficient code forseveral 6502-basedtarget platforms while catching manycommon mistakes at compile-time, reducing the time spent in debugging.
Make sure you have Python (2.7 or 3.5+) installed. Thenclone this repository and put itsbin directory on yourexecutable search path. Then you can run:
sixtypicalIf you have theVICE emulator suite installed, you can run
sixtypical --run-on=x64 eg/c64/hearts.60pand it will compile thehearts.60p source code andautomatically start it in thex64 emulator, and you should see:
You can trysixtypical --run-on on other sources in theeg directorytree, which contains more extensive examples, including an entiregame(-like program); seeeg/README.md for a listing.
SixtyPical aims to fill this niche:
- You'd use assembly, but you don't want to spend hoursdebugging (say) a memory overrun that happened because of aridiculous silly error.
- You'd use C or some other "high-level" language, but you don'twant the extra overhead added by the compiler to manage thestack and registers.
SixtyPical gives the programmer a coding regimen on par with assemblylanguage in terms of size and hands-on-ness, but also able to catchmany ridiculous silly errors at compile time.
Many of SixtyPical's primitive instructions resemble those of theMOS Technology 6502 — it is in fact intended to be compiled to 6502machine code. However, it also provides some "higher-level" operationsbased on common 8-bit machine-language programming idioms, including
- copying values from one register to another (via a third register whenthere are no underlying instructions that directly support it)
- copying, adding, and comparing 16-bit values (done in two steps)
- explicit tail calls
- indirect subroutine calls
While a programmer will find these constructs convenient, theirinclusion in the language is primarily to make programs easier to analyze.
The SixtyPical language defines aneffect system, and the referencecompilerabstractly interprets the input program in the manner offlow typing to confirm that it does not violate it. This can detectcommon mistakes such as
- you forgot to clear carry before adding something to the accumulator
- a subroutine that you called trashes a register you thought it preserved
- you tried to read or write a byte beyond the end of a byte array
- you tried to write the address of something that was not a routine, toa jump vector
Unlike most conventional languages, in SixtyPical the programmer must managememory very explicitly, selecting the registers and memory locations to storeeach piece of data in. So, unlike a C compiler such ascc65, a SixtyPicalcompiler doesn't need to generate code to handlecalling conventions orregister allocation. This results in smaller (and thus faster) programs.
The flagship demo, a minigame for the Commodore 64, compiles toa930-byte.PRG file.
The reference implementation can analyze and compile SixtyPical programs to6502 machine code formats which can run on several 6502-based 8-bit architectures:
For example programs for each of these, seeeg/README.md.
SixtyPical is defined by a specification document, a set of test cases,and a reference implementation written in Python.
There are over 400 test cases, written inFalderal format for readability.In order to run the tests for compilation,dcc6502 needs to be installed.
- SixtyPical specification
- Literate test suite for SixtyPical syntax
- Literate test suite for SixtyPical analysis (operations)
- Literate test suite for SixtyPical analysis (storage)
- Literate test suite for SixtyPical analysis (control flow)
- Literate test suite for SixtyPical compilation
- Literate test suite for SixtyPical fallthru optimization
- Literate test suite for SixtyPical callgraph construction
About
MIRROR ofhttps://codeberg.org/catseye/SixtyPical : A 6502-oriented low-level programming language supporting advanced static analysis
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.
