<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.g4slv.info/dokuwiki/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>John&#039;s Vademecum - public:computers:6502</title>
        <description></description>
        <link>https://www.g4slv.info/dokuwiki/</link>
        <lastBuildDate>Tue, 14 Apr 2026 15:12:08 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=logo.png</url>
            <title>John&#039;s Vademecum</title>
            <link>https://www.g4slv.info/dokuwiki/</link>
        </image>
        <item>
            <title>6502 based homebrew computer</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:beginning</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;based_homebrew_computer&quot;&gt;6502 based homebrew computer&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
— &lt;em&gt;John Pumford-Green 17/09/22 12:29&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;
I started a new project last month. I&amp;#039;d been thinking of what to use my new &lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:calculator:info:dm16l_info&quot; class=&quot;wikilink1&quot; title=&quot;public:calculator:info:dm16l_info&quot; data-wiki-id=&quot;public:calculator:info:dm16l_info&quot;&gt;DM16L&lt;/a&gt; for, apart from simple Decimal to Hex to Binary conversions. 
&lt;/p&gt;

&lt;p&gt;
In a roundabout manner I found the work of &lt;a href=&quot;http://wilsonminesco.com/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://wilsonminesco.com/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;Garth Wilson&lt;/a&gt; and his excellent resources for 6502 hardware and assembly-language. Then I found the excellent YouTube videos of &lt;a href=&quot;https://eater.net/6502&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://eater.net/6502&quot; rel=&quot;ugc nofollow noopener&quot;&gt;Ben Eater&lt;/a&gt; and I was convinced that I needed to start building and learning 6502. I&amp;#039;ve always struggled with some aspects of software - it seems too abstract and not rooted in anything hard and physical. I found I enjoyed learning about machine code, and then Assembly, as it is tied very firmly to the hardware, you need to understand what happens on each clock cycle, where the data goes, how it can be manipulated. 
&lt;/p&gt;

&lt;p&gt;
And a DM16L calculator is right at home with the bit-twiddling needed to write code at the machine-code/assembly level. After all, the HP16 was originally designed for Programmers back when machine-code and bit-level programming was all there was!
&lt;/p&gt;

&lt;p&gt;
I got a Ben Eater 6502 kit and haven&amp;#039;t looked back.
&lt;/p&gt;

&lt;p&gt;
I plan eventually to fix a hardware design, once I&amp;#039;ve experimented on Vero-board, and perhaps design some PCBs and build it “properly”….
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:6502&amp;amp;do=showtag&amp;amp;tag=6502&quot; class=&quot;wikilink1&quot; title=&quot;tag:6502&quot; rel=&quot;tag&quot;&gt;6502&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;6502 based homebrew computer&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;based_homebrew_computer&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;16-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 24 Dec 2025 17:20:45 +0000</pubDate>
        </item>
        <item>
            <title>CA65 Setup</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:ca65_setup</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;ca65_setup&quot;&gt;CA65 Setup&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; Using CA65 in place of VASM &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;CA65 Setup&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;ca65_setup&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-77&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;support_files&quot;&gt;Support Files&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; firmware.cfg&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code&quot;&gt;MEMORY
{
# Zero page
  ZP: start = $00, size = $100, type = rw, define = yes;
  RAM: start = $200, size = $3dff define=yes;
  ROM:       start=$8000, size=$8000, type=ro, define=yes, fill=yes,   fillval=$00, file=%O;
}

SEGMENTS
{
  ZEROPAGE: load = ZP,             type = zp;
  BSS:        load=RAM,       type=bss, define=yes;
  
  CODE:      load=ROM,       type=ro,  define=yes;
  VECTORS:   load=ROM,       type=ro,  define=yes,   offset=$7ffa, optional=yes;
}&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; cc65.rules.mk&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code makefile&quot;&gt;include /home/gm4slv/6502/ca65src/tools.mk
&amp;nbsp;
BUILD_FOLDER=../build
TEMP_FOLDER=$(BUILD_FOLDER)/$(ROM_NAME)
ROM_FILE=$(BUILD_FOLDER)/$(ROM_NAME).bin
MAP_FILE=$(TEMP_FOLDER)/$(ROM_NAME).map
&amp;nbsp;
ASM_OBJECTS=$(ASM_SOURCES:%.s=$(TEMP_FOLDER)/%.o)
&amp;nbsp;
# Compile assembler sources
$(TEMP_FOLDER)/%.o: %.s
	@$(MKDIR_BINARY) $(MKDIR_FLAGS) $(TEMP_FOLDER)
	$(CA65_BINARY) $(CA65_FLAGS) -o $@ -l $(@:.o=.lst) $&amp;lt;
&amp;nbsp;
# Link ROM image
$(ROM_FILE): $(ASM_OBJECTS) $(FIRMWARE_CFG)
	@$(MKDIR_BINARY) $(MKDIR_FLAGS) $(BUILD_FOLDER)
	$(LD65_BINARY) $(LD65_FLAGS) -C $(FIRMWARE_CFG) -o $@ -m $(MAP_FILE) $(ASM_OBJECTS)
&amp;nbsp;
# Default target
all: $(ROM_FILE)
&amp;nbsp;
# Build and dump output
test: $(ROM_FILE)
	$(HEXDUMP_BINARY) $(HEXDUMP_FLAGS) $&amp;lt;
	$(MD5_BINARY) $&amp;lt;
&amp;nbsp;
# Clean build artifacts
clean:
	$(RM_BINARY) -f $(ROM_FILE) \
	$(MAP_FILE) \
	$(ASM_OBJECTS) \
	$(ASM_OBJECTS:%.o=%.lst)&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; tools.mk&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code&quot;&gt;# cc65 utilities used in this example
CA65_BINARY=ca65
CC65_BINARY=cc65
LD65_BINARY=ld65
AR65_BINARY=ar65

VASM_BINARY=vasm6502_oldstyle

CPU_FLAG=--cpu 65C02
ARCH_FLAG=-t none

CC65_FLAGS=$(CPU_FLAG) $(ARCH_FLAG) $(EXTRA_FLAGS) -O
CA65_FLAGS=$(CPU_FLAG) $(EXTRA_FLAGS)
LD65_FLAGS=
AR65_FLAGS=r

VASM_FLAGS=-Fbin -dotdir

# Hexdump is used for &amp;quot;testing&amp;quot; the ROM
HEXDUMP_BINARY=hexdump
HEXDUMP_FLAGS=-C

# Checksum generator
MD5_BINARY=md5sum

# Standard utilities (rm/mkdir)
RM_BINARY=rm
RM_FLAGS=-f
MKDIR_BINARY=mkdir
MKDIR_FLAGS=-p
CP_BINARY=cp
CP_FLAGS=-f
&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; project &lt;code&gt;makefile&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code&quot;&gt;CONF_DIR=/home/gm4slv/6502/ca65src

ROM_NAME=monitor_dev

ASM_SOURCES=monitor_dev.s

FIRMWARE_CFG=$(CONF_DIR)/firmware.cfg

