Build DaMaGe-Emulator Boot ROM
This commit is contained in:
parent
c756861822
commit
5fae86a662
BIN
BootROMs/DamageLogo.1bpp
Normal file
BIN
BootROMs/DamageLogo.1bpp
Normal file
Binary file not shown.
@ -549,7 +549,8 @@ TrademarkSymbol:
|
||||
db $3c,$42,$b9,$a5,$b9,$a5,$42,$3c
|
||||
|
||||
SameboyLogo:
|
||||
incbin "SameboyLogo.1bpp"
|
||||
; incbin "SameboyLogo.1bpp"
|
||||
incbin "DamageLogo.1bpp"
|
||||
SameboyLogoEnd:
|
||||
|
||||
AnimationColors:
|
||||
|
@ -91,7 +91,11 @@ Start:
|
||||
call WaitBFrames
|
||||
|
||||
; Set registers to match the original DMG boot
|
||||
IF DEF(MGB)
|
||||
ld hl, $01B0
|
||||
ELSE
|
||||
ld hl, $FFB0
|
||||
ENDC
|
||||
push hl
|
||||
pop af
|
||||
ld hl, $014D
|
||||
|
2
BootROMs/mgb_boot.asm
Normal file
2
BootROMs/mgb_boot.asm
Normal file
@ -0,0 +1,2 @@
|
||||
MGB EQU 1
|
||||
include "dmg_boot.asm"
|
10
Makefile
10
Makefile
@ -106,9 +106,9 @@ endif
|
||||
|
||||
cocoa: $(BIN)/SameBoy.app
|
||||
quicklook: $(BIN)/SameBoy.qlgenerator
|
||||
sdl: $(SDL_TARGET) $(BIN)/SDL/dmg_boot.bin $(BIN)/SDL/cgb_boot.bin $(BIN)/SDL/agb_boot.bin $(BIN)/SDL/sgb_boot.bin $(BIN)/SDL/sgb2_boot.bin $(BIN)/SDL/LICENSE $(BIN)/SDL/registers.sym $(BIN)/SDL/background.bmp $(BIN)/SDL/Shaders
|
||||
bootroms: $(BIN)/BootROMs/agb_boot.bin $(BIN)/BootROMs/cgb_boot.bin $(BIN)/BootROMs/dmg_boot.bin $(BIN)/BootROMs/sgb_boot.bin $(BIN)/BootROMs/sgb2_boot.bin
|
||||
tester: $(TESTER_TARGET) $(BIN)/tester/dmg_boot.bin $(BIN)/tester/cgb_boot.bin $(BIN)/tester/agb_boot.bin $(BIN)/tester/sgb_boot.bin $(BIN)/tester/sgb2_boot.bin
|
||||
sdl: $(SDL_TARGET) $(BIN)/SDL/dmg_boot.bin $(BIN)/SDL/mgb_boot.bin $(BIN)/SDL/cgb_boot.bin $(BIN)/SDL/cgb_boot_fast.bin $(BIN)/SDL/agb_boot.bin $(BIN)/SDL/sgb_boot.bin $(BIN)/SDL/sgb2_boot.bin $(BIN)/SDL/LICENSE $(BIN)/SDL/registers.sym $(BIN)/SDL/background.bmp $(BIN)/SDL/Shaders
|
||||
bootroms: $(BIN)/BootROMs/agb_boot.bin $(BIN)/BootROMs/cgb_boot.bin $(BIN)/BootROMs/cgb_boot_fast.bin $(BIN)/BootROMs/dmg_boot.bin $(BIN)/BootROMs/mgb_boot.bin $(BIN)/BootROMs/sgb_boot.bin $(BIN)/BootROMs/sgb2_boot.bin
|
||||
tester: $(TESTER_TARGET) $(BIN)/tester/dmg_boot.bin $(BIN)/tester/mgb_boot.bin $(BIN)/tester/cgb_boot.bin $(BIN)/tester/cgb_boot_fast.bin $(BIN)/tester/agb_boot.bin $(BIN)/tester/sgb_boot.bin $(BIN)/tester/sgb2_boot.bin
|
||||
all: cocoa sdl tester libretro
|
||||
|
||||
# Get a list of our source files and their respective object file targets
|
||||
@ -178,7 +178,9 @@ $(BIN)/SameBoy.app: $(BIN)/SameBoy.app/Contents/MacOS/SameBoy \
|
||||
Cocoa/Info.plist \
|
||||
Misc/registers.sym \
|
||||
$(BIN)/SameBoy.app/Contents/Resources/dmg_boot.bin \
|
||||
$(BIN)/SameBoy.app/Contents/Resources/mgb_boot.bin \
|
||||
$(BIN)/SameBoy.app/Contents/Resources/cgb_boot.bin \
|
||||
$(BIN)/SameBoy.app/Contents/Resources/cgb_boot_fast.bin \
|
||||
$(BIN)/SameBoy.app/Contents/Resources/agb_boot.bin \
|
||||
$(BIN)/SameBoy.app/Contents/Resources/sgb_boot.bin \
|
||||
$(BIN)/SameBoy.app/Contents/Resources/sgb2_boot.bin \
|
||||
@ -309,7 +311,7 @@ $(BIN)/BootROMs/%.bin: BootROMs/%.asm
|
||||
-@$(MKDIR) -p $(dir $@)
|
||||
cd BootROMs && rgbasm -o ../$@.tmp ../$<
|
||||
rgblink -o $@.tmp2 $@.tmp
|
||||
head -c $(if $(findstring dmg,$@)$(findstring sgb,$@), 256, 2304) $@.tmp2 > $@
|
||||
head -c $(if $(findstring dmg,$@)$(findstring sgb,$@)$(findstring mgb,$@), 256, 2304) $@.tmp2 > $@
|
||||
@rm $@.tmp $@.tmp2
|
||||
|
||||
# Libretro Core (uses its own build system)
|
||||
|
188
test.pl
Executable file
188
test.pl
Executable file
@ -0,0 +1,188 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# This script parses Git blame's "porcelain" output format and
|
||||
# ascertains the oldest lines of code seen.
|
||||
#
|
||||
# If you want to perform a custom report, just define your own callback
|
||||
# function and invoke parse_porcelain() with it.
|
||||
#
|
||||
# The expected input format is slightly modified from raw `git blame
|
||||
# -p`. Here is an example script for producing input:
|
||||
#
|
||||
# for f in `git ls-tree -r --name-only HEAD`; do \
|
||||
# echo "BEGIN_RECORD $f"; \
|
||||
# git blame -l -t -M -C -n -w -p $f; \
|
||||
# echo "END_RECORD $f"; \
|
||||
# done
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => "all";
|
||||
|
||||
use POSIX qw(strftime);
|
||||
|
||||
our @STATES = qw(global header_first header_metadata);
|
||||
|
||||
our $RE_BEGIN_RECORD = qr/^BEGIN_RECORD\s(.*)$/msx;
|
||||
our $RE_END_RECORD = qr/^END_RECORD\s(.*)$/msx;
|
||||
|
||||
our $RE_LINE_HEADER = qr/
|
||||
^
|
||||
([a-z0-9]{40}) # SHA
|
||||
\s(\d+) # Original line number
|
||||
\s(\d+) # Current line number
|
||||
(?:\s(\d+))? # Number of lines in group (optional)
|
||||
$/msx;
|
||||
|
||||
our $RE_HEADER_METADATA = qr/^([a-z-]+)\s(.*)$/msx;
|
||||
our $RE_LINE_DATA = qr/^\t(.*)$/msx;
|
||||
|
||||
# Parses Git blame's porcelain output.
|
||||
# Calls the supplied $onBlock callback function when a full block of
|
||||
# code has been parsed. The function receives a hashref describing the
|
||||
# block.
|
||||
sub parse_porcelain {
|
||||
my ($fh, $onBlock) = @_;
|
||||
|
||||
my $state = "global";
|
||||
my $metadata = {};
|
||||
my @lines;
|
||||
my ($commit, $original_line, $current_line);
|
||||
my $current_file;
|
||||
|
||||
my $callOnBlock = sub {
|
||||
my $data = {};
|
||||
$data->{'filename'} = $current_file;
|
||||
$data->{'lines'} = \@lines;
|
||||
$data->{'metadata'} = $metadata;
|
||||
$data->{'commit'} = $commit;
|
||||
|
||||
&$onBlock($data);
|
||||
|
||||
@lines = ();
|
||||
};
|
||||
|
||||
while (my $line = <$fh>) {
|
||||
chomp $line;
|
||||
|
||||
if ($line =~ $RE_BEGIN_RECORD) {
|
||||
$state eq "global" or die "Parser error. Unexpected BEGIN_RECORD.";
|
||||
|
||||
$current_file = $1;
|
||||
$state = "header_first";
|
||||
|
||||
next;
|
||||
}
|
||||
elsif ($line =~ $RE_END_RECORD) {
|
||||
$1 eq $current_file or die "Parser error. END_RECORD mismatch!";
|
||||
|
||||
if ($onBlock and scalar(@lines)) {
|
||||
&$callOnBlock();
|
||||
}
|
||||
|
||||
$state = "global";
|
||||
next;
|
||||
}
|
||||
|
||||
if ($state eq "header_first") {
|
||||
$line =~ $RE_LINE_HEADER or die "Invalid initial header line! $line";
|
||||
my ($new_commit, $new_original_line, $new_current_line, $block_count);
|
||||
($new_commit, $new_original_line, $new_current_line, $block_count) = ($1, $2, $3, $4);
|
||||
|
||||
if ($block_count and $onBlock and scalar(@lines)) {
|
||||
&$callOnBlock();
|
||||
}
|
||||
|
||||
$commit = $new_commit;
|
||||
$original_line = $new_original_line;
|
||||
$current_line = $new_current_line;
|
||||
|
||||
$state = "header_metadata";
|
||||
next;
|
||||
}
|
||||
|
||||
if ($state eq "header_metadata") {
|
||||
# Lines beginning with a tab denote line content. Subsequent line(s)
|
||||
# will be metadata for that line.
|
||||
if ($line =~ $RE_LINE_DATA) {
|
||||
my $content = $1;
|
||||
|
||||
push @lines, [$content, $original_line, $current_line];
|
||||
$state = "header_first";
|
||||
next;
|
||||
}
|
||||
|
||||
next if $line eq "boundary";
|
||||
|
||||
$line =~ $RE_HEADER_METADATA or die "Could not parse header metadata.";
|
||||
my ($k, $v) = ($1, $2);
|
||||
|
||||
$metadata->{$k} = $v;
|
||||
next;
|
||||
}
|
||||
|
||||
die "Unknown state!";
|
||||
}
|
||||
}
|
||||
|
||||
# onBlock callback that collects oldest commit times for blocks.
|
||||
my $old_lines = {};
|
||||
sub collect_times {
|
||||
my ($data) = @_;
|
||||
|
||||
# We filter non-relevant lines.
|
||||
my $have_content = 0;
|
||||
|
||||
foreach my $line (@{$data->{'lines'}}) {
|
||||
my $s = $line->[0];
|
||||
|
||||
# Skip empty and whitespace.
|
||||
next if $s =~ m/^\s*$/;
|
||||
|
||||
# Skip things looking like comments.
|
||||
next if $s =~ m/^\s*(#|\/\/|\/\*|\*\/)/;
|
||||
|
||||
if ($s =~ m/[a-z0-9]/) {
|
||||
$have_content = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$have_content) {
|
||||
return;
|
||||
}
|
||||
|
||||
my $time = $data->{'metadata'}->{'committer-time'};
|
||||
|
||||
my $metadata = {};
|
||||
$metadata->{'commit'} = $data->{'commit'};
|
||||
$metadata->{'author'} = $data->{'metadata'}->{'author'};
|
||||
$metadata->{'filename'} = $data->{'filename'};
|
||||
$metadata->{'lines'} = [];
|
||||
|
||||
foreach my $line (@{$data->{'lines'}}) {
|
||||
push @{$metadata->{'lines'}}, $line->[2];
|
||||
}
|
||||
|
||||
push @{$old_lines->{$time}}, $metadata;
|
||||
}
|
||||
|
||||
sub print_oldest_blocks {
|
||||
my ($times) = @_;
|
||||
|
||||
foreach my $time (sort { $a <=> $b } keys %$times) {
|
||||
my $blocks = $times->{$time};
|
||||
my $date = strftime("%Y-%m-%d %H:%M:%S", gmtime($time));
|
||||
|
||||
print "Time: $time ($date)\n";
|
||||
foreach my $data (@$blocks) {
|
||||
print " Commit: " . $data->{'commit'} . "\n";
|
||||
print " Author: " . $data->{'author'} . "\n";
|
||||
print " Filename: " . $data->{'filename'} . "\n";
|
||||
print " Lines: " . join(', ', @{$data->{'lines'}}) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parse_porcelain(*STDIN, \&collect_times);
|
||||
print_oldest_blocks($old_lines);
|
||||
|
Loading…
Reference in New Issue
Block a user