mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-25 18:33:11 +00:00
fixed ca65 listing line numbers
This commit is contained in:
parent
b1c76cf6bb
commit
9032eaf9b5
@ -204,6 +204,8 @@ TODO:
|
||||
- need Edge 79+
|
||||
- no import in workers
|
||||
- copy to gen/ directory (allowJs is weird)
|
||||
- can we debug first frame via replay?
|
||||
- ca65 line numbers are not aligned with source code
|
||||
|
||||
|
||||
WEB WORKER FORMAT
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { MOS6502, MOS6502State } from "../common/cpu/MOS6502";
|
||||
import { Bus, BasicScanlineMachine, xorshift32, SavesState } from "../common/devices";
|
||||
import { KeyFlags } from "../common/emu"; // TODO
|
||||
import { lzgmini, stringToByteArray, RGBA, printFlags } from "../common/util";
|
||||
import { hex, lzgmini, stringToByteArray, RGBA, printFlags } from "../common/util";
|
||||
|
||||
const cpuFrequency = 1023000;
|
||||
const cpuCyclesPerLine = 65; // approx: http://www.cs.columbia.edu/~sedwards/apple2fpga/
|
||||
@ -993,7 +993,7 @@ const APPLEIIGO_LZG = `TFpHAAAwAAAABYxwdy2NARUZHjRBUFBMRUlJR08gUk9NMS4wADQfNB80H
|
||||
|
||||
const NUM_DRIVES = 2;
|
||||
const NUM_TRACKS = 35;
|
||||
const TRACK_SIZE = 0x1a00;
|
||||
const TRACK_SIZE = 0x1880;
|
||||
const SECTOR_SIZE = 383;
|
||||
|
||||
const DISKII_PROM = [
|
||||
@ -1072,6 +1072,7 @@ class DiskII extends DiskIIState implements SlotDevice, SavesState<DiskIIState>
|
||||
"\nOffset: " + (this.track_index) +
|
||||
"\nMode: " + (this.read_mode ? "READ" : "WRITE") +
|
||||
"\nMotor: " + this.motor +
|
||||
"\nData: " + (this.track_data ? hex(this.track_data[this.track_index]) : '-') +
|
||||
"\n";
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ import { NullProbe, Probeable, ProbeAll } from "../common/devices";
|
||||
// http://www.playvectrex.com/designit/chrissalo/bios.asm
|
||||
// https://www.6809.org.uk/asm6809/doc/asm6809.shtml
|
||||
// http://www.playvectrex.com/
|
||||
// http://vectrexmuseum.com/vectrexhistory.php
|
||||
|
||||
var VECTREX_PRESETS = [
|
||||
{ id: 'hello.xasm', name: 'Hello World (ASM)' },
|
||||
|
@ -843,22 +843,28 @@ function setupStdin(fs, code:string) {
|
||||
);
|
||||
}
|
||||
|
||||
//TODO: this doesn't align very well
|
||||
/*
|
||||
000000r 1 .segment "CODE"
|
||||
000000r 1 .proc _rasterWait: near
|
||||
000000r 1 ; int main() { return mul2(2); }
|
||||
000000r 1 .dbg line, "main.c", 3
|
||||
000014r 1 .dbg func, "main", "00", extern, "_main"
|
||||
000000r 1 A2 00 ldx #$00
|
||||
000000r 1 .segment "CODE"
|
||||
000000r 1 .proc _rasterWait: near
|
||||
000000r 1 ; int main() { return mul2(2); }
|
||||
000000r 1 .dbg line, "main.c", 3
|
||||
000014r 1 .dbg func, "main", "00", extern, "_main"
|
||||
000000r 1 A2 00 ldx #$00
|
||||
00B700 1 BOOT2:
|
||||
00B700 1 A2 01 ldx #1 ;track
|
||||
00B725 1 00 IBLASTDRVN: .byte 0
|
||||
00B726 1 xx xx IBSECSZ: .res 2
|
||||
00BA2F 1 2A 2B E8 2C HEX "2A2BE82C2D2E2F303132F0F133343536"
|
||||
*/
|
||||
function parseCA65Listing(code, symbols, params, dbg) {
|
||||
var segofs = 0;
|
||||
var offset = 0;
|
||||
var dbgLineMatch = /^([0-9A-F]+)([r]?)\s+(\d+)\s+[.]dbg\s+(\w+), "([^"]+)", (.+)/;
|
||||
var funcLineMatch = /"(\w+)", (\w+), "(\w+)"/;
|
||||
var insnLineMatch = /^([0-9A-F]+)([r]?)\s+(\d+)\s+([0-9A-Fr ]*)\s*(.*)/;
|
||||
var insnLineMatch = /^([0-9A-F]+)([r]?)\s{1,2}(\d+)\s{1,2}([0-9A-Frx ]{11})\s+(.*)/;
|
||||
var lines = [];
|
||||
var linenum = 4; // ca65 listing header, 5 lines
|
||||
var linenum = 0;
|
||||
// TODO: only does .c functions, not all .s files
|
||||
for (var line of code.split(re_crlf)) {
|
||||
var dbgm = dbgLineMatch.exec(line);
|
||||
@ -1034,6 +1040,7 @@ function linkLD65(step:BuildStep) {
|
||||
for (var fn of step.files) {
|
||||
if (fn.endsWith('.lst')) {
|
||||
var lstout = FS.readFile(fn, {encoding:'utf8'});
|
||||
lstout = lstout.split('\n\n')[1] || lstout; // remove header
|
||||
var asmlines = parseCA65Listing(lstout, symbolmap, params, false);
|
||||
var srclines = parseCA65Listing(lstout, symbolmap, params, true);
|
||||
putWorkFile(fn, lstout);
|
||||
|
Loading…
Reference in New Issue
Block a user