All Projects → robmcmullen → asmgen

robmcmullen / asmgen

Licence: other
6502 code generator for sprites, fonts, images and more

Programming Languages

python
139335 projects - #7 most used programming language
assembly
5116 projects

Labels

Projects that are alternatives of or similar to asmgen

Thistle
6502 based architecture for OpenComputers
Stars: ✭ 26 (+85.71%)
Mutual labels:  6502
n65
An assembler for the 6502 microprocessor written in Ruby
Stars: ✭ 12 (-14.29%)
Mutual labels:  6502
pettil
6502 Forth-83 dialect for the Commodore PET 2001
Stars: ✭ 31 (+121.43%)
Mutual labels:  6502
6502-npp-syntax
Notepad++ Syntax Highlighting for 6502 Assembly (and NESASM)
Stars: ✭ 21 (+50%)
Mutual labels:  6502
Gearnes
NES / Famicom emulator for iOS, Mac, Raspberry Pi, Windows, Linux and RetroArch.
Stars: ✭ 23 (+64.29%)
Mutual labels:  6502
TaliForth2
A Subroutine Threaded Code (STC) ANS-like Forth for the 65c02
Stars: ✭ 78 (+457.14%)
Mutual labels:  6502
nes-pipeline
🔄 Continuous integration for NES homebrew that adds screenshots taken in the cloud.
Stars: ✭ 88 (+528.57%)
Mutual labels:  6502
retro-computing
🤓🕹💾 This hobby project contains software implementations of old microprocessors and complete computer systems. I'm very interested in retrocomputing and this is how I learn about the inner workings of these old, classic and amazing computers and game consoles.
Stars: ✭ 15 (+7.14%)
Mutual labels:  6502
asm6f
A fork of loopy's ASM6, a 6502 assembler.
Stars: ✭ 79 (+464.29%)
Mutual labels:  6502
tamagotchi-tech-specs
Tamagotchi Tech Specs
Stars: ✭ 29 (+107.14%)
Mutual labels:  6502
6502-emulator
An Understandable 6502 Emulator
Stars: ✭ 26 (+85.71%)
Mutual labels:  6502
disc-elite-beebasm
Fully documented and annotated source code for the disc version of Elite on the BBC Micro
Stars: ✭ 19 (+35.71%)
Mutual labels:  6502
champ
A 65C02 profiler
Stars: ✭ 17 (+21.43%)
Mutual labels:  6502
Apple-1-Mini
A minified replica of the Apple 1
Stars: ✭ 32 (+128.57%)
Mutual labels:  6502
go6502
6502 CPU emulator, assembler and disassembler written in Go
Stars: ✭ 31 (+121.43%)
Mutual labels:  6502
js-nes-emulator
NES emulator in javascript.
Stars: ✭ 12 (-14.29%)
Mutual labels:  6502
language-65asm
Adds syntax highlighting to 65816/65C816/65802/6502/65C02 files in Atom, with extra support for various compilers.
Stars: ✭ 32 (+128.57%)
Mutual labels:  6502
Donsol
Card game for the Famicom, written in 6502 assembly
Stars: ✭ 106 (+657.14%)
Mutual labels:  6502
hb6502
My Homebrew 6502 breadboard computer with my own #FORTH implementation
Stars: ✭ 13 (-7.14%)
Mutual labels:  6502
cbmtapepi
Use a Raspberry Pi as fast mass storage solution for your Commodore 8-bit computer using just the datassette port.
Stars: ✭ 41 (+192.86%)
Mutual labels:  6502

AsmGen

Abstract