include $(CONF_DIR)/cc65.rules.mk
&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Support Files&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;support_files&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;78-2289&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;a_typical_project&quot;&gt;A typical project&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;A typical project&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;a_typical_project&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:4,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;2290-2320&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit4&quot; id=&quot;monitor_devs_setup&quot;&gt;monitor_dev.s setup&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Put the asm source for the project in a folder (&lt;code&gt;/home/gm4slv/6502/ca65src/src/monitor/monitor_dev.s&lt;/code&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Put the &lt;code&gt;makefile&lt;/code&gt; in the same folder&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; put any source files to be included in the assembly process in the &lt;code&gt;includes&lt;/code&gt; folder&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;/home/gm4slv/6502/ca65src/src/includes/rtc.inc&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;/home/gm4slv/6502/ca65src/src/includes/ioports.inc&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; make a &lt;code&gt;build&lt;/code&gt; main folder &lt;code&gt;/home/gm4slv/6502/ca65src/build/&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
The general tree:
&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;/home/gm4slv/6502/ca65src/&lt;/code&gt; = base folder for ca65 projects aka &lt;code&gt;$CA65SRC&lt;/code&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; config files : firmware.cfg, cc65.rules.mk, tools.mk are in &lt;code&gt;$(CA65SRC)&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; sources directory : &lt;code&gt;src&lt;/code&gt; is in &lt;code&gt;$(CA65SRC)&lt;/code&gt; → &lt;code&gt;$(CA65SRC)/src&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; inside sources directory are &lt;code&gt;build&lt;/code&gt;, &lt;code&gt;includes&lt;/code&gt; and the individual project source directories. &lt;code&gt;$(CA65SRC)/src/build/&lt;/code&gt;, &lt;code&gt;$(CA65SRC)/src/includes/&lt;/code&gt; and (eg) &lt;code&gt;$(CA65SRC)/src/monitor/&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; inside each &lt;code&gt;project&lt;/code&gt; source directory are the asm source file eg &lt;code&gt;monitor_dev.s&lt;/code&gt; and a specific &lt;code&gt;makefile&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
To include sources from the &lt;code&gt;includes&lt;/code&gt; directory first define the variables, then the includes
:
&lt;/p&gt;

&lt;/div&gt;

&lt;h4 id=&quot;variables&quot;&gt;Variables&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;
define &lt;code&gt;zeropage&lt;/code&gt; variables:
&lt;/p&gt;
&lt;pre class=&quot;code asm&quot;&gt;&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;zeropage
&amp;nbsp;
DUMP_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;     &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
FLAGS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TOGGLE_TIME&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
CLOCK_LAST&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;       &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MESSAGE_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TICKS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
CENTISEC&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;         &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HUNDRED_HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;              &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_MINUTES&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MINUTES&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_SECONDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
SECONDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MEM_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
and define the other &lt;code&gt;.bss&lt;/code&gt; variables:
&lt;/p&gt;
&lt;pre class=&quot;code asm&quot;&gt;&lt;span class=&quot;kw5&quot;&gt;.bss&lt;/span&gt;
&amp;nbsp;
INKEY&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
ASCII&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TENS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HUNDREDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;         &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HEX&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;              &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
HEXB&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TEMP&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEMP2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Then the &lt;code&gt;includes&lt;/code&gt;
&lt;/p&gt;
&lt;pre class=&quot;code asm&quot;&gt;  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/ioports.inc&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/lcd.inc&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/getkey.inc&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/functions.inc&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/rtc.inc&amp;quot;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
make sure the &lt;code&gt;include&lt;/code&gt; files have appropriate &lt;code&gt;.code&lt;/code&gt; directive to put it in the right place when its all assembled together:
&lt;/p&gt;

&lt;p&gt;
e.g. in &lt;code&gt;functions.inc&lt;/code&gt;:
&lt;/p&gt;
&lt;pre class=&quot;code asm&quot;&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;code&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;          convert a binary number from Accumulator, in range 00000000 -&amp;gt; 11111111 ($00 to $FF)&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;          to its HEX number encode as ASCII -  using a simple lookup table and print it on LCD&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
bintohex&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  pha
  lsr
  lsr
  lsr
  lsr
  tax
  lda hexascii&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  jsr print_char
  pla
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0f&lt;/span&gt;
  tax
  lda hexascii&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  jsr print_char
  rts
&amp;nbsp;
hexascii&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;0123456789ABCDEF&amp;quot;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;monitor_dev.s setup&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;monitor_devs_setup&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:4,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;2321-5090&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit5&quot; id=&quot;monitor_devs_source_code&quot;&gt;monitor_dev.s source code&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;p&gt;&lt;a class=&quot;folder&quot; href=&quot;#folded_9ec384bf640d1bce7a945271c863c2a7_1&quot;&gt;monitor_dev.s &lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;folded hidden&quot; id=&quot;folded_9ec384bf640d1bce7a945271c863c2a7_1&quot;&gt;&lt;pre class=&quot;code asm&quot;&gt;&amp;nbsp;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;localchar &lt;span class=&quot;st0&quot;&gt;&#039;@&#039;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;.SEGMENT &amp;quot;ZEROPAGE&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;zeropage
&amp;nbsp;
DUMP_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;     &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
FLAGS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TOGGLE_TIME&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
CLOCK_LAST&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;       &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MESSAGE_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TICKS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
CENTISEC&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;         &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HUNDRED_HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;              &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_MINUTES&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MINUTES&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_SECONDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
SECONDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MEM_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;.SEGMENT &amp;quot;BSS&amp;quot;&lt;/span&gt;
&lt;span class=&quot;kw5&quot;&gt;.bss&lt;/span&gt;
&amp;nbsp;
INKEY&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
ASCII&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TENS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HUNDREDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;         &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HEX&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;              &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
HEXB&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TEMP&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEMP2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/ioports.inc&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/lcd.inc&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/getkey.inc&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/functions.inc&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/rtc.inc&amp;quot;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;code&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
reset&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  ldx #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;ff
  txs
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;cli&lt;/span&gt;      &lt;span class=&quot;co1&quot;&gt;; interrupts ON&lt;/span&gt;
&amp;nbsp;
  jsr via_1_init &lt;span class=&quot;co1&quot;&gt;; set-up VIA_1 for LCD/Keypad &lt;/span&gt;
  jsr lcd_init &lt;span class=&quot;co1&quot;&gt;; set-up 4-bit mode &lt;/span&gt;
  jsr lcd_start &lt;span class=&quot;co1&quot;&gt;; set-up various features of lcd &lt;/span&gt;
&amp;nbsp;
init_variables&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  stz TICKS
  stz TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  stz TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
  stz TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
  stz DUMP_POINTER
  stz DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  stz MESSAGE_POINTER
  stz MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  stz TOGGLE_TIME
  stz CLOCK_LAST
  stz CENTISEC
  stz FLAGS
  stz SECONDS
  stz TEN_SECONDS
  stz MINUTES
  stz HRS
  stz TEN_HRS
  stz TEN_MINUTES
  stz HUNDRED_HRS
  stz TEMP
  stz TEMP2
  stz TENS  
  stz MEM_POINTER
  stz MEM_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;; test then clear RAM between &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; $0200 - $3FFF - avoids the ZP and STACK areas&lt;/span&gt;
&amp;nbsp;
ram_clear&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;02&lt;/span&gt;            &lt;span class=&quot;co1&quot;&gt;; start at $0200&lt;/span&gt;
  sta MEM_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
loop_ram&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;AA
  sta &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;FF
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;AA
  bne mem_fail_1
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;55&lt;/span&gt;
  sta &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;FF
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;55&lt;/span&gt;
  bne mem_fail_2
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  iny
  beq next_page
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; loop_ram
next_page&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda MEM_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt;
  beq done_ram
  sta MEM_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; loop_ram
&amp;nbsp;
&amp;nbsp;
done_ram&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  lda #&amp;lt;mem_pass_msg
  sta MESSAGE_POINTER
  lda #&amp;gt;mem_pass_msg
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print 
  smb5 FLAGS
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
mem_fail_1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&amp;lt;mem_fail_msg_1
  sta MESSAGE_POINTER
  lda #&amp;gt;mem_fail_msg_1
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
mem_fail_2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&amp;lt;mem_fail_msg_2
  sta MESSAGE_POINTER
  lda #&amp;gt;mem_fail_msg_2
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; go straight to MONITOR at startup&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  lda #&amp;lt;splash&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  sta MESSAGE_POINTER&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  lda #&amp;gt;splash&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  sta MESSAGE_POINTER + 1&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  jsr new_address&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; main loop&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  wai
  jsr check_flags
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;; FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
check_flags&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  bbs0 FLAGS&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt; update_block_address
  bbs5 FLAGS&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt; clock_time
  &lt;span class=&quot;co1&quot;&gt;; check other flags... other actions....&lt;/span&gt;
  rts
&amp;nbsp;
update_block_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  sec
  lda TICKS
  sbc TOGGLE_TIME
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;
  bcc exit_update_block
  jsr block_address
  lda TICKS
  sta TOGGLE_TIME
&amp;nbsp;
exit_update_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
clock_time&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  sec
  lda TICKS
  sbc CLOCK_LAST
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;
  bcc exit_clock
&amp;nbsp;
  jsr lcd_cursor_off
&amp;nbsp;
  jsr lcd_home
&amp;nbsp;
  lda HUNDRED_HRS
  jsr bintoascii
  lda TEN_HRS
  jsr bintoascii
  lda HRS
  jsr bintoascii
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;:&#039;&lt;/span&gt;
  jsr print_char
  lda TEN_MINUTES
  jsr bintoascii
  lda MINUTES
  jsr bintoascii
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;:&#039;&lt;/span&gt;
  jsr print_char
  lda TEN_SECONDS
  jsr bintoascii
  lda SECONDS
  jsr bintoascii
  lda #&lt;span class=&quot;st0&quot;&gt;&#039; &#039;&lt;/span&gt;
  jsr print_char
  lda TICKS
  sta CLOCK_LAST
exit_clock&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      update screen when new memory location is selected&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
new_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr lcd_clear
&amp;nbsp;
  jsr lcd_cursor_on
&amp;nbsp;
&amp;nbsp;
print_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;$&#039;&lt;/span&gt;
  jsr print_char
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr bintohex
  lda DUMP_POINTER
  jsr bintohex
&amp;nbsp;
  lda #&lt;span class=&quot;st0&quot;&gt;&#039; &#039;&lt;/span&gt;
  jsr print_char
&amp;nbsp;
print_data&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
&amp;nbsp;
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  jsr bintohex
  lda #&lt;span class=&quot;st0&quot;&gt;&#039; &#039;&lt;/span&gt;
  jsr print_char
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  jsr print_char
&amp;nbsp;
message_end&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr print   &lt;span class=&quot;co1&quot;&gt;; add second line (cursor) after re-writing the top line&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; display 8 bytes of data for a &amp;quot;block&amp;quot; of memory&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
block_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr lcd_clear
&amp;nbsp;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
&amp;nbsp;
print_block_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;$&#039;&lt;/span&gt;
  jsr print_char
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr bintohex
  lda DUMP_POINTER
  jsr bintohex
&amp;nbsp;
  jsr lcd_line_2
&amp;nbsp;
print_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  jsr bintohex
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  iny
  cpy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;08&lt;/span&gt;
  bne print_block
&amp;nbsp;
&amp;nbsp;
block_message_end&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; re-draw line 2 cursor&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
print&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr lcd_line_2
&amp;nbsp;
  ldy #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;
line1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MESSAGE_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  beq end_print
  jsr print_char
  iny
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; line1
&amp;nbsp;
end_print&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Monitor function - decrement the selected address &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
decrement_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  sec
  lda DUMP_POINTER
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;01&lt;/span&gt;
  sta DUMP_POINTER
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
dec_ok&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Monitor function - increment the selected address &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
increment_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  lda DUMP_POINTER
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;01&lt;/span&gt;
  sta DUMP_POINTER
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  bcc inc_ok
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
inc_ok&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Monitor function - increment the selected block of  addresses by 8 &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
increment_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  lda DUMP_POINTER
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;08&lt;/span&gt;
  sta DUMP_POINTER
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Monitor function - decrement the selected block of  addresses by 8 &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
decrement_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  sec
  lda DUMP_POINTER
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;08&lt;/span&gt;
  sta DUMP_POINTER
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;          use last 4 entered ASCII characters from the keypad and convert &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;          them to TWO 8-bit binary bytes in RAM&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
ascii_byte&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
  jsr ascii_bin
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  asl
  asl
  asl
  asl
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
&amp;nbsp;
  lda ASCII
&amp;nbsp;
  jsr ascii_bin
  ora &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
&amp;nbsp;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
  jsr ascii_bin
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  asl
  asl
  asl
  asl
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
&amp;nbsp;
  jsr ascii_bin
  ora &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    toggle the display/update of Clock on each appropriate keypress&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
show_clock&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  bbs5 FLAGS&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt; reset_bit5
  smb5 FLAGS
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_show_clock
&amp;nbsp;
reset_bit5&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rmb5 FLAGS
&amp;nbsp;
exit_show_clock&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rts
  &lt;span class=&quot;co1&quot;&gt;;jmp debounce&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    toggle the automatic update view of the &amp;quot;8-byte memory block&amp;quot;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
show_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  bbs0 FLAGS&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt; reset_bit0
  smb0 FLAGS
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_show_block
&amp;nbsp;
reset_bit0&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rmb0 FLAGS
&amp;nbsp;
exit_show_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rts
  &lt;span class=&quot;co1&quot;&gt;;jmp debounce&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;debounce:&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  ldx #$ff&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  ldy #$ff&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;delay:&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  nop&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  dex&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  bne delay&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  dey&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  bne delay&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  rts  &lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;; INTERRUPT HANDLERS ;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      CB1 : reset &amp;amp; restart timer&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
cb1_handler&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  stz HUNDRED_HRS
  stz TEN_HRS
  stz TEN_MINUTES
  stz TEN_SECONDS
  stz HRS
  stz MINUTES
  stz SECONDS
&amp;nbsp;
  smb5 FLAGS
&amp;nbsp;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;     CB2 : lap-time pause timer&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
cb2_handler&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr show_clock
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;                    MONITOR / KEYPAD &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
keypad_handler&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr get_key     &lt;span class=&quot;co1&quot;&gt;; READs from PORTA which also re-sets VIA&#039;s Interrupt flag&lt;/span&gt;
  sta INKEY       &lt;span class=&quot;co1&quot;&gt;; put the ASCII value of input into RAM ( $00 ) &lt;/span&gt;
&amp;nbsp;
  lda PORTB_1       &lt;span class=&quot;co1&quot;&gt;; check for SHIFT/INSTRUCTION button&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%10000000&lt;/span&gt;
  beq check_keypress &lt;span class=&quot;co1&quot;&gt;; done this way to get around the limit in size of branch jumps....&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; handle_new_char
&amp;nbsp;
check_keypress&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda INKEY       
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; choose action of &amp;quot;SHIFTed&amp;quot; key-press&lt;/span&gt;
check_a&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;A&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; move up one memory address and display contents&lt;/span&gt;
  bne check_b     
  jsr increment_address
  jsr new_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_b&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;B&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; move down one memory address and display contents&lt;/span&gt;
  bne check_c
  jsr decrement_address
  jsr new_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_c&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;C&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; return to MONITOR&lt;/span&gt;
  bne check_d
  rmb5 FLAGS
  jsr lcd_clear
  lda #&amp;lt;splash
  sta MESSAGE_POINTER
  lda #&amp;gt;splash
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
  jsr new_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_d&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;D&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; move monitor to entered 4-digit memory address&lt;/span&gt;
  bne check_e
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  sta DUMP_POINTER
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr new_address
  jsr print
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_e&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;E&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; insert (POKE) byte of data in to current memory address, then increment to next address&lt;/span&gt;
  bne check_f
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  jsr increment_address
  jsr new_address
  jsr print
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_f&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;F&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; show 8-byte wide block of memory&lt;/span&gt;
  bne check_1
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  sta DUMP_POINTER
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr block_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;1&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; show/auto-update clock&lt;/span&gt;
  bne check_3
  jsr lcd_clear
  lda #&amp;lt;emt
  sta MESSAGE_POINTER
  lda #&amp;gt;emt
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print
  smb5 FLAGS
&amp;nbsp;
  &lt;span class=&quot;co1&quot;&gt;;jsr show_clock&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_3&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;3&#039;&lt;/span&gt;
  bne check_6
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  jsr increment_block
  jsr block_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_6&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;6&#039;&lt;/span&gt;
  bne check_9
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  jsr decrement_block
  jsr block_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_9&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;9&#039;&lt;/span&gt;
  bne check_4
  jsr show_block
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_4&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;4&#039;&lt;/span&gt;
  bne check_5
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  sta HEXB
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta HEXB &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr byte_to_hex
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_5&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;5&#039;&lt;/span&gt;
  bne exit_key_irq
  jsr &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;3F00
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
&amp;nbsp;
handle_new_char&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
  sta ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
  lda ASCII
  sta ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  lda INKEY       &lt;span class=&quot;co1&quot;&gt;; get the new ASCII keypress value and... &lt;/span&gt;
  sta ASCII
  jsr print_char  &lt;span class=&quot;co1&quot;&gt;; and print it on LCD&lt;/span&gt;
&amp;nbsp;
  jsr ascii_byte  &lt;span class=&quot;co1&quot;&gt;; convert the rolling 4-byte ASCII character data into two binary bytes&lt;/span&gt;
&amp;nbsp;
exit_key_irq&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
  jsr scan  &lt;span class=&quot;co1&quot;&gt;; re-enable keypad&lt;/span&gt;
&amp;nbsp;
  rts
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&amp;nbsp;
nmi&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rti
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    interrupt is triggered by HIGH edge on VIA CA1 pin&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;     PORTA low nibble (keypad columns) inputs are diode ORed to CA1&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
irq&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;; put registers on the stack while handling the IRQ&lt;/span&gt;
  pha
  phx
  phy
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;  find responsible hardware&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;  Is it VIA_1?&lt;/span&gt;
&amp;nbsp;
  lda IFR_1   &lt;span class=&quot;co1&quot;&gt;; if IFR_1 has Bit7 set (ie sign=NEGATIVE) then it IS the source of the interrupt&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;bpl&lt;/span&gt; next_device &lt;span class=&quot;co1&quot;&gt;; if it&#039;s not set (ie sign=POSITIVE) then branch to test the next possible device&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; IFR Flags&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; B7  B6  B5  B4  B3  B2  B1  B0&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; IRQ TI1 TI2 CB1 CB2 SR CA1 CA2&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; Interrupt source is found by sequentially shifting IFR bit left to put bit-of-interest into the CARRY place&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; and then branching based on whether CARRY is SET or not&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; Only add tests for IRQ sources in use, and adjust the ASLs in each test as necessary&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&amp;nbsp;
test_timer1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl           &lt;span class=&quot;co1&quot;&gt;; shift IFR left twice puts the TI1 bit into CARRY....&lt;/span&gt;
  asl
  bcc test_cb1  &lt;span class=&quot;co1&quot;&gt;; carry clear = next test&lt;/span&gt;
  bit T1CL_1      &lt;span class=&quot;co1&quot;&gt;; clear not clear = handle the TIMER interrupt&lt;/span&gt;
  jsr rtc
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_irq
&amp;nbsp;
test_cb1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl
  asl
  bcc test_cb2
  bit PORTB_1
  jsr cb1_handler
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_irq
&amp;nbsp;
test_cb2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl
  bcc test_ca1
  bit PORTB_1
  jsr cb2_handler
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_irq
&amp;nbsp;
test_ca1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl           &lt;span class=&quot;co1&quot;&gt;; shift CA1 bit into the CARRY bit &amp;amp; test&lt;/span&gt;
  asl
  bcc exit_irq        &lt;span class=&quot;co1&quot;&gt;; carry clear = leave&lt;/span&gt;
  jsr keypad_handler  &lt;span class=&quot;co1&quot;&gt;; carry not clear = handle the CA1 interrupt (keypad)&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_irq
&amp;nbsp;
&amp;nbsp;
next_device&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
exit_irq&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  ply
  plx
  pla
&amp;nbsp;
&amp;nbsp;
  rti
&amp;nbsp;
emt&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;hhh mm ss  MET&amp;quot;&lt;/span&gt;
splash&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;cmon&amp;gt; &amp;quot;&lt;/span&gt;
error_message&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;Not Decimal&amp;quot;&lt;/span&gt;
mem_pass_msg&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;RAM Test Pass&amp;quot;&lt;/span&gt;
mem_fail_msg_1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;RAM Test 1 Fail&amp;quot;&lt;/span&gt;
mem_fail_msg_2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;RAM Test 2 Fail&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; Reset/IRQ vectors&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;segment&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;VECTORS&amp;quot;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; nmi
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; reset
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; irq&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;a class=&quot;folder&quot; href=&quot;#folded_9ec384bf640d1bce7a945271c863c2a7_2&quot;&gt;ioports.inc &lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;folded hidden&quot; id=&quot;folded_9ec384bf640d1bce7a945271c863c2a7_2&quot;&gt;&lt;pre class=&quot;code asm&quot;&gt;  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;code&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; VIA_1 Port addresses&lt;/span&gt;
VIA_1     = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6000&lt;/span&gt;
PORTB_1   = VIA_1
PORTA_1   = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
DDRB_1    = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
DDRA_1    = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
T1CL_1    = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
T1CH_1    = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;
T1LL_1    = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;
T1LH_1    = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;
T2CL_1    = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;
T2CH_1    = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;
SR_1      = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
ACR_1     = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;11&lt;/span&gt;
PCR_1     = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;12&lt;/span&gt;
IFR_1     = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;13&lt;/span&gt;
IER_1     = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;
PORTA_NO_HS_1 = VIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; VIA_2 Port addresses&lt;/span&gt;
VIA_2     = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;5000&lt;/span&gt;
PORTB_2   = VIA_2
PORTA_2   = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
DDRB_2    = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
DDRA_2    = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
T1CL_2    = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
T1CH_2    = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;
T1LL_2    = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;
T1LH_2    = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;
T2CL_2    = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;
T2CH_2    = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;
SR_2      = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
ACR_2     = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;11&lt;/span&gt;
PCR_2     = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;12&lt;/span&gt;
IFR_2     = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;13&lt;/span&gt;
IER_2     = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;
PORTA_NO_HS_2 = VIA_2 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; VIA_3 Port addresses&lt;/span&gt;
VIA_3     = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4800&lt;/span&gt;
PORTB_3   = VIA_3
PORTA_3   = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
DDRB_3    = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
DDRA_3    = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
T1CL_3    = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
T1CH_3    = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;5&lt;/span&gt;
T1LL_3    = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;
T1LH_3    = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;7&lt;/span&gt;
T2CL_3    = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;8&lt;/span&gt;
T2CH_3    = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;
SR_3      = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
ACR_3     = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;11&lt;/span&gt;
PCR_3     = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;12&lt;/span&gt;
IFR_3     = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;13&lt;/span&gt;
IER_3     = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;14&lt;/span&gt;
PORTA_NO_HS_3 = VIA_3 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;15&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; ACIA_1 Port Addresses&lt;/span&gt;
ACIA_1    = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4400&lt;/span&gt;
S_TXRX_1  = ACIA_1      &lt;span class=&quot;co1&quot;&gt;; TXD / RXD&lt;/span&gt;
S_STA_1   = ACIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; Status&lt;/span&gt;
S_COM_1   = ACIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; Command&lt;/span&gt;
S_CON_1   = ACIA_1 &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; Control&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
via_1_init&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  lda #&lt;span class=&quot;nu0&quot;&gt;%01000000&lt;/span&gt;
  sta ACR_1
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;0E
  sta T1CL_1
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;27&lt;/span&gt;
  sta T1CH_1
&amp;nbsp;
  lda #&lt;span class=&quot;nu0&quot;&gt;%11011010&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; T1, CA1 active&lt;/span&gt;
  sta IER_1
&amp;nbsp;
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;01&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;;  CA1 active high-transition &lt;/span&gt;
  sta PCR_1
&amp;nbsp;
  lda #&lt;span class=&quot;nu0&quot;&gt;%01111111&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set all pins on port B to output except BIT 7 which is used for &amp;quot;SHIFT/INSTRUCTION&amp;quot;  button&lt;/span&gt;
  sta DDRB_1
  lda #&lt;span class=&quot;nu0&quot;&gt;%11110000&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set low-nibble pins on port A to input and high-nibble pins to output, for keypad&lt;/span&gt;
  sta DDRA_1
&amp;nbsp;
  rts&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;a class=&quot;folder&quot; href=&quot;#folded_9ec384bf640d1bce7a945271c863c2a7_3&quot;&gt;lcd.inc &lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;folded hidden&quot; id=&quot;folded_9ec384bf640d1bce7a945271c863c2a7_3&quot;&gt;&lt;pre class=&quot;code asm&quot;&gt;&amp;nbsp;
&amp;nbsp;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;code&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; LCD Command masks&lt;/span&gt;
E  = &lt;span class=&quot;nu0&quot;&gt;%01000000&lt;/span&gt;
RW = &lt;span class=&quot;nu0&quot;&gt;%00100000&lt;/span&gt;
RS = &lt;span class=&quot;nu0&quot;&gt;%00010000&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;                              LCD Functions &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
lcd_start&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00101000&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set 4-bit mode; 2-line display; 5x8 font&lt;/span&gt;
  jsr lcd_instruction
  jsr lcd_entry_mode
  jsr lcd_cursor_off
  jsr lcd_clear
  rts
&amp;nbsp;
lcd_entry_mode&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000110&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Increment and shift cursor; don&#039;t shift display&lt;/span&gt;
  jsr lcd_instruction
  rts
&amp;nbsp;
lcd_home&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000010&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; cursor HOME&lt;/span&gt;
  jsr lcd_instruction
  rts
&amp;nbsp;
lcd_clear&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000001&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Clear display&lt;/span&gt;
  jsr lcd_instruction
  rts
&amp;nbsp;
lcd_cursor_off&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00001100&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Display on; cursor off; blink off&lt;/span&gt;
  jsr lcd_instruction
  rts
&amp;nbsp;
lcd_cursor_on&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Display on; cursor on; blink on&lt;/span&gt;
  jsr lcd_instruction
  rts
&amp;nbsp;
lcd_line_2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%10101001&lt;/span&gt;
  jsr lcd_instruction
  rts
&amp;nbsp;
lcd_wait&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  pha
  lda #&lt;span class=&quot;nu0&quot;&gt;%01110000&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; LCD data is input (don&#039;t change MSB BIT7, it has to stay ZERO for SHIFT Button input)&lt;/span&gt;
  sta DDRB_1
lcdbusy&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #RW
  sta PORTB_1
  lda #&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;RW | E&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  sta PORTB_1
  lda PORTB_1     &lt;span class=&quot;co1&quot;&gt;; Read high nibble&lt;/span&gt;
  pha             &lt;span class=&quot;co1&quot;&gt;; and put on stack since it has the busy flag&lt;/span&gt;
  lda #RW
  sta PORTB_1
  lda #&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;RW | E&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  sta PORTB_1
  lda PORTB_1       &lt;span class=&quot;co1&quot;&gt;; Read low nibble&lt;/span&gt;
  pla             &lt;span class=&quot;co1&quot;&gt;; Get high nibble off stack&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001000&lt;/span&gt;
  bne lcdbusy
&amp;nbsp;
  lda #RW
  sta PORTB_1
  lda #&lt;span class=&quot;nu0&quot;&gt;%01111111&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; LCD data is output (don&#039;t change MSB BIT7, it has to stay ZERO for SHIFT Buttion input)&lt;/span&gt;
  sta DDRB_1
  pla
  rts
&amp;nbsp;
lcd_init&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000010&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set 4-bit mode : DO ONCE AT POWER UP&lt;/span&gt;
  sta PORTB_1
  ora #E
  sta PORTB_1
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt;
  sta PORTB_1
  rts
&amp;nbsp;
lcd_instruction&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr lcd_wait
  pha
  lsr
  lsr
  lsr
  lsr            &lt;span class=&quot;co1&quot;&gt;; Send high 4 bits&lt;/span&gt;
  sta PORTB_1
  ora #E         &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTB_1
  eor #E         &lt;span class=&quot;co1&quot;&gt;; Clear E bit&lt;/span&gt;
  sta PORTB_1
  pla
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Send low 4 bits&lt;/span&gt;
  sta PORTB_1
  ora #E         &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTB_1
  eor #E         &lt;span class=&quot;co1&quot;&gt;; Clear E bit&lt;/span&gt;
  sta PORTB_1
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;   &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;        PRINT Characters on LCD - an ASCII value in Accumulator &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;        is printed on the display&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
print_char&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr lcd_wait
  pha
  lsr
  lsr
  lsr
  lsr             &lt;span class=&quot;co1&quot;&gt;; Send high 4 bits&lt;/span&gt;
  ora #RS         &lt;span class=&quot;co1&quot;&gt;; Set RS&lt;/span&gt;
  sta PORTB_1
  ora #E          &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTB_1
  eor #E          &lt;span class=&quot;co1&quot;&gt;; Clear E bit&lt;/span&gt;
  sta PORTB_1
  pla
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; Send low 4 bits&lt;/span&gt;
  ora #RS         &lt;span class=&quot;co1&quot;&gt;; Set RS&lt;/span&gt;
  sta PORTB_1
  ora #E          &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTB_1
  eor #E          &lt;span class=&quot;co1&quot;&gt;; Clear E bit&lt;/span&gt;
  sta PORTB_1
  rts&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;a class=&quot;folder&quot; href=&quot;#folded_9ec384bf640d1bce7a945271c863c2a7_4&quot;&gt;getkey.inc &lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;folded hidden&quot; id=&quot;folded_9ec384bf640d1bce7a945271c863c2a7_4&quot;&gt;&lt;pre class=&quot;code asm&quot;&gt;&amp;nbsp;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;code&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      READ THE 4x4 keypad using  VIA_1 PORTA &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Accumulator holds the ASCII value of the pressed key when it returns&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
get_key&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
readKeypad&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  ldx #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;04&lt;/span&gt;        &lt;span class=&quot;co1&quot;&gt;; Row 4 - counting down&lt;/span&gt;
  ldy #&lt;span class=&quot;nu0&quot;&gt;%10000000&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;;&lt;/span&gt;
ScanRow&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  sty PORTA_1
  lda PORTA_1
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; mask off keypad input - only low 4 (keypad column) bits are read&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  bne Row_Found   &lt;span class=&quot;co1&quot;&gt;; non-zero means a row output has been connected via a switch to a column input&lt;/span&gt;
  dex             &lt;span class=&quot;co1&quot;&gt;; zero means it hasn&#039;t been found, so check next row down&lt;/span&gt;
  tya
  lsr
  tay
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001000&lt;/span&gt;
  bne ScanRow
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;ff
  rts
Row_Found&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  stx TEMP &lt;span class=&quot;co1&quot;&gt;; store row&lt;/span&gt;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;ff
FindCol&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  iny
  lsr
  bcc FindCol
  tya
  asl
  asl  &lt;span class=&quot;co1&quot;&gt;; col * 4&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; TEMP &lt;span class=&quot;co1&quot;&gt;; add row &lt;/span&gt;
  tax
  lda keypad_array&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  rts
&amp;nbsp;
&amp;nbsp;
keypad_array&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;?DCBAF9630852E741&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  set ROW keypad outputs high as a source for triggering interrupt when a key is pressed&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
scan&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  ldy #&lt;span class=&quot;nu0&quot;&gt;%11110000&lt;/span&gt;
  sty PORTA_1
  rts&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;a class=&quot;folder&quot; href=&quot;#folded_9ec384bf640d1bce7a945271c863c2a7_5&quot;&gt;functions.inc &lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;folded hidden&quot; id=&quot;folded_9ec384bf640d1bce7a945271c863c2a7_5&quot;&gt;&lt;pre class=&quot;code asm&quot;&gt;&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;.zeropage&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;MESSAGE_POINTER = $20&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  .org $8000&lt;/span&gt;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;code&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;          convert a binary number from Accumulator, in range 00000000 -&amp;gt; 11111111 ($00 to $FF)&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;          to its HEX number encode as ASCII -  using a simple lookup table and print it on LCD&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
bintohex&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  pha
  lsr
  lsr
  lsr
  lsr
  tax
  lda hexascii&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  jsr print_char
  pla
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0f&lt;/span&gt;
  tax
  lda hexascii&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  jsr print_char
  rts
&amp;nbsp;
hexascii&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;0123456789ABCDEF&amp;quot;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    convert a binary (hex) value in Accumulator into&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    its ASCII equivalent character in decimal 0-99 and print it&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    this converts hex/binary numbers from the RTC into human readable&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    decimal for display on clock&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
bintoascii&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
  bmi single_figure
  asl
  tax
  lda binascii&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  jsr print_char
&amp;nbsp;
  inx
&amp;nbsp;
  lda binascii&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  jsr print_char
  rts
&amp;nbsp;
single_figure&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl
  tax
  inx
  lda binascii&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  jsr print_char
  rts
&amp;nbsp;
&amp;nbsp;
binascii&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;00010203040506070809&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;10111213141516171819&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;20212223242526272829&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;30313233343536373839&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;40414243444546474849&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;50515253545556575859&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;60616263646566676869&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;70717273747576777879&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;80818283848586878889&amp;quot;&lt;/span&gt;
          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;90919293949596979899&amp;quot;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Convert a decimal number entered at keypad into its&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      HEX equivalent and display&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
byte_to_hex&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr lcd_clear
  lda HEXB &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0f&lt;/span&gt;
  jsr bintohex
  lda HEXB
  jsr bintohex
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;d&#039;&lt;/span&gt;
  jsr print_char
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;=&#039;&lt;/span&gt;
  jsr print_char
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;$&#039;&lt;/span&gt;
  jsr print_char
&amp;nbsp;
  lda HEXB &lt;span class=&quot;co1&quot;&gt;; lo byte&lt;/span&gt;
  pha
  lsr
  lsr
  lsr
  lsr
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;bpl&lt;/span&gt; error
  jsr mult10
  sta TENS
  pla
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; UNITS&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;bpl&lt;/span&gt; print_error
&lt;span class=&quot;co1&quot;&gt;;  jsr mult10&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; TENS
  sta HEX
&amp;nbsp;
  lda HEXB &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; hi byte&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;bpl&lt;/span&gt; print_error
  jsr mult10
  jsr mult10 &lt;span class=&quot;co1&quot;&gt;; hundreds&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; HEX
&amp;nbsp;
  jsr bintohex
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_byte_to_hex
&amp;nbsp;
error&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  pla
print_error&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&amp;lt;error_message
  sta MESSAGE_POINTER
  lda #&amp;gt;error_message
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print
  &lt;span class=&quot;co1&quot;&gt;;jsr lcd_cursor_off&lt;/span&gt;
  rts
&amp;nbsp;
exit_byte_to_hex&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr lcd_line_2
&amp;nbsp;
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  (A * 8) + (A * 2) = A * 10 &lt;/span&gt;
&amp;nbsp;
mult10&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  pha
  asl
  asl
  asl
  sta TEMP2 &lt;span class=&quot;co1&quot;&gt;; A*8&lt;/span&gt;
  pla
  asl      &lt;span class=&quot;co1&quot;&gt;; A*2&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; TEMP2 &lt;span class=&quot;co1&quot;&gt;; A*10&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; Convert the encoded ASCII character representing a hex digit to its actual binary value.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; e.g. Letter &amp;quot;A&amp;quot; in ASCII is $41 (0100001) but its &amp;quot;numerical&amp;quot; value as a hex digit is &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; 10 ($0A = 10d = %00001010). &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; We convert &amp;quot;A&amp;quot; in ASCII ($41) to a byte of numerical value 10 by subtracting $37&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; $41 - $37 = $0A (in decimal 65 - 55 = 10) and the result is a byte 00001010&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; The same is done for all characters representing upper case letters.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; Numbers are handled differently according to their place on the ASCII table.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; The ASCII representation of &amp;quot;9&amp;quot; is $39 (00111001) and to get a byte with a value of 9 we can simply&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; AND it with a mask of 00001111 to save only the lower 4 bits.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
ascii_bin&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;41&lt;/span&gt;
  bmi ascii_bin_num   &lt;span class=&quot;co1&quot;&gt;; a CMP with $41, from a number character ($30 - $39), will set the negative flag&lt;/span&gt;
                      &lt;span class=&quot;co1&quot;&gt;; and the conversion is done by ANDing with $0F&lt;/span&gt;
&amp;nbsp;
ascii_bin_letter&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;    &lt;span class=&quot;co1&quot;&gt;; otherwise treat as a letter (A -&amp;gt; F) and the conversion is done by&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;                &lt;span class=&quot;co1&quot;&gt;; subtracting $37&lt;/span&gt;
  sec
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;37&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; end_ascii_bin
&amp;nbsp;
ascii_bin_num&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt;
&amp;nbsp;
end_ascii_bin&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;co1&quot;&gt;; Accumulator holds the numerical version of the ASCII character supplied&lt;/span&gt;
  rts&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;a class=&quot;folder&quot; href=&quot;#folded_9ec384bf640d1bce7a945271c863c2a7_6&quot;&gt;rtc.inc &lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;folded hidden&quot; id=&quot;folded_9ec384bf640d1bce7a945271c863c2a7_6&quot;&gt;&lt;pre class=&quot;code asm&quot;&gt;&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;code&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;                          RTC / Jiffy Tick&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
rtc&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;  RTC stores ticks at 10ms intervals into a 4-byte (32 bit) value&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  as each byte rolls over the next one is incremented&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  on a tick that doesn&#039;t roll over the TIME OF DAY &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  is updated&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; TICKS
  bne inc_MET
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  bne inc_MET
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
  bne inc_MET
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  Every time it&#039;s called we increment the &amp;quot;hundredths of a second&amp;quot; byte&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  When there&#039;s been 100 x 10ms (i.e. 1 second) we increment the seconds&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  When SECONDS reaches 60 we increment MINUTES and reset SECONDS to zero...&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  etc... for HOURS, DAYS etc.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  days/months years are handled too - although probably moot&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;  this routine comes from http://wilsonminesco.com/6502interrupts/#2.1&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
inc_MET&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; CENTISEC
  lda CENTISEC
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;100&lt;/span&gt;
  bmi end_MET
  stz CENTISEC
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; SECONDS
  lda SECONDS
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
  bmi end_MET
  stz SECONDS
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; TEN_SECONDS
&amp;nbsp;
  lda TEN_SECONDS
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;
  bmi end_MET
  stz TEN_SECONDS
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; MINUTES
  lda MINUTES
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
  bmi end_MET
  stz MINUTES
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; TEN_MINUTES
  lda TEN_MINUTES
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;6&lt;/span&gt;
  bmi end_MET
  stz TEN_MINUTES
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; HRS
  lda HRS
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
  bmi end_MET
  stz HRS
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; TEN_HRS
  lda TEN_HRS
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
  bmi end_MET
  stz TEN_HRS
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; HUNDRED_HRS
&amp;nbsp;
end_MET&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
— &lt;em&gt;John Pumford-Green 05/09/22 14:23&lt;/em&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;monitor_dev.s source code&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;monitor_devs_source_code&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:8,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;5091-28628&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit6&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:14,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;28629-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 30 Dec 2025 09:55:07 +0000</pubDate>
        </item>
        <item>
            <title>Datasheets</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:datasheets</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;datasheets&quot;&gt;Datasheets&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; Datasheets for parts used in my 6502 project &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Datasheets&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;datasheets&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-94&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;cpu&quot;&gt;CPU&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:w65c02s.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:w65c02s.pdf (1.6 MB)&quot;&gt; WD 65C02&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;CPU&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;cpu&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;95-163&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;eeprom&quot;&gt;EEPROM&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:28c256.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:28c256.pdf (348.9 KB)&quot;&gt; 28C256 EEPROM&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;EEPROM&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;eeprom&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;164-239&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;ram&quot;&gt;RAM&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:hm62256b.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:hm62256b.pdf (154.5 KB)&quot;&gt; 62256 RAM&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;RAM&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;ram&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;240-310&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;lcd&quot;&gt;LCD&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:hd44780.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:hd44780.pdf (322.1 KB)&quot;&gt; Generic LCD&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;LCD&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;lcd&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;311-382&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit6&quot; id=&quot;via&quot;&gt;VIA&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:w65c22.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:w65c22.pdf (727.4 KB)&quot;&gt; WDC 65C22 VIA &lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;VIA&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;via&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;383-456&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit7&quot; id=&quot;acia&quot;&gt;ACIA&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:rockwell_r65c51.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:rockwell_r65c51.pdf (1.5 MB)&quot;&gt; Rockwell 65C51 &lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:w65c51n.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:w65c51n.pdf (1.7 MB)&quot;&gt; WDC 65C51 &lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;ACIA&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;acia&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:7,&amp;quot;range&amp;quot;:&amp;quot;457-596&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit8&quot; id=&quot;rtc&quot;&gt;RTC&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:ds1306.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:ds1306.pdf (371.3 KB)&quot;&gt; Maxim DS1306&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;RTC&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;rtc&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:8,&amp;quot;range&amp;quot;:&amp;quot;597-669&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit9&quot; id=&quot;various_support_chips&quot;&gt;Various support chips&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:74hc00.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:74hc00.pdf (79.2 KB)&quot;&gt; 74HC00 Quad NAND&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:ne555.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:ne555.pdf (1.2 MB)&quot;&gt; NE555 &lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:max232.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:max232.pdf (1.4 MB)&quot;&gt; MAX232 TTL-RS232&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:computers:6502:sn74ls21.pdf&quot; class=&quot;media mediafile mf_pdf&quot; title=&quot;public:computers:6502:sn74ls21.pdf (756.6 KB)&quot;&gt; 74LS21 dual 4-input AND &lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
— &lt;em&gt;John Pumford-Green 24/09/22 13:25&lt;/em&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Various support chips&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;various_support_chips&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:9,&amp;quot;range&amp;quot;:&amp;quot;670-985&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit10&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:6502&amp;amp;do=showtag&amp;amp;tag=6502&quot; class=&quot;wikilink1&quot; title=&quot;tag:6502&quot; rel=&quot;tag&quot;&gt;6502&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:10,&amp;quot;range&amp;quot;:&amp;quot;986-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 30 Dec 2025 10:10:35 +0000</pubDate>
        </item>
        <item>
            <title>Goals : 6502</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:goals</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;goals6502&quot;&gt;Goals : 6502&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; What do I want to achieve  &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Goals : 6502&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;goals6502&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-78&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;phase_one&quot;&gt;Phase One&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;del&gt;Follow Ben Eater&amp;#039;s 6502 Tutorials and become familiar with the mechanism of programming the 6502&lt;/del&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;del&gt;Adapt some of the code to gain experience at modifying 6502 assembly code&lt;/del&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; make some mini code projects to get experience of handling input, output and interrupts&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Phase One&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;phase_one&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;79-395&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;phase_two&quot;&gt;Phase Two&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;del&gt;add key-pad for simple user input&lt;/del&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;del&gt;write simple &lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:monitor&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:monitor&quot; data-wiki-id=&quot;public:computers:6502:monitor&quot;&gt;&amp;#039;&amp;#039;monitor&amp;#039;&amp;#039;&lt;/a&gt; firmware to gain experience with user i/o etc.&lt;/del&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; add serial port hardware and enough software to send/receive RS232 to/from a terminal&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; write routines for LCD display of RS232 data received&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; investigate using additional VIA port(s) to interact with external hardware&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;del&gt;refine hardware design and move OFF breadboard onto more permanent hardware (vero/perf board etc)&lt;/del&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; investigate parsing and reacting to input via RS232, beyond simply receive/transmit and display - interact with the machine!&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Phase Two&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;phase_two&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;396-1061&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;phase_three&quot;&gt;Phase Three&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; specific projects - e.g. DSC, Selcall etc&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; keep an open mind and keep learning new techniques….&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; this phase will largely depend on what is learned earlier….&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
— &lt;em&gt;John Pumford-Green 15/08/22 09:23&lt;/em&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Phase Three&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;phase_three&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;1062-1304&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:6502&amp;amp;do=showtag&amp;amp;tag=6502&quot; class=&quot;wikilink1&quot; title=&quot;tag:6502&quot; rel=&quot;tag&quot;&gt;6502&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;1305-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sun, 02 Mar 2025 11:21:25 +0000</pubDate>
        </item>
        <item>
            <title>Links</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:links</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;links&quot;&gt;Links&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; Useful Links &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Links&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;links&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-57&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;you_tube&quot;&gt;You Tube&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://www.youtube.com/c/BenEater/featured&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://www.youtube.com/c/BenEater/featured&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://www.youtube.com/c/BenEater/featured&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;You Tube&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;you_tube&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;58-133&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;general&quot;&gt;General&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://forum.6502.org/index.php&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://forum.6502.org/index.php&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://forum.6502.org/index.php&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://6502.org/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://6502.org/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://6502.org/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://eater.net/6502&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://eater.net/6502&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://eater.net/6502&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://cx16.dk/6502/algorithms.html&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://cx16.dk/6502/algorithms.html&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://cx16.dk/6502/algorithms.html&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;General&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;general&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;134-297&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;personal_project_blogs_pages&quot;&gt;Personal Project/Blogs Pages&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://wilsonminesco.com/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://wilsonminesco.com/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://wilsonminesco.com/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://mansfield-devine.com/speculatrix/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://mansfield-devine.com/speculatrix/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://mansfield-devine.com/speculatrix/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://sbc.bcstechnology.net/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://sbc.bcstechnology.net/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://sbc.bcstechnology.net/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://projects.drogon.net/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://projects.drogon.net/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://projects.drogon.net/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://www.grappendorf.net/projects/6502-home-computer/#table-of-contents&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://www.grappendorf.net/projects/6502-home-computer/#table-of-contents&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://www.grappendorf.net/projects/6502-home-computer/#table-of-contents&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://www.chrisward.org.uk/6502/intro.shtml&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://www.chrisward.org.uk/6502/intro.shtml&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://www.chrisward.org.uk/6502/intro.shtml&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://searle.wales/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://searle.wales/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://searle.wales/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://6502sbc.blogspot.com/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://6502sbc.blogspot.com/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://6502sbc.blogspot.com/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;https://sbc.rictor.org/home.html&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://sbc.rictor.org/home.html&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://sbc.rictor.org/home.html&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://danceswithferrets.org/geekblog/?page_id=915&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://danceswithferrets.org/geekblog/?page_id=915&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://danceswithferrets.org/geekblog/?page_id=915&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.suppertime.co.uk/blogmywiki/2021/03/6502-breadboard-computer-part-7-working-monitor/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://www.suppertime.co.uk/blogmywiki/2021/03/6502-breadboard-computer-part-7-working-monitor/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://www.suppertime.co.uk/blogmywiki/2021/03/6502-breadboard-computer-part-7-working-monitor/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Personal Project\/Blogs Pages&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;personal_project_blogs_pages&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;298-908&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;tools&quot;&gt;Tools&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://sun.hasenbraten.de/vasm/index.php?view=main&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://sun.hasenbraten.de/vasm/index.php?view=main&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://sun.hasenbraten.de/vasm/index.php?view=main&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
— &lt;em&gt;John Pumford-Green 13/08/22 07:10&lt;/em&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Tools&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;tools&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;909-1033&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit6&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;1034-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 30 Dec 2025 09:55:07 +0000</pubDate>
        </item>
        <item>
            <title>Monitor</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:monitor</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;monitor&quot;&gt;Monitor&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; My first attempts at a Monitor program &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Monitor&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;monitor&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-85&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;features&quot;&gt;Features&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; RAM is tested at power-up- writing and checking with 2 different bit patterns, then zeroing RAM if successful (avoiding ZeroPage and Stack areas)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; display a “Mission Elapsed Time” counter and reset to zero with a button press&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; step forward and backward through memory locations&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; display hex data and its ASCII equivalent for each memory location (&lt;code&gt;PEEK&lt;/code&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; enter a 2-digit hex value and write it into the currently selected memory location (&lt;code&gt;POKE&lt;/code&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; enter a 4-digit hex value and move to that chosen memory address&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; display an 8-byte block of memory data on one line, starting at the currently selected address&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; display an 8-byte block of memory data and have it auto-refresh at 1 second intervals&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; move to a pre-determined address ($3F00) in memory and begin executing code from that point&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; this allows machine code to be entered directly from $3F00 onwards and then executed. It&amp;#039;s cumbersome, but makes the machine programmable!&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
Data/addresses are entered on the keypad. Commands are entered by pressing the “SHIFT/INSTRUCT” button at the same time as one of the pre-set instructions.
&lt;/p&gt;
&lt;div class=&quot;table sectionedit3&quot;&gt;&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;1&lt;/kbd&gt; &lt;code&gt;MET CLOCK&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  2  &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;3&lt;/kbd&gt; &lt;code&gt;BLOCK UP&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col3&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;A&lt;/kbd&gt; &lt;code&gt;UP&lt;/code&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot;&gt;  &lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;4&lt;/kbd&gt; &lt;code&gt;dec→hex&lt;/code&gt;  &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  &lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;5&lt;/kbd&gt; &lt;code&gt;GO&lt;/code&gt;  &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;6&lt;/kbd&gt; &lt;code&gt;BLOCK DOWN&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col3&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;B&lt;/kbd&gt; &lt;code&gt;DOWN&lt;/code&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot;&gt;  7  &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  8  &lt;/td&gt;&lt;td class=&quot;col2 leftalign&quot;&gt; &lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;9&lt;/kbd&gt; &lt;code&gt;auto-update Block view&lt;/code&gt;  &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;C&lt;/kbd&gt; &lt;code&gt;CLS&lt;/code&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;td class=&quot;col0&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;E&lt;/kbd&gt; &lt;code&gt;POKE&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  0  &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;F&lt;/kbd&gt; &lt;code&gt;BLOCK&lt;/code&gt;&lt;/td&gt;&lt;td class=&quot;col3&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;D&lt;/kbd&gt; &lt;code&gt;PEEK&lt;/code&gt;&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;table&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;table&amp;quot;,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;1233-1648&amp;quot;} --&gt;&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;1&lt;/kbd&gt; = &lt;code&gt;MET Clock&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;2&lt;/kbd&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;3&lt;/kbd&gt; = &lt;code&gt;Display the next 8-byte block up&lt;/code&gt; - aka “page Up”&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;A&lt;/kbd&gt; = &lt;code&gt;Memory selected = UP one&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;4&lt;/kbd&gt; = &lt;code&gt;Convert an entered decimal number to its HEX equivalent&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;5&lt;/kbd&gt; = &lt;code&gt;GO!&lt;/code&gt; (jsr $3F00)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;6&lt;/kbd&gt; = &lt;code&gt;Display the next 8-byte block down&lt;/code&gt;  - aka “page Down”&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;B&lt;/kbd&gt; = &lt;code&gt;Memory selected = DOWN one&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;7&lt;/kbd&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;8&lt;/kbd&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;9&lt;/kbd&gt; = &lt;code&gt;Update 8-byte block view at 1-second intervals&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;C&lt;/kbd&gt; = &lt;code&gt;Clear Screen&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;E&lt;/kbd&gt; = &lt;code&gt;Enter data byte into selected memory address&lt;/code&gt; - aka &lt;code&gt;POKE&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;0&lt;/kbd&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;F&lt;/kbd&gt; = &lt;code&gt;Display an 8-byte block of data, starting from current memory address&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;kbd class=&quot;__keyboard&quot;&gt;Shift&lt;/kbd&gt;+&lt;kbd class=&quot;__keyboard&quot;&gt;D&lt;/kbd&gt; = &lt;code&gt;move to the new memory location provided in last 4 digits entered&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Features&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;features&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;86-2573&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;monitor_devs&quot;&gt;monitor_dev.s&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;code asm&quot;&gt;&amp;nbsp;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;localchar &lt;span class=&quot;st0&quot;&gt;&#039;@&#039;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;.SEGMENT &amp;quot;ZEROPAGE&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;zeropage
&amp;nbsp;
DUMP_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;     &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
FLAGS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TOGGLE_TIME&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
CLOCK_LAST&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;       &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MESSAGE_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TICKS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
CENTISEC&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;         &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HUNDRED_HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HRS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;              &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_MINUTES&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MINUTES&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEN_SECONDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
SECONDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
MEM_POINTER&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;.SEGMENT &amp;quot;BSS&amp;quot;&lt;/span&gt;
&lt;span class=&quot;kw5&quot;&gt;.bss&lt;/span&gt;
&amp;nbsp;
INKEY&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
ASCII&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TENS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HUNDREDS&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;         &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
HEX&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;              &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
HEXB&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
TEMP&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;             &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
TEMP2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;            &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;res &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/ioports.inc&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/lcd.inc&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/getkey.inc&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/functions.inc&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;include &lt;span class=&quot;st0&quot;&gt;&amp;quot;../includes/rtc.inc&amp;quot;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;code&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
reset&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  ldx #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;ff
  txs
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;cli&lt;/span&gt;      &lt;span class=&quot;co1&quot;&gt;; interrupts ON&lt;/span&gt;
&amp;nbsp;
  jsr via_1_init &lt;span class=&quot;co1&quot;&gt;; set-up VIA_1 for LCD/Keypad &lt;/span&gt;
  jsr lcd_init &lt;span class=&quot;co1&quot;&gt;; set-up 4-bit mode &lt;/span&gt;
  jsr lcd_start &lt;span class=&quot;co1&quot;&gt;; set-up various features of lcd &lt;/span&gt;
&amp;nbsp;
init_variables&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  stz TICKS
  stz TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  stz TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
  stz TICKS &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
  stz DUMP_POINTER
  stz DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  stz MESSAGE_POINTER
  stz MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  stz TOGGLE_TIME
  stz CLOCK_LAST
  stz CENTISEC
  stz FLAGS
  stz SECONDS
  stz TEN_SECONDS
  stz MINUTES
  stz HRS
  stz TEN_HRS
  stz TEN_MINUTES
  stz HUNDRED_HRS
  stz TEMP
  stz TEMP2
  stz TENS  
  stz MEM_POINTER
  stz MEM_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;; test then clear RAM between &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; $0200 - $3FFF - avoids the ZP and STACK areas&lt;/span&gt;
&amp;nbsp;
ram_clear&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;02&lt;/span&gt;            &lt;span class=&quot;co1&quot;&gt;; start at $0200&lt;/span&gt;
  sta MEM_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
loop_ram&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;AA
  sta &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;FF
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;AA
  bne mem_fail_1
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;55&lt;/span&gt;
  sta &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;FF
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;55&lt;/span&gt;
  bne mem_fail_2
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MEM_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  iny
  beq next_page
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; loop_ram
next_page&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda MEM_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt;
  beq done_ram
  sta MEM_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; loop_ram
&amp;nbsp;
&amp;nbsp;
done_ram&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  lda #&amp;lt;mem_pass_msg
  sta MESSAGE_POINTER
  lda #&amp;gt;mem_pass_msg
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print 
  smb5 FLAGS
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
mem_fail_1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&amp;lt;mem_fail_msg_1
  sta MESSAGE_POINTER
  lda #&amp;gt;mem_fail_msg_1
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
mem_fail_2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&amp;lt;mem_fail_msg_2
  sta MESSAGE_POINTER
  lda #&amp;gt;mem_fail_msg_2
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; go straight to MONITOR at startup&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  lda #&amp;lt;splash&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  sta MESSAGE_POINTER&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  lda #&amp;gt;splash&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  sta MESSAGE_POINTER + 1&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  jsr new_address&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; main loop&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  wai
  jsr check_flags
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;; FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
check_flags&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  bbs0 FLAGS&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt; update_block_address
  bbs5 FLAGS&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt; clock_time
  &lt;span class=&quot;co1&quot;&gt;; check other flags... other actions....&lt;/span&gt;
  rts
&amp;nbsp;
update_block_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  sec
  lda TICKS
  sbc TOGGLE_TIME
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;
  bcc exit_update_block
  jsr block_address
  lda TICKS
  sta TOGGLE_TIME
&amp;nbsp;
exit_update_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
clock_time&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  sec
  lda TICKS
  sbc CLOCK_LAST
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt;
  bcc exit_clock
&amp;nbsp;
  jsr lcd_cursor_off
&amp;nbsp;
  jsr lcd_home
&amp;nbsp;
  lda HUNDRED_HRS
  jsr bintoascii
  lda TEN_HRS
  jsr bintoascii
  lda HRS
  jsr bintoascii
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;:&#039;&lt;/span&gt;
  jsr print_char
  lda TEN_MINUTES
  jsr bintoascii
  lda MINUTES
  jsr bintoascii
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;:&#039;&lt;/span&gt;
  jsr print_char
  lda TEN_SECONDS
  jsr bintoascii
  lda SECONDS
  jsr bintoascii
  lda #&lt;span class=&quot;st0&quot;&gt;&#039; &#039;&lt;/span&gt;
  jsr print_char
  lda TICKS
  sta CLOCK_LAST
exit_clock&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      update screen when new memory location is selected&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
new_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr lcd_clear
&amp;nbsp;
  jsr lcd_cursor_on
&amp;nbsp;
&amp;nbsp;
print_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;$&#039;&lt;/span&gt;
  jsr print_char
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr bintohex
  lda DUMP_POINTER
  jsr bintohex
&amp;nbsp;
  lda #&lt;span class=&quot;st0&quot;&gt;&#039; &#039;&lt;/span&gt;
  jsr print_char
&amp;nbsp;
print_data&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
&amp;nbsp;
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  jsr bintohex
  lda #&lt;span class=&quot;st0&quot;&gt;&#039; &#039;&lt;/span&gt;
  jsr print_char
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  jsr print_char
&amp;nbsp;
message_end&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr print   &lt;span class=&quot;co1&quot;&gt;; add second line (cursor) after re-writing the top line&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; display 8 bytes of data for a &amp;quot;block&amp;quot; of memory&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
block_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr lcd_clear
&amp;nbsp;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
&amp;nbsp;
print_block_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;st0&quot;&gt;&#039;$&#039;&lt;/span&gt;
  jsr print_char
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr bintohex
  lda DUMP_POINTER
  jsr bintohex
&amp;nbsp;
  jsr lcd_line_2
&amp;nbsp;
print_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  jsr bintohex
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  iny
  cpy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;08&lt;/span&gt;
  bne print_block
&amp;nbsp;
&amp;nbsp;
block_message_end&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; re-draw line 2 cursor&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
print&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr lcd_line_2
&amp;nbsp;
  ldy #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;
line1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;MESSAGE_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  beq end_print
  jsr print_char
  iny
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; line1
&amp;nbsp;
end_print&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Monitor function - decrement the selected address &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
decrement_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  sec
  lda DUMP_POINTER
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;01&lt;/span&gt;
  sta DUMP_POINTER
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
dec_ok&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Monitor function - increment the selected address &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
increment_address&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  lda DUMP_POINTER
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;01&lt;/span&gt;
  sta DUMP_POINTER
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  bcc inc_ok
  &lt;span class=&quot;kw1&quot;&gt;inc&lt;/span&gt; DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
inc_ok&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Monitor function - increment the selected block of  addresses by 8 &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
increment_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  lda DUMP_POINTER
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;08&lt;/span&gt;
  sta DUMP_POINTER
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      Monitor function - decrement the selected block of  addresses by 8 &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
decrement_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  sec
  lda DUMP_POINTER
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;08&lt;/span&gt;
  sta DUMP_POINTER
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  lda DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sbc #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;          use last 4 entered ASCII characters from the keypad and convert &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;          them to TWO 8-bit binary bytes in RAM&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
ascii_byte&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
  jsr ascii_bin
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  asl
  asl
  asl
  asl
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
&amp;nbsp;
  lda ASCII
&amp;nbsp;
  jsr ascii_bin
  ora &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
&amp;nbsp;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
  jsr ascii_bin
  &lt;span class=&quot;kw1&quot;&gt;clc&lt;/span&gt;
  asl
  asl
  asl
  asl
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
&amp;nbsp;
  jsr ascii_bin
  ora &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  rts
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    toggle the display/update of Clock on each appropriate keypress&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
show_clock&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  bbs5 FLAGS&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt; reset_bit5
  smb5 FLAGS
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_show_clock
&amp;nbsp;
reset_bit5&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rmb5 FLAGS
&amp;nbsp;
exit_show_clock&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rts
  &lt;span class=&quot;co1&quot;&gt;;jmp debounce&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    toggle the automatic update view of the &amp;quot;8-byte memory block&amp;quot;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
show_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  bbs0 FLAGS&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt; reset_bit0
  smb0 FLAGS
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_show_block
&amp;nbsp;
reset_bit0&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rmb0 FLAGS
&amp;nbsp;
exit_show_block&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  rts
  &lt;span class=&quot;co1&quot;&gt;;jmp debounce&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;debounce:&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  ldx #$ff&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  ldy #$ff&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;delay:&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  nop&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  dex&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  bne delay&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  dey&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  bne delay&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;  rts  &lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;; INTERRUPT HANDLERS ;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;      CB1 : reset &amp;amp; restart timer&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
cb1_handler&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  stz HUNDRED_HRS
  stz TEN_HRS
  stz TEN_MINUTES
  stz TEN_SECONDS
  stz HRS
  stz MINUTES
  stz SECONDS
&amp;nbsp;
  smb5 FLAGS
&amp;nbsp;
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;     CB2 : lap-time pause timer&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
cb2_handler&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr show_clock
  rts
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;                    MONITOR / KEYPAD &lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
keypad_handler&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
  jsr get_key     &lt;span class=&quot;co1&quot;&gt;; READs from PORTA which also re-sets VIA&#039;s Interrupt flag&lt;/span&gt;
  sta INKEY       &lt;span class=&quot;co1&quot;&gt;; put the ASCII value of input into RAM ( $00 ) &lt;/span&gt;
&amp;nbsp;
  lda PORTB_1       &lt;span class=&quot;co1&quot;&gt;; check for SHIFT/INSTRUCTION button&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%10000000&lt;/span&gt;
  beq check_keypress &lt;span class=&quot;co1&quot;&gt;; done this way to get around the limit in size of branch jumps....&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; handle_new_char
&amp;nbsp;
check_keypress&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda INKEY       
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; choose action of &amp;quot;SHIFTed&amp;quot; key-press&lt;/span&gt;
check_a&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;A&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; move up one memory address and display contents&lt;/span&gt;
  bne check_b     
  jsr increment_address
  jsr new_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_b&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;B&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; move down one memory address and display contents&lt;/span&gt;
  bne check_c
  jsr decrement_address
  jsr new_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_c&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;C&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; return to MONITOR&lt;/span&gt;
  bne check_d
  rmb5 FLAGS
  jsr lcd_clear
  lda #&amp;lt;splash
  sta MESSAGE_POINTER
  lda #&amp;gt;splash
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
  jsr new_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_d&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;D&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; move monitor to entered 4-digit memory address&lt;/span&gt;
  bne check_e
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  sta DUMP_POINTER
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr new_address
  jsr print
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_e&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;E&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; insert (POKE) byte of data in to current memory address, then increment to next address&lt;/span&gt;
  bne check_f
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  sta &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;DUMP_POINTER&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;y
  jsr increment_address
  jsr new_address
  jsr print
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_f&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;F&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; show 8-byte wide block of memory&lt;/span&gt;
  bne check_1
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  sta DUMP_POINTER
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta DUMP_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr block_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;1&#039;&lt;/span&gt;
  &lt;span class=&quot;co1&quot;&gt;; show/auto-update clock&lt;/span&gt;
  bne check_3
  jsr lcd_clear
  lda #&amp;lt;emt
  sta MESSAGE_POINTER
  lda #&amp;gt;emt
  sta MESSAGE_POINTER &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr print
  smb5 FLAGS
&amp;nbsp;
  &lt;span class=&quot;co1&quot;&gt;;jsr show_clock&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_3&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;3&#039;&lt;/span&gt;
  bne check_6
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  jsr increment_block
  jsr block_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_6&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;6&#039;&lt;/span&gt;
  bne check_9
  ldy #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
  jsr decrement_block
  jsr block_address
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_9&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;9&#039;&lt;/span&gt;
  bne check_4
  jsr show_block
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_4&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;4&#039;&lt;/span&gt;
  bne check_5
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt;
  sta HEXB
  lda &lt;span class=&quot;kw6&quot;&gt;BYTE&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta HEXB &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  jsr byte_to_hex
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
check_5&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;cmp&lt;/span&gt; #&lt;span class=&quot;st0&quot;&gt;&#039;5&#039;&lt;/span&gt;
  bne exit_key_irq
  jsr &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;3F00
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_key_irq
&amp;nbsp;
&amp;nbsp;
handle_new_char&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
  sta ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
  lda ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  sta ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
  lda ASCII
  sta ASCII &lt;span class=&quot;sy1&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  lda INKEY       &lt;span class=&quot;co1&quot;&gt;; get the new ASCII keypress value and... &lt;/span&gt;
  sta ASCII
  jsr print_char  &lt;span class=&quot;co1&quot;&gt;; and print it on LCD&lt;/span&gt;
&amp;nbsp;
  jsr ascii_byte  &lt;span class=&quot;co1&quot;&gt;; convert the rolling 4-byte ASCII character data into two binary bytes&lt;/span&gt;
&amp;nbsp;
exit_key_irq&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
  jsr scan  &lt;span class=&quot;co1&quot;&gt;; re-enable keypad&lt;/span&gt;
&amp;nbsp;
  rts
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&amp;nbsp;
nmi&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  rti
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;    interrupt is triggered by HIGH edge on VIA CA1 pin&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;     PORTA low nibble (keypad columns) inputs are diode ORed to CA1&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&amp;nbsp;
irq&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;; put registers on the stack while handling the IRQ&lt;/span&gt;
  pha
  phx
  phy
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;  find responsible hardware&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;  Is it VIA_1?&lt;/span&gt;
&amp;nbsp;
  lda IFR_1   &lt;span class=&quot;co1&quot;&gt;; if IFR_1 has Bit7 set (ie sign=NEGATIVE) then it IS the source of the interrupt&lt;/span&gt;
  &lt;span class=&quot;kw4&quot;&gt;bpl&lt;/span&gt; next_device &lt;span class=&quot;co1&quot;&gt;; if it&#039;s not set (ie sign=POSITIVE) then branch to test the next possible device&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; IFR Flags&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; B7  B6  B5  B4  B3  B2  B1  B0&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; IRQ TI1 TI2 CB1 CB2 SR CA1 CA2&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; Interrupt source is found by sequentially shifting IFR bit left to put bit-of-interest into the CARRY place&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; and then branching based on whether CARRY is SET or not&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;; Only add tests for IRQ sources in use, and adjust the ASLs in each test as necessary&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/span&gt;
&amp;nbsp;
test_timer1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl           &lt;span class=&quot;co1&quot;&gt;; shift IFR left twice puts the TI1 bit into CARRY....&lt;/span&gt;
  asl
  bcc test_cb1  &lt;span class=&quot;co1&quot;&gt;; carry clear = next test&lt;/span&gt;
  bit T1CL_1      &lt;span class=&quot;co1&quot;&gt;; clear not clear = handle the TIMER interrupt&lt;/span&gt;
  jsr rtc
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_irq
&amp;nbsp;
test_cb1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl
  asl
  bcc test_cb2
  bit PORTB_1
  jsr cb1_handler
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_irq
&amp;nbsp;
test_cb2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl
  bcc test_ca1
  bit PORTB_1
  jsr cb2_handler
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_irq
&amp;nbsp;
test_ca1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  asl           &lt;span class=&quot;co1&quot;&gt;; shift CA1 bit into the CARRY bit &amp;amp; test&lt;/span&gt;
  asl
  bcc exit_irq        &lt;span class=&quot;co1&quot;&gt;; carry clear = leave&lt;/span&gt;
  jsr keypad_handler  &lt;span class=&quot;co1&quot;&gt;; carry not clear = handle the CA1 interrupt (keypad)&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; exit_irq
&amp;nbsp;
&amp;nbsp;
next_device&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
exit_irq&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  ply
  plx
  pla
&amp;nbsp;
&amp;nbsp;
  rti
&amp;nbsp;
emt&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;hhh mm ss  MET&amp;quot;&lt;/span&gt;
splash&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;cmon&amp;gt; &amp;quot;&lt;/span&gt;
error_message&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;Not Decimal&amp;quot;&lt;/span&gt;
mem_pass_msg&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;RAM Test Pass&amp;quot;&lt;/span&gt;
mem_fail_msg_1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;RAM Test 1 Fail&amp;quot;&lt;/span&gt;
mem_fail_msg_2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;RAM Test 2 Fail&amp;quot;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; Reset/IRQ vectors&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;segment&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;VECTORS&amp;quot;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; nmi
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; reset
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; irq&lt;/pre&gt;

&lt;p&gt;
See &lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:ca65_setup&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:ca65_setup&quot; data-wiki-id=&quot;public:computers:6502:ca65_setup&quot;&gt;CA65 Setup&lt;/a&gt; for the details of the additional &lt;code&gt;includes&lt;/code&gt; files needed to assemble the code.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;monitor_dev.s&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;monitor_devs&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;2574-15074&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;notes&quot;&gt;Notes&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
The idea of basic features came from 
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.suppertime.co.uk/blogmywiki/2021/03/6502-breadboard-computer-part-7-working-monitor/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://www.suppertime.co.uk/blogmywiki/2021/03/6502-breadboard-computer-part-7-working-monitor/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://www.suppertime.co.uk/blogmywiki/2021/03/6502-breadboard-computer-part-7-working-monitor/&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.youtube.com/watch?v=TK2JIZREgYM&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://www.youtube.com/watch?v=TK2JIZREgYM&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://www.youtube.com/watch?v=TK2JIZREgYM&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
My version is similar, but different.
&lt;/p&gt;

&lt;p&gt;
The Keypad scanning routine came from :
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.asinine.nz/2022-05-01/6502-part4/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://www.asinine.nz/2022-05-01/6502-part4/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://www.asinine.nz/2022-05-01/6502-part4/&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
I wanted to write a routine to poll the 16-key pad and needed some hints. I understood what was needed, but was uncertain about the best way to achieve the correct results, so I looked at various bits of code online. When I worked through this snippet I understood what it was doing, and could perhaps in future come up with a similar working solution myself. It&amp;#039;s all a matter of studying, understanding and then using the new knowledge. In the meantime this snippet of code works well enough that I see no point in re-inventing the wheel, so I&amp;#039;m just using it verbatim.
&lt;/p&gt;

&lt;p&gt;
To allow key presses to trigger interrupts I have to set the 4 row-outputs (PA4-PA7) high and then diode-OR the switch&amp;#039;s column lines, feeding this OR&amp;#039;d signal in to CA1 on the 65c22. Pressing any key pulls CA1 high, triggering an interrupt, and the interrupt routine then calls the keypad reading function itself which then determines which key was pressed.
&lt;/p&gt;

&lt;p&gt;
— &lt;em&gt;John Pumford-Green 27/08/22 09:24&lt;/em&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Notes&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;notes&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:1,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;15075-16393&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit6&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:6502&amp;amp;do=showtag&amp;amp;tag=6502&quot; class=&quot;wikilink1&quot; title=&quot;tag:6502&quot; rel=&quot;tag&quot;&gt;6502&lt;/a&gt;,
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:assembly&amp;amp;do=showtag&amp;amp;tag=assembly&quot; class=&quot;wikilink1&quot; title=&quot;tag:assembly&quot; rel=&quot;tag&quot;&gt;assembly&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:1,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;16394-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sun, 07 Apr 2024 23:13:33 +0000</pubDate>
        </item>
        <item>
            <title>Photos</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:photos</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;photos&quot;&gt;Photos&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; Some pics of the project &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Photos&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;photos&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-70&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;version_1_-_veroboard&quot;&gt;Version 1 - veroboard&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;plugin_wrap_start&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;0-&amp;quot;} --&gt;&lt;div class=&quot;group wrap__dark plugin_wrap&quot;&gt;&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;plugin_wrap_start&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;0-&amp;quot;} --&gt;&lt;div class=&quot;wrap_third wrap_column wrap__dark plugin_wrap&quot;&gt;
