Autogenerate include file for LC resources

This commit is contained in:
Joshua Bell
2018-05-02 21:05:31 -07:00
parent 7ac11c080d
commit fe2948e489
8 changed files with 1547 additions and 1563 deletions
+6 -1
View File
@@ -5,7 +5,7 @@ CCFLAGS = --config asm.cfg
OUTDIR = out
HEADERS = $(wildcard ../*.inc) $(wildcard ../inc/*.inc) $(wildcard *.inc)
HEADERS = $(wildcard ../*.inc) $(wildcard ../inc/*.inc) $(wildcard *.inc) $(OUTDIR)/desktop_res.inc
SEGMENTS = loader mgtk desktop invoker \
ovl1 ovl1a ovl1b ovl1c ovl2 ovl34567
@@ -21,9 +21,14 @@ $(OUTDIR):
clean:
rm -f $(OUTDIR)/*.o
rm -f $(OUTDIR)/*.list
rm -f $(OUTDIR)/*.inc
rm -f $(OUTDIR)/*.built
rm -f $(OUTDIR)/*.sys
$(OUTDIR)/desktop_res.inc: desktop_res.s desktop_res_builder.s
$(CC65)/ca65 $(CAFLAGS) --listing $(OUTDIR)/desktop_res.list -o $@ desktop_res_builder.s
cat $(OUTDIR)/desktop_res.list | res/build_res_inc.pl > $@
$(OUTDIR)/ovl34567.o: ovl34567.s $(HEADERS) ovl3.s ovl4.s ovl5.s ovl6.s ovl7.s
$(CC65)/ca65 $(CAFLAGS) --listing $(basename $@).list -o $@ $<
+1 -1476
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
.setcpu "6502"
.include "../mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "../inc/prodos.inc"
.org $D200
.include "desktop_res.s"
-84
View File
@@ -1,84 +0,0 @@
;;; ============================================================
;;; Re-used param space for events/queries
pencopy := $D200
penOR := $D201
penXOR := $D202
penBIC := $D203
notpencopy := $D204
notpenOR := $D205
notpenXOR := $D206
notpenBIC := $D207
event_params := $D208
event_kind := event_params + 0
;; if kind is key_down
event_key := event_params + 1
event_modifiers := event_params + 2
;; if kind is no_event, button_down/up, drag, or apple_key:
event_coords := event_params + 1
event_xcoord := event_params + 1
event_ycoord := event_params + 3
;; if kind is update:
event_window_id := event_params + 1
screentowindow_params := event_params
screentowindow_window_id := screentowindow_params + 0
screentowindow_screenx := screentowindow_params + 1
screentowindow_screeny := screentowindow_params + 3
screentowindow_windowx := screentowindow_params + 5
screentowindow_windowy := screentowindow_params + 7
.assert screentowindow_screenx = event_xcoord, error, "param mismatch"
.assert screentowindow_screeny = event_ycoord, error, "param mismatch"
findwindow_params := event_params + 1 ; offset to x/y overlap event_params x/y
findwindow_mousex := findwindow_params + 0
findwindow_mousey := findwindow_params + 2
findwindow_which_area := findwindow_params + 4
findwindow_window_id := findwindow_params + 5
.assert findwindow_mousex = event_xcoord, error, "param mismatch"
.assert findwindow_mousey = event_ycoord, error, "param mismatch"
findcontrol_params := event_params + 1 ; offset to x/y overlap event_params x/y
findcontrol_mousex := findcontrol_params + 0
findcontrol_mousey := findcontrol_params + 2
findcontrol_which_ctl := findcontrol_params + 4
findcontrol_which_part := findcontrol_params + 5
.assert findcontrol_mousex = event_xcoord, error, "param mismatch"
.assert findcontrol_mousey = event_ycoord, error, "param mismatch"
activatectl_params := event_params
activatectl_which_ctl := activatectl_params
activatectl_activate := activatectl_params + 1
trackthumb_params := event_params
trackthumb_which_ctl := trackthumb_params
trackthumb_mousex := trackthumb_params + 1
trackthumb_mousey := trackthumb_params + 3
trackthumb_thumbpos := trackthumb_params + 5
trackthumb_thumbmoved := trackthumb_params + 6
.assert trackthumb_mousex = event_xcoord, error, "param mismatch"
.assert trackthumb_mousey = event_ycoord, error, "param mismatch"
updatethumb_params := event_params
updatethumb_which_ctl := updatethumb_params
updatethumb_thumbpos := updatethumb_params + 1
updatethumb_stash := updatethumb_params + 5 ; not part of struct
;;; ============================================================
;;; Resources
winfo_alert_dialog := $D57D
winfo_entrydlg := $D5B7
winfo_entrydlg_file_picker := $D5F1
winfo_entry_picker := $D665
path_buf0 := $D402
path_buf1 := $D443
path_buf2 := $D484
grafport3 := $D239
dialog_rect1 := $DA9E
dialog_rect2 := $DAAA
+1 -1
View File
@@ -6,7 +6,7 @@
.include "../mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "inc/desktoplc.inc"
.include "out/desktop_res.inc"
;;; ============================================================
;;; Overlay for Format/Erase
+1 -1
View File
@@ -7,7 +7,7 @@
.include "../mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
.include "inc/desktoplc.inc"
.include "out/desktop_res.inc"
.macro entry arg1, arg2
.byte arg1
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env perl
use strict;
use warnings;
my @symbols = ();
my @equates = ();
# TODO: Handle nested procs
my $proc = '';
while (<STDIN>) {
chomp;
next unless m/^00([0-9A-F]{4}) 2 .. .. .. .. (.*)/;
my ($addr, $line) = ($1, $2);
$line =~ s/;.*//;
$line =~ s/^\s*|\s*$//;
next unless $line;
if ($line =~ m/^\.proc\s+(\S+)/) {
$proc = $1;
push @symbols, [$proc, $addr];
next;
}
if ($line =~ m/^\.endproc/) {
$proc = '';
next;
}
next if $proc;
if ($line =~ m/^(\S+)\s*:=\s*(.*)/) {
my ($symbol, $value) = ($1, $2);
next if $value =~ m/::/;
$value =~ s/\*/\$$addr/; # foo := * + 2
push @equates, [$symbol, $value];
next;
}
if ($line =~ m/^(\S+):/) {
push @symbols, [$1, $addr];
}
}
foreach my $pair (@symbols) {
printf "%-24s := \$%s\n", @$pair[0], @$pair[1];
}
foreach my $pair (@equates) {
printf "%-24s := %s\n", @$pair[0], @$pair[1];
}