AsmGen - 6502 assembly code generator for sprites, fonts, and images for Apple ][ hi-res and Atari 8-bit computers

This program creates 6502 (or 65c02) code for several tasks, including a high speed font rendering engine and a sprite compiler. The font rendered can plot font glyphs (or game tiles) much faster than normal tile drawing routines. The sprite complier (based on HiSprite) hardcodes sprite data in unrolled loops for each shifted shape. By removing image lookups and loops, sprites can be drawn much faster than otherwise possible.

Other utilities include generating code for reporting screen damage, screen clearing, screen scrolling, and generation for all the row/column lookup tables for each supported bitmap mode.

Installation

The autogenerator code is written in Python and should run on any platform that can use python. It requires:

  • python 3.6 (and above)
  • numpy
  • pypng

the latter two of which will be installed automatically when using the Python package manager:

pip install asmgen

Starting with version 2.0, python 2 support has been dropped.

Installing From Source

To contribute bug fixes or enhancements, it would be useful to get an account on github and clone the source to your own account. You can then send me pull requests for any modifications you would like to see included.

If you just want to clone the source to look at it, use:

git clone https://github.com/robmcmullen/asmgen.git

Using the Code Generator

The code generator is a command line tool that creates text files that can be used as source code for assemblers. Its general usage is:

asmgen.py [OPTIONS] -o ROOTNAME

which will create one file called ''ROOTNAME-driver.s'' and one or more files containing generated code as specified by ''OPTIONS''. This driver file is a convenience that only exists to include all the other generated files. This means that your build process only needs to include ROOTNAME-driver.s instead of needing to be updated if you add aditional code generation options.

Assembler Support

Code generation is supported for the following assemblers:

  • cc65 (the default)
  • MAC/65
  • Merlin (from ksherlock)

Contributors welcome for other assemblers, like MADS, dasm, xasm, etc.

Code Generation Capabilities

  • Transposed font code generator
  • Sprite compiler
  • Screen clearing
  • Screen vertical scrolling
  • Hi-res row lookup table generation

Experimental (and unsupported)

  • Font compiler (slower than the transposed font code)
  • Run-length encoding of images
  • Merge two hi-res images, switching images at specified scan line

Transposed Font

To generate source code for a fast font renderer, you will need a binary font file. The code generator will embed the binary data as .byte directives (or equivalent for the chosen assembler) because the transposition requires reordering of the data. The usage is:

asmgen.py -f FONTFILENAME -o ROOTNAME

It will create two source files, the ROOTNAME-driver.s file described above, and the file of interest called ROOTNAME-fastfont.s which contains the generated code and data for use of the transposed font. The entry point look like this:

FASTFONT_H1 ; A = character, X = column, Y = row; A is clobbered, X&Y are not
        pha
        lda FASTFONT_H1_JMP_HI,y
        sta FASTFONT_H1_JMP+2
        lda FASTFONT_H1_JMP_LO,y
        sta FASTFONT_H1_JMP+1
        sty scratch_0
        pla
        tay
FASTFONT_H1_JMP
        jmp $ffff

FASTFONT_H1_JMP is a jump table, broken into high and low bytes.

The input is described in the comment: the glyph in the accumulator, column value (0-39) in the X register, and row value (0-23) in the Y register. Note that no error checking is done here, so it will happily trash data in some unintended part of RAM if you pass it values that are out of range.

Use it like this:

lda #65  ; ASCII character 'A'
ldx #20  ; column 20 (counting from zero)
ldy #5   ; row 5 (counting from zero)
jsr FASTFONT_H1

Fork me!

The source is free and open, and lives on github, so clone and enhance at will!

History

This program started life as a friendly fork of Quinn Dunki's HiSprite that she presented at KansasFest 2017.

Her conclusion was that it was not that practical for the Apple II because of the limited memory and the number of sprite shifts needed. I wanted to port this to the Atari because it would require fewer shifted shapes in most of the graphics modes (e.g. only 4 shifted shapes for the commonly used ANTIC modes 13 and 14) She told me that she was unlikely to continue work on sprite compiling but encouraged me to continue development.

Additional Credits

The sample font is modified from Michael Pohoreski's excellent tutorial on Apple II fonts.

License

AsmGen, the 6502 code generator sponsored by the Player/Missile Podcast Copyright (c) 2017-2021 Rob McMullen

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Generated Code License

While the code for AsmGen itself is licensed under the MPL 2.0, the code it produces is licensed under the the Creative Commons Attribution 4.0 International (CC BY 4.0), so you are free to use the generated code for commercial or non-commercial purposes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].