Apple ][ Helper

This commit is contained in:
Elizabeth Cray 2021-07-30 21:53:27 -04:00
commit c1c8a0a2eb
8 changed files with 87 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
Tools/cc65
Tools/ac.jar

8
Example/Example.c Normal file
View File

@ -0,0 +1,8 @@
#include <conio.h>
#include "../Library/clear.h"
int main(void) {
clear(40, 40);
cputs("HELLO MADELINE CRAY\n\rWOULD YOU LIKE TO PLAY A GAME?\n\r");
cgetc();
}

BIN
Example/Example.dsk Normal file

Binary file not shown.

16
Library/clear.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef CLEAR_H
#define CLEAR_H
#include <conio.h>
void clear(int w, int h){
int i = 0;
int j = 0;
for(i=0; i<h; i++) {
for(j=0; j<w; j++) {
cputs(" ");
}
cputs("\n\r");
}
}
#endif

26
Makefile Normal file
View File

@ -0,0 +1,26 @@
PROJECT=Example
CC65_DIR=./Tools/cc65
UC = $(shell echo '$1' | tr '[:lower:]' '[:upper:]')
all: build package.dsk clean
build :
$(CC65_DIR)/bin/cc65 -t apple2 $(PROJECT)/$(PROJECT).c -o $(PROJECT)/$(PROJECT).s
$(CC65_DIR)/bin/ca65 -t apple2 $(PROJECT)/$(PROJECT).s -o $(PROJECT)/$(PROJECT).o
$(CC65_DIR)/bin/ld65 -t apple2 $(PROJECT)/$(PROJECT).o -o $(PROJECT)/$(PROJECT).bin --lib apple2.lib
package.po :
java -jar ./Tools/ac.jar -pro140 $(PROJECT)/$(PROJECT).po $(call UC,$PROJECT)
java -jar ./Tools/ac.jar -p $(PROJECT)/$(PROJECT).po $(call UC,$PROJECT) BIN < $(PROJECT)/$(PROJECT).bin
package.dsk :
cp ./Tools/ProDOS_Example.dsk $(PROJECT)/$(PROJECT).dsk
java -jar ./Tools/ac.jar -p $(PROJECT)/$(PROJECT).dsk $(call UC,$PROJECT).SYSTEM sys < $(CC65_DIR)/target/apple2/util/loader.system
java -jar ./Tools/ac.jar -as $(PROJECT)/$(PROJECT).dsk $(call UC,$PROJECT) bin < $(PROJECT)/$(PROJECT).bin
clean :
rm -f $(PROJECT)/$(PROJECT).s $(PROJECT)/$(PROJECT).o $(PROJECT)/$(PROJECT).bin
reset : clean
rm -rf $(PROJECT)/$(PROJECT).po $(PROJECT)/$(PROJECT).dsk

26
README.md Normal file
View File

@ -0,0 +1,26 @@
# Applesauce
Apple ][ C compiler helper built on top of [cc65](https://github.com/cc65/cc65)
## Getting Started
I wrote a script `setup.sh` to pull the required files and get your build environment ready.
Just be sure to have the following packages already instaled on your system:
`build-essential make git openjdk-11-jdk`
## Building
The Directory tree should look like this (replace Project with your project's name):
```
Project
⌞ Project.c
```
Then from the main project directory (where the `Makefile` is located) run:
```bash
make PROJECT=Project
```

BIN
Tools/ProDOS_Example.dsk Normal file

Binary file not shown.

9
setup.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# This file sets up the build environment
cd Tools
git clone https://github.com/cc65/cc65.git
wget -O ac.jar https://github.com/AppleCommander/AppleCommander/releases/download/v1-6-0/AppleCommander-ac-1.6.0.jar
cd cc65
make -j4
cd ../..