|
|
1.1 ! root 1: #!/usr/bin/env perl ! 2: ! 3: # ! 4: # nono ! 5: # Copyright (C) 2023 nono project ! 6: # Licensed under nono-license.txt ! 7: # ! 8: ! 9: # z80-asm の出力する .z80 形式を .COM に変換する。 ! 10: # (10バイトのヘッダを取り除くだけ) ! 11: # ! 12: # usage: z80tocom.pl <infile.z80> [<outfile.com>] ! 13: ! 14: { ! 15: $filename = $ARGV[0]; ! 16: $filesize = -s $filename; ! 17: ! 18: if (@ARGV > 1) { ! 19: $outfile = $ARGV[1]; ! 20: } else { ! 21: $outfile = $filename; ! 22: $outfile =~ s/(\.z80|)$/.com/; ! 23: } ! 24: ! 25: # ファイルを全部読み込む ! 26: open(IN, $filename) or die; ! 27: binmode(IN); ! 28: read(IN, $magic, 8); ! 29: read(IN, $dummylen, 2); ! 30: read(IN, $data, $filesize - 10); ! 31: close(IN); ! 32: ! 33: # マジック照合 ! 34: if ($magic != "Z80ASM\x1a\x0a") { ! 35: die("${filename} is not .z80 object format"); ! 36: } ! 37: ! 38: # 出力 ! 39: open(OUT, ">$outfile") or die; ! 40: binmode(OUT); ! 41: print OUT $data; ! 42: close(OUT); ! 43: ! 44: exit 0; ! 45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.