//www.旧型、PSP開発幼稚園.game.jp/(本館) -111ページ目

RUKA日記2006-01/15

RUKA日記2006-01/15

今日は、NesterJ(PSP版)のソースDLしてあったの思い出して、
(そんな事は、すーっかり忘れてた)
ごそごそコンパイル始めたんだけど...

管理人C言語、解かります。もちろん判るったら、全部です。 (鳥語とは違う) でも、よくわかんない。(PSP用NESTERJのNES_APU.Cより) *((int16 *) buffer)++ = (int16) accum; って、どおいうことなんだ?管理人の感覚では、 *((int16 *) buffer++) = (int16) accum; だと思うんだけど、「絶対に同じ?」って聞かれると、 なんだか自信が、なくなってくる。うーん。 でも、この場合はどう解釈しても同じだよな。 buffer++なんだから。++bufferじゃあないからな。 っていうか、もし、元が *((int16 *) ++buffer) = (int16) accum; だとしたら ++(*((int16 *) buffer)) = (int16) accum; って記述もありなのか?(相当屁理屈です) ぜーーーーっ対にだめだと思うんだが。 (でも恐らく一番始めの記述がとうるコンパイラなら論理的にとおる筈) (あ、bufferはポインタ変数です。念のため。まあ判ったとは思うけど)
うう、またきた今度はpg.hまた全く同じだ。 for (; c>0; --c) *(((unsigned long *)d)++)=*(((unsigned long *)s)++); って、 for (; c>0; --c) *(((unsigned long *)d++))=*(((unsigned long *)s++)); でいいのかな? 判らん。同じだとしても、上のように書きたくなる心理が判らん。 ぜったーいにポインタ変数が分離してなきゃ、やだぁーいって、 だだっ子なのか?それとも++って磁石みたいだから、くっつきたくないねん。とか? 謎だ。それとも、こういう風に書かないと、 for (; c>0; --c) *(((unsigned long *)++d))=*(((unsigned long *)++s)); とかいう風に、(うち、頭硬いから++dとd++の区別つかへんねんって言って)自分勝手に 解釈してずれるコンパイラが存在するとか?(何時の時代のコンパイラやねん) それ、少なくともANSI準拠(緑本)してないよ。 白本(K&R第1版)の時代にはあったのか? 私は緑本(K&R第2版)の時代以降なら、なんとか情報収集したけど、 うちに白本(もちろん親の所有物です。生まれる遥か彼方前の本なんて買える訳ないってば) あるけど、あんなの流石に読む気がせん。(持ってる本人がハッタリ用だと認めたもん。 ほかの本はカバーの上に本屋のカバー(紙)が掛かってるのに、あの本だけ無い。 嫌でも目立つから、字も読めない小さい頃から、子供心に存在自体が不審だと、思ってたんだ。 そりゃそうだ、見えなきゃハッタリにならんもんね。だから、聖書の様に余計ぼろぼろなんす。) 判らん。全然判らん。過去にそんなコンパイラ存在したのか? で、そおいう流儀が現代に脈々と生き残っているのか?...判らん。
次のエラーは... はい、毎度おなじみアッセンブラちゃんです。(げっそし...) startup.s: Assembler messages: startup.s:21: Error: illegal operands `sw $s0,4($sp)' startup.s:22: Error: illegal operands `sw $s1,8($sp)' startup.s:24: Error: illegal operands `la $v0,_gp' startup.s:25: Error: illegal operands `move' startup.s:27: Error: illegal operands `move $s0,$a0' startup.s:28: Error: illegal operands `move $s1,$a1' startup.s:30: Error: illegal operands `la $a0,_main_thread_name' startup.s:31: Error: illegal operands `la $a1,xmain' startup.s:32: Error: illegal operands `li $a2,0x20' startup.s:33: Error: illegal operands `li $a3,0x40000' startup.s:34: Error: illegal operands `lui $t0,0x8000' startup.s:36: Error: illegal operands `move $t1,$0' startup.s:38: Error: illegal operands `move $a0,$v0' startup.s:39: Error: illegal operands `move $a1,$s0' startup.s:41: Error: illegal operands `move $a2,$s1' startup.s:44: Error: illegal operands `lw $s0,4($sp)' startup.s:45: Error: illegal operands `lw $s1,8($sp)' startup.s:46: Error: illegal operands `move $v0,$0' startup.s:96: Warning: setting incorrect section attributes for .rodata.entrytab le make: *** [startup.o] Error 1 (はいはい。エラー1ですね。ケッ小憎らしい) 仕方がない。ちまちま直すか。 今回はさすがにデーターシート取り寄せないと 意味わからんかもしれん。 (管理人R4000はまったく知らない) NECのVR辺りにするかな、めんどくさいなあ。と思いながら ソースを見た、なんだあ前と一緒じゃん。 (→エラーは単なる素人脅しのこけ騙しです) これなら適当でいい事にしよ。 (私はちまちま直したけど、他からコピーしてきても殆ど一緒) きっとRxxxxのデーターシートあれば一発なんだけど、 それ見るためにはPDFビュアー入れなきゃなんないし、 今日あたりわけ解らんゴミたまってきたんでHDDから追い出して CDに焼こうかなってくらいHDD切羽詰まってる。 やだ、変なソフト入れるのは絶対やだ。
とにかくHelloWorldとやってる事全く一緒です。 (ベクターレジスタ?) よくわかんないけど、$v0を$2 にする。 (アドレスレジスタ?) よくわかんないけど、$a0を$4 にする。 よくわかんないけど、$a1を$5 にする。 よくわかんないけど、$a2を$6 にする。 よくわかんないけど、$a3を$7 にする。 (?) よくわかんないけど、$t0を$8 にする。 よくわかんないけど、$t1を$9 にする。 (システムスタック?) よくわかんないけど、$s0を$16にする。 よくわかんないけど、$s1を$17にする。 とか想像しつつ適当に直す。 a0は4番とか決まっているから、一度 表にしといた方がいいかも。 .section .rodata.entrytable,"wa",@progbits __entrytable: を .section .xodata.entrytable,"wa",@progbits __entrytable: にする。でOKの筈。
そして、 省略 psp-ld: failed to merge target specific data of file unzip/unziplib.a(inflate.o) psp-ld: unzip/unziplib.a(inftrees.o): linking mips:4000 module with previous mip s:allegrex modules psp-ld: failed to merge target specific data of file unzip/unziplib.a(inftrees.o ) psp-ld: unzip/unziplib.a(ioapi.o): linking mips:4000 module with previous mips:a llegrex modules psp-ld: failed to merge target specific data of file unzip/unziplib.a(ioapi.o) psp-ld: unzip/unziplib.a(zutil.o): linking mips:4000 module with previous mips:a llegrex modules psp-ld: failed to merge target specific data of file unzip/unziplib.a(zutil.o) psp-ld: unzip/unziplib.a(adler32.o): linking mips:4000 module with previous mips :allegrex modules psp-ld: failed to merge target specific data of file unzip/unziplib.a(adler32.o) psp-ld: unzip/unziplib.a(inffast.o): linking mips:4000 module with previous mips :allegrex modules psp-ld: failed to merge target specific data of file unzip/unziplib.a(inffast.o) psp-ld: final link failed: Invalid operation make: *** [out] Error 1 あーん、せっかくunziplib.aのバイナリが標準で付いてるから、 「ラッキー今回は楽チン?」 とか、おもったのにぃ。 (大体ソース展開してちらっとこれ見つけたんで、コンパイルする気になった) ちなみに、このエラー達は、リンカが違うからリンカでこけてるんです。 判ると思いますが念のため。えーと、翻訳すると、 「えーん、マージ失敗でちゅー。わからんでちゅよ。えーん。えーん」 ってとこですかね。
とにかく、(UNZIPLIBの)Verも何も判らんじゃないか。 って事で、RUKA版の「unziplib.a」をバイナリエディタで覗いてみる。
えーと、コンパイルしたときの「GCCは3.2.2」を使ってます。 ふーん「PS2Dev」ってのが、あるんですか。 まずいですよ。もしかして某SXNY社の契約条項にひっかかる ...ってことはないか(多分)だってGCCだもんね。きっとGPL2。 あーーーあったあった、これは(UNZIPLIB)1.2.2ですね。 じゃあRINちゃんの奴。そのままつかっちゃお。
で、(注:リンカのオプションはHelloWorldと同じ、あの時も元がEE-GCCだったでしょ) $ make psp-ld -O0 nes/cpu/nes6502.o nes/cpu/nes_6502.o nes/ppu/nes_ppu.o nes/apu/fdssnd .o nes/apu/nes_apu.o nes/apu/nes_apu_wrapper.o nes/apu/nes_exsound.o nes/apu/nes _fme7.o nes/apu/nes_mmc5.o nes/apu/nes_n106.o nes/apu/nes_vrc6.o nes/apu/nes_vrc 7.o nes/nes.o nes/nes_config.o nes/nes_mapper.o nes/nes_rom.o nes/snss.o nes/fil eio.o nes/nes_crc32.o nes/libsnss/libsnss.o emu_main.o loadromimage.o soundmanag er.o screenmanager.o inputmanager.o startup.o main.o pg.o menu.o filer.o sound.o debug/debug.o string.o menu_submenu.o unzip/unziplib.a -M -Ttext 8900000 -q -o out > NesterJ.map unzip/unziplib.a(zlibInterface.o): In function `Unzip_execExtract': zlibInterface.c:(.text+0xd0): undefined reference to `strlen' unzip/unziplib.a(unzip.o): In function `unzStringFileNameCompare': unzip.c:(.text+0x84): undefined reference to `strcmp' unzip/unziplib.a(unzip.o): In function `unzReadCurrentFile': unzip.c:(.text+0x268): undefined reference to `crc32' unzip.c:(.text+0x2c8): undefined reference to `inflate' unzip.c:(.text+0x2f4): undefined reference to `crc32' unzip/unziplib.a(unzip.o): In function `unzCloseCurrentFile': unzip.c:(.text+0x620): undefined reference to `free' unzip.c:(.text+0x638): undefined reference to `free' unzip.c:(.text+0x660): undefined reference to `inflateEnd' unzip.c:(.text+0x66c): undefined reference to `free' unzip/unziplib.a(unzip.o): In function `unzClose': unzip.c:(.text+0x7f0): undefined reference to `free' unzip.c:(.text+0x80c): undefined reference to `free' unzip.c:(.text+0x828): undefined reference to `free' unzip.c:(.text+0x848): undefined reference to `inflateEnd' unzip/unziplib.a(unzip.o): In function `unzLocateFile': unzip.c:(.text+0x1548): undefined reference to `strlen' unzip.c:(.text+0x177c): undefined reference to `strcmp' unzip/unziplib.a(unzip.o): In function `unzOpenCurrentFile3': unzip.c:(.text+0x1834): undefined reference to `free' unzip.c:(.text+0x184c): undefined reference to `free' unzip.c:(.text+0x1888): undefined reference to `inflateEnd' unzip.c:(.text+0x19bc): undefined reference to `malloc' unzip.c:(.text+0x19cc): undefined reference to `malloc' unzip.c:(.text+0x1bcc): undefined reference to `free' unzip.c:(.text+0x1be4): undefined reference to `get_crc_table' unzip.c:(.text+0x1e28): undefined reference to `inflateInit2_' unzip/unziplib.a(unzip.o): In function `unzOpen2': unzip.c:(.text+0x21ac): undefined reference to `malloc' unzip.c:(.text+0x2278): undefined reference to `free' unzip.c:(.text+0x22b4): undefined reference to `malloc' unzip.c:(.text+0x23c8): undefined reference to `free' unzip.c:(.text+0x23e0): undefined reference to `free' unzip/unziplib.a(ioapi.o): In function `fopen_file_func': ioapi.c:(.text+0x34): undefined reference to `fopen' unzip/unziplib.a(ioapi.o): In function `fread_file_func': ioapi.c:(.text+0x80): undefined reference to `fileno' unzip/unziplib.a(ioapi.o): In function `fwrite_file_func': ioapi.c:(.text+0xc0): undefined reference to `fileno' unzip/unziplib.a(ioapi.o): In function `ftell_file_func': ioapi.c:(.text+0xf0): undefined reference to `fileno' unzip/unziplib.a(ioapi.o): In function `fseek_file_func': ioapi.c:(.text+0x14c): undefined reference to `fileno' ioapi.c:(.text+0x180): undefined reference to `fileno' unzip/unziplib.a(ioapi.o): In function `fclose_file_func': ioapi.c:(.text+0x1a4): undefined reference to `fclose' make: *** [out] Error 1 ながーーーーなが出てますけど、要するに、 「おめーのunziplib.aにはstrlenだのmallocだの関数ねぇんだよ」 ってエラーです。 コピーした段階でおかしいとおもったんだぁ。 だって、
RUKA版unziplib.a195Kb
RIN版unziplib.a20Kb
もお一度、半信半疑ながらRUKA版unziplib.aを覗くと、 ううーん、見えます。確かにあります。 _ _ _ mallocとか_ _ _ strcmpとか とにかく頭にアンダースコア3つついた、如何にも 私は人畜無害の標準関数ですねんって顔した、 バリバリアッセンブラの(予想)うそつき野郎どもが、 きみたち校則違反だよ!! きーっ!
■補足(2006-01/19) オフィシャルページの「unziplib_v1_00src.zip」が、 前記の「RUKA版unziplib.a」を作成するファイルみたいです。 (2006-01/15)には知らなかったんだよ。 そのうち、続きは実験します。