<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MZ-80 &#8211; EXPERTGIG</title>
	<atom:link href="https://expertgig.jp/tag/mz-80/feed/" rel="self" type="application/rss+xml" />
	<link>https://expertgig.jp</link>
	<description>工場IoT に特化したシステム開発</description>
	<lastBuildDate>Mon, 30 Mar 2026 08:43:52 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>MZ-80K/C で micro SDから mzt を読み込む基板の改善</title>
		<link>https://expertgig.jp/2026/03/29/mz-80k-c-%e3%81%a7-micro-sd%e3%81%8b%e3%82%89-mzt-%e3%82%92%e8%aa%ad%e3%81%bf%e8%be%bc%e3%82%80%e5%9f%ba%e6%9d%bf%e3%81%ae%e6%94%b9%e5%96%84/</link>
					<comments>https://expertgig.jp/2026/03/29/mz-80k-c-%e3%81%a7-micro-sd%e3%81%8b%e3%82%89-mzt-%e3%82%92%e8%aa%ad%e3%81%bf%e8%be%bc%e3%82%80%e5%9f%ba%e6%9d%bf%e3%81%ae%e6%94%b9%e5%96%84/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Sun, 29 Mar 2026 08:02:20 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[arduino pro]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[SD-CARD]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6241</guid>

					<description><![CDATA[MZ-80K向けに開発したプログラムを実機で試すには、それなりに手間がかかります。そんな悩みを持つ同志の手によって、micro-SDからmztファイルの読み込みを可能にするという夢のような基板を Git にて公開されてい [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>MZ-80K向けに開発したプログラムを実機で試すには、それなりに手間がかかります。そんな悩みを持つ同志の手によって、micro-SDからmztファイルの読み込みを可能にするという夢のような基板を Git にて公開されている。</p>



<p><a href="https://github.com/yanataka60/MZ80K_SD">GitHub &#8211; yanataka60/MZ80K_SD: MZ-80KシリーズでSD-CARDからのアプリケーション起動、BASICなどのアプリケーションからSD-CARDへのロード、セーブを実現するものです · GitHub</a></p>



<p></p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="768" height="1024" data-id="6245" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/15026-768x1024.jpg" alt="" class="wp-image-6245" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/15026-768x1024.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15026-225x300.jpg 225w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15026-1152x1536.jpg 1152w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15026-1536x2048.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15026-scaled.jpg 1920w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</figure>



<p>これに基づいて、製作された基板を手に入れて、MZ-80Kで試したのだが、FDLコマンドによる ファイルリストの表示が途中でとまってしまったり、FDでファイル名指定で読み込み開始までこぎつけても途中で通信エラーになってしまったりで、一度も成功しませんでした。</p>



<p>一方、同志によるMZ-700向けやPC-8001向けの基板はすんなり動いていますので、この基板固有の何か問題があるんだろうなと思って、Arduino pro や micro-SD ユニットなどを疑って、交換してみたものの、逆に症状が悪化したりしていました。</p>



<p>しまいには、Arduino pro の プログラムソースを書き換えて、通信速度を落としたりもしたのですが、ダメでした。</p>



<p>そこで、こうなったらできることはすべてやってみるかということで、ロジックIC  74LS30と 74LS04 について、調べたところ、74HCT シリーズのほうが出力波形が綺麗であるという情報があったので、74LS30, 74LS04 の代わりに 74HCT30, 74HCT04 を購入して、差し替えたら、なんと一発でエラー解消。</p>



<p>MZ-80K2、MZ-80C、MZ-80K2E を所有していまして、どれも同じ症状でしたらので、MZの個体の問題ではないと思いますので、MZ-80K/Cシリーズでは、ノイズの話や通信制御の能力という点で結構きわどいのか? その辺はよくわかりません。</p>



<p class="has-medium-font-size">もし同様の悩みを持っている、またはこれから基板作成に挑戦するという方はぜひ <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-cyan-blue-color"><strong>74HCT シリーズ</strong></mark>をご検討ください。</p>



<p>ちなみに、ノイズも疑って、ノイズ除去のデカップリング用途を狙って、いくつかコンデンサも同時に購入しましたが、今回は不要のようでした。</p>



<p></p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="768" data-id="6246" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/IMG_20260329_154350-1024x768.jpg" alt="" class="wp-image-6246" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/IMG_20260329_154350-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/IMG_20260329_154350-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/IMG_20260329_154350-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/IMG_20260329_154350-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/IMG_20260329_154350-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="768" data-id="6242" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/15023-1024x768.jpg" alt="" class="wp-image-6242" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/15023-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15023-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15023-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15023-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15023-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="768" data-id="6243" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/15024-1024x768.jpg" alt="" class="wp-image-6243" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/15024-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15024-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15024-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15024-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15024-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="768" data-id="6244" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/15025-1024x768.jpg" alt="" class="wp-image-6244" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/15025-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15025-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15025-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15025-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/15025-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</figure>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2026/03/29/mz-80k-c-%e3%81%a7-micro-sd%e3%81%8b%e3%82%89-mzt-%e3%82%92%e8%aa%ad%e3%81%bf%e8%be%bc%e3%82%80%e5%9f%ba%e6%9d%bf%e3%81%ae%e6%94%b9%e5%96%84/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MZ-80K/C の モニタ ROMを換装する (2332 → 2732)、CG-ROM　も一緒に換装 (2316 → 2732 )</title>
		<link>https://expertgig.jp/2026/03/05/mz-80k-c-%e3%81%ae-%e3%83%a2%e3%83%8b%e3%82%bf-rom%e3%82%92%e6%8f%9b%e8%a3%85%e3%81%99%e3%82%8b-2332-%e2%86%92-2732/</link>
					<comments>https://expertgig.jp/2026/03/05/mz-80k-c-%e3%81%ae-%e3%83%a2%e3%83%8b%e3%82%bf-rom%e3%82%92%e6%8f%9b%e8%a3%85%e3%81%99%e3%82%8b-2332-%e2%86%92-2732/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Thu, 05 Mar 2026 05:55:18 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[技術全般]]></category>
		<category><![CDATA[2316]]></category>
		<category><![CDATA[2332]]></category>
		<category><![CDATA[2732]]></category>
		<category><![CDATA[CG-ROM]]></category>
		<category><![CDATA[EPROM]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[ROM換装]]></category>
		<category><![CDATA[SP-1002]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6186</guid>

					<description><![CDATA[MZ-80のモニタ プログラム (IPL) と言えば、 SP-1002 ですが、これを少し改造する必要がでてきました。とりあえず、うまくいきましたので情報をシェアしておきます。 ついでといってはなんですが、 CG-ROM [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>MZ-80のモニタ プログラム (IPL) と言えば、 SP-1002 ですが、これを少し改造する必要がでてきました。<br>とりあえず、うまくいきましたので情報をシェアしておきます。 </p>



<p>ついでといってはなんですが、 CG-ROMの 2316 → 2732 の回路図も後半に掲載します。<br><br>最初は、 EPROMに書き込んで、差し替えればいいのかなと思っていたのですが、ピン配列の差異があるため、そのままというわけには行きませんでした。PROMの2332 を EPROM 2732 に換装するという事例は、海外のCommodore PET-2001や C64 をターゲットにした記事がいくつかあるのみ。日本でも紹介されている記事はあるものの具体的な配線については言及されていませんでした。</p>



<p>仕方ないので、まずはそれぞれのデータシートのピン配列を確認して、結線について考えました。</p>



<p>2332と 2732 は、その「32」が示す通り、 32KBit すなわち 4KByte のROMですので、容量は一緒。そしてピン配列もおおよそ一緒。違うのは 3ヵ所のみ。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="683" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/image-1024x683.png" alt="" class="wp-image-6187" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/image-1024x683.png 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/image-300x200.png 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/image-768x512.png 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/image.png 1484w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>2332 の /CE1 と M2732Aの E̅ は、両方とも Low で ROM が有効 (Active Row) という意味なりますので、これを結線。<br>M2732Aの ピン20 ( G̅Vpp) は、2332 の ピン12 (GND) に繋ぎます。<br>それと、それぞれの A11を結線。<br><br>ということで簡単なのですが、ユニバーサル基板にコンパクトに作成することを考えると、少し工夫が必要でした。<br>実は、基板作成には 2回失敗して、3回目にうまく行きました。しっかりとMZ-80K/C側のICソケットに刺さることが必要です。不安定になってしまいます。</p>



<h2 class="wp-block-heading">うまくいった作成方法</h2>



<p>最初に失敗だったのは、手持ちの角ピンのピンヘッドを使ったこと。これが結構 ICソケットに対しては刺さりが悪いです。Arduino や ESP32などの Break out 作成やジャンパ用には良かったのですが、適材適所ということで。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="768" height="1024" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14820-768x1024.jpg" alt="" class="wp-image-6191" style="aspect-ratio:0.7500123098133832;width:211px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14820-768x1024.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14820-225x300.jpg 225w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14820-1152x1536.jpg 1152w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14820-1536x2048.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14820-scaled.jpg 1920w" sizes="(max-width: 768px) 100vw, 768px" /></figure>



<p>秋月で、両端がピンのものと、片側が丸穴ソケットになっているものを購入。<br></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="768" height="1024" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14819-768x1024.jpg" alt="" class="wp-image-6192" style="width:285px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14819-768x1024.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14819-225x300.jpg 225w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14819-1152x1536.jpg 1152w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14819-1536x2048.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14819-scaled.jpg 1920w" sizes="(max-width: 768px) 100vw, 768px" /></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="768" height="1024" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14818-768x1024.jpg" alt="" class="wp-image-6193" style="aspect-ratio:0.7500109318291136;width:282px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14818-768x1024.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14818-225x300.jpg 225w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14818-1152x1536.jpg 1152w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14818-1536x2048.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14818-scaled.jpg 1920w" sizes="(max-width: 768px) 100vw, 768px" /></figure>



<p>ユニバーサル基板の端っこに、写真のようにハンダ付け。ピン位置が同じ部分は「渡しハンダ」(言い方が古い? ) 、今風に言えば ハンダ ブリッジ (solder brigde) かな? <br>作成手順</p>



<p>① 基板をランド側 (ハンダ付けする側) を上にしてテーブル上に置いて、片側丸穴ソケットのピンを刺します。つまり、ピンの脚が浮いた状態で、基板の逆側に飛び出さない形にしてハンダ付け。垂直になるように一カ所だけハンダ付けして、垂直を調整して固定します。そのあと残りのピンをすべてハンダ付け。これを2つ分。 ( 2732を刺しますのでピッチに注意 )</p>



<p>② 両端がピンになっているものをハンダ付け。ピンをブレッドボードに差して、そこに基板を乗せてハンダ付けするとかなり垂直になります。ブレッドボードがあれば是非そうしてください。</p>



<p>③ 同一ピンは、渡しハンダで導通させます。テスターで1つずつ確認しましょう。</p>



<p>④ 18,20,21ピンを写真のように配線。</p>



<p>とりあえず以上でハンダ付け完了です。</p>



<h2 class="wp-block-heading">そのままトライしてみる</h2>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="768" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14813-1024x768.jpg" alt="" class="wp-image-6194" style="width:375px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14813-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14813-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14813-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14813-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14813-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>基板が大きいままなので、コンデンサに当たってしまうため、2段下駄を履かせて高さ調整。</p>



<p>そして MZ-80K2の電源をON!</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="768" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14814-1024x768.jpg" alt="" class="wp-image-6195" style="width:369px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14814-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14814-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14814-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14814-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14814-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>モニターのプログラムを改造したことがわかるように、SP-1002A (Aの文字を追加) としましたので、配線がうまく行ったことが確認できました。</p>



<h2 class="wp-block-heading">基板を加工する</h2>



<p>作成した基板のままでは大きすぎるので、コンターマシン (エンドレスのバンドソー) でおおよその大きさに切り出し。<br>写真では2つありますが、これは 2316 → 2732 (キャラグラROMの換装 ) 基板も同時に作ったためです。こちらはまた配線が少し違いますので、別途紹介いたします。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="768" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14823-1024x768.jpg" alt="" class="wp-image-6196" style="width:337px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14823-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14823-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14823-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14823-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14823-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>次にグラインダーで細かく、できるだけ小さくなるように加工。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="768" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14824-1024x768.jpg" alt="" class="wp-image-6197" style="width:289px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14824-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14824-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14824-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14824-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14824-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14825-1024x576.jpg" alt="" class="wp-image-6198" style="width:396px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14825-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14825-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14825-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14825-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14825-800x450.jpg 800w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14825.jpg 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14826-1024x576.jpg" alt="" class="wp-image-6199" style="width:388px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14826-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14826-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14826-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14826-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14826-800x450.jpg 800w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14826.jpg 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>出来上がり。</p>



<h2 class="wp-block-heading">実装</h2>



<p>写真の下側が モニタROMを換装したもので、上部は CG-ROM を換装したものです。モニタROM が4KBなのに対して、CG-ROMは2KBですので、配線は少し違います。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="768" height="1024" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14830-768x1024.jpg" alt="" class="wp-image-6200" style="width:412px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14830-768x1024.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14830-225x300.jpg 225w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14830-1152x1536.jpg 1152w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14830-1536x2048.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14830-scaled.jpg 1920w" sizes="(max-width: 768px) 100vw, 768px" /></figure>



<h2 class="wp-block-heading">起動そして確認</h2>



<p>今回は、MZ-80K/C で SDカードから mztファイルを読み込む基板を手に入れたので、それを利用するため モニタROMの改造をしました。また CG-ROMについては、MZ-80Aという海外版に実装されたキャラクター ROM の内容に差し替えてみたかったからです。海外向けは「カタカナ」が不要ですので、そこに結構面白い記号や図形が登録されています。PCGがなくても面白いキャラグラができそうな感じです。</p>



<p>二つの ROMを換装して電源を入れて、キー入力で表示できるものを表示してみまたした。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="768" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14832-1024x768.jpg" alt="" class="wp-image-6202" style="width:517px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14832-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14832-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14832-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14832-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14832-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>あとで、256個のキャラをすべて表示するプログラムを作成して公開いたします。</p>



<h2 class="wp-block-heading">CG-ROM (2316 → 2732) の換装</h2>



<p>CG-ROMは、 8×8ドットのキャラ文字 256種ということで、2046byte (2KB) のPROM 2316 となっています。これを EPROM 2732に換装するということで、前半2KBだけ利用します。ということで A11はGNDに固定。</p>



<p>切り替えスイッチを付けて 日本版と輸出版のCG-ROMデータを切り替えなんてこともできると思いますが、とりあえずは換装するだけの回路図となります。こちらはとてもシンプルです。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="589" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/image-1-1024x589.png" alt="" class="wp-image-6206" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/image-1-1024x589.png 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/image-1-300x172.png 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/image-1-768x441.png 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/image-1.png 1472w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">道具は重要</h2>



<p>最初の2回の失敗は、基板の設計や部品に問題がありましたが、そのほかも重要でした。</p>



<p>ちょっと良いハンダこて、フラックス、ハンダ吸い取り線、テスター</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="768" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14815-1024x768.jpg" alt="" class="wp-image-6203" style="width:355px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14815-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14815-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14815-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14815-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14815-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">失敗の巻 (第一回トライ)</h2>



<p>初回、2回目は、基板の設計の問題、ハンダ付け、ピンの刺さり具合など問題だらけでした。反省の念を込めて写真をアップ。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="768" height="1024" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14538-768x1024.jpg" alt="" class="wp-image-6188" style="aspect-ratio:0.7500116490377895;width:288px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14538-768x1024.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14538-225x300.jpg 225w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14538-1152x1536.jpg 1152w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14538-1536x2048.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14538-scaled.jpg 1920w" sizes="(max-width: 768px) 100vw, 768px" /></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="768" height="1024" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14539-768x1024.jpg" alt="" class="wp-image-6189" style="aspect-ratio:0.7500157937961969;width:234px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14539-768x1024.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14539-225x300.jpg 225w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14539-1152x1536.jpg 1152w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14539-1536x2048.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14539-scaled.jpg 1920w" sizes="(max-width: 768px) 100vw, 768px" /></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="768" src="https://expertgig.jp/wp/wp-content/uploads/2026/03/14540-1024x768.jpg" alt="" class="wp-image-6190" style="width:281px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/03/14540-1024x768.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14540-300x225.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14540-768x576.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14540-1536x1152.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2026/03/14540-2048x1536.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2026/03/05/mz-80k-c-%e3%81%ae-%e3%83%a2%e3%83%8b%e3%82%bf-rom%e3%82%92%e6%8f%9b%e8%a3%85%e3%81%99%e3%82%8b-2332-%e2%86%92-2732/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>今年は細々とMZ80Kのマシン語を組む</title>
		<link>https://expertgig.jp/2026/01/30/%e4%bb%8a%e5%b9%b4%e3%81%af%e7%b4%b0%e3%80%85%e3%81%a8mz80k%e3%81%ae%e3%83%9e%e3%82%b7%e3%83%b3%e8%aa%9e%e3%82%92%e7%b5%84%e3%82%80/</link>
					<comments>https://expertgig.jp/2026/01/30/%e4%bb%8a%e5%b9%b4%e3%81%af%e7%b4%b0%e3%80%85%e3%81%a8mz80k%e3%81%ae%e3%83%9e%e3%82%b7%e3%83%b3%e8%aa%9e%e3%82%92%e7%b5%84%e3%82%80/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Fri, 30 Jan 2026 12:45:46 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[Z80]]></category>
		<category><![CDATA[エミュレータ]]></category>
		<category><![CDATA[マシン語]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6118</guid>

					<description><![CDATA[去年(2025) はPC-8001向けに、マシン語のゲームを2つ作成したので、今年(2026) は来年の干支 「羊」をテーマにしたゲームをMZ-80Kのマシン語で開発することにする。同じZ80なのでPC-8001向けにプ [&#8230;]]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="6118" class="elementor elementor-6118" data-elementor-post-type="post">
						<section class="elementor-section elementor-top-section elementor-element elementor-element-b7754f7 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="b7754f7" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2734d9b" data-id="2734d9b" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-3ffaf46 elementor-widget elementor-widget-text-editor" data-id="3ffaf46" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>去年(2025) はPC-8001向けに、マシン語のゲームを2つ作成したので、今年(2026) は来年の干支 「羊」をテーマにしたゲームをMZ-80Kのマシン語で開発することにする。同じZ80なのでPC-8001向けにプログラミングするのとそんなに違いはありませんが、私の一番思い入れの強いMZ-80K2向けにオールマシン語でゲームを開発するというのは大変意味のある事なんです(笑)。</p>
<p>とはいえ、実機を使って当時のアセンブラで開発するというは、現代ではなかなかの苦行ですので、例によってクロス開発環境を整える。</p>
<p>Z80のアセンブリコードは秀丸を利用。<br />アセンブラは AILZ80ASM を利用。<br />.mztファイルの生成には DumpListEditor Ver 0.80を利用。</p>
<p>こんな構成で行きます。<br />PC8001のときから少し時間がたってしまったので、手順をおさらいします。</p>
<p>テストコードとして、「VRAMをクリアして、VRAMの先頭からディスプレイコードすべてを書き込む」というプログラムを作成します。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-8aa20da elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="8aa20da" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9def595" data-id="9def595" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-7b0831b elementor-widget elementor-widget-heading" data-id="7b0831b" data-element_type="widget" data-e-type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-default">1. 秀丸でアセンブリコードを記述して保存</h2>				</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-9b183a7 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="9b183a7" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e742c15" data-id="e742c15" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap">
							</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-d8863a6 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="d8863a6" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ab333d3" data-id="ab333d3" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-0221cb6 elementor-widget elementor-widget-code-highlight" data-id="0221cb6" data-element_type="widget" data-e-type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-less line-numbers">
				<code readonly="true" class="language-less">
					<xmp>;============================================================
; MZ-80K Display Code Table Viewer
;============================================================

            ORG     1200h

;----------------------------
; MZ-80K 定義
;----------------------------
VRAM        EQU     0D000h	; テキストVRAM先頭
COLS        EQU     40		; 画面の横文字数
ROWS        EQU     25		; 画面の縦文字数
VRAM_SIZE   EQU     COLS*ROWS	; 1000 bytes
SPC         EQU     00h		; スペース

;============================================================
START:
;----------------------------
; 1) VRAMクリア（SPC=$00）
;----------------------------
	LD	HL, VRAM
	LD	(HL), SPC
	LD	DE, VRAM+1
	LD	BC, VRAM_SIZE-1
	LDIR

;----------------------------
; 2) 表示コードを 00h→FFh 順に書く
;----------------------------
	LD	HL, VRAM
	LD	A, 00h

DISP_LOOP:
	LD	(HL), A		; VRAMに文字を書きこむ
	INC	HL		;
	INC	A		; 00→01→…→FF→00…

	CP	FFh
	JR	NZ, DISP_LOOP

;----------------------------
; 3) CPU停止
;----------------------------
STOP_CPU:
	HALT

END
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-51db709 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="51db709" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-754ae2c" data-id="754ae2c" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-8a5ff8e elementor-widget elementor-widget-text-editor" data-id="8a5ff8e" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>保存するファイル名を VRAMTEST.z80 として保存します。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-b969496 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="b969496" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b041249" data-id="b041249" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-9de71e2 elementor-widget elementor-widget-heading" data-id="9de71e2" data-element_type="widget" data-e-type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-default">2. アセンブラでバイナリファイルを生成</h2>				</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-514a902 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="514a902" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3edb7f9" data-id="3edb7f9" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-78561bd elementor-widget elementor-widget-text-editor" data-id="78561bd" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>AILZ80ASMはコマンドラインで利用するアセンブラですので、次のような batファイルを作成すると便利だろう。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-36dc421 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="36dc421" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5006cc2" data-id="5006cc2" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-da1badc elementor-widget elementor-widget-code-highlight" data-id="da1badc" data-element_type="widget" data-e-type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-bash line-numbers">
				<code readonly="true" class="language-bash">
					<xmp>cd C:\work\2025\05_PERSONAL\Emulator\MZ80マシン語テスト
ailz80asm VRAMTEST.z80 -bin -lst -sym -f
pause
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-1372c60 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="1372c60" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7b98f83" data-id="7b98f83" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-7101b05 elementor-widget elementor-widget-text-editor" data-id="7101b05" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>バッチファイルを実行すると次のようなファイルが生成される。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-4a140fa elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="4a140fa" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-d79166a" data-id="d79166a" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-221e551 elementor-widget elementor-widget-image" data-id="221e551" data-element_type="widget" data-e-type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img loading="lazy" decoding="async" width="211" height="148" src="https://expertgig.jp/wp/wp-content/uploads/2026/01/d432fa515bd7e8287f17d9ec63d019b9.jpg" class="attachment-large size-large wp-image-6123" alt="" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-94ef25a elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="94ef25a" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f72296f" data-id="f72296f" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-bf9f0d2 elementor-widget elementor-widget-text-editor" data-id="bf9f0d2" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>*.sym はシンボリックファイルで、アセンブリソース記述した「EQU」で設定した値と「ラベル」の位置のアドレスが一覧になっている。EQUは、他の言語で言えば const である。これを頼りにしてソースコードとにらめっこしてデバッグしていくのである。</p>
<p>*.lst は、アドレス、クロック数、アセンブルした16進数のコード、アセンブリソースを一体化したもので、プログラムの解析に利用する。</p>
<p>*.bin はアセンブリソースをマシン語に変換したバイナリプログラムでこれが実行プログラムになる。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-9564ebe elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="9564ebe" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-04fef43" data-id="04fef43" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-39bbd5f elementor-widget elementor-widget-heading" data-id="39bbd5f" data-element_type="widget" data-e-type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-default">3. DumpListEditor で mztファイルを生成する</h2>				</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-2a68c05 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="2a68c05" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-769dd4f" data-id="769dd4f" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-ade9856 elementor-widget elementor-widget-text-editor" data-id="ade9856" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>binファイルができたので、これをエミュレータで読み込める形式にするため、このツールを使う。</p>
<p>最初に「MZ-80K」モードにする。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-8109d20 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="8109d20" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b4640b0" data-id="b4640b0" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-93b5e0b elementor-widget elementor-widget-image" data-id="93b5e0b" data-element_type="widget" data-e-type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img loading="lazy" decoding="async" width="424" height="223" src="https://expertgig.jp/wp/wp-content/uploads/2026/01/2b5c935017301a56d7ea9d97d8579833.jpg" class="attachment-large size-large wp-image-6124" alt="" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/01/2b5c935017301a56d7ea9d97d8579833.jpg 424w, https://expertgig.jp/wp/wp-content/uploads/2026/01/2b5c935017301a56d7ea9d97d8579833-300x158.jpg 300w" sizes="(max-width: 424px) 100vw, 424px" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-1f58dde elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="1f58dde" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-d4db180" data-id="d4db180" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-9881185 elementor-widget elementor-widget-text-editor" data-id="9881185" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>次に 「ファイル読み込み」メニューから「BINファイル読み込み&amp;ダンプリスト表示」で作ほど作成した「VRAMTEST.bin」を読み込む。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-f4fecfb elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="f4fecfb" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7af4204" data-id="7af4204" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-476408b elementor-widget elementor-widget-image" data-id="476408b" data-element_type="widget" data-e-type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img loading="lazy" decoding="async" width="870" height="343" src="https://expertgig.jp/wp/wp-content/uploads/2026/01/418c80b53d7d74248d924ba2c1823cee.jpg" class="attachment-large size-large wp-image-6125" alt="" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/01/418c80b53d7d74248d924ba2c1823cee.jpg 870w, https://expertgig.jp/wp/wp-content/uploads/2026/01/418c80b53d7d74248d924ba2c1823cee-300x118.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/01/418c80b53d7d74248d924ba2c1823cee-768x303.jpg 768w" sizes="(max-width: 870px) 100vw, 870px" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-ed6bf47 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="ed6bf47" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-360432e" data-id="360432e" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-31a2c54 elementor-widget elementor-widget-text-editor" data-id="31a2c54" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>先頭の行に「$1200」と入力して、「アドレス補正」ボタンを押すと次のように水色にハイライトされる。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-3038de8 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="3038de8" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f2a0c54" data-id="f2a0c54" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-e51d061 elementor-widget elementor-widget-image" data-id="e51d061" data-element_type="widget" data-e-type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img loading="lazy" decoding="async" width="834" height="413" src="https://expertgig.jp/wp/wp-content/uploads/2026/01/804784694ad54d387a75d33f157c5d76.jpg" class="attachment-large size-large wp-image-6126" alt="" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/01/804784694ad54d387a75d33f157c5d76.jpg 834w, https://expertgig.jp/wp/wp-content/uploads/2026/01/804784694ad54d387a75d33f157c5d76-300x149.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/01/804784694ad54d387a75d33f157c5d76-768x380.jpg 768w" sizes="(max-width: 834px) 100vw, 834px" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-5930c2a elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="5930c2a" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-63e6f89" data-id="63e6f89" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-ff6925f elementor-widget elementor-widget-text-editor" data-id="ff6925f" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>そして「形式変換」ボタンを押せばバイナリファイルの先頭アドレスが「1200」からとなる。</p>
<p>右側のファイル名を確認して、必要であれば変更する。実行アドレスは先頭アドレスと同じであれば 1200とする。</p>
<p>「ファイル整理画面にPaste」ボタンを押すと「ファイル整理」タグに移動し、binファイルが生成される。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-609df14 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="609df14" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-07c0a55" data-id="07c0a55" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-98e8094 elementor-widget elementor-widget-image" data-id="98e8094" data-element_type="widget" data-e-type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img loading="lazy" decoding="async" width="566" height="307" src="https://expertgig.jp/wp/wp-content/uploads/2026/01/becc0f2f7610b9f2ce6171bd5ded2453.jpg" class="attachment-large size-large wp-image-6127" alt="" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/01/becc0f2f7610b9f2ce6171bd5ded2453.jpg 566w, https://expertgig.jp/wp/wp-content/uploads/2026/01/becc0f2f7610b9f2ce6171bd5ded2453-300x163.jpg 300w" sizes="(max-width: 566px) 100vw, 566px" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-8bcb05b elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="8bcb05b" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-179ddd2" data-id="179ddd2" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-396a505 elementor-widget elementor-widget-text-editor" data-id="396a505" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>これで、「mzt書出し」ボタンを押して、保存すれば mztファイルの出来上がり。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-4b5d406 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="4b5d406" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3946583" data-id="3946583" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-037c950 elementor-widget elementor-widget-image" data-id="037c950" data-element_type="widget" data-e-type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img loading="lazy" decoding="async" width="646" height="163" src="https://expertgig.jp/wp/wp-content/uploads/2026/01/987e362b24a78f2af719a296c3f96c94.jpg" class="attachment-large size-large wp-image-6128" alt="" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/01/987e362b24a78f2af719a296c3f96c94.jpg 646w, https://expertgig.jp/wp/wp-content/uploads/2026/01/987e362b24a78f2af719a296c3f96c94-300x76.jpg 300w" sizes="(max-width: 646px) 100vw, 646px" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-6170b3f elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="6170b3f" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-cca4ce4" data-id="cca4ce4" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-2add1d4 elementor-widget elementor-widget-heading" data-id="2add1d4" data-element_type="widget" data-e-type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-default">4. MZ-80Kのエミュレータで実行させる</h2>				</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-f5df6b5 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="f5df6b5" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2f0677b" data-id="2f0677b" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-37803c3 elementor-widget elementor-widget-text-editor" data-id="37803c3" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>Emulator を起動して、生成した VRAMTEST.mzt を選択して、「LOAD」+ CR (Enter) でプログラムがロードされます。mzt ファイルにはプログラムの読み込みアドレス、実行アドレスが書き込まれているので、読み込むが完了すると自動的に実行されます。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-0ec9bb9 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="0ec9bb9" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-44f9ae6" data-id="44f9ae6" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-dc900c2 elementor-widget elementor-widget-image" data-id="dc900c2" data-element_type="widget" data-e-type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img loading="lazy" decoding="async" width="1024" height="717" src="https://expertgig.jp/wp/wp-content/uploads/2026/01/57cb2d8bad3c0566ad951fbbad01f1bc-1024x717.jpg" class="attachment-large size-large wp-image-6129" alt="" srcset="https://expertgig.jp/wp/wp-content/uploads/2026/01/57cb2d8bad3c0566ad951fbbad01f1bc-1024x717.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2026/01/57cb2d8bad3c0566ad951fbbad01f1bc-300x210.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2026/01/57cb2d8bad3c0566ad951fbbad01f1bc-768x538.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2026/01/57cb2d8bad3c0566ad951fbbad01f1bc.jpg 1440w" sizes="(max-width: 1024px) 100vw, 1024px" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-15e3ec1 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="15e3ec1" data-element_type="section" data-e-type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-657cb63" data-id="657cb63" data-element_type="column" data-e-type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-6a95f89 elementor-widget elementor-widget-text-editor" data-id="6a95f89" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>おー、パチパチパチ。<br />めでたく実行されました。MZ-80Kに設定されているキャラクタはちょっと楽しい感じですね。グラフィクスを描画できないので、ゲームをつくるときは、この文字を組み合わせて、それっぽい感じにすることになります。センスが問われるのがおもしろいところ。</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				</div>
		]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2026/01/30/%e4%bb%8a%e5%b9%b4%e3%81%af%e7%b4%b0%e3%80%85%e3%81%a8mz80k%e3%81%ae%e3%83%9e%e3%82%b7%e3%83%b3%e8%aa%9e%e3%82%92%e7%b5%84%e3%82%80/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MZ-80K2 取扱説明書を書庫から発掘</title>
		<link>https://expertgig.jp/2025/08/02/mz-80k2-%e5%8f%96%e6%89%b1%e8%aa%ac%e6%98%8e%e6%9b%b8%e3%82%92%e6%9b%b8%e5%ba%ab%e3%81%8b%e3%82%89%e7%99%ba%e6%8e%98/</link>
					<comments>https://expertgig.jp/2025/08/02/mz-80k2-%e5%8f%96%e6%89%b1%e8%aa%ac%e6%98%8e%e6%9b%b8%e3%82%92%e6%9b%b8%e5%ba%ab%e3%81%8b%e3%82%89%e7%99%ba%e6%8e%98/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 06:43:52 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[MZ-80]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6105</guid>

					<description><![CDATA[今日、休みだったので会社で、レトロPC本の I/O を整理していたら、MZ-80K2 の取扱説明書をきれいな状態で発掘。 ずっと行方不明だったのですが、 重ねてあった古い I/O の間にありました。よかったよかった。 何 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>今日、休みだったので会社で、レトロPC本の I/O を整理していたら、MZ-80K2 の取扱説明書をきれいな状態で発掘。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="768" height="1024" src="https://expertgig.jp/wp/wp-content/uploads/2025/08/IMG_20250802_152950-768x1024.jpg" alt="" class="wp-image-6106" style="width:437px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/08/IMG_20250802_152950-768x1024.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/08/IMG_20250802_152950-225x300.jpg 225w, https://expertgig.jp/wp/wp-content/uploads/2025/08/IMG_20250802_152950-1152x1536.jpg 1152w, https://expertgig.jp/wp/wp-content/uploads/2025/08/IMG_20250802_152950-1536x2048.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/08/IMG_20250802_152950-scaled.jpg 1920w" sizes="(max-width: 768px) 100vw, 768px" /></figure>



<p>ずっと行方不明だったのですが、 重ねてあった古い I/O の間にありました。よかったよかった。</p>



<p>何年か前に、MZ-80K2のエミュレータを作り出したつきに色々と資料を漁っていたのですが、</p>



<p>これが見つからなくて、Web上で公開されていたぼやけたの文字を読んでました。</p>



<p>とりあえず、さっそくデータ化ということで、PDFにしてみました。<br></p>



<div data-wp-interactive="core/file" class="wp-block-file"><object data-wp-bind--hidden="!state.hasPdfPreview" hidden class="wp-block-file__embed" data="https://expertgig.jp/wp/wp-content/uploads/2025/08/adae004b035a13943b957803666a3484.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="MZ80K2_取扱説明書の埋め込み。"></object><a id="wp-block-file--media-ca791404-005e-4e2e-b041-7a82b6cf46f6" href="https://expertgig.jp/wp/wp-content/uploads/2025/08/adae004b035a13943b957803666a3484.pdf">MZ80K2_取扱説明書</a><a href="https://expertgig.jp/wp/wp-content/uploads/2025/08/adae004b035a13943b957803666a3484.pdf" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-ca791404-005e-4e2e-b041-7a82b6cf46f6">ダウンロード</a></div>



<p></p>



<p>この中で重要なのは、8255と8253 の メモリマップド I/O の部分です。これがはっきりしないとエミュレータが完成しない。</p>



<p>著作権上はちょっと問題ありますが、重要な情報ということで公開します。</p>



<p>問題がある場合は、お知らせください。すぐに非公開いします。</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2025/08/02/mz-80k2-%e5%8f%96%e6%89%b1%e8%aa%ac%e6%98%8e%e6%9b%b8%e3%82%92%e6%9b%b8%e5%ba%ab%e3%81%8b%e3%82%89%e7%99%ba%e6%8e%98/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Raspi Zero 2W ベアメタル開発 9 (キー入力の基礎知識 編)</title>
		<link>https://expertgig.jp/2025/06/21/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab-10-%e3%82%ad%e3%83%bc%e5%85%a5%e5%8a%9b%e3%81%ae%e5%9f%ba%e7%a4%8e%e7%9f%a5%e8%ad%98-%e7%b7%a8/</link>
					<comments>https://expertgig.jp/2025/06/21/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab-10-%e3%82%ad%e3%83%bc%e5%85%a5%e5%8a%9b%e3%81%ae%e5%9f%ba%e7%a4%8e%e7%9f%a5%e8%ad%98-%e7%b7%a8/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Fri, 20 Jun 2025 17:22:06 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[KEYSTROBE]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[Raspi Zero 2W]]></category>
		<category><![CDATA[Ultibo]]></category>
		<category><![CDATA[Z80]]></category>
		<category><![CDATA[キーストローブ]]></category>
		<category><![CDATA[キーマトリクス]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6098</guid>

					<description><![CDATA[MZ80K のキーボードの実装を進めていきたいと思う。 キーボードの実装に当たっては、MZ80K がマップドI/O方式について理解する必要がある。 今、この瞬間に押されてるキーボードは何か? あのキーボードは押されている [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>MZ80K のキーボードの実装を進めていきたいと思う。</p>



<p>キーボードの実装に当たっては、MZ80K がマップドI/O方式について理解する必要がある。</p>



<p>今、この瞬間に押されてるキーボードは何か? あのキーボードは押されているのか押されていないのか? リアルタイムなゲームを作るうえでは欠かせない情報である。MZ80KのBASICでは、キーの状態をリアルタイムに検知する機能はない。</p>



<p>MZ80KのBASIC ( SP-5030等) の場合、INKEY$ でキー入力が発生するまで、ループして押された瞬間を検知することはできるが、今どんな状態かを知ることができない。しかしマシン語を使えば、簡単である。<br>メモリの $E000 と $E001 に接続された Intel 8255 ( Programmable Peripheral Interface ) PPI の対して、操作を行えばいいのである。</p>



<p>具体的には、メモリの$E000 の 上位4ビットは常に1111B として、下位4ビットには下図の知りたいキーがある場所のKEYSTROBE番号をセットして、$E0001 のDATAビットの状態をしらべれば良い。 MZ700やMZ1500のキーマトリクスはネットでもちらほら散見するが、今となっては MZ80Kのキーマトリクスの情報が無いと思われるので、ここに情報を公開しておこう。だれかの役に立つかもしれないので。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="669" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/image-16-1024x669.png" alt="" class="wp-image-6099" style="width:715px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/image-16-1024x669.png 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/image-16-300x196.png 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/image-16-768x501.png 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/image-16.png 1438w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>例えば、【V】キーが押されているかどうか知りたかったら、$E000 に F7h (11110111B) をセットして、$E000 の値が FDh (1111 1101B) ならば、Vキーがおされているということになる。</p>



<p>Z80のマシン語だとこんな感じ。BITの状態を調べて条件分岐。</p>



<pre class="wp-block-code"><code class="">LD ($E000),$F7<br>LD A,($E001) <br>BIT 2,A<br>JP Z,V_KEY_PRESSED</code></pre>



<p>もしくは、AND (論理積) を使って明示的に下記のようにするのも良い。</p>



<pre class="wp-block-code"><code class="">LD ($E000),$F7<br>LD A,($E001) <br>AND %00000100     ; Bit2だけマスク（0b00000100）<br>JP Z,V_KEY_PRESSED</code></pre>



<p>鋭い人であれば、これが複数キーの状態も検知できそうだと気づくだろう。つまり同時押しも検知できるのである。</p>



<p>ただし、キーマトリクスの回路の弱点として、ある特定のパターンで3つ以上のキーを押すと回路のショートルートができ、違うキーが押された誤検知するという現象があり、ゴーストキーと呼ばれています。 </p>



<h2 class="wp-block-heading">エミュレータでどのように組み込むか</h2>



<p>エミュレータでは、マップされたI/O $E000～$E008 のメモリに対して読み書きがあったら、上記処理をすれば良い。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2025/06/21/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab-10-%e3%82%ad%e3%83%bc%e5%85%a5%e5%8a%9b%e3%81%ae%e5%9f%ba%e7%a4%8e%e7%9f%a5%e8%ad%98-%e7%b7%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Raspi Zero 2W ベアメタル開発 08 (VRAM描画解決 編)</title>
		<link>https://expertgig.jp/2025/06/19/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-08-vram%e6%8f%8f%e7%94%bb%e8%a7%a3%e6%b1%ba-%e7%b7%a8/</link>
					<comments>https://expertgig.jp/2025/06/19/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-08-vram%e6%8f%8f%e7%94%bb%e8%a7%a3%e6%b1%ba-%e7%b7%a8/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Wed, 18 Jun 2025 23:42:18 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[Lazarus]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[Raspi Zero 2W]]></category>
		<category><![CDATA[Ultibo]]></category>
		<category><![CDATA[エミュレータ]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6093</guid>

					<description><![CDATA[先週は、VRAMイメージの描画で、VRAMの内容を一発表示する分には、まぁまぁ問題なかったのですが、描画Threadを回すと、画面がゴミだらけで、まともに表示されるまで何分も待つという不思議な現象に悩まされていました。  [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>先週は、VRAMイメージの描画で、VRAMの内容を一発表示する分には、まぁまぁ問題なかったのですが、描画Threadを回すと、画面がゴミだらけで、まともに表示されるまで何分も待つという不思議な現象に悩まされていました。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250613_214530-1-1024x576.jpg" alt="" class="wp-image-6096" style="width:480px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250613_214530-1-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250613_214530-1-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250613_214530-1-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250613_214530-1-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250613_214530-1-2048x1153.jpg 2048w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250613_214530-1-800x450.jpg 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>その原因が、いわゆる V-Sync (垂直同期) の問題と思っていて、どうやって Raspi Zero 2Wから V-Sync完了の情報をもらうか、そしてどれだけ速く書き込むか (次のV-Syncまでの間に画面生成完了させる。) 、Double Buffer にしてどうするとか。。</p>



<p>さんざんいじくりまわした挙句、元に戻すこともできなくなり、前回の投稿のように Z80エミュレート部分のスピードアップにいそしんだというわけです。</p>



<p>まぁしかし、怪我の功名。Z80のスピードは3.5倍になっただけでなく、新たなアプローチで原因を探すきっかけとなり、見事解決。</p>



<p>結果からいうと、CPUのL1 キャッシュの問題でした。</p>



<p>どういうことかというと、現代のCPU は、プログラムを先読みしてキャッシュしたり分岐の予測をしりして動作スピードをアップさせているわけなんですが、その先読み部分のデータについては、画面描画プログラムは高速で随時書き換えているわけです。</p>



<p>ですから、CPUが先走って読み込んだあとに対象の部分をプログラムが書き換えているので、データの不整合がおきるわけですね。</p>



<p>その結果画面はゴミが残ったような状態になったり、文字が欠けていたりしたわけです。</p>



<p>そこで、VRAM書き換え直後に キャッシュクリアしたら、あっさり解決。勉強になりました。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="889" height="1024" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/image-15-889x1024.png" alt="" class="wp-image-6094" style="width:435px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/image-15-889x1024.png 889w, https://expertgig.jp/wp/wp-content/uploads/2025/06/image-15-260x300.png 260w, https://expertgig.jp/wp/wp-content/uploads/2025/06/image-15-768x885.png 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/image-15.png 908w" sizes="(max-width: 889px) 100vw, 889px" /></figure>



<p><br></p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<p class="responsive-video-wrap clr"><iframe title="Raspi Zero 2W で MZ80K emu 開発。VRAM描画もうまくいった件 #raspi #emulator #mz80 #ultibo" width="1200" height="675" src="https://www.youtube.com/embed/f58UqlGKObI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
</div></figure>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2025/06/19/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-08-vram%e6%8f%8f%e7%94%bb%e8%a7%a3%e6%b1%ba-%e7%b7%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Raspi Zero 2W ベアメタル開発 07 (Z80 スピードアップ編)</title>
		<link>https://expertgig.jp/2025/06/17/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-07-z80-%e3%82%b9%e3%83%94%e3%83%bc%e3%83%89%e3%82%a2%e3%83%83%e3%83%97%e7%b7%a8/</link>
					<comments>https://expertgig.jp/2025/06/17/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-07-z80-%e3%82%b9%e3%83%94%e3%83%bc%e3%83%89%e3%82%a2%e3%83%83%e3%83%97%e7%b7%a8/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Tue, 17 Jun 2025 12:06:11 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[Raspi Zero 2W]]></category>
		<category><![CDATA[Ultibo]]></category>
		<category><![CDATA[Z80]]></category>
		<category><![CDATA[エミュレータ]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6089</guid>

					<description><![CDATA[先週は週末も含め、画面まわりの改善に時間を費やしましたが、HDMIのV-SYNC IRQをトリガとしたDMA転送の実装は、同期や動作確認が取れずにことごとく失敗。代わりにDMAをポーリングで監視する方法も試しましたが、ポ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>先週は週末も含め、画面まわりの改善に時間を費やしましたが、HDMIのV-SYNC IRQをトリガとしたDMA転送の実装は、同期や動作確認が取れずにことごとく失敗。代わりにDMAをポーリングで監視する方法も試しましたが、ポーリングしてもDMAの状態が一切変化せず、値も返らないという状態で機能せず。コードを大幅に改造しすぎて元の状態に戻すのも困難になり、挫折感の大きい週末となりました。</p>



<p>気晴らしに、Z80エミュ部分のスピード改善に集中することにした。</p>



<h1 class="wp-block-heading">Z80エミュを 10MHz まで上げたい!</h1>



<p>最初、とりあえず動作するようになった Z80エミュですが、当初は実機を下回る。1.727MHz</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-1024x576.jpg" alt="" class="wp-image-6078" style="width:418px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-2048x1153.jpg 2048w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-800x450.jpg 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>エミュなのでいうなれば、内部的な構造はZ80インタプリタという感じではあるが、Cortex-A53（64-bit）@ 1GHz のマシンで 1.7MHz では、なんとも悲しいではないか。ここに画面描画 Thread が動いたら、どんだけ遅いんだってことになってしまいます。</p>



<p>それで、いろいろとムダ改善 ( 工場らしい単語だね ) を行いまして、スピードは徐々に改善し、3.367MHz と約2倍に。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-1024x576.jpg" alt="" class="wp-image-6082" style="width:460px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-2048x1153.jpg 2048w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-800x450.jpg 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>それでも、まだまだということで、絞りまくって、なんと 6.098MHz まで到達。</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250617_193423-1024x576.jpg" alt="" class="wp-image-6088" style="width:457px;height:auto" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250617_193423-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250617_193423-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250617_193423-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250617_193423-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250617_193423-2048x1153.jpg 2048w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250617_193423-800x450.jpg 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>とりあえずここまでくれば、一段落。</p>



<p>今回、どんなことをしてスピードを上げたのか。箇条書きで記します。</p>



<h2 class="wp-block-heading">Z80エミュレーション スピードアップ施策（時系列）</h2>



<h3 class="wp-block-heading" style="font-size:27px">【初期】〜 1.73MHz 程度</h3>



<ol class="wp-block-list">
<li class="has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-bbedcccff48773359065e3a80f5e4be6"><strong>Z80の命令実行部を関数ポインタ配列で管理（Opc_mainなど）</strong></li>
</ol>



<p>　初期は Delphi 的なスタイルで、オペコードごとにメソッド参照で分岐。</p>



<ol start="2" class="wp-block-list">
<li class="has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-daef81c1b59f23000004cd8a05719c20"><strong>Z80_RDMEM/Z80_WRMEMの抽象化</strong></li>
</ol>



<p>　メモリアクセスを関数化したが、処理分岐が多く遅延の原因に。可能な限りダイレクトにメモリの読み書きをするように書き換え。</p>



<ol start="3" class="wp-block-list">
<li class="has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-69f9b3c8fefd3e5b79144c7dc102f56d"><strong>Z80のClass化を廃止、Cライクにべた書き</strong></li>
</ol>



<p>　意外にこれはすごく大きく改善した。Class は便利だが、やはり動作は遅くなることがわかった。</p>



<h3 class="wp-block-heading" style="font-size:27px">【中期】〜 約3〜5MHz台</h3>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-7b2b19ec8abdd12594192972b5689349">　<strong>4. 関数ポインタ呼び出しの高速化検討</strong></p>



<p>　　<code>Opc_main[opcode]()</code> での呼び出しが遅いか検証。</p>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-1c1af6999f38bd90e9d47d21f841686e"><strong>　5. 命令デコードの分岐を単純</strong></p>



<p>　　<code>case</code>や<code>if-else</code>の多重分岐を避け、直接ジャンプに近い構造に。</p>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-9eb8cc75cc26cae36f89f543468f3d9d"><strong>　6. 読み出し回数が多いところでのムダな関数呼び出し排除</strong></p>



<p>　　関数呼び出しがネストしていっている部分がかなりムダが多かった。</p>



<h2 class="wp-block-heading" style="font-size:27px">【最適化フェーズ】〜 約6.06MHz 到達</h2>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-30de01dcf268fda272bdd954d8d7fa3e"><strong>　7. 変数の型のオバースペックを解消</strong></p>



<p>　　なんとなく Int32 となっていたところを、厳格に Word (UInt16) にしたり、byte (Uint8) にしたら、内部的なムダなキャスト処理が減ったということで、これも大きくスピードアップに貢献</p>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-8021809c6618c653e43429916bf4e51a">　<strong>8. メモリマップドI/Oを早期に除外</strong></p>



<p>　　MZ80がメモリマップドI/Oの構造をとっているため、 $E000～$E008 のアドレスに読み書きがあったら、pio8255、pit8253 の処理と連動させなくてはいけないので、メモリに読み書きがあるたびに判定を繰り替えしていたが、初期の段階で $E000以前のアドレスだったらすぐに手続き離脱 (exit ) することで、かなり速くなった。</p>



<p>ということで、これからはVRAM描画の最適化に挑戦。 (今のバージョンをバックアップしておこう。。)</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2025/06/17/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-07-z80-%e3%82%b9%e3%83%94%e3%83%bc%e3%83%89%e3%82%a2%e3%83%83%e3%83%97%e7%b7%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Raspi Zero 2W ベアメタル開発 06 (エミュ速度改善編)</title>
		<link>https://expertgig.jp/2025/06/11/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-06-%e3%82%a8%e3%83%9f%e3%83%a5%e9%80%9f%e5%ba%a6%e6%94%b9%e5%96%84%e7%b7%a8/</link>
					<comments>https://expertgig.jp/2025/06/11/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-06-%e3%82%a8%e3%83%9f%e3%83%a5%e9%80%9f%e5%ba%a6%e6%94%b9%e5%96%84%e7%b7%a8/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Wed, 11 Jun 2025 14:36:25 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[Raspi Zero 2W]]></category>
		<category><![CDATA[Ultibo]]></category>
		<category><![CDATA[Z80]]></category>
		<category><![CDATA[エミュレータ]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6079</guid>

					<description><![CDATA[さて、前回 MZ-80K2 のエミュはほぼ動いたのですが、めちゃめちゃ遅いという問題がは発生。 画面描画にメスを入れる ★ カラーを 32bitから16bit にして描画コストを半分にする。 エミュレートする対象がMZ- [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>さて、前回 MZ-80K2 のエミュはほぼ動いたのですが、めちゃめちゃ遅いという問題がは発生。</p>



<h2 class="wp-block-heading">画面描画にメスを入れる</h2>



<p>★ カラーを 32bitから16bit にして描画コストを半分にする。</p>



<p>エミュレートする対象がMZ-80Kなので、カラーが 32bit というのはかなりオーバースペックであることに気づいたので、16bitモードに変更。これに伴って、 ARGB (LongWord) で記述していたコードを RGB565 (Word) にすべて書き換え。</p>



<pre class="wp-block-code"><code class="">//==============================================================================<br>// 指定した X,Y (40x25) にキャラを表示  (RGB565形式バージョン)<br>//==============================================================================<br>procedure DrawCharToSurface(X, Y: Integer; CharCode: Byte);<br>var<br>  Line, Bit: Integer;<br>  Data: Byte;<br>  PixelAddr: PWord;<br>  BaseAddr: PtrUInt;<br>begin<br>  // 1文字目の先頭アドレス（1ピクセル=2バイト）<br>  BaseAddr := FBInfo.PixelAddr + Y * FBInfo.Pitch + X * 2;<br><br>  for Line := 0 to 7 do<br>  begin<br>    Data := FontRom[CharCode * 8 + Line];<br>    for Bit := 0 to 7 do<br>    begin<br>      PixelAddr := PWord(BaseAddr + Line * FBInfo.Pitch + Bit * 2);<br>      if (Data and (128 shr Bit)) &lt;&gt; 0 then<br>        PixelAddr^ := FG   // FG は Word 型（RGB565値）<br>      else<br>        PixelAddr^ := BG;  // BG も Word 型<br>    end;<br>  end;<br>end; </code></pre>



<p> こんな感じで、すべて Word型に。 RGB565変換は、下記のようなfunctionを作成。</p>



<pre class="wp-block-code"><code class="">//==============================================================================<br>// RGB565 形式に変換する関数<br>//==============================================================================<br>function RGB565(R, G, B: Byte): Word;<br>begin<br>  Result := ((R shr 3) shl 11) or ((G shr 2) shl 5) or (B shr 3);<br>end; </code></pre>



<p>これは、ARDUINO や ESP32 などのSBCで、外部LEDに出力するときに RGB565仕様のLEDモニタが多いので役立ちそう。あまり考えずに RGB を 255,255,255 で指定して、自動変換。</p>



<p>★ フレーム描画を間引き</p>



<p>禁断かどうかわかりませんが、フレーム描画を4回に1回だけ描画して、フレーム描画をすっとばす。</p>



<pre class="wp-block-code"><code class="">//==============================================================================<br>// Draw Screen Thread Execeute<br>//==============================================================================<br>procedure TDrawScreenThread.Execute;<br>var<br>  FStartVSync, FEndVSync, FVSyncTime: QWord;<br>  FrameCount: Integer;<br>begin<br>  FrameCount := 0;<br><br>  while not Terminated do<br>  begin<br>    FStartVSync := GetTickCount64;<br><br>    Inc(FrameCount);<br><br>    if hw80.v_gate then<br>    begin<br>      if (FrameCount mod 4 = 0) then<br>        update_scrn;<br>    end<br>    else<br>    begin<br>      // 描画間引きに関係なく、背景は毎回クリア<br>      ClearGameAreaFast16(BG);<br>    end;<br><br>    FEndVSync := GetTickCount64;<br>    FVSyncTime := FEndVSync - FStartVSync;<br><br>    if SYNCTIME &gt; FVSyncTime then<br>      Sleep(SYNCTIME - FVSyncTime)<br>    else<br>      Sleep(1);<br>  end;<br>end;</code></pre>



<p> update_scrn の呼び出し頻度を変えている。</p>



<p>★ Thread の優先順位を設定</p>



<p>画面描画をLOWEST にして、 Z80のThreadをHIGHEST に設定</p>



<h2 class="wp-block-heading">結果は?</h2>



<p>少し早くなったが、まだまだぜんぜん。なかなかなやましい。</p>



<h2 class="wp-block-heading">画面描画処理をストップしてZ80だけ動かして計測してみた</h2>



<p>そもそも Z80 部分は十分なスピードで動いているのか? という疑問があったので、計測用のソースに書き換えてテスト</p>



<pre class="wp-block-code"><code class="">//==============================================================================<br>// Z80Thread Execute<br>//==============================================================================<br>procedure TZ80Thread.Execute;<br>var<br>  i: Integer;<br>  T1, T2: QWord;<br>  Hz: Double;<br>begin<br>  // 描画がない状態で、Z80処理速度を測定<br>  T1 := GetTickCount64;<br><br>  for i := 1 to 1000000 do<br>    z80.Z80_Execute;<br><br>  T2 := GetTickCount64;<br><br>  // ミリ秒 → 秒へ変換して Hz 計算<br>  if (T2 &gt; T1) then<br>  begin<br>    Hz := 1000000 / ((T2 - T1) / 1000);<br>    ConsoleWindowWriteLn(Console1, 'Z80: ' + FloatToStrF(Hz / 1000000, ffFixed, 5, 3) + ' MHz');<br>  end<br>  else<br>    ConsoleWindowWriteLn(Console1, '計測エラー');<br><br>  // スレッド終了<br>  Terminate;<br>end;  </code></pre>



<p>1,000,000個の命令を処理して、何ヘルツで動いているか計測してみた。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-1024x576.jpg" alt="" class="wp-image-6078" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-2048x1153.jpg 2048w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_225115-800x450.jpg 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>ガーン! ショック。テスト結果は 1.727MHz。実機の 2MHz に達していないではないか!</p>



<p>そりゃ、描画処理も入れたら遅いわけだ。。</p>



<h2 class="wp-block-heading">ボトルネックは何んなのか考える</h2>



<p>ChatGPT に相談してみた。</p>



<p>そしたら、以下のような指摘が帰ってきました。(致命的!!) と言ってます。</p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/26a0.png" alt="⚠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 問題点①：ExecMethod2 の文字列分岐（致命的）<br><br>ExecMethod2(op, &#8216;main&#8217;, opcode); // ← これが非常に遅い<br>文字列で分岐しています：<br>if kind = &#8216;main&#8217; then<br>op.opc_main[opcode]()<br>else if kind = &#8216;cb&#8217; then …<br><br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 改善策：直接呼び出しに置き換える<br>op.opc_main[opcode](); // ← これで高速化（関数ポインタ直呼び）<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 25%以上の速度向上が見込めます。</p>



<p>先生了解しました。直接呼出しにしてみます。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-1024x576.jpg" alt="" class="wp-image-6082" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-2048x1153.jpg 2048w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250612_071623-800x450.jpg 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>す、すごい 倍速になりました。</p>



<p>やはり、Z80などのエミュレーションは、とにかく繰り返し処理なので、繰り返しの中のオーバーヘッドをなくすってことですね。</p>



<p>昔のマイコンプログラムを思い出す。</p>



<p>現代のゆるーい感じのコーディングのぬるま湯に浸かりすぎてました。反省。</p>



<p>まだまだ、改善できそうなので、次回に続く。</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2025/06/11/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-06-%e3%82%a8%e3%83%9f%e3%83%a5%e9%80%9f%e5%ba%a6%e6%94%b9%e5%96%84%e7%b7%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Raspi Zero 2W ベアメタル開発 05【MZ-80K2 Emu 編】</title>
		<link>https://expertgig.jp/2025/06/11/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba%e3%80%90mz-80k2-emu-%e7%b7%a8%e3%80%91/</link>
					<comments>https://expertgig.jp/2025/06/11/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba%e3%80%90mz-80k2-emu-%e7%b7%a8%e3%80%91/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Wed, 11 Jun 2025 03:54:22 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[Raspi Zero 2W]]></category>
		<category><![CDATA[Ultibo]]></category>
		<category><![CDATA[Z80]]></category>
		<category><![CDATA[エミュレータ]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6074</guid>

					<description><![CDATA[さて、前回から数日経ってしまいましたが、Z80のエミュレーションで、問題が発生。 Delphi で開発したソースは、メモリからオペコード（1byte）を読み込んで、事前に用意したオペコードに対応するプロシージャ名の配列か [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>さて、前回から数日経ってしまいましたが、Z80のエミュレーションで、問題が発生。</p>



<p>Delphi で開発したソースは、メモリからオペコード（1byte）を読み込んで、事前に用意したオペコードに対応するプロシージャ名の配列から、対象となるprocedure 名を取得して、そのprocedure名からプロシージャを呼び出すためのポインタを取得してマシン語の実行というプログラムだったのですが（ややこしいですけど効率的）、なんとベアメタルでの Free Pascal では構文でエラーは出ないものの、ポインタの値が null しか戻ってこないという大ピンチに陥っていまして、ちょいとなやんでいました。</p>



<p>色々と調べて、トライしてやっと求めている動きになりました。</p>



<p>具体的には、procedure（ ）of object 型の配列を準備して、オペコードに対応するprocedure のポインタを設定するという方法です。</p>



<p>TOp という class にマシン語命令を処理するprocedure がすべて入っていて、そのインスタンスをop とした時、クラス外で準備した配列に次のようにポインタを代入します。</p>



<p>opcode_main[$C3] := @op.jp;</p>



<p>Z80 ではメインとなる命令群が256個、2バイト命令が、CB, DD,ED,FD ということで、4*256個、3バイト命令で、256*2の512個、合わせて 1792 個の命令（その中には未定義の部分もありますが）なので、ポインタを利用した呼び出しをしないと、大量のif then else if をずらーっと記述しなければいけないはめになり、かつ遅いプログラムとなってしまいます。</p>



<p>まぁとりあえず、解決策があって良かった。</p>



<p>ということで、Z80の動作もレジスタの値の変化を表示して、うまくいってるようなので、VRAMの内容を画面に書き込むモードに切り替えて実行!</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="576" data-id="6075" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_040155-1024x576.jpg" alt="" class="wp-image-6075" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_040155-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_040155-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_040155-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_040155-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_040155-2048x1152.jpg 2048w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250611_040155-800x450.jpg 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</figure>



<p>とりあえず、モニタプログラムが動いて、画面にSP-1002 の表示が出ました。</p>



<p>しかし、めちゃくちゃ遅い! これはなんとかせねば。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2025/06/11/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba%e3%80%90mz-80k2-emu-%e7%b7%a8%e3%80%91/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Raspi Zero 2W ベアメタル開発 04 ( MZ80KのVRAM表示編)</title>
		<link>https://expertgig.jp/2025/06/08/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-mz80k%e3%81%aevram%e8%a1%a8%e7%a4%ba%e7%b7%a8/</link>
					<comments>https://expertgig.jp/2025/06/08/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-mz80k%e3%81%aevram%e8%a1%a8%e7%a4%ba%e7%b7%a8/#respond</comments>
		
		<dc:creator><![CDATA[Ariyuki Tano]]></dc:creator>
		<pubDate>Sat, 07 Jun 2025 15:33:22 +0000</pubDate>
				<category><![CDATA[マイコン]]></category>
		<category><![CDATA[情報発信基地]]></category>
		<category><![CDATA[Lazarus]]></category>
		<category><![CDATA[MZ-80]]></category>
		<category><![CDATA[Raspi Zero 2W]]></category>
		<category><![CDATA[Ultibo]]></category>
		<category><![CDATA[VRAM]]></category>
		<category><![CDATA[Z80]]></category>
		<category><![CDATA[エミュレータ]]></category>
		<guid isPermaLink="false">https://expertgig.jp/?p=6069</guid>

					<description><![CDATA[前回、画面へのキャラクタ描画はうまく行ったので、もっとエミュレータ開発に使づくように、今日はもう一歩前進してみましょう。 MZ80Kのメモリ領域全体は、8bitマシンということで、64KBとなります。 メモリ内容を保持す [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>前回、画面へのキャラクタ描画はうまく行ったので、もっとエミュレータ開発に使づくように、今日はもう一歩前進してみましょう。</p>



<p>MZ80Kのメモリ領域全体は、8bitマシンということで、64KBとなります。</p>



<pre class="wp-block-code"><code class="">unit mem;<br>interface<br>var<br>  memory: array[0..65535] of Byte;<br>implementation<br>end. </code></pre>



<p>メモリ内容を保持する unit として、上記のように準備しました。</p>



<p>ここに、MZ-80KのモニタROM (SP-1002) を読み込んでみましょう。</p>



<pre class="wp-block-code"><code class="">//==============================================================================<br>// Load MONITOR ROM<br>//==============================================================================<br>procedure LoadMonitorRom;<br>var<br>  FS: TFileStream;<br>  MonitorPath: string;<br>  I: Integer;<br>begin<br>  ConsoleWindowWriteLn(Console1, 'Waiting for drive...');<br><br>  // C:\ または fat:\ が使えるのを待つ<br>  while not DirectoryExists('C:\') and not DirectoryExists('fat:\') do<br>    Sleep(100);<br><br>  if DirectoryExists('C:\') then<br>    MonitorPath := 'C:\mon_rom'<br>  else<br>    MonitorPath := 'fat:\mon_rom';<br><br>  ConsoleWindowWriteLn(Console1, 'Drive is ready.');<br><br>  if FileExists(MonitorPath) then<br>  begin<br>    ConsoleWindowWriteLn(Console1, 'Loading monitor ROM file...');<br>    FS := TFileStream.Create(MonitorPath, fmOpenRead);<br>    FS.Read(MonitorRom, SizeOf(MonitorRom));<br>    FS.Free;<br>    ConsoleWindowWriteLn(Console1, 'Monitor ROM loaded successfully!');<br>  end<br>  else<br>  begin<br>    ConsoleWindowWriteLn(Console1, 'Monitor ROM file not found at ' + MonitorPath);<br>  end;<br><br>  // 読み込んだ内容を memory[] にコピー<br>  for I := 0 to SizeOf(MonitorRom) - 1 do<br>    memory[I] := MonitorRom[I];<br>end;                  </code></pre>



<p>メモリの先頭 $0000番地から4KBのモニタROMを読み込んでセットします。</p>



<p>今後、Z80のエミュレータがうまく動けば、このモニタ部分を実行して、VRAMへの初期表示もされることになります。</p>



<p>まだそこまでは行けないので、今回はVRAMとして割り当てられた $D000 からの1000byte の内容を画面に表示するところまでやってみましょう。</p>



<p>つまり画面表示部分だけ先にテストしておこうというわけです。</p>



<h2 class="wp-block-heading">VRAMの内容を画面に表示する</h2>



<p>とりあえずざっとソースプログラムを見てみましょう。</p>



<pre class="wp-block-code"><code class="">//==============================================================================<br>// スクリーン描画スレッド<br>//==============================================================================<br>procedure DrawScreenThread;<br>var<br>  FTimeValue : QWord;<br>  FTimeDis   : QWord;<br>  FStartVSync: QWord;<br>  FEndVSync  : QWord;<br>  FVSyncTime : QWord;<br>  Amin       : Integer;<br>  Asec       : Integer;<br>  DrawFreq   : Integer;<br>  i, j       : Integer;<br>begin<br>  // すでにスレッドが開始されていたら停止<br>  if Assigned(ScreenThread) then<br>  begin<br>    flgStop := True;<br>    ScreenThread.Terminate;<br>    FreeAndNil(ScreenThread);<br>  end;<br><br>  // スレッド開始<br>  flgStop := False;<br>  ScreenThread := TDrawScreenThread.Create(False); // False = 自動起動<br>  ScreenThread.FreeOnTerminate := False;<br>end;<br><br>//==============================================================================<br>// Draw Screen Thread Execeute<br>//==============================================================================<br>procedure TDrawScreenThread.Execute;<br>var<br>  FStartVSync, FEndVSync, FVSyncTime: QWord;<br>begin<br>  while not Terminated do<br>  begin<br>    FStartVSync := GetTickCount64;<br><br>    //if hw80.v_gate then<br>    if true then  // z80動かすまでの仮設定<br>    begin<br>      update_scrn;<br>    end<br>    else<br>    begin<br>      ClearScreenFast(BG);  // 事前定義された背景色<br>    end;<br><br>    FEndVSync := GetTickCount64;<br>    FVSyncTime := FEndVSync - FStartVSync;<br><br>    if SYNCTIME > FVSyncTime then<br>      Sleep(SYNCTIME - FVSyncTime);<br><br>    Sleep(1);<br>  end;<br>end;<br><br>//==============================================================================<br>// 画面アップデート処理  (v-blank) [書き換えが必要部分だけ画面を書き換える]<br>//==============================================================================<br>procedure update_scrn;<br>var<br>  i: Integer;<br>  CharCode: Byte;<br>  Row, Col: Integer;<br>begin<br>  for i := 0 to 999 do<br>  begin<br>    CharCode := Memory[$D000 + i];<br>    if ScrChar[i] &lt;> CharCode then<br>    begin<br>      Row := i div 40;<br>      Col := i mod 40;<br>      DrawCharToSurface(Col * 8, Row * 8, CharCode);<br>      ScrChar[i] := CharCode;<br>    end;<br>  end;<br>end;<br><br>//==============================================================================<br>// 指定した X,Y (40x25) にキャラを表示<br>//==============================================================================<br>procedure DrawCharToSurface(X, Y: Integer; CharCode: Byte);<br>var<br>  Line, Bit: Integer;<br>  Px, Py: Integer;<br>  Data: Byte;<br>  Color: LongWord;<br>begin<br>  for Line := 0 to 7 do<br>  begin<br>    Data := FontRom[CharCode * 8 + Line];<br>    for Bit := 0 to 7 do<br>    begin<br>      Px := X + Bit;<br>      Py := Y + Line;<br><br>      if (Data and (1 shl (7 - Bit))) &lt;> 0 then<br>        Color := FG<br>      else<br>        Color := BG;<br><br>      PutPixel(Px, Py, Color);<br>    end;<br>  end;<br>end;<br><br>//==============================================================================<br>// 点を描画<br>//==============================================================================<br>procedure PutPixel(X, Y: Integer; Color: LongWord);<br>var<br>  Offset: PtrUInt;<br>begin<br>  Offset := FBInfo.PixelAddr + Y * FBInfo.Pitch + X * 4;<br>  PLongWord(Pointer(Offset))^ := Color;<br>end;<br><br>//==============================================================================<br>// 画面を高速クリア<br>//==============================================================================<br>procedure ClearScreenFast(Color: LongWord);<br>var<br>  PixelPtr: PLongWord;<br>  Count: Integer;<br>begin<br>  PixelPtr := PLongWord(Pointer(FBInfo.PixelAddr));<br>  Count := (FBInfo.Pitch div 4) * FBInfo.Height;<br><br>  while Count > 0 do<br>  begin<br>    PixelPtr^ := Color;<br>    Inc(PixelPtr);<br>    Dec(Count);<br>  end;<br>end;                 </code></pre>



<p>画面を一定周期で更新するThread を定義して実行します。</p>



<p>Thead内から、update_scrn (画面の更新処理) を呼び出します。</p>



<p>update_scrn では、高速化のためVRAM 上の値が前回と違う部分だけ更新するようにしています。</p>



<p>この中で、指定のX,Y 座標に文字を書き込む処理 DrawCharToSurface(X,Y,CharCode) を呼びだしています。</p>



<p>DrawCharToSurfaceでは、フォントデータに基づいてドットで画像を生成 ( PutPixel) しています。</p>



<p>PutPixel では、文字単位ではなくドット単位で書き込む処理が記述されています。</p>



<p>このように階層的に処理をしています。</p>



<h2 class="wp-block-heading">ランダムな情報をVRAMに書き込む</h2>



<p>まだ Z80が動いていないので、VRAMエリアに情報が書き込まれない状態ですので、とりあえずVRAMエリアにランダムに値を書き込みます。</p>



<pre class="wp-block-code"><code class="">procedure FillVRAMWithRandomChars;<br>var<br>  i: Integer;<br>begin<br>  Randomize;<br>  for i := 0 to 999 do<br>  begin<br>    Memory[$D000 + i] := Random(256);  // ランダムなキャラクターコード（0〜255）<br>  end;<br>end;   </code></pre>



<p>これで、元データはできあ゛かりますので、テストしてみましょう。</p>



<p>それと、プログラムがちゃんと動作していることを確かめるため、MZ700風に背景を青にして描画するようにしてみましょう。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250608_002026-1024x576.jpg" alt="" class="wp-image-6070" srcset="https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250608_002026-1024x576.jpg 1024w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250608_002026-300x169.jpg 300w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250608_002026-768x432.jpg 768w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250608_002026-1536x864.jpg 1536w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250608_002026-2048x1152.jpg 2048w, https://expertgig.jp/wp/wp-content/uploads/2025/06/IMG_20250608_002026-800x450.jpg 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>うまく行きました。</p>



<p>Z80部分もコンパイルできるところまでは修正したのですが、まだうまく動いていないので、とりあえず今日はVRAMの表示をスレッドでできたというところまで。</p>



<div class="wp-block-file"><a id="wp-block-file--media-11e68203-2e33-4c76-a816-bdaf13c6df1f" href="https://expertgig.jp/wp/wp-content/uploads/2025/06/VRAM_DRAW.zip">VRAM_DRAW</a><a href="https://expertgig.jp/wp/wp-content/uploads/2025/06/VRAM_DRAW.zip" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-11e68203-2e33-4c76-a816-bdaf13c6df1f">ダウンロード</a></div>



<p>今回は、Z80の実装とMZ80のハードウェア定義もすべてソースに含まれていますが、まだZ80の実装部分のテストができていないので、動作からは外しています。</p>



<p>しかし、Z80部分のDEBUGをどうやってやろうかな。今の開発のやり方だと、まともにデバッグできないので、Raspi の エミュレータを開発環境に絡めてやるしかないんだろうな。。また開発環境の設定を触るしかないね。</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://expertgig.jp/2025/06/08/raspi-zero-2w-%e3%83%99%e3%82%a2%e3%83%a1%e3%82%bf%e3%83%ab%e9%96%8b%e7%99%ba-mz80k%e3%81%aevram%e8%a1%a8%e7%a4%ba%e7%b7%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