&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/detail.php?id=public%3Acomputers%3A6502%3Aphotos&amp;amp;media=public:computers:6502:img_20220929_081619_102_1.jpg&quot; class=&quot;media&quot; title=&quot;public:computers:6502:img_20220929_081619_102_1.jpg&quot;&gt;&lt;img src=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?w=400&amp;amp;tok=ae48b2&amp;amp;media=public:computers:6502:img_20220929_081619_102_1.jpg&quot; class=&quot;media&quot; loading=&quot;lazy&quot; alt=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Mark 1 in all its glory
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/detail.php?id=public%3Acomputers%3A6502%3Aphotos&amp;amp;media=public:computers:6502:img_20220929_081651_164_1.jpg&quot; class=&quot;media&quot; title=&quot;public:computers:6502:img_20220929_081651_164_1.jpg&quot;&gt;&lt;img src=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?w=400&amp;amp;tok=815b71&amp;amp;media=public:computers:6502:img_20220929_081651_164_1.jpg&quot; class=&quot;media&quot; loading=&quot;lazy&quot; alt=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Twin LCD displays. 2-line for RTC and Uptime. 4 Line for monitor.
&lt;/p&gt;
&lt;/div&gt;&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;plugin_wrap_end&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;0-&amp;quot;} --&gt;&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;plugin_wrap_start&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;secid&amp;quot;:7,&amp;quot;range&amp;quot;:&amp;quot;0-&amp;quot;} --&gt;&lt;div class=&quot;wrap_third wrap_column wrap__dark plugin_wrap&quot;&gt;
&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/detail.php?id=public%3Acomputers%3A6502%3Aphotos&amp;amp;media=public:computers:6502:img_20220929_081729_937_1.jpg&quot; class=&quot;media&quot; title=&quot;public:computers:6502:img_20220929_081729_937_1.jpg&quot;&gt;&lt;img src=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?w=400&amp;amp;tok=20408e&amp;amp;media=public:computers:6502:img_20220929_081729_937_1.jpg&quot; class=&quot;media&quot; loading=&quot;lazy&quot; alt=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
RTC Chip and 2 debounced push buttons on the top breadboard. RTC is fed with 32.768kHz from a function generator
awaiting for a new xtal.
&lt;/p&gt;

