<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
               "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>6502Arch</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name="title" content="6502Arch"/>
<meta name="generator" content="Org-mode"/>
<meta name="generated" content="2014-09-25T21:09-0400"/>
<meta name="author" content="Alex Weisberger"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<style type="text/css">
 <!--/*--><![CDATA[/*><!--*/
  html { font-family: Times, serif; font-size: 12pt; }
  .title  { text-align: center; }
  .todo   { color: red; }
  .done   { color: green; }
  .tag    { background-color: #add8e6; font-weight:normal }
  .target { }
  .timestamp { color: #bebebe; }
  .timestamp-kwd { color: #5f9ea0; }
  .right  {margin-left:auto; margin-right:0px;  text-align:right;}
  .left   {margin-left:0px;  margin-right:auto; text-align:left;}
  .center {margin-left:auto; margin-right:auto; text-align:center;}
  p.verse { margin-left: 3% }
  pre {
	border: 1pt solid #AEBDCC;
	background-color: #F3F5F7;
	padding: 5pt;
	font-family: courier, monospace;
        font-size: 90%;
        overflow:auto;
  }
  table { border-collapse: collapse; }
  td, th { vertical-align: top;  }
  th.right  { text-align:center;  }
  th.left   { text-align:center;   }
  th.center { text-align:center; }
  td.right  { text-align:right;  }
  td.left   { text-align:left;   }
  td.center { text-align:center; }
  dt { font-weight: bold; }
  div.figure { padding: 0.5em; }
  div.figure p { text-align: center; }
  div.inlinetask {
    padding:10px;
    border:2px solid gray;
    margin:10px;
    background: #ffffcc;
  }
  textarea { overflow-x: auto; }
  .linenr { font-size:smaller }
  .code-highlighted {background-color:#ffff00;}
  .org-info-js_info-navigation { border-style:none; }
  #org-info-js_console-label { font-size:10px; font-weight:bold;
                               white-space:nowrap; }
  .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
                                 font-weight:bold; }
  /*]]>*/-->
</style>
<script type="text/javascript">
/*
@licstart  The following is the entire license notice for the
JavaScript code in this tag.

Copyright (C) 2012-2013 Free Software Foundation, Inc.

The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version.  The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.

As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.


@licend  The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
 function CodeHighlightOn(elem, id)
 {
   var target = document.getElementById(id);
   if(null != target) {
     elem.cacheClassElem = elem.className;
     elem.cacheClassTarget = target.className;
     target.className = "code-highlighted";
     elem.className   = "code-highlighted";
   }
 }
 function CodeHighlightOff(elem, id)
 {
   var target = document.getElementById(id);
   if(elem.cacheClassElem)
     elem.className = elem.cacheClassElem;
   if(elem.cacheClassTarget)
     target.className = elem.cacheClassTarget;
 }
/*]]>*///-->
</script>

</head>
<body>

<div id="preamble">

</div>

<div id="content">
<h1 class="title">6502Arch</h1>


<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Addressing modes</a>
<ul>
<li><a href="#sec-1-1">1.1 Absolute</a></li>
<li><a href="#sec-1-2">1.2 Zero-page</a></li>
<li><a href="#sec-1-3">1.3 Zero-page, X</a></li>
<li><a href="#sec-1-4">1.4 Zero-page, Y</a></li>
<li><a href="#sec-1-5">1.5 Immediate</a></li>
<li><a href="#sec-1-6">1.6 Relative</a></li>
<li><a href="#sec-1-7">1.7 Implicit</a></li>
<li><a href="#sec-1-8">1.8 Indirect</a></li>
<li><a href="#sec-1-9">1.9 Indexed Indirect</a></li>
<li><a href="#sec-1-10">1.10 Indirect Indexed</a></li>
</ul>
</li>
<li><a href="#sec-2">2 Stack</a></li>
<li><a href="#sec-3">3 Jumping</a></li>
</ul>
</div>
</div>

<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Addressing modes</h2>
<div class="outline-text-2" id="text-1">


<p>
has a 16-byte address bus.
</p>


</div>

<div id="outline-container-1-1" class="outline-3">
<h3 id="sec-1-1"><span class="section-number-3">1.1</span> Absolute</h3>
<div class="outline-text-3" id="text-1-1">


<ul>
<li>Full memory location specified, i.e. $c000
</li>
<li>65536 bytes of addressable memory (2<sup>16</sup> duyyy)
</li>
</ul>



</div>

</div>

<div id="outline-container-1-2" class="outline-3">
<h3 id="sec-1-2"><span class="section-number-3">1.2</span> Zero-page</h3>
<div class="outline-text-3" id="text-1-2">


<ul>
<li>1 byte adress, i.e. $c0, 256 bytes adressable
</li>
<li>faster, takes less program space
</li>
</ul>



</div>

</div>

<div id="outline-container-1-3" class="outline-3">
<h3 id="sec-1-3"><span class="section-number-3">1.3</span> Zero-page, X</h3>
<div class="outline-text-3" id="text-1-3">


<ul>
<li>Relative adressing <span style="text-decoration:underline;">within</span> the zero page. 
</li>
<li>Adds the value in reg. x with a 1-byte adress
</li>
<li>i.e. STA $a0, X
</li>
<li>Address wraps around if the addition is larger than 1 byte
</li>
</ul>



</div>

</div>

<div id="outline-container-1-4" class="outline-3">
<h3 id="sec-1-4"><span class="section-number-3">1.4</span> Zero-page, Y</h3>
<div class="outline-text-3" id="text-1-4">


<ul>
<li>equiv to zero-page, X but can only be used with LDX and STX
</li>
</ul>






</div>

</div>

<div id="outline-container-1-5" class="outline-3">
<h3 id="sec-1-5"><span class="section-number-3">1.5</span> Immediate</h3>
<div class="outline-text-3" id="text-1-5">


<ul>
<li>i.e. #$c0
</li>
<li>loads immedate number into register
</li>
</ul>



</div>

</div>

<div id="outline-container-1-6" class="outline-3">
<h3 id="sec-1-6"><span class="section-number-3">1.6</span> Relative</h3>
<div class="outline-text-3" id="text-1-6">


<ul>
<li>i.e. $c0, or label
</li>
</ul>



</div>

</div>

<div id="outline-container-1-7" class="outline-3">
<h3 id="sec-1-7"><span class="section-number-3">1.7</span> Implicit</h3>
<div class="outline-text-3" id="text-1-7">


<ul>
<li>when operation doesn't deal with memory
</li>
</ul>



</div>

</div>

<div id="outline-container-1-8" class="outline-3">
<h3 id="sec-1-8"><span class="section-number-3">1.8</span> Indirect</h3>
<div class="outline-text-3" id="text-1-8">


<ul>
<li>Uses absolute address to get another address
</li>
<li>first address is LSB of address, following byte is MSB
</li>
</ul>



</div>

</div>

<div id="outline-container-1-9" class="outline-3">
<h3 id="sec-1-9"><span class="section-number-3">1.9</span> Indexed Indirect</h3>
<div class="outline-text-3" id="text-1-9">


<ul>
<li>i.e. LDA ($c0, X)
</li>
<li>Take a zero page adress and add the value in reg. x to it, look up 2 byte address
</li>
</ul>




</div>

</div>

<div id="outline-container-1-10" class="outline-3">
<h3 id="sec-1-10"><span class="section-number-3">1.10</span> Indirect Indexed</h3>
<div class="outline-text-3" id="text-1-10">


<ul>
<li>zero page address dereferenced then Y is added to it
</li>
</ul>


</div>
</div>

</div>

<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Stack</h2>
<div class="outline-text-2" id="text-2">


<ul>
<li>lives in memory between $0100 and $01ff
</li>
</ul>


</div>

</div>

<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Jumping</h2>
<div class="outline-text-2" id="text-3">


<ul>
<li>JSR/RTS: Jump to subroutine and return from subroutine
</li>
</ul>


</div>
</div>
</div>

<div id="postamble">
<p class="date">Date: 2014-09-25T21:09-0400</p>
<p class="author">Author: Alex Weisberger</p>
<p class="creator"><a href="http://orgmode.org">Org</a> version 7.9.3f with <a href="http://www.gnu.org/software/emacs/">Emacs</a> version 24</p>
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>

</div>
</body>
</html>