Skip to content

Commit 99a088c

Browse files
committed
Update steps to make ca65 code compile in asm6502
1 parent 041a457 commit 99a088c

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

samples/README.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,41 @@ This folder contains sample for use with the Assembler.
55
This is a version of Manic Miner that I wrote for the Apple 2 using cc65's assembler, ca65, converted to my assembly format.
66

77
These are the steps:
8-
* Create a file (mminer-a2m.asm) that defines segments, turns on HGR and includes the root file.
9-
* Turn `.Repeat <count>, <var>` into `.for <var>=0, <var> .lt <count>, <var>++`
8+
* Create a file (`mminer-a2m.asm`) that defines segments, turns on HGR and includes the root file.
109
* Fix evaluation order differences `row & $08 << 4` vs `(row & $08) << 4`
11-
* Change `.addr` to `.word`
12-
* Make `.string` of data in quotes
13-
* Fix .local in macro by replacing the alias with the actual names
1410
* Change .ifblank in macro to .if .defined (and swap code generation to match)
15-
11+
12+
This is what the `mminer-a2m.asm` file looks like. It defines the segments and puts the Apple II into HGR mode - the laoder would have done that in the ca65 version. It then includes the main assembly file that was made for ca65.
13+
```
14+
.segdef "ZEROPAGE", $50, noemit
15+
.segdef "LOWMEM", $800, noemit
16+
.segdef "HGR", $4000
17+
.segdef "CODE", $6000
18+
.segdef "RODATA", $89DC
19+
.segdef "DATA", $BE40
20+
21+
SETAN3 = $C05F
22+
CLR80STORE = $C000
23+
CLR80 = $C00C ; apple2.inc has CLR80COL as $C000 - I call that CLR80STORE
24+
25+
.segment "CODE"
26+
sta SETAN3
27+
sta CLR80STORE
28+
sta CLR80 ; This turns off 80 col mode
29+
bit TXTCLR
30+
bit MIXCLR
31+
bit HISCR
32+
bit HIRES
33+
; .proc main follows so this falls through intentionally
34+
35+
.include "mminer.asm"
36+
```
1637
Press `CTRL + SHIFT + F4`. Browse to `samples/mmminer/mminer-a2m.asm`. Change the address to `6000`. Press `OK`.
1738

1839
Press `CTRL + F4`. Pretty much immediately Manic Miner should be running.
1940

2041
You can now open the debugger with `F2` and stop with `F11`, open the source, modify it and press `CTRL-B` (when stopped) or `CTRL+F4` at any time, to instantly see the changes. You can also un-check the box to auto-run, in which case you could press `CTRL-A` to jump to an address (say 6000). Then press `CTRL-P` to set the program counter to the address of the cursor. Now pressing `F5` will run the code from that address. You can also, with the mouse over the dissasembly window and the debugger stopped, press `CTRL+S` to open the symbols view, and type `main` to show only symbols that match `main`. Click on the `main` symbol itself and you should be at the place where `main` is compiled to. Press `CTRL+left cursor` to set the PC to the disassembly cursor (from clicking on `main`). Press `F5` to run or `F10` to step over or `F11` to step into.
2142

2243
29 November 2024
23-
Updated 24 November 2025
44+
Updated 24 Nov 2025
45+
Updated 4 Feb 2026

0 commit comments

Comments
 (0)