&lt;p&gt;
4-input AND gate for VIA IRQ connection to CPU on the other breadboard.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/detail.php?id=public%3Acomputers%3A6502%3Aphotos&amp;amp;media=public:computers:6502:img_20220929_081737_023_1.jpg&quot; class=&quot;media&quot; title=&quot;public:computers:6502:img_20220929_081737_023_1.jpg&quot;&gt;&lt;img src=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?w=400&amp;amp;tok=6a6458&amp;amp;media=public:computers:6502:img_20220929_081737_023_1.jpg&quot; class=&quot;media&quot; loading=&quot;lazy&quot; alt=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
I/O board with 2 65C22 VIAs. Beeper piezo sounder in the Altoids tin.
&lt;/p&gt;
&lt;/div&gt;&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;plugin_wrap_end&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;secid&amp;quot;:8,&amp;quot;range&amp;quot;:&amp;quot;0-&amp;quot;} --&gt;&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;plugin_wrap_start&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;secid&amp;quot;:9,&amp;quot;range&amp;quot;:&amp;quot;0-&amp;quot;} --&gt;&lt;div class=&quot;wrap_third wrap_column wrap__dark plugin_wrap&quot;&gt;
&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/detail.php?id=public%3Acomputers%3A6502%3Aphotos&amp;amp;media=public:computers:6502:img_20220929_081741_790_1.jpg&quot; class=&quot;media&quot; title=&quot;public:computers:6502:img_20220929_081741_790_1.jpg&quot;&gt;&lt;img src=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?w=400&amp;amp;tok=009019&amp;amp;media=public:computers:6502:img_20220929_081741_790_1.jpg&quot; class=&quot;media&quot; loading=&quot;lazy&quot; alt=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;plugin_wrap_end&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;secid&amp;quot;:10,&amp;quot;range&amp;quot;:&amp;quot;0-&amp;quot;} --&gt;&lt;/div&gt;&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;plugin_wrap_end&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;0-&amp;quot;} --&gt;
&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Version 1 - veroboard&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;version_1_-_veroboard&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;71-914&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit11&quot; id=&quot;version_2&quot;&gt;Version 2&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; Planned to be built using Wirewrap methods but seems to have been forgotten about&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; I&amp;#039;ll possibly return to the project in winter 2024/5?&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
— &lt;em&gt;John Pumford-Green 29/09/22 08:21&lt;/em&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Version 2&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;version_2&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:11,&amp;quot;range&amp;quot;:&amp;quot;915-1129&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit12&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:12,&amp;quot;range&amp;quot;:&amp;quot;1130-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 29 Jan 2026 13:22:23 +0000</pubDate>
        </item>
        <item>
            <title>6502 Setup</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:setup</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;setup&quot;&gt;6502 Setup&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; Various pre-requisites &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;6502 Setup&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;setup&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-72&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;vim_syntax_highlighting&quot;&gt;Vim Syntax Highlighting&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
