Skip to content

Commit

Permalink
create_d64 can now make optional dynmem files
Browse files Browse the repository at this point in the history
  • Loading branch information
johanberntsson committed Jun 13, 2018
1 parent a8ec7bc commit 62572fa
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ X64 := /usr/bin/x64 -cartcrt final_cartridge.crt -autostart-delay-random

#all: minizork
#all: zork1
all: dejavu
#all: dejavu
#all: dragon
#all: minform
all: minform
#all: czechz3
#all: czechz5
#all: strictz3
Expand Down Expand Up @@ -59,7 +59,8 @@ d64.strictz5:
$(C1541) -attach strictz5.d64 -write ozmoo ozmoo

d64.minform:
acme -DZ5=1 $(DEBUGFLAGS) $(VMFLAGS) --cpu 6510 --format cbm -l acme_labels.txt --outfile ozmoo ozmoo.asm
acme -DTRACE=1 -DZ5=1 $(DEBUGFLAGS) $(VMFLAGS) --cpu 6510 --format cbm -l acme_labels.txt --outfile ozmoo ozmoo.asm
#exomizer/src/exomizer sfx basic oz -o ozmoo
cp minform/minform.d64 minform.d64
$(C1541) -attach minform.d64 -write ozmoo ozmoo

Expand All @@ -74,7 +75,8 @@ d64.zork1:
$(C1541) -attach zork1.d64 -write ozmoo ozmoo

d64.dejavu:
acme -DZ3=1 $(DEBUGFLAGS) $(VMFLAGS) --cpu 6510 --format cbm -l acme_labels.txt --outfile ozmoo ozmoo.asm
acme -DZ3=1 $(DEBUGFLAGS) $(VMFLAGS) --cpu 6510 --format cbm -l acme_labels.txt --outfile oz ozmoo.asm
exomizer/src/exomizer sfx basic oz -o ozmoo
cp examples/dejavu.d64 dejavu.d64
$(C1541) -attach dejavu.d64 -write ozmoo ozmoo

Expand Down
2 changes: 1 addition & 1 deletion constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ datasette_buffer_end = $03fb
;basic_printinteger = $bdcd ; write integer value in a/x

; Trace information
z_trace_page = $cf00
z_trace_page = $2f00

; --- I/O registers ---
reg_screen_char_mode = $d018
Expand Down
42 changes: 37 additions & 5 deletions create_d64.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def add_story_data(story_file, d64_file)
story_data_added
end

def create_d64(story_filename, d64_filename)
def create_d64(story_filename, d64_filename, dynmem_filename)
begin
story_file = File.open(story_filename, "rb")
rescue
Expand All @@ -131,6 +131,16 @@ def create_d64(story_filename, d64_filename)
story_file.close
exit 0
end
if !dynmem_filename.nil? then
begin
dynmem_file = File.open(dynmem_filename, "wb")
rescue
puts "ERROR: Can't open #{dynmem_filename} for writing"
story_file.close
d64_file.close
exit 0
end
end

puts "Creating..."

Expand All @@ -150,7 +160,28 @@ def create_d64(story_filename, d64_filename)
puts
end

# now do it for real
# check header.high_mem_start (size of dynmem + statmem)
# minform: $1768 = 5992 (23, 104)
story_file.read(4) # skip version and flags1
high_mem_start = story_file.read(2).unpack("n")

# check header.static_mem_start (size of dynmem)
story_file.read(8) # skip until this entry
static_mem_start = story_file.read(2).unpack("n")[0]

# get dynmem size (in 1kb blocks)
dynmem_size = 1024 * ((static_mem_start + 512)/1024)

# save dynmem as separate file
story_file.rewind
dynmem = story_file.read(dynmem_size)
if !dynmem_filename.nil? then
dynmem_file.write(dynmem)
dynmem_file.close
end

# now save the sectors
story_file.rewind
for track in 1..35 do
for sector in 1.. get_track_length(track) do
if track == 18 && sector == 1 then
Expand All @@ -171,14 +202,15 @@ def create_d64(story_filename, d64_filename)

end

if ARGV.length != 2 then
puts "Usage: create_d64.rb <zmachine file> <d64 file>"
if ARGV.length < 2 then
puts "Usage: create_d64.rb <zmachine file> <d64 file> [<dynmem file>]"
exit 0
end
story_filename = ARGV[0]
d64_filename = ARGV[1]
dynmem_filename = ARGV[2] # nil if not given

create_d64(story_filename, d64_filename)
create_d64(story_filename, d64_filename, dynmem_filename)
puts "Done!"
exit 0

6 changes: 3 additions & 3 deletions minform/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
all:
inform -v5 minform.inf
cp ../d64toinf/inftod64.dat .
../d64toinf/inftod64 minform.z5 minform.d64
../ztools-master/txd -d -n minform.z5 > minform.zasm
../create_d64.rb minform.z5 minform.d64 minform.dynmem
clean:
rm -f minform.z5 inftod64.dat minform.d64
rm -f minform.z5 minform.d64

Binary file modified minform/minform.d64
Binary file not shown.
Binary file added minform/minform.dynmem
Binary file not shown.
Binary file modified minform/minform.z5
Binary file not shown.

0 comments on commit 62572fa

Please sign in to comment.