mirror of
https://github.com/mgcaret/rom4x.git
synced 2025-02-28 10:29:50 +00:00
4X: fix assembler warning; 4X+5X: Prepare for binary distribution
This commit is contained in:
parent
094e9d98fa
commit
df08db5fce
@ -4,7 +4,7 @@
|
|||||||
ldx #msglen
|
ldx #msglen
|
||||||
lp1: lda bootmsg,x
|
lp1: lda bootmsg,x
|
||||||
ora #$80
|
ora #$80
|
||||||
sta $7d0+19-msglen/2,x
|
sta $7d0+19-(<msglen/2),x
|
||||||
dex
|
dex
|
||||||
bpl lp1
|
bpl lp1
|
||||||
lda #23 ; last line
|
lda #23 ; last line
|
||||||
|
@ -1,21 +1,53 @@
|
|||||||
source_rom = "iic_rom4.bin"
|
rom_url = 'https://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/Apple%20II/Apple%20IIc/ROM%20Images/Apple%20IIc%20ROM%2004%20-%20341-0445-B.bin'
|
||||||
dest_rom = "iic_rom4x.bin"
|
source_rom = 'iic_rom4.bin'
|
||||||
|
source_rom_sha256 = '8ad5e6c4ed15d09b62183965b6c04762610d4b26510afc1896bdb4ecc55da883'
|
||||||
|
dest_rom = 'iic_rom4x.bin'
|
||||||
|
distzip = 'iic_rom4x.zip'
|
||||||
rom_base = 0xc000
|
rom_base = 0xc000
|
||||||
|
|
||||||
source_files = Rake::FileList.new('*.s')
|
source_files = Rake::FileList.new('*.s')
|
||||||
|
|
||||||
desc "Default: clean and build it"
|
desc 'Default: clean and build it'
|
||||||
task :default => [:clean, :assemble, :build_rom] do
|
task :default => [:clean, :assemble, :build_rom] do
|
||||||
sh "ls -l #{dest_rom}"
|
sh "ls -l #{dest_rom}"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Clean object files"
|
task :zip => [:clean, :assemble, :build_zip] do
|
||||||
|
sh "ls -l #{dest_rom}"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Clean object files'
|
||||||
task :clean do
|
task :clean do
|
||||||
sh "rm -f #{dest_rom}"
|
sh "rm -f #{dest_rom}"
|
||||||
sh "rm -f sf512_#{dest_rom}"
|
sh "rm -f sf512_#{dest_rom}"
|
||||||
sh "rm -f *.o"
|
sh "rm -f *.o"
|
||||||
sh "rm -f *.lst"
|
sh "rm -f *.lst"
|
||||||
sh "rm -f *.b"
|
sh "rm -f *.b"
|
||||||
|
sh "rm -f rom.sha256"
|
||||||
|
sh "rm -f make_rom.sh"
|
||||||
|
sh "rm -f #{distzip}"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Obtain ROM'
|
||||||
|
rule source_rom do
|
||||||
|
require 'open-uri'
|
||||||
|
|
||||||
|
puts "Downloading ROM..."
|
||||||
|
|
||||||
|
File.open(source_rom, "wb") do |romfile|
|
||||||
|
open(rom_url) do |wwwfile|
|
||||||
|
romfile.write(wwwfile.read)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Verify ROM Checksum"
|
||||||
|
task :checksum_rom => source_rom do
|
||||||
|
require 'digest'
|
||||||
|
|
||||||
|
sha256 = Digest::SHA256.file source_rom
|
||||||
|
fail "ROM checksum failed" unless sha256.hexdigest == source_rom_sha256
|
||||||
|
puts "Source ROM appears correct!"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Assemble all source files"
|
desc "Assemble all source files"
|
||||||
@ -30,7 +62,7 @@ rule ".b" => ".o" do |t|
|
|||||||
end
|
end
|
||||||
|
|
||||||
desc "Build ROM"
|
desc "Build ROM"
|
||||||
task :build_rom => [:assemble] do
|
task :build_rom => [:assemble, :checksum_rom] do
|
||||||
puts "Building ROM image..."
|
puts "Building ROM image..."
|
||||||
obj_files = Rake::FileList.new('*.b')
|
obj_files = Rake::FileList.new('*.b')
|
||||||
rom = File.read(source_rom)
|
rom = File.read(source_rom)
|
||||||
@ -62,3 +94,60 @@ task :sf512 => [:build_rom] do
|
|||||||
sh "cat #{dest_rom} #{dest_rom} > sf512_#{dest_rom}"
|
sh "cat #{dest_rom} #{dest_rom} > sf512_#{dest_rom}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Build disributable ZIP"
|
||||||
|
task :build_zip => [:build_rom] do
|
||||||
|
require 'digest'
|
||||||
|
require 'date'
|
||||||
|
|
||||||
|
sha256 = Digest::SHA256.file dest_rom
|
||||||
|
shafile = <<EOF
|
||||||
|
#{source_rom_sha256} #{source_rom}
|
||||||
|
#{sha256.hexdigest} #{dest_rom}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
dd_cmds = []
|
||||||
|
|
||||||
|
puts "Building distributable ZIP..."
|
||||||
|
obj_files = Rake::FileList.new('*.b')
|
||||||
|
obj_files.each do |t|
|
||||||
|
if t =~ /B(\h)_(\h{4})/
|
||||||
|
bnum = $1.to_i(16)
|
||||||
|
badd = $2.to_i(16)
|
||||||
|
addr = bnum * 16384 + badd - rom_base
|
||||||
|
dd_cmds << "dd if=#{t} of=#{dest_rom} bs=1 seek=#{addr} conv=notrunc"
|
||||||
|
sh "zip #{distzip} #{t}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Creating maker script..."
|
||||||
|
|
||||||
|
script = <<EOF
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
BDATE="#{DateTime.now.to_s}"
|
||||||
|
ROM_URL="#{rom_url}"
|
||||||
|
echo ${BDATE}
|
||||||
|
if [ -e `which curl` ]; then
|
||||||
|
curl -s "${ROM_URL}" > #{source_rom}
|
||||||
|
elif [ -e `which wget` ]; then
|
||||||
|
wget -O #{source_rom} "${ROM_URL}"
|
||||||
|
else
|
||||||
|
echo "Can't download source ROM image!"
|
||||||
|
fi
|
||||||
|
cp #{source_rom} #{dest_rom}
|
||||||
|
#{dd_cmds.join("\n")}
|
||||||
|
if [ -e `which shasum` ]; then
|
||||||
|
shasum -a 256 -c rom.sha256
|
||||||
|
elif [ -e "sha256sum" ]; then
|
||||||
|
sha256sum -c rom.sha256
|
||||||
|
else
|
||||||
|
echo "Please check the .bin files against rom.sha256"
|
||||||
|
fi
|
||||||
|
echo "#{dest_rom} created!"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
File.write('rom.sha256', shafile)
|
||||||
|
File.write('make_rom.sh', script)
|
||||||
|
|
||||||
|
sh "zip #{distzip} rom.sha256 make_rom.sh"
|
||||||
|
end
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
source_rom = "iic+_rom5.bin"
|
rom_url = 'https://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Computers/Apple%20II/Apple%20IIc%20plus/ROM%20Images/Apple%20IIc%20plus%20ROM%2005%20-%20342-0625-A%20-%201988.bin'
|
||||||
dest_rom = "iic+_rom5x.bin"
|
source_rom = 'iic+_rom5.bin'
|
||||||
|
source_rom_sha256 = '5a62070f6a0b07784681d4df4bf2ce88b2809bec0cbaa65fcb963e804ed60374'
|
||||||
|
dest_rom = 'iic+_rom5x.bin'
|
||||||
|
distzip = 'iic+_rom5x.zip'
|
||||||
rom_base = 0xc000
|
rom_base = 0xc000
|
||||||
|
|
||||||
source_files = Rake::FileList.new('*.s')
|
source_files = Rake::FileList.new('*.s')
|
||||||
@ -9,6 +12,10 @@ task :default => [:clean, :assemble, :build_rom] do
|
|||||||
sh "ls -l #{dest_rom}"
|
sh "ls -l #{dest_rom}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task :zip => [:clean, :assemble, :build_zip] do
|
||||||
|
sh "ls -l #{dest_rom}"
|
||||||
|
end
|
||||||
|
|
||||||
desc "Clean object files"
|
desc "Clean object files"
|
||||||
task :clean do
|
task :clean do
|
||||||
sh "rm -f #{dest_rom}"
|
sh "rm -f #{dest_rom}"
|
||||||
@ -18,6 +25,31 @@ task :clean do
|
|||||||
sh "rm -f *.b"
|
sh "rm -f *.b"
|
||||||
sh "rm -f accel5x"
|
sh "rm -f accel5x"
|
||||||
sh "rm -f POOF1 *.po"
|
sh "rm -f POOF1 *.po"
|
||||||
|
sh "rm -f rom.sha256"
|
||||||
|
sh "rm -f make_rom.sh"
|
||||||
|
sh "rm -f #{distzip}"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Obtain ROM'
|
||||||
|
rule source_rom do
|
||||||
|
require 'open-uri'
|
||||||
|
|
||||||
|
puts "Downloading ROM..."
|
||||||
|
|
||||||
|
File.open(source_rom, "wb") do |romfile|
|
||||||
|
open(rom_url) do |wwwfile|
|
||||||
|
romfile.write(wwwfile.read)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Verify ROM Checksum"
|
||||||
|
task :checksum_rom => source_rom do
|
||||||
|
require 'digest'
|
||||||
|
|
||||||
|
sha256 = Digest::SHA256.file source_rom
|
||||||
|
fail "ROM checksum failed" unless sha256.hexdigest == source_rom_sha256
|
||||||
|
puts "Source ROM appears correct!"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Assemble all source files"
|
desc "Assemble all source files"
|
||||||
@ -32,7 +64,7 @@ rule ".b" => ".o" do |t|
|
|||||||
end
|
end
|
||||||
|
|
||||||
desc "Build ROM"
|
desc "Build ROM"
|
||||||
task :build_rom => [:assemble] do
|
task :build_rom => [:assemble, :checksum_rom] do
|
||||||
puts "Building ROM image..."
|
puts "Building ROM image..."
|
||||||
obj_files = Rake::FileList.new('*.b')
|
obj_files = Rake::FileList.new('*.b')
|
||||||
rom = File.read(source_rom)
|
rom = File.read(source_rom)
|
||||||
@ -76,3 +108,61 @@ task :"accel5x.po" => [:accel5x] do
|
|||||||
sh "mv -f POOF1 accel5x.po"
|
sh "mv -f POOF1 accel5x.po"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Build disributable ZIP"
|
||||||
|
task :build_zip => [:build_rom] do
|
||||||
|
require 'digest'
|
||||||
|
require 'date'
|
||||||
|
|
||||||
|
sha256 = Digest::SHA256.file dest_rom
|
||||||
|
shafile = <<EOF
|
||||||
|
#{source_rom_sha256} #{source_rom}
|
||||||
|
#{sha256.hexdigest} #{dest_rom}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
dd_cmds = []
|
||||||
|
|
||||||
|
puts "Building distributable ZIP..."
|
||||||
|
obj_files = Rake::FileList.new('*.b')
|
||||||
|
obj_files.each do |t|
|
||||||
|
if t =~ /B(\h)_(\h{4})/
|
||||||
|
bnum = $1.to_i(16)
|
||||||
|
badd = $2.to_i(16)
|
||||||
|
addr = bnum * 16384 + badd - rom_base
|
||||||
|
dd_cmds << "dd if=#{t} of=#{dest_rom} bs=1 seek=#{addr} conv=notrunc"
|
||||||
|
sh "zip #{distzip} #{t}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Creating maker script..."
|
||||||
|
|
||||||
|
script = <<EOF
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
BDATE="#{DateTime.now.to_s}"
|
||||||
|
ROM_URL="#{rom_url}"
|
||||||
|
echo ${BDATE}
|
||||||
|
if [ -e `which curl` ]; then
|
||||||
|
curl -s "${ROM_URL}" > #{source_rom}
|
||||||
|
elif [ -e `which wget` ]; then
|
||||||
|
wget -O #{source_rom} "${ROM_URL}"
|
||||||
|
else
|
||||||
|
echo "Can't download source ROM image!"
|
||||||
|
fi
|
||||||
|
cp #{source_rom} #{dest_rom}
|
||||||
|
#{dd_cmds.join("\n")}
|
||||||
|
if [ -e `which shasum` ]; then
|
||||||
|
shasum -a 256 -c rom.sha256
|
||||||
|
elif [ -e "sha256sum" ]; then
|
||||||
|
sha256sum -c rom.sha256
|
||||||
|
else
|
||||||
|
echo "Please check the .bin files against rom.sha256"
|
||||||
|
fi
|
||||||
|
echo "#{dest_rom} created!"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
File.write('rom.sha256', shafile)
|
||||||
|
File.write('make_rom.sh', script)
|
||||||
|
|
||||||
|
sh "zip #{distzip} rom.sha256 make_rom.sh"
|
||||||
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user