To get better syntax highlighting for 6502 assembler I found a vim syntax file &lt;code&gt;asmM6502.vim&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://github.com/jestin/asmM6502.vim&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://github.com/jestin/asmM6502.vim&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://github.com/jestin/asmM6502.vim&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
This was saved as &lt;code&gt;~/.vim/syntax/asmM6502.vim&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt;
To make sure assembler source code used the 6502 syntax add:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;autocmd BufRead,BufNewFile *.s,*.asm,*.inc set filetype=asmM6502&lt;/pre&gt;

&lt;p&gt;
to &lt;code&gt;~/.vimrc&lt;/code&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Vim Syntax Highlighting&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;vim_syntax_highlighting&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;73-449&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit3&quot; id=&quot;vim_in_action&quot;&gt;Vim in action&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?media=public:linux:6502:screenshot_2022-08-10_14.30.06.png&quot; class=&quot;media wikilink2&quot; title=&quot;public:linux:6502:screenshot_2022-08-10_14.30.06.png&quot;&gt;&lt;img src=&quot;https://www.g4slv.info/dokuwiki/lib/exe/fetch.php?w=400&amp;amp;tok=8ccc6a&amp;amp;media=public:linux:6502:screenshot_2022-08-10_14.30.06.png&quot; class=&quot;medialeft&quot; align=&quot;left&quot; loading=&quot;lazy&quot; alt=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Vim in action&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;vim_in_action&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;450-546&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;assembler_compiler_vasm&quot;&gt;Assembler compiler VASM&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
To compile source to machine-code suitable for blowing onto EEPROM use the &lt;code&gt;vasm&lt;/code&gt; compiler
&lt;/p&gt;

