Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MIRROR ofhttps://codeberg.org/catseye/SixtyPical : A 6502-oriented low-level programming language supporting advanced static analysis

NotificationsYou must be signed in to change notification settings

catseye/SixtyPical

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version 0.21|See also:Bubble Escape 2KSITU-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.

Quick Start

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:

sixtypical

If you have theVICE emulator suite installed, you can run

sixtypical --run-on=x64 eg/c64/hearts.60p

and it will compile thehearts.60p source code andautomatically start it in thex64 emulator, and you should see:

Screenshot of result of running hearts.60p

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.

Features

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.

Low level

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.

Static analysis

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

Efficient code

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.

Target platforms

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.

Specification

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.

Documentation

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp