{"id":11851,"date":"2024-07-23T23:56:57","date_gmt":"2024-07-23T14:56:57","guid":{"rendered":"https:\/\/www.webcyou.com\/?p=11851"},"modified":"2024-07-24T00:00:35","modified_gmt":"2024-07-23T15:00:35","slug":"rust%e3%81%a7%e5%89%b5%e3%82%8b-mos-6502-cpu-%e3%81%9d%e3%81%ae2","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=11851","title":{"rendered":"Rust\u3067\u5275\u308b MOS 6502 CPU \u305d\u306e2"},"content":{"rendered":"\n<p>\u3069\u3082\u3067\u3059\u3002<\/p>\n<p>\u524d\u56de\u306e\u300c<a href=\"https:\/\/www.webcyou.com\/?p=11834\">Rust\u3067\u5275\u308b MOS 6502 CPU \u305d\u306e1<\/a>\u300d\u306e\u7d9a\u304d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u65e9\u901f\u5b9f\u88c5\u3057\u3066\u884c\u3053\u3046\u304b\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u3001\u679c\u305f\u3057\u3066\u3069\u3053\u304b\u3089\u624b\u3092\u3064\u3051\u3066\u3044\u3051\u3070\u3088\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u6700\u8fd1\u3001\u30de\u30a4\u30d6\u30fc\u30e0\u306eGoogle\u306e\u300c<a href=\"https:\/\/notebooklm.google.com\/\">NotebookLM<\/a>\u300d\u306b\u805e\u3044\u3066\u898b\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>MOS 6502 CPU \u306b\u95a2\u3059\u308b\u8cc7\u6599\u306a\u3069\u3092\u8272\u3005\u3068\u307e\u3068\u3081\u305f\u5f8c\u306b\u8cea\u554f\u3002<\/p>\n<p>\u4ee5\u4e0b\u304c\u56de\u7b54\u3002<\/p>\n<p>\u00a0<\/p>\n<p><strong>1.CPU \u306e\u69cb\u9020\u4f53\u306e\u5b9a\u7fa9<\/strong>: \u307e\u305a\u3001CPU \u306e\u30ec\u30b8\u30b9\u30bf\uff08A, X, Y, PC, SP, \u30b9\u30c6\u30fc\u30bf\u30b9\u30d5\u30e9\u30b0\uff09\u3092\u4fdd\u6301\u3059\u308b\u69cb\u9020\u4f53\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002Rust \u306e\u69cb\u9020\u4f53\u3068\u5217\u6319\u578b\u3092\u7528\u3044\u308b\u3053\u3068\u3067\u3001\u30ec\u30b8\u30b9\u30bf\u3084\u30b9\u30c6\u30fc\u30bf\u30b9\u30d5\u30e9\u30b0\u3092\u8868\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>2.\u30e1\u30e2\u30ea\u306e\u5b9f\u88c5<\/strong>: 6502 \u306f 65,536 \u30d0\u30a4\u30c8\u306e\u30e1\u30e2\u30ea\u7a7a\u9593\u3092\u6301\u3064\u305f\u3081\u3001 [u8; 0x10000] \u306e\u3088\u3046\u306a\u914d\u5217\u3067\u8868\u73fe\u3067\u304d\u307e\u3059\u3002\u30e1\u30e2\u30ea\u3078\u306e\u8aad\u307f\u66f8\u304d\u3092\u884c\u3046\u30e1\u30bd\u30c3\u30c9\u3082\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<p><strong>3.\u547d\u4ee4\u306e\u5b9f\u88c5<\/strong>: \u5404\u547d\u4ee4\u3092\u3001CPU \u3068\u30e1\u30e2\u30ea\u3092\u53d7\u3051\u53d6\u308a\u3001CPU \u306e\u72b6\u614b\u3092\u5909\u66f4\u3059\u308b\u95a2\u6570\u3068\u3057\u3066\u5b9f\u88c5\u3057\u307e\u3059\u3002\u00a0\u5404\u547d\u4ee4\u306e\u52d5\u4f5c\u306f\u3001\u30bd\u30fc\u30b9\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u547d\u4ee4\u8868\u3092\u53c2\u7167\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001LDA #$01 (A\u30ec\u30b8\u30b9\u30bf\u306b\u5373\u5024$01\u3092\u30ed\u30fc\u30c9\u3059\u308b) \u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>4.\u30d5\u30a7\u30c3\u30c1\u30fb\u30c7\u30b3\u30fc\u30c9\u30fb\u5b9f\u884c\u30b5\u30a4\u30af\u30eb\u306e\u5b9f\u88c5<\/strong>: CPU \u306f\u30e1\u30e2\u30ea\u304b\u3089\u547d\u4ee4\u3092\u8aad\u307f\u8fbc\u307f (\u30d5\u30a7\u30c3\u30c1)\u3001\u547d\u4ee4\u3092\u89e3\u91c8\u3057 (\u30c7\u30b3\u30fc\u30c9)\u3001\u5bfe\u5fdc\u3059\u308b\u95a2\u6570\u3092\u5b9f\u884c\u3057\u307e\u3059 (\u5b9f\u884c)\u3002\u3053\u308c\u3089\u306e\u30b5\u30a4\u30af\u30eb\u3092\u30eb\u30fc\u30d7\u51e6\u7406\u3067\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<p><strong>5.\u30a2\u30c9\u30ec\u30c3\u30b7\u30f3\u30b0\u30e2\u30fc\u30c9\u306e\u5b9f\u88c5<\/strong>: 6502 \u306f\u3001\u30a2\u30d6\u30bd\u30ea\u30e5\u30fc\u30c8\u3001\u30bc\u30ed\u30da\u30fc\u30b8\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30c8\u306a\u3069\u3001\u591a\u304f\u306e\u30a2\u30c9\u30ec\u30c3\u30b7\u30f3\u30b0\u30e2\u30fc\u30c9\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u5404\u547d\u4ee4\u306e\u5b9f\u88c5\u6642\u306b\u3001\u5bfe\u5fdc\u3059\u308b\u30a2\u30c9\u30ec\u30c3\u30b7\u30f3\u30b0\u30e2\u30fc\u30c9\u306e\u51e6\u7406\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001STA $10, X (X\u30ec\u30b8\u30b9\u30bf\u306e\u5024\u3092\u30a2\u30c9\u30ec\u30b9\u306b\u52a0\u7b97\u3057\u3066\u30b9\u30c8\u30a2) \u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>6.\u30c6\u30b9\u30c8<\/strong>: \u5404\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3001\u547d\u4ee4\u3001\u30a2\u30c9\u30ec\u30c3\u30b7\u30f3\u30b0\u30e2\u30fc\u30c9\u3092\u500b\u5225\u306b\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002\u30bd\u30fc\u30b9\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3084\u3001\u81ea\u5206\u3067\u4f5c\u6210\u3057\u305f\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f7f\u7528\u3057\u3066\u3001\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u304c\u6b63\u3057\u304f\u52d5\u4f5c\u3059\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u3053\u308c\u3089\u306e\u624b\u9806\u3092\u9806\u756a\u306b\u5b9f\u88c5\u3057\u3066\u3044\u304f\u3053\u3068\u3067\u3001Rust \u3067 6502 CPU \u306e\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>\u6ce8\u610f\u70b9<\/strong>:<\/p>\n<p>\u25cf\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u306f\u7c21\u7565\u5316\u3055\u308c\u3066\u304a\u308a\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u306a\u3069\u306f\u7701\u7565\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u25cf\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u306e\u958b\u767a\u306b\u306f\u3001CPU \u3084\u30a2\u30bb\u30f3\u30d6\u30ea\u8a00\u8a9e\u306b\u95a2\u3059\u308b\u6df1\u3044\u77e5\u8b58\u304c\u5fc5\u8981\u3067\u3059\u3002\u30bd\u30fc\u30b9\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u60c5\u5831\u4ee5\u5916\u306b\u3082\u3001\u5225\u9014\u5b66\u7fd2\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u304a\u3049\u3002\u696d\u52d9\u3067ChatGPT\u3092\u7528\u3044\u3066\u3044\u307e\u3059\u304c\u3001\u300c<a href=\"https:\/\/notebooklm.google.com\/\">NotebookLM<\/a>\u300d\u306f\u305d\u306e\u540d\u306e\u901a\u308a\u3001\u81ea\u5206\u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u304c\u4f5c\u6210\u3067\u304d\u3001\u30c6\u30ad\u30b9\u30c8\u3084\u3001PDF\u3001URL\u306a\u3069\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u81ea\u5206\u597d\u307f\u306e\u30e2\u30c7\u30eb\u306b\u4ed5\u4e0a\u3052\u3066\u3044\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u8d85\u4fbf\u5229\u3002\u30cd\u30c3\u30c8\u30b5\u30fc\u30d5\u30a3\u30f3\u304c\u3066\u3089\u6c17\u8efd\u306b\u4f5c\u6210\u3067\u304d\u308b\u306e\u304c\u672c\u5f53\u5b09\u3057\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u300c<a href=\"https:\/\/notebooklm.google.com\/\">NotebookLM<\/a>\u300d\u306e\u8a00\u3046\u901a\u308a\u3001<strong>1.CPU \u306e\u69cb\u9020\u4f53\u306e\u5b9a\u7fa9\u30012.\u30e1\u30e2\u30ea\u306e\u5b9f\u88c5<\/strong>\u3068\u9032\u3081\u3066\u884c\u304f\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001CPU\u306e\u69cb\u9020\u4f53\u3092\u7528\u610f\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"rust\">struct CPU {\n    a: u8,  \/\/ A Register\n    x: u8,  \/\/ X Register\n    y: u8,  \/\/ Y Register\n    pc: u16, \/\/ Program Counter\n    sp: u8,  \/\/ Stack Pointer\n    status: StatusRegister, \/\/ Status Register\n}<\/pre>\n<p>CPU \u306e\u30ec\u30b8\u30b9\u30bf\uff08A, X, Y, PC, SP, \u30b9\u30c6\u30fc\u30bf\u30b9\u30d5\u30e9\u30b0\uff09\u3092\u4fdd\u6301\u3059\u308b\u69cb\u9020\u4f53\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30b9\u30c6\u30fc\u30bf\u30b9\u30d5\u30e9\u30b0\u306e\u69cb\u9020\u4f53\u3082\u7528\u610f\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"rust\">struct StatusRegister {\n    c: bool, \/\/ Carry Flag\n    z: bool, \/\/ Zero Flag\n    i: bool, \/\/ Interrupt Disable Flag\n    d: bool, \/\/ Decimal Mode Flag\n    b: bool, \/\/ Break Command Flag\n    v: bool, \/\/ Overflow Flag\n    n: bool, \/\/ Negative Flag\n}<\/pre>\n<p>\u5404\u30d5\u30e9\u30b0\u3092\u3082\u305f\u305b\u307e\u3059\u3002<\/p>\n<p>\u66f4\u306b\u30e1\u30e2\u30ea\u9818\u57df\u306e\u78ba\u4fdd\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"rust\">struct Memory {\n    data: [u8; 0x10000], \/\/ 65,536 bytes of memory\n}<\/pre>\n<p>\u5206\u3051\u308b\u5fc5\u8981\u306a\u3044\u304b\u3082\u3067\u3059\u304c\u3001CPU\u306e\u5b9f\u88c5\u306f\u5927\u304d\u304f\u306a\u308b\u306e\u3067\u3001\u5404\u69cb\u9020\u4f53\u3054\u3068\u306b\u3001cpu.rs\u3001register.rs\u3001memory.rs\u3068\u5404\u30d5\u30a1\u30a4\u30eb\u306b\u5206\u5272\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u3089\u7528\u3044\u3066\u3001CPU\u306e\u547d\u4ee4\u3092\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u304c\u3001<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"rust\">impl CPU {\n    fn new() -&gt; Self {\n        CPU {\n            a: 0,\n            x: 0,\n            y: 0,\n            pc: 0,\n            sp: 0xFF, \/\/ Initial value of stack pointer is 0xFF\n            status: StatusRegister::new(),\n        }\n    }\n\n    fn execute(&amp;mut self, opcode: u8, memory: &amp;mut Memory) {\n    }\n}<\/pre>\n<p>\u4eca\u56de\u306f\u3053\u306e\u8fba\u306b\u3057\u3066\u304a\u3044\u3066\u3001\u6b21\u56de\u3078\u3068\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u3041\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p><!-- notionvc: 9023e5fd-13dd-4471-af4b-7a771f469a08 --><\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3082\u3067\u3059\u3002 \u524d\u56de\u306e\u300cRust\u3067\u5275\u308b MOS 6502 CPU \u305d\u306e1\u300d\u306e\u7d9a\u304d\u3068\u306a\u308a\u307e\u3059\u3002 \u4eca\u56de\u306f\u65e9\u901f\u5b9f\u88c5\u3057\u3066\u884c\u3053\u3046\u304b\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u3001\u679c\u305f\u3057\u3066\u3069\u3053\u304b\u3089\u624b\u3092\u3064\u3051\u3066\u3044\u3051\u3070\u3088\u3044\u3067\u3057\u3087\u3046\u304b\u3002 \u6700\u8fd1\u3001\u30de\u30a4\u30d6\u30fc\u30e0\u306eGoogle\u306e\u300cNo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11849,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[299],"tags":[343,346,247,344,327,345],"class_list":["post-11851","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-rust","tag-343","tag-asm","tag-cpu","tag-mos6502","tag-rust","tag-345"],"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/11851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11851"}],"version-history":[{"count":2,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/11851\/revisions"}],"predecessor-version":[{"id":11855,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/11851\/revisions\/11855"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/media\/11849"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}