&lt;p&gt;
It&amp;#039;s possible to self-compile &lt;code&gt;VASM&lt;/code&gt; by downloading the source-code from:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://sun.hasenbraten.de/vasm/&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://sun.hasenbraten.de/vasm/&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://sun.hasenbraten.de/vasm/&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
but there are ready made binaries here, specifically for the 6502 &lt;em&gt;old-style&lt;/em&gt; binaries:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.compilers.de/vasm.html&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://www.compilers.de/vasm.html&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://www.compilers.de/vasm.html&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Use the link at the foot of the page:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.ibaug.de/vasm/vasm6502.zip&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;http://www.ibaug.de/vasm/vasm6502.zip&quot; rel=&quot;ugc nofollow noopener&quot;&gt;http://www.ibaug.de/vasm/vasm6502.zip&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Download, unzip (extracts the files needed into &lt;code&gt;../vasm6502_oldstyle/linux/&lt;/code&gt;)
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;sudo cp ./vasm6502_oldstyle/linux/* /usr/local/bin&lt;/pre&gt;

&lt;p&gt;
Add an alias to &lt;code&gt;~/.bashrc&lt;/code&gt;
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;alias vasm=&amp;#039;vasm6502_oldstyle -Fbin -dotdir&amp;#039;&lt;/pre&gt;

&lt;p&gt;
for the most used options
&lt;/p&gt;

&lt;p&gt;
To compile a source file to a binary &lt;code&gt;a.out&lt;/code&gt; file:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;vasm hello_world.s&lt;/pre&gt;
&lt;p&gt;&lt;a class=&quot;folder&quot; href=&quot;#folded_e88f501c92d4ddf4a22a536e56941c29_1&quot;&gt;hello_world.s &lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;folded hidden&quot; id=&quot;folded_e88f501c92d4ddf4a22a536e56941c29_1&quot;&gt;&lt;pre class=&quot;code asm&quot;&gt;PORTB = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6000&lt;/span&gt;
PORTA = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6001&lt;/span&gt;
DDRB = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6002&lt;/span&gt;
DDRA = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6003&lt;/span&gt;
&amp;nbsp;
E  = &lt;span class=&quot;nu0&quot;&gt;%10000000&lt;/span&gt;
RW = &lt;span class=&quot;nu0&quot;&gt;%01000000&lt;/span&gt;
RS = &lt;span class=&quot;nu0&quot;&gt;%00100000&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;org &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8000&lt;/span&gt;
&amp;nbsp;
reset&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  ldx #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;ff
  txs
&amp;nbsp;
  lda #&lt;span class=&quot;nu0&quot;&gt;%11111111&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set all pins on port B to output&lt;/span&gt;
  sta DDRB
  lda #&lt;span class=&quot;nu0&quot;&gt;%11100000&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set top 3 pins on port A to output&lt;/span&gt;
  sta DDRA
&amp;nbsp;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00111000&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set 8-bit mode; 2-line display; 5x8 font&lt;/span&gt;
  jsr lcd_instruction
  lda #&lt;span class=&quot;nu0&quot;&gt;%00001110&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Display on; cursor on; blink off&lt;/span&gt;
  jsr lcd_instruction
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000110&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Increment and shift cursor; don&#039;t shift display&lt;/span&gt;
  jsr lcd_instruction
  lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00000001&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Clear display&lt;/span&gt;
  jsr lcd_instruction
&amp;nbsp;
  ldx #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;
print&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda message&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  beq &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
  jsr print_char
  inx
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; print
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
message&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;Hello, world!&amp;quot;&lt;/span&gt;
&amp;nbsp;
lcd_wait&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  pha
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000000&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; Port B is input&lt;/span&gt;
  sta DDRB
lcdbusy&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #RW
  sta PORTA
  lda #&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;RW | E&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  sta PORTA
  lda PORTB
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%10000000&lt;/span&gt;
  bne lcdbusy
&amp;nbsp;
  lda #RW
  sta PORTA
  lda #&lt;span class=&quot;nu0&quot;&gt;%11111111&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; Port B is output&lt;/span&gt;
  sta DDRB
  pla
  rts
&amp;nbsp;
lcd_instruction&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr lcd_wait
  sta PORTB
  lda #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;         &lt;span class=&quot;co1&quot;&gt;; Clear RS/RW/E bits&lt;/span&gt;
  sta PORTA
  lda #E         &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTA
  lda #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;         &lt;span class=&quot;co1&quot;&gt;; Clear RS/RW/E bits&lt;/span&gt;
  sta PORTA
  rts
&amp;nbsp;
print_char&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr lcd_wait
  sta PORTB
  lda #RS         &lt;span class=&quot;co1&quot;&gt;; Set RS; Clear RW/E bits&lt;/span&gt;
  sta PORTA
  lda #&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;RS | E&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTA
  lda #RS         &lt;span class=&quot;co1&quot;&gt;; Clear E bits&lt;/span&gt;
  sta PORTA
  rts
&amp;nbsp;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;org &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;fffc
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; reset
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0000&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;pre class=&quot;code bash&quot;&gt;gm4slv&lt;span class=&quot;sy0&quot;&gt;@&lt;/span&gt;laptop:~&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6502&lt;/span&gt; $ vasm hello_world.s
vasm 1.8h &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;c&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2002&lt;/span&gt;-&lt;span class=&quot;nu0&quot;&gt;2019&lt;/span&gt; Volker Barthelmann
vasm &lt;span class=&quot;nu0&quot;&gt;6502&lt;/span&gt; cpu backend &lt;span class=&quot;nu0&quot;&gt;0.8&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;c&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2002&lt;/span&gt;,&lt;span class=&quot;nu0&quot;&gt;2006&lt;/span&gt;,&lt;span class=&quot;nu0&quot;&gt;2008&lt;/span&gt;-&lt;span class=&quot;nu0&quot;&gt;2012&lt;/span&gt;,&lt;span class=&quot;nu0&quot;&gt;2014&lt;/span&gt;-&lt;span class=&quot;nu0&quot;&gt;2018&lt;/span&gt; Frank Wille
vasm oldstyle syntax module 0.13f &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;c&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2002&lt;/span&gt;-&lt;span class=&quot;nu0&quot;&gt;2018&lt;/span&gt; Frank Wille
vasm binary output module 1.8a &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;c&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2002&lt;/span&gt;-&lt;span class=&quot;nu0&quot;&gt;2009&lt;/span&gt;,&lt;span class=&quot;nu0&quot;&gt;2013&lt;/span&gt;,&lt;span class=&quot;nu0&quot;&gt;2015&lt;/span&gt;,&lt;span class=&quot;nu0&quot;&gt;2017&lt;/span&gt; Volker Barthelmann
&amp;nbsp;
seg8000&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;acrwx1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:                 &lt;span class=&quot;nu0&quot;&gt;143&lt;/span&gt; bytes
segfffc&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;acrwx1&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:                   &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt; bytes&lt;/pre&gt;

&lt;p&gt;
Inspect the hexcode in the binary file &lt;code&gt;hexdump&lt;/code&gt;
&lt;/p&gt;
&lt;pre class=&quot;code bash&quot;&gt;gm4slv&lt;span class=&quot;sy0&quot;&gt;@&lt;/span&gt;laptop:~&lt;span class=&quot;sy0&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6502&lt;/span&gt; $ &lt;span class=&quot;kw2&quot;&gt;hexdump&lt;/span&gt; &lt;span class=&quot;re5&quot;&gt;-C&lt;/span&gt; a.out
00000000  a2 ff 9a a9 ff 8d 02 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt;  a9 e0 8d 03 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 &lt;span class=&quot;nu0&quot;&gt;38&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt;  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;.......&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;....&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;.8 &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
00000010  &lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; a9 0e &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; a9  06 &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; a9 01 &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;63&lt;/span&gt;  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;c... c... c... c&lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
00000020  &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; a2 00 bd &lt;span class=&quot;nu0&quot;&gt;32&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; f0 07  &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;79&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; e8 4c &lt;span class=&quot;nu0&quot;&gt;23&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; 4c  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;....&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;... y..L&lt;span class=&quot;co0&quot;&gt;#.L|&lt;/span&gt;
00000030  2f &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;48&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;65&lt;/span&gt; 6c 6c 6f 2c  &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;77&lt;/span&gt; 6f &lt;span class=&quot;nu0&quot;&gt;72&lt;/span&gt; 6c &lt;span class=&quot;nu0&quot;&gt;64&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;21&lt;/span&gt; 00  &lt;span class=&quot;sy0&quot;&gt;|/&lt;/span&gt;.Hello, world&lt;span class=&quot;sy0&quot;&gt;!&lt;/span&gt;.&lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
00000040  &lt;span class=&quot;nu0&quot;&gt;48&lt;/span&gt; a9 00 8d 02 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 &lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt;  8d 01 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 c0 8d 01 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt;  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;H....&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;.&lt;span class=&quot;sy0&quot;&gt;@&lt;/span&gt;..&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;....&lt;span class=&quot;sy0&quot;&gt;`|&lt;/span&gt;
00000050  ad 00 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;29&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; d0 ef a9  &lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt; 8d 01 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 ff 8d 02  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;..&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;....&lt;span class=&quot;sy0&quot;&gt;@&lt;/span&gt;..&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;....&lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
00000060  &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;68&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; 8d 00  &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 00 8d 01 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt;  &lt;span class=&quot;sy0&quot;&gt;|`&lt;/span&gt;h&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;@&lt;/span&gt;...&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;....&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;..&lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
00000070  8d 01 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 00 8d 01 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt;  &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; 8d 00 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;..&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;....&lt;span class=&quot;sy0&quot;&gt;``&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;@&lt;/span&gt;...&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;.&lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
00000080  &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; 8d 01 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 a0 8d 01  &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; a9 &lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt; 8d 01 &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt; 00  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt; ..&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;....&lt;span class=&quot;sy0&quot;&gt;`&lt;/span&gt;. ..&lt;span class=&quot;sy0&quot;&gt;``&lt;/span&gt;.&lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;................&lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
&lt;span class=&quot;sy0&quot;&gt;*&lt;/span&gt;
00007ff0  00 00 00 00 00 00 00 00  00 00 00 00 00 &lt;span class=&quot;nu0&quot;&gt;80&lt;/span&gt; 00 00  &lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;................&lt;span class=&quot;sy0&quot;&gt;|&lt;/span&gt;
00008000&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Assembler compiler VASM&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;assembler_compiler_vasm&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;547-4187&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;minipro_eeprom_programmer&quot;&gt;minipro EEPROM programmer&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
An open source project &lt;code&gt;minipro&lt;/code&gt; to use the TI866 USB EEPROM programmer under Linux
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;git clone https://gitlab.com/DavidGriffith/minipro.git
cd minipro
make
sudo make install&lt;/pre&gt;

&lt;p&gt;
to burn an EEPROM
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;minipro -p AT28C256 -w a.out&lt;/pre&gt;

&lt;p&gt;
— &lt;em&gt;John Pumford-Green 10/08/22 13:50&lt;/em&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;minipro EEPROM programmer&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;minipro_eeprom_programmer&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:3,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;4188-4511&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit6&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Sept&amp;#039; 2022 : Moved to CA65 assembler. &lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:ca65_setup&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:ca65_setup&quot; data-wiki-id=&quot;public:computers:6502:ca65_setup&quot;&gt;CA65 Setup&lt;/a&gt;
&lt;/p&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:6502&amp;amp;do=showtag&amp;amp;tag=6502&quot; class=&quot;wikilink1&quot; title=&quot;tag:6502&quot; rel=&quot;tag&quot;&gt;6502&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:3,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;4512-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 30 Dec 2025 09:55:07 +0000</pubDate>
        </item>
        <item>
            <title>6502 Project</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:start&quot; data-wiki-id=&quot;public:computers:start&quot;&gt;Computers&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;project&quot;&gt;6502 Project&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;6502 Project&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;project&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;16-43&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;my_new_2022_project&quot;&gt;My New 2022 Project&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
I&amp;#039;ve never really considered myself to be a programmer. I dabble very badly in Python but I&amp;#039;ve always been confused by what goes on at the CPU level.
&lt;/p&gt;

&lt;p&gt;
Assembler &amp;amp; Machine Code seem to be where you get to grips with what&amp;#039;s really happening.
&lt;/p&gt;

&lt;p&gt;
I&amp;#039;m going to build a small 6502-based computer, with the bare minimum of hardware &amp;amp; features…. CPU, ROM, RAM, I/O and some form of display.
&lt;/p&gt;

&lt;p&gt;
I was going to source the parts myself, but found it impossible to find a supplier with stock of the usual 28C256 EEPROM. I&amp;#039;ve been watching the excellent You Tube video series by Ben Eater:
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://youtube.com/playlist?list=PLowKtXNTBypFbtuVMUVXNR0z1mu7dp7eH&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://youtube.com/playlist?list=PLowKtXNTBypFbtuVMUVXNR0z1mu7dp7eH&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://youtube.com/playlist?list=PLowKtXNTBypFbtuVMUVXNR0z1mu7dp7eH&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Ben supplies a kit with everything needed to build the basic computer - just add a PSU and an EEPROM programmer - so I&amp;#039;ve bought one of his kits.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://eater.net/6502&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://eater.net/6502&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://eater.net/6502&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
I&amp;#039;ve ordered a TL866 programmer from Amazon as well as a well-regarded book &lt;code&gt;Programming the 65816: Including the 6502, 65C02, and 65802&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;script type=&quot;text/javascript&quot;&gt; catlist_baseurl = &quot;https://www.g4slv.info/dokuwiki/&quot;; catlist_basescript = &quot;doku.php&quot;; catlist_useslash = 0; catlist_userewrite = 0; catlist_sepchar = &quot;_&quot;; catlist_deaccent = 1; catlist_pagename_sanitize = 1; &lt;/script&gt;&lt;ul class=&quot;catlist-nslist&quot; &gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:beginning&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:beginning&quot; data-wiki-id=&quot;public:computers:6502:beginning&quot;&gt;6502 based homebrew computer&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:setup&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:setup&quot; data-wiki-id=&quot;public:computers:6502:setup&quot;&gt;6502 Setup&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:ca65_setup&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:ca65_setup&quot; data-wiki-id=&quot;public:computers:6502:ca65_setup&quot;&gt;CA65 Setup&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:datasheets&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:datasheets&quot; data-wiki-id=&quot;public:computers:6502:datasheets&quot;&gt;Datasheets&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:goals&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:goals&quot; data-wiki-id=&quot;public:computers:6502:goals&quot;&gt;Goals : 6502&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:links&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:links&quot; data-wiki-id=&quot;public:computers:6502:links&quot;&gt;Links&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:monitor&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:monitor&quot; data-wiki-id=&quot;public:computers:6502:monitor&quot;&gt;Monitor&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:photos&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:photos&quot; data-wiki-id=&quot;public:computers:6502:photos&quot;&gt;Photos&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:tutorial_progress&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:tutorial_progress&quot; data-wiki-id=&quot;public:computers:6502:tutorial_progress&quot;&gt;Tutorial Progress&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;catlist-page&quot;&gt;&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:update_sept_2022&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:update_sept_2022&quot; data-wiki-id=&quot;public:computers:6502:update_sept_2022&quot;&gt;Update Sept 2022&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;My New 2022 Project&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;my_new_2022_project&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;44-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 30 Dec 2025 09:55:07 +0000</pubDate>
        </item>
        <item>
            <title>Tutorial Progress</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:tutorial_progress</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;tutorial_progress&quot;&gt;Tutorial Progress&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; A record of my progress through the Ben Eater You Tube tutorial &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Tutorial Progress&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;tutorial_progress&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-120&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;day_onetuesday_16_8_22&quot;&gt;Day One : Tuesday 16/8/22&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Kit arrived&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; Installed:&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; CPU&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; EEPROM&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; NAND Gate&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; Address &amp;amp; Data lines between CPU and EEPROM and address decoder for EEPROM&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Used python “makerom.py” script to burn eprom:&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code python&quot;&gt;rom &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;bytearray&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0xea&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; * &lt;span class=&quot;nu0&quot;&gt;32768&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0xa9&lt;/span&gt;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x42&lt;/span&gt;
&amp;nbsp;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x8d&lt;/span&gt;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x00&lt;/span&gt;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x60&lt;/span&gt;
&amp;nbsp;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0x7ffc&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x00&lt;/span&gt;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0x7ffd&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x80&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;rom.bin&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;wb&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; out_file:
     out_file.&lt;span class=&quot;me1&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rom&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;

&lt;p&gt;
ROM file hexdump:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;00000000  a9 42 8d 00 60 ea ea ea  ea ea ea ea ea ea ea ea  |.B..`...........|
00000010  ea ea ea ea ea ea ea ea  ea ea ea ea ea ea ea ea  |................|
*
00007ff&lt;/pre&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Unable to confirm correct running - still waiting for Arduino Mega to act as a logic analyzer. LEDs on data or Address lines show activity….&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Day One : Tuesday 16\/8\/22&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;day_onetuesday_16_8_22&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;121-953&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit3&quot; id=&quot;next_stage&quot;&gt;Next stage&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; add the 65C22 VIA and use LEDs on output to show correct running&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; make an 8-bit binary counter with LEDs as an exercise&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Next stage&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;next_stage&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:2,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;954-1104&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;day_twowednesday_17_8_22&quot;&gt;Day Two : Wednesday 17/8/22&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Using Siglent Function Generator as the CPU PHI2 clock
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; added 65C22 VIA and 8 leds&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; much debugging of hardware/wiring - breadboard is a NASTY way of doing this…..!&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; ordered some IC sockets &amp;amp; other hardware to allow me to build a version on Vero/perf board and move away from breadboard once I&amp;#039;ve got the the point in the tutorials where all the hardware is stable.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; used python script to get the “01010101 → 10101010” LED sequence running.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Day Two : Wednesday 17\/8\/22&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;day_twowednesday_17_8_22&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:2,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;1105-1604&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit5&quot; id=&quot;self-study&quot;&gt;Self-study&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; modified assembly code to make the LEDs flash in a binary count&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;

&lt;h4 id=&quot;bit_counter&quot;&gt;8 bit counter&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;co1&quot;&gt;### 8-bit Counter&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw3&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;bytearray&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;
    &lt;span class=&quot;nu0&quot;&gt;0xa9&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0xff&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;         &lt;span class=&quot;co1&quot;&gt;# lda #$FF&lt;/span&gt;
    &lt;span class=&quot;nu0&quot;&gt;0x8d&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x02&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x60&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;# sta $6002 : put 11111111 into VIA&#039;s Port B control register - all port pins are OUTPUT&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;nu0&quot;&gt;0xa9&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0xff&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;         &lt;span class=&quot;co1&quot;&gt;# lda #$ff (start with all LEDs lit)&lt;/span&gt;
    &lt;span class=&quot;nu0&quot;&gt;0x8d&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x00&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x60&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;# sta $6000&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;nu0&quot;&gt;0x1a&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;                &lt;span class=&quot;co1&quot;&gt;# inc A&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;nu0&quot;&gt;0x4c&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x07&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x80&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;   &lt;span class=&quot;co1&quot;&gt;# jmp $8007&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
rom &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;code&lt;/span&gt; + &lt;span class=&quot;kw3&quot;&gt;bytearray&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0xea&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; * &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;32768&lt;/span&gt; - &lt;span class=&quot;kw2&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0x7ffc&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x00&lt;/span&gt;
rom&lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0x7ffd&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;0x80&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&amp;quot;rom.bin&amp;quot;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;wb&amp;quot;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; out_file:
     out_file.&lt;span class=&quot;me1&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;rom&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
This assembles as :
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;00000000  a9 ff 8d 02 60 a9 ff 8d  00 60 1a 4c 07 80 ea ea  |....`....`.L....|
00000010  ea ea ea ea ea ea ea ea  ea ea ea ea ea ea ea ea  |................|
*
00007ff0  ea ea ea ea ea ea ea ea  ea ea ea ea 00 80 ea ea  |................|
00008000
&lt;/pre&gt;

&lt;p&gt;
LEDs flash in binary count to 255 and cycle round… endlessly.
&lt;/p&gt;

&lt;/div&gt;

&lt;h4 id=&quot;bit_counter1&quot;&gt;16 bit counter&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;
I wanted to see if I could extend the counter to 16-bits, using 2 VIA ports to drive the LEDs
&lt;/p&gt;

&lt;p&gt;
To make life easier I moved to &lt;code&gt;assembly&lt;/code&gt; language and the &lt;code&gt;VASM&lt;/code&gt; assembler as recommended in the tutorial. 
&lt;/p&gt;

&lt;p&gt;
To count beyond a single 8-bit byte needs a way of holding 2 separate bytes of the count, the low byte and high byte, and only increment the high byte when the low byte rolls past &lt;code&gt;11111111&lt;/code&gt;. Tricky with no RAM installed yet.
&lt;/p&gt;

&lt;p&gt;
I used the 2 index registers &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;Y&lt;/code&gt;. The carry bit is set as a result of arithmetic on the Accumulator register, so &lt;code&gt;X&lt;/code&gt; (low byte) has to be copied to the Accumulator for the addition of &lt;code&gt;1&lt;/code&gt; each time round the loop.
&lt;/p&gt;
&lt;pre class=&quot;code asm&quot;&gt;        &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;org &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8000&lt;/span&gt;
&amp;nbsp;
reset&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
        lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;ff
        sta &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6002&lt;/span&gt;    &lt;span class=&quot;co1&quot;&gt;; set port B pins to all output&lt;/span&gt;
        sta &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6003&lt;/span&gt;    &lt;span class=&quot;co1&quot;&gt;; set port A pins to all output&lt;/span&gt;
        lda #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;00&lt;/span&gt;
        tax          &lt;span class=&quot;co1&quot;&gt;; X holds the low byte. initialize to zero&lt;/span&gt;
        tay          &lt;span class=&quot;co1&quot;&gt;; Y holds the high byte. initialize to zero&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
        txa          &lt;span class=&quot;co1&quot;&gt;; copy low byte to A&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;adc&lt;/span&gt; #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;01&lt;/span&gt;     &lt;span class=&quot;co1&quot;&gt;; add 1&lt;/span&gt;
        tax          &lt;span class=&quot;co1&quot;&gt;; copy new value to X&lt;/span&gt;
        bcs high_b   &lt;span class=&quot;co1&quot;&gt;; if carry flag set, branch to increment the high byte&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
print&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
        txa          &lt;span class=&quot;co1&quot;&gt;; bring the low byte to A&lt;/span&gt;
        sta &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6000&lt;/span&gt;    &lt;span class=&quot;co1&quot;&gt;; send low byte to Port B LEDs&lt;/span&gt;
        tya          &lt;span class=&quot;co1&quot;&gt;; bring the high byte to A&lt;/span&gt;
        sta &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6001&lt;/span&gt;    &lt;span class=&quot;co1&quot;&gt;; send high byte to Port A LEDs&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
high_b&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
&amp;nbsp;
        iny          &lt;span class=&quot;co1&quot;&gt;; increment high byte in Y&lt;/span&gt;
        &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; print
&amp;nbsp;
        &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;org &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;fffc
        &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; reset
        &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0000&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
Assembled code
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;00000000  a9 ff 8d 02 60 8d 03 60  a9 00 aa a8 8a 69 01 aa  |....`..`.....i..|
00000010  b0 0b 8a 8d 00 60 98 8d  01 60 4c 0c 80 c8 4c 12  |.....`...`L...L.|
00000020  80 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00007ff0  00 00 00 00 00 00 00 00  00 00 00 00 00 80 00 00  |................|
00008000&lt;/pre&gt;

&lt;p&gt;
Add another 8 LEDs, to Port A, to show the High Byte…. 
&lt;/p&gt;

&lt;p&gt;
It now counts to &lt;code&gt;1111111111111111&lt;/code&gt; or &lt;code&gt;$FFFF&lt;/code&gt; or &lt;code&gt;65535&lt;/code&gt; as displayed by the LEDs attached to both VIA ports.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Self-study&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;self-study&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:2,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;1605-4825&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit6&quot; id=&quot;next_stage1&quot;&gt;Next stage&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
 is to add the LCD module in place of the flashing LEDs
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Next stage&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;next_stage1&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:6,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;4826-4905&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit7&quot; id=&quot;day_threefriday_19_8_22&quot;&gt;Day Three : Friday 19/8/22&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Day Three : Friday 19\/8\/22&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;day_threefriday_19_8_22&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:6,&amp;quot;secid&amp;quot;:7,&amp;quot;range&amp;quot;:&amp;quot;4906-4946&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit8&quot; id=&quot;lcd&quot;&gt;LCD&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; added the LCD module to the VIA output port(s)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; put the “hello.s” assembled code into ROM&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; LCD printed &lt;code&gt;Hello, w&lt;/code&gt; and no more….&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
8 Characters… what, why?
&lt;/p&gt;

&lt;p&gt;
Lots of messing about with the assembler code to see if I could get all the &lt;code&gt;Hello, world!&lt;/code&gt; message to print to the LCD.
&lt;/p&gt;

&lt;p&gt;
By adding the necessary instruction to change the display position I could use all 16 characters of the display, but I couldn&amp;#039;t get it to print all the message in one go…. The same happened with a different LCD module.
&lt;/p&gt;

&lt;p&gt;
Eventually I checked, and re-checked, the address and data lines between CPU, ROM and VIA and must have re-inserted one that was loose. Afterwards the display showed &lt;code&gt;Hello, world!&lt;/code&gt; correctly.
&lt;/p&gt;

&lt;p&gt;
I assume the error was that an address line between CPU and ROM wasn&amp;#039;t connected, so at one step of the program the ROM went to the wrong address and returned garbage data, and the program stopped, or just randomly stepped through the otherwise empty ROM?
&lt;/p&gt;

&lt;p&gt;
Anyway, whatever the mechanism, ensuring all address &amp;amp; data lines were seated correctly cured the &lt;em&gt;bug&lt;/em&gt;.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;LCD&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;lcd&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:6,&amp;quot;secid&amp;quot;:8,&amp;quot;range&amp;quot;:&amp;quot;4947-6039&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit9&quot; id=&quot;next_stage2&quot;&gt;Next Stage&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; adding RAM&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; rebuilding on “properly wired” stripboard to remove the annoyance of breadboard wires coming adrift.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Next Stage&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;next_stage2&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:6,&amp;quot;secid&amp;quot;:9,&amp;quot;range&amp;quot;:&amp;quot;6040-6182&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit10&quot; id=&quot;day_4saturday_21_8_22&quot;&gt;Day 4 : Saturday 21/8/22&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; added RAM&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; re-wrote “hello_world” to use 4-bit LCD addressing and moved LCD to PORTB of VIA, freeing up all of PORTA for other uses&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; began building veroboard version to&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Day 4 : Saturday 21\/8\/22&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;day_4saturday_21_8_22&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:6,&amp;quot;secid&amp;quot;:10,&amp;quot;range&amp;quot;:&amp;quot;6183-6400&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit11&quot; id=&quot;day_5sunday_22_8_22&quot;&gt;Day 5 : Sunday 22/8/22&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; completed veroboard build and tested with 4-bit/2-line LCD “Hello world”&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code asm&quot;&gt;&amp;nbsp;
PORTB = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6000&lt;/span&gt;
PORTA = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6001&lt;/span&gt;
DDRB = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6002&lt;/span&gt;
DDRA = &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;6003&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
E  = &lt;span class=&quot;nu0&quot;&gt;%01000000&lt;/span&gt;
RW = &lt;span class=&quot;nu0&quot;&gt;%00100000&lt;/span&gt;
RS = &lt;span class=&quot;nu0&quot;&gt;%00010000&lt;/span&gt;
LED = &lt;span class=&quot;nu0&quot;&gt;%10000000&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;org &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;8000&lt;/span&gt;
&amp;nbsp;
reset&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  ldx #&lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;ff
  txs
&amp;nbsp;
  lda #&lt;span class=&quot;nu0&quot;&gt;%11111111&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set all pins on port B to output&lt;/span&gt;
  sta DDRB
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000000&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set all pins on port A to input&lt;/span&gt;
  sta DDRA
&amp;nbsp;
  jsr lcd_init
  lda #&lt;span class=&quot;nu0&quot;&gt;%00101000&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set 4-bit mode; 2-line display; 5x8 font&lt;/span&gt;
  jsr lcd_instruction
  lda #&lt;span class=&quot;nu0&quot;&gt;%00001110&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Display on; cursor on; blink off&lt;/span&gt;
  jsr lcd_instruction
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000110&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Increment and shift cursor; don&#039;t shift display&lt;/span&gt;
  jsr lcd_instruction
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000001&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Clear display&lt;/span&gt;
  jsr lcd_instruction
&amp;nbsp;
  ldx #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;
&amp;nbsp;
print1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda message1&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  beq print2
  jsr print_char
  inx
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; print1
&amp;nbsp;
message1&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;Shed-o-tron II &amp;quot;&lt;/span&gt;
&amp;nbsp;
message2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;asciiz &lt;span class=&quot;st0&quot;&gt;&amp;quot;* * 22/8/22 * * &amp;quot;&lt;/span&gt;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #LED
  sta PORTB
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
&amp;nbsp;
print2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%10101001&lt;/span&gt;
  jsr lcd_instruction
&amp;nbsp;
  ldx #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;
line2&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda message2&lt;span class=&quot;sy1&quot;&gt;,&lt;/span&gt;x
  beq &lt;span class=&quot;kw1&quot;&gt;loop&lt;/span&gt;
  jsr print_char
  inx
  &lt;span class=&quot;kw1&quot;&gt;jmp&lt;/span&gt; line2
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
lcd_wait&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  pha
  lda #&lt;span class=&quot;nu0&quot;&gt;%11110000&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; LCD data is input&lt;/span&gt;
  sta DDRB
lcdbusy&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #RW
  sta PORTB
  lda #&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;RW | E&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  sta PORTB
  lda PORTB       &lt;span class=&quot;co1&quot;&gt;; Read high nibble&lt;/span&gt;
  pha             &lt;span class=&quot;co1&quot;&gt;; and put on stack since it has the busy flag&lt;/span&gt;
  lda #RW
  sta PORTB
  lda #&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;RW | E&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
  sta PORTB
  lda PORTB       &lt;span class=&quot;co1&quot;&gt;; Read low nibble&lt;/span&gt;
  pla             &lt;span class=&quot;co1&quot;&gt;; Get high nibble off stack&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001000&lt;/span&gt;
  bne lcdbusy
&amp;nbsp;
  lda #RW
  sta PORTB
  lda #&lt;span class=&quot;nu0&quot;&gt;%11111111&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; LCD data is output&lt;/span&gt;
  sta DDRB
  pla
  rts
&amp;nbsp;
lcd_init&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  lda #&lt;span class=&quot;nu0&quot;&gt;%00000010&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Set 4-bit mode&lt;/span&gt;
  sta PORTB
  ora #E
  sta PORTB
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt;
  sta PORTB
  rts
&amp;nbsp;
lcd_instruction&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr lcd_wait
  pha
  lsr
  lsr
  lsr
  lsr            &lt;span class=&quot;co1&quot;&gt;; Send high 4 bits&lt;/span&gt;
  sta PORTB
  ora #E         &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTB
  eor #E         &lt;span class=&quot;co1&quot;&gt;; Clear E bit&lt;/span&gt;
  sta PORTB
  pla
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;; Send low 4 bits&lt;/span&gt;
  sta PORTB
  ora #E         &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTB
  eor #E         &lt;span class=&quot;co1&quot;&gt;; Clear E bit&lt;/span&gt;
  sta PORTB
  rts
&amp;nbsp;
print_char&lt;span class=&quot;sy1&quot;&gt;:&lt;/span&gt;
  jsr lcd_wait
  pha
  lsr
  lsr
  lsr
  lsr             &lt;span class=&quot;co1&quot;&gt;; Send high 4 bits&lt;/span&gt;
  ora #RS         &lt;span class=&quot;co1&quot;&gt;; Set RS&lt;/span&gt;
  sta PORTB
  ora #E          &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTB
  eor #E          &lt;span class=&quot;co1&quot;&gt;; Clear E bit&lt;/span&gt;
  sta PORTB
  pla
  &lt;span class=&quot;kw1&quot;&gt;and&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;%00001111&lt;/span&gt;  &lt;span class=&quot;co1&quot;&gt;; Send low 4 bits&lt;/span&gt;
  ora #RS         &lt;span class=&quot;co1&quot;&gt;; Set RS&lt;/span&gt;
  sta PORTB
  ora #E          &lt;span class=&quot;co1&quot;&gt;; Set E bit to send instruction&lt;/span&gt;
  sta PORTB
  eor #E          &lt;span class=&quot;co1&quot;&gt;; Clear E bit&lt;/span&gt;
  sta PORTB
  rts
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;; Reset/IRQ vectors&lt;/span&gt;
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;org &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;fffc
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; reset
  &lt;span class=&quot;sy1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw6&quot;&gt;word&lt;/span&gt; &lt;span class=&quot;sy2&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0000&lt;/span&gt;
&amp;nbsp;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Day 5 : Sunday 22\/8\/22&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;day_5sunday_22_8_22&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:6,&amp;quot;secid&amp;quot;:11,&amp;quot;range&amp;quot;:&amp;quot;6401-8933&amp;quot;} --&gt;
&lt;h3 class=&quot;sectionedit12&quot; id=&quot;next_stage3&quot;&gt;Next Stage&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; begin expanding software&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; routines to examine memory contents and display (in HEX) the contents of selected memory location(s)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; add switches to VIA PORTA and begin reading state of switches and update LCD with information&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; a power-on memory test and toggle LED/LCD?&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Next Stage&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;next_stage3&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:7,&amp;quot;secid&amp;quot;:12,&amp;quot;range&amp;quot;:&amp;quot;8934-9242&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit13&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Github : &lt;a href=&quot;https://github.com/gm4slv/6502&quot; class=&quot;urlextern&quot; target=&quot;_BLANK&quot; title=&quot;https://github.com/gm4slv/6502&quot; rel=&quot;ugc nofollow noopener&quot;&gt;https://github.com/gm4slv/6502&lt;/a&gt;
&lt;/p&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:6502&amp;amp;do=showtag&amp;amp;tag=6502&quot; class=&quot;wikilink1&quot; title=&quot;tag:6502&quot; rel=&quot;tag&quot;&gt;6502&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:7,&amp;quot;secid&amp;quot;:13,&amp;quot;range&amp;quot;:&amp;quot;9243-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 30 Dec 2025 09:55:07 +0000</pubDate>
        </item>
        <item>
            <title>Update Sept 2022</title>
            <link>https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:update_sept_2022</link>
            <description>
&lt;p&gt;
←&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=public:computers:6502:start&quot; class=&quot;wikilink1&quot; title=&quot;public:computers:6502:start&quot; data-wiki-id=&quot;public:computers:6502:start&quot;&gt;6502 Project&lt;/a&gt;
&lt;/p&gt;

&lt;h1 class=&quot;sectionedit1&quot; id=&quot;update_sept_2022&quot;&gt;Update Sept 2022&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;strong&gt; Some recent modifications and additions &lt;/strong&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Update Sept 2022&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;update_sept_2022&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;17-95&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;hardware&quot;&gt;Hardware&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; 2 more 65C22 VIA chips to give a total of 3 VIAs providing six 8-bit I/O ports.&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #1 ($6001) : Port A = Keypad&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #1 ($6000) : Port B = LCD_1 (4&amp;times;20 in 4-bit mode)&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #1 : IRQ connection to CPU for keypad and CB1 &amp;amp; CB2 buttons&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #1 Port B handshaking CB1 and CB2 connected to debounced buttons for user input experiments&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #2 ($5001) : Port A = Spare&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #2 ($5000) : Port B = SPI (bit0,1,2,6), Piezo Sounder (bit7)&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #2 : T1 Timer = square wave generator for sounder using Port B bit7&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #3 ($4801) : Port A = LCD_2 (2&amp;times;16 in 4-bit mode)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #3 ($4800) : Port B = Spare&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA #3 : T1 Timer = System Clock Ticks at 10ms rate via NMI connection to CPU&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; main LCD changed to a 4 line by 20 character display&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 2nd LCD (2 x 16) added on VIA #3 Port A&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; LED indicator plug-in boards made to give easy visual indication of VIA output port state&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Piezo sounder connected to VIA #2 Port B, bit 7&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; SPI interfacing using VIA #2 Port B&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Buttons for controlling interrupt driven events, each de-bounced with a 555 monostable&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 555 timer as a power-on CPU reset&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Hardware&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;hardware&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;96-1264&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;firmware&quot;&gt;Firmware&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
ROM Monitor code extended to support the new hardware.
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; SPI transceive to communicate with a basic SPI slave running on a PyBoard&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; LCD #2 display of either “Mission Time” or SPI TX/RX data to/from PyBoard&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; code to send audible beeps of different pitch/duration (controlled by the 2 buttons)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; keypad - confirmation keypress beeps&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Byte (binary) to ASCII decimal conversion to show 16-bit/2-byte binary data as a human readable decimal number&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Use of FLAGS to control background tasks extended/explored&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Firmware&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;firmware&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;1265-1807&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;next_steps&quot;&gt;Next Steps&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; add Serial Interface using Rockwell 65C51 ACIA and MAX232&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; learn how to code for interacting via serial interface&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; connect to a Wyse-185 Serial Terminal&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;span class=&quot;todo&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;todocheckbox&quot; data-index=&quot;0&quot; data-date=&quot;1722424344&quot; data-pageid=&quot;public:computers:6502:update_sept_2022&quot; data-strikethrough=&quot;1&quot; checked=&quot;checked&quot; /&gt; &lt;span class=&quot;todouser&quot;&gt;[✓ John Pumford-Green, 2022-09-26]&lt;/span&gt;&lt;span class=&quot;todotext clickabletodo todohlght&quot;&gt;&lt;del&gt;&lt;span class=&quot;todoinnertext&quot;&gt;add DS1306 RTC via SPI&lt;/span&gt;&lt;/del&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;span class=&quot;todo&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;todocheckbox&quot; data-index=&quot;1&quot; data-date=&quot;1722424344&quot; data-pageid=&quot;public:computers:6502:update_sept_2022&quot; data-strikethrough=&quot;1&quot; checked=&quot;checked&quot; /&gt; &lt;span class=&quot;todouser&quot;&gt;[✓ John Pumford-Green, 2022-09-26]&lt;/span&gt;&lt;span class=&quot;todotext clickabletodo todohlght&quot;&gt;&lt;del&gt;&lt;span class=&quot;todoinnertext&quot;&gt;move system clock back to VIA_1 using IRQ interrupt&lt;/span&gt;&lt;/del&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt;&lt;span class=&quot;todo&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;todocheckbox&quot; data-index=&quot;2&quot; data-date=&quot;1722424344&quot; data-pageid=&quot;public:computers:6502:update_sept_2022&quot; data-strikethrough=&quot;1&quot; checked=&quot;checked&quot; /&gt; &lt;span class=&quot;todouser&quot;&gt;[✓ John Pumford-Green, 2022-09-26]&lt;/span&gt;&lt;span class=&quot;todotext clickabletodo todohlght&quot;&gt;&lt;del&gt;&lt;span class=&quot;todoinnertext&quot;&gt;move beep to VIA_3 port B7&lt;/span&gt;&lt;/del&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;span class=&quot;todo&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;todocheckbox&quot; data-index=&quot;3&quot; data-date=&quot;1722424344&quot; data-pageid=&quot;public:computers:6502:update_sept_2022&quot; data-strikethrough=&quot;1&quot; checked=&quot;checked&quot; /&gt; &lt;span class=&quot;todouser&quot;&gt;[✓ John Pumford-Green, 2022-09-26]&lt;/span&gt;&lt;span class=&quot;todotext clickabletodo todohlght&quot;&gt;&lt;del&gt;&lt;span class=&quot;todoinnertext&quot;&gt;move SPI interface to VIA_3 port B, for future connection to DS1306 RTC&lt;/span&gt;&lt;/del&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2 node&quot;&gt;&lt;div class=&quot;li&quot;&gt; this will leave :&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA_2 ports A &amp;amp; B free for external use&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA_3 Port A = LCD2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level3&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIA_3 Port B = Beep and SPI/RTC&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
— &lt;em&gt;John Pumford-Green 17/09/22 11:50&lt;/em&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Next Steps&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;next_steps&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;1808-2487&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;further_information&quot;&gt;Further Information&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;tags&quot;&gt;&lt;span&gt;
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:6502&amp;amp;do=showtag&amp;amp;tag=6502&quot; class=&quot;wikilink1&quot; title=&quot;tag:6502&quot; rel=&quot;tag&quot;&gt;6502&lt;/a&gt;,
	&lt;a href=&quot;https://www.g4slv.info/dokuwiki/doku.php?id=tag:assembly&amp;amp;do=showtag&amp;amp;tag=assembly&quot; class=&quot;wikilink1&quot; title=&quot;tag:assembly&quot; rel=&quot;tag&quot;&gt;assembly&lt;/a&gt;
&lt;/span&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Further Information&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;further_information&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;2488-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 31 Jul 2024 11:12:24 +0000</pubDate>
        </item>
    </channel>
</rss>
