mirror of
https://github.com/michaelcmartin/Ophis.git
synced 2025-02-19 03:30:58 +00:00
Remove outdated website data
This commit is contained in:
parent
5362a635c8
commit
ae59cbf3c4
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head><title>The Ophis Assembler</title></head>
|
||||
<body>
|
||||
<h1>The Ophis Assembler</h1>
|
||||
|
||||
<p>Ophis is a cross-assembler for the 65xx series of chips. It supports the stock 6502 opcodes, the 65c02 extensions, and syntax for the "undocumented opcodes" in the 6510 chip used on the Commodore 64. (Syntax for these opcodes matches those given in the <a href="http://www.viceteam.org">VICE team's documentation</a>.)</p>
|
||||
|
||||
<p>Ophis is written in pure Python and should be highly portable.</p>
|
||||
|
||||
<p>If you have questions or comments, email me at <i>mcmartin AT gmail DOT com</i>.</p>
|
||||
|
||||
<h2>Downloads</h2>
|
||||
<ul>
|
||||
<li><a href="Ophis-1.0.tar.gz">Source distribution</a>. For Unix and Mac. Untar, then run "python setup.py install" as root to install. Documentation and sample code is in the tarball but won't be placed anywhere special.</li>
|
||||
<li><a href="http://hkn.eecs.berkeley.edu/~mcmartin/ophis/Ophis-1.0-win32-installer.exe">Win32 installer</a>. Installs a standalone executable and support libraries. You will need to put the install directory into your PATH to run it conveniently, as it is a commandline program.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Documentation</h2>
|
||||
|
||||
<p>The manual <i>Programming with Ophis</i> is distributed with each download. You can also get it alone.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="ophismanual.pdf">Download the PDF version of <i>Programming with Ophis</i></a></li>
|
||||
<li><a href="manual/book1.html">Browse <i>Programming with Ophis</i> online</a></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,184 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Example Programs</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Programming with Ophis"
|
||||
HREF="book1.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Where to go from here"
|
||||
HREF="x449.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="tutor2.oph"
|
||||
HREF="x461.html"></HEAD
|
||||
><BODY
|
||||
CLASS="APPENDIX"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Programming with Ophis</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x449.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x461.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="APPENDIX"
|
||||
><H1
|
||||
><A
|
||||
NAME="AEN454"
|
||||
></A
|
||||
>Example Programs</H1
|
||||
><P
|
||||
> This Appendix collects all the programs referred to in the course
|
||||
of this manual.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECTION"
|
||||
><H1
|
||||
CLASS="SECTION"
|
||||
><A
|
||||
NAME="TUTOR1-SRC"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor1.oph</TT
|
||||
></A
|
||||
></H1
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>.word $0801
|
||||
.org $0801
|
||||
|
||||
.word next, 10 ; Next line and current line number
|
||||
.byte $9e," 2064",0 ; SYS 2064
|
||||
next: .word 0 ; End of program
|
||||
|
||||
.advance 2064
|
||||
|
||||
ldx #0
|
||||
loop: lda hello, x
|
||||
beq done
|
||||
jsr $ffd2
|
||||
inx
|
||||
bne loop
|
||||
done: rts
|
||||
|
||||
hello: .byte "HELLO, WORLD!", 0</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x449.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.html"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x461.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Where to go from here</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor2.oph</TT
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,311 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Ophis Command Reference</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Programming with Ophis"
|
||||
HREF="book1.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="tutor7.oph"
|
||||
HREF="x501.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Basic arguments"
|
||||
HREF="x572.html"></HEAD
|
||||
><BODY
|
||||
CLASS="APPENDIX"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Programming with Ophis</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x501.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x572.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="APPENDIX"
|
||||
><H1
|
||||
><A
|
||||
NAME="REF-LINK"
|
||||
></A
|
||||
>Ophis Command Reference</H1
|
||||
><DIV
|
||||
CLASS="SECTION"
|
||||
><H1
|
||||
CLASS="SECTION"
|
||||
><A
|
||||
NAME="AEN507"
|
||||
>Command Modes</A
|
||||
></H1
|
||||
><P
|
||||
> These mostly follow the <I
|
||||
CLASS="EMPHASIS"
|
||||
>MOS Technology 6500
|
||||
Microprocessor Family Programming Manual</I
|
||||
>, except
|
||||
for the Accumulator mode. Accumulator instructions are written
|
||||
and interpreted identically to Implied mode instructions.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Implied:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>RTS</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Accumulator:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LSR</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Immediate:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA #$06</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Zero Page:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA $7C</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Zero Page, X:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA $7C,X</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Zero Page, Y:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA $7C,Y</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Absolute:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA $D020</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Absolute, X:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA $D000,X</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Absolute, Y:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA $D000,Y</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>(Zero Page Indirect, X):</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA ($80, X)</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>(Zero Page Indirect), Y:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDA ($80), Y</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>(Absolute Indirect):</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>JMP ($A000)</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>Relative:</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>BNE loop</TT
|
||||
></P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>(Absolute Indirect, X):</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>JMP ($A000, X)</TT
|
||||
> — Only available with 65C02 extensions</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>(Zero Page Indirect):</I
|
||||
> <TT
|
||||
CLASS="LITERAL"
|
||||
>LDX ($80)</TT
|
||||
> — Only available with 65C02 extensions</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x501.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.html"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x572.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor7.oph</TT
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Basic arguments</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,467 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Programming with Ophis</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Preface"
|
||||
HREF="f10.html"></HEAD
|
||||
><BODY
|
||||
CLASS="BOOK"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="BOOK"
|
||||
><A
|
||||
NAME="AEN1"
|
||||
></A
|
||||
><DIV
|
||||
CLASS="TITLEPAGE"
|
||||
><H1
|
||||
CLASS="TITLE"
|
||||
><A
|
||||
NAME="AEN2"
|
||||
>Programming with Ophis</A
|
||||
></H1
|
||||
><H3
|
||||
CLASS="AUTHOR"
|
||||
><A
|
||||
NAME="AEN4"
|
||||
></A
|
||||
>Michael Martin</H3
|
||||
><P
|
||||
CLASS="COPYRIGHT"
|
||||
>Copyright © 2006-7 Michael Martin</P
|
||||
><HR></DIV
|
||||
><DIV
|
||||
CLASS="TOC"
|
||||
><DL
|
||||
><DT
|
||||
><B
|
||||
>Table of Contents</B
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="f10.html"
|
||||
>Preface</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="f10.html#AEN15"
|
||||
>Why <SPAN
|
||||
CLASS="QUOTE"
|
||||
>"Ophis"</SPAN
|
||||
>?</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x22.html"
|
||||
>Getting a copy of Ophis</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="c35.html"
|
||||
>The basics</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="c35.html#AEN48"
|
||||
>A note on numeric notation</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x51.html"
|
||||
>Producing Commodore 64 programs</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x119.html"
|
||||
>Related commands and options</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x140.html"
|
||||
>Writing the actual code</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x149.html"
|
||||
>Assembling the code</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="c200.html"
|
||||
>Labels and aliases</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="c200.html#AEN206"
|
||||
>Temporary labels</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x214.html"
|
||||
>Anonymous labels</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x225.html"
|
||||
>Aliasing</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="c236.html"
|
||||
>Headers, Libraries, and Macros</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="c236.html#AEN240"
|
||||
>Header files and libraries</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x257.html"
|
||||
>Macros</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="x257.html#AEN265"
|
||||
>Macro definitions</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x257.html#AEN278"
|
||||
>Macro invocations</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="x287.html"
|
||||
>Example code</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="c292.html"
|
||||
>Character maps</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="c329.html"
|
||||
>Local variables and memory segments</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="c371.html"
|
||||
>Expressions</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="c419.html"
|
||||
>Advanced Memory Segments</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="c419.html#AEN424"
|
||||
>The Problem</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x430.html"
|
||||
>The Solution</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x449.html"
|
||||
>Where to go from here</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="a454.html"
|
||||
>Example Programs</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="a454.html#TUTOR1-SRC"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor1.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x461.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor2.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x465.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>c64-1.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x469.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>kernal.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x473.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor3.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x477.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor4a.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x481.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor4b.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x485.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor4c.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x489.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor5.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x493.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor6.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x497.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>c64-2.oph</TT
|
||||
></A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x501.html"
|
||||
><TT
|
||||
CLASS="FILENAME"
|
||||
>tutor7.oph</TT
|
||||
></A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="a505.html"
|
||||
>Ophis Command Reference</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="a505.html#AEN507"
|
||||
>Command Modes</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x572.html"
|
||||
>Basic arguments</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="x572.html#AEN575"
|
||||
>Numeric types</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x572.html#AEN598"
|
||||
>Label types</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x572.html#AEN611"
|
||||
>String types</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="x620.html"
|
||||
>Compound Arguments</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x647.html"
|
||||
>Memory Model</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="x647.html#AEN650"
|
||||
>Basic PC tracking</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x647.html#AEN659"
|
||||
>Basic Segmentation simulation</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x647.html#AEN683"
|
||||
>General Segmentation Simulation</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="x692.html"
|
||||
>Macros</A
|
||||
></DT
|
||||
><DD
|
||||
><DL
|
||||
><DT
|
||||
><A
|
||||
HREF="x692.html#AEN696"
|
||||
>Defining Macros</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x692.html#AEN702"
|
||||
>Invoking Macros</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x692.html#AEN710"
|
||||
>Passing Arguments to Macros</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x692.html#AEN720"
|
||||
>Features and Restrictions of the Ophis Macro Model</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
><DT
|
||||
><A
|
||||
HREF="x732.html"
|
||||
>Assembler directives</A
|
||||
></DT
|
||||
></DL
|
||||
></DD
|
||||
></DL
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="f10.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Preface</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,208 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Labels and aliases</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Programming with Ophis"
|
||||
HREF="book1.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Assembling the code"
|
||||
HREF="x149.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Anonymous labels"
|
||||
HREF="x214.html"></HEAD
|
||||
><BODY
|
||||
CLASS="CHAPTER"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Programming with Ophis</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x149.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x214.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="CHAPTER"
|
||||
><H1
|
||||
><A
|
||||
NAME="AEN200"
|
||||
></A
|
||||
>Labels and aliases</H1
|
||||
><P
|
||||
> Labels are an important part of your code. However, since each
|
||||
label must normally be unique, this can lead to <SPAN
|
||||
CLASS="QUOTE"
|
||||
>"namespace
|
||||
pollution,"</SPAN
|
||||
> and you'll find yourself going through ever
|
||||
more contorted constructions to generate unique label names.
|
||||
Ophis offers two solutions to this: <I
|
||||
CLASS="EMPHASIS"
|
||||
>anonymous
|
||||
labels</I
|
||||
> and <I
|
||||
CLASS="EMPHASIS"
|
||||
>temporary labels</I
|
||||
>. This
|
||||
tutorial will cover both of these facilities, and also introduce
|
||||
the aliasing mechanism.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECTION"
|
||||
><H1
|
||||
CLASS="SECTION"
|
||||
><A
|
||||
NAME="AEN206"
|
||||
>Temporary labels</A
|
||||
></H1
|
||||
><P
|
||||
> Temporary labels are the easiest to use. If a label begins with
|
||||
an underscore, it will only be reachable from inside the
|
||||
innermost enclosing scope. Scopes begin when
|
||||
a <TT
|
||||
CLASS="LITERAL"
|
||||
>.scope</TT
|
||||
> statement is encountered. This
|
||||
produces a new, inner scope if there is another scope in use.
|
||||
The <TT
|
||||
CLASS="LITERAL"
|
||||
>.scend</TT
|
||||
> command ends the innermost
|
||||
currently active scope.
|
||||
</P
|
||||
><P
|
||||
> We can thus rewrite our header data using temporary labels, thus
|
||||
allowing the main program to have a label
|
||||
named <TT
|
||||
CLASS="LITERAL"
|
||||
>next</TT
|
||||
> if it wants.
|
||||
</P
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>.word $0801
|
||||
.org $0801
|
||||
|
||||
.scope
|
||||
.word _next, 10 ; Next line and current line number
|
||||
.byte $9e," 2064",0 ; SYS 2064
|
||||
_next: .word 0 ; End of program
|
||||
.scend
|
||||
|
||||
.advance 2064</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x149.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.html"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x214.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Assembling the code</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Anonymous labels</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,226 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Headers, Libraries, and Macros</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Programming with Ophis"
|
||||
HREF="book1.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Aliasing"
|
||||
HREF="x225.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Macros"
|
||||
HREF="x257.html"></HEAD
|
||||
><BODY
|
||||
CLASS="CHAPTER"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Programming with Ophis</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x225.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x257.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="CHAPTER"
|
||||
><H1
|
||||
><A
|
||||
NAME="CH3-LINK"
|
||||
></A
|
||||
>Headers, Libraries, and Macros</H1
|
||||
><P
|
||||
> In this chapter we will split away parts of our <SPAN
|
||||
CLASS="QUOTE"
|
||||
>"Hello
|
||||
World"</SPAN
|
||||
> program into reusable header files and libraries.
|
||||
We will also abstract away our string printing technique into a
|
||||
macro which may be invoked at will, on arbitrary strings. We will
|
||||
then multiply the output of our program tenfold.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECTION"
|
||||
><H1
|
||||
CLASS="SECTION"
|
||||
><A
|
||||
NAME="AEN240"
|
||||
>Header files and libraries</A
|
||||
></H1
|
||||
><P
|
||||
> The prelude to our program—the <TT
|
||||
CLASS="FILENAME"
|
||||
>PRG</TT
|
||||
>
|
||||
information and the BASIC program—are going to be the same
|
||||
in many, many programs. Thus, we should put them into a header
|
||||
file to be included later. The <TT
|
||||
CLASS="LITERAL"
|
||||
>.include</TT
|
||||
>
|
||||
directive will load a file and insert it as source at the
|
||||
designated point.
|
||||
</P
|
||||
><P
|
||||
> A related directive, <TT
|
||||
CLASS="LITERAL"
|
||||
>.require</TT
|
||||
>, will include
|
||||
the file as long as it hasn't been included yet elsewhere. It
|
||||
is useful for ensuring a library is linked in.
|
||||
</P
|
||||
><P
|
||||
> For pre-assembled code or raw binary data,
|
||||
the <TT
|
||||
CLASS="LITERAL"
|
||||
>.incbin</TT
|
||||
> directive lets you include the
|
||||
contents of a binary file directly in the output. This is handy
|
||||
for linking in pre-created graphics or sound data.
|
||||
</P
|
||||
><P
|
||||
> As a sample library, we will expand the definition of
|
||||
the <TT
|
||||
CLASS="LITERAL"
|
||||
>chrout</TT
|
||||
> routine to include the standard
|
||||
names for every KERNAL routine. Our header file will
|
||||
then <TT
|
||||
CLASS="LITERAL"
|
||||
>.require</TT
|
||||
> it.
|
||||
</P
|
||||
><P
|
||||
> We'll also add some convenience aliases for things like reverse
|
||||
video, color changes, and shifting between upper case/graphics
|
||||
and mixed case text. We'd feed those to
|
||||
the <TT
|
||||
CLASS="LITERAL"
|
||||
>chrout</TT
|
||||
> routine to get their effects.
|
||||
</P
|
||||
><P
|
||||
> Since there have been no interesting changes to the prelude, and
|
||||
the KERNAL values are standard, we do not reproduce them here.
|
||||
(The files in question are <A
|
||||
HREF="x465.html"
|
||||
><I
|
||||
><I
|
||||
>c64-1.oph</I
|
||||
></I
|
||||
></A
|
||||
> and <A
|
||||
HREF="x469.html"
|
||||
><I
|
||||
><I
|
||||
>kernal.oph</I
|
||||
></I
|
||||
></A
|
||||
>.)
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x225.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.html"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x257.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Aliasing</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Macros</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,344 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Character maps</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Programming with Ophis"
|
||||
HREF="book1.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Example code"
|
||||
HREF="x287.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Local variables and memory segments"
|
||||
HREF="c329.html"></HEAD
|
||||
><BODY
|
||||
CLASS="CHAPTER"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Programming with Ophis</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x287.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="c329.html"
|
||||
ACCESSKEY="N"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="CHAPTER"
|
||||
><H1
|
||||
><A
|
||||
NAME="CH4-LINK"
|
||||
></A
|
||||
>Character maps</H1
|
||||
><P
|
||||
> Now we will close the gap between the Commodore's
|
||||
version of ASCII and the real one. We'll also add a time-delay
|
||||
routine to slow down the output. This routine isn't really of
|
||||
interest to us right now, so we'll add a subroutine
|
||||
called <TT
|
||||
CLASS="LITERAL"
|
||||
>delay</TT
|
||||
> that executes 2,560*(accumulator)
|
||||
<KBD
|
||||
CLASS="USERINPUT"
|
||||
>NOP</KBD
|
||||
>s. By the time the program is finished,
|
||||
we'll have executed 768,000 no-ops.
|
||||
</P
|
||||
><P
|
||||
> There actually are better ways of getting a time-delay on the
|
||||
Commodore 64; we'll deal with those in <A
|
||||
HREF="c329.html"
|
||||
>the Chapter called <I
|
||||
>Local variables and memory segments</I
|
||||
></A
|
||||
>.
|
||||
As a result, there isn't really a lot to discuss here. The later
|
||||
tutorials will be building off of <A
|
||||
HREF="x477.html"
|
||||
><I
|
||||
><I
|
||||
>tutor4a.oph</I
|
||||
></I
|
||||
></A
|
||||
>, so you may want to get familiar with
|
||||
that. Note also the change to the body of
|
||||
the <TT
|
||||
CLASS="LITERAL"
|
||||
>greet</TT
|
||||
> macro.
|
||||
</P
|
||||
><P
|
||||
> On to the topic at hand. Let's change the code to use mixed case.
|
||||
We defined the <TT
|
||||
CLASS="LITERAL"
|
||||
>upper'case</TT
|
||||
>
|
||||
and <TT
|
||||
CLASS="LITERAL"
|
||||
>lower'case</TT
|
||||
> aliases back
|
||||
in <A
|
||||
HREF="c236.html"
|
||||
>the Chapter called <I
|
||||
>Headers, Libraries, and Macros</I
|
||||
></A
|
||||
> as part of the
|
||||
standard <A
|
||||
HREF="x469.html"
|
||||
><I
|
||||
><I
|
||||
>kernal.oph</I
|
||||
></I
|
||||
></A
|
||||
>
|
||||
header, so we can add this before our invocations of
|
||||
the <TT
|
||||
CLASS="LITERAL"
|
||||
>greet</TT
|
||||
> macro:
|
||||
</P
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> lda #lower'case
|
||||
jsr chrout</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
> And that will put us into mixed case mode. So, now we just need
|
||||
to redefine the data so that it uses the mixed-case:
|
||||
</P
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>hello1: .byte "Hello, ",0
|
||||
hello2: .byte "!", 13, 0
|
||||
|
||||
target1: .byte "programmer", 0
|
||||
target2: .byte "room", 0
|
||||
target3: .byte "building", 0
|
||||
target4: .byte "neighborhood", 0
|
||||
target5: .byte "city", 0
|
||||
target6: .byte "nation", 0
|
||||
target7: .byte "world", 0
|
||||
target8: .byte "Solar System", 0
|
||||
target9: .byte "Galaxy", 0
|
||||
target10: .byte "Universe", 0</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
> The code that does this is in <A
|
||||
HREF="x481.html"
|
||||
><I
|
||||
><I
|
||||
>tutor4b.oph</I
|
||||
></I
|
||||
></A
|
||||
>. If you assemble and run it, you will
|
||||
notice that the output is not what we want. In particular, upper
|
||||
and lowercase are reversed, so we have messages
|
||||
like <SAMP
|
||||
CLASS="COMPUTEROUTPUT"
|
||||
>hELLO, sOLAR sYSTEM!</SAMP
|
||||
>. For
|
||||
the specific case of PETSCII, we can just fix our strings, but
|
||||
that's less of an option if we're writing for the Apple II's
|
||||
character set, or targeting a game console that puts its letters
|
||||
in arbitrary locations. We need to remap how strings are turned
|
||||
into byte values. The <TT
|
||||
CLASS="LITERAL"
|
||||
>.charmap</TT
|
||||
>
|
||||
and <TT
|
||||
CLASS="LITERAL"
|
||||
>.charmapbin</TT
|
||||
> directives do what we need.
|
||||
</P
|
||||
><P
|
||||
> The <TT
|
||||
CLASS="LITERAL"
|
||||
>.charmap</TT
|
||||
> directive usually takes two
|
||||
arguments; a byte (usually in character form) indicating the ASCII
|
||||
value to start remapping from, and then a string giving the new
|
||||
values. To do our case-swapping, we write two directives before
|
||||
defining any string constants:
|
||||
</P
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>.charmap 'A, "abcdefghijklmnopqrstuvwxyz"
|
||||
.charmap 'a, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
> Note that the <TT
|
||||
CLASS="LITERAL"
|
||||
>'a</TT
|
||||
> constant in the second
|
||||
directive refers to the <SPAN
|
||||
CLASS="QUOTE"
|
||||
>"a"</SPAN
|
||||
> character in the source,
|
||||
not in the current map.
|
||||
</P
|
||||
><P
|
||||
> The fixed code is in <A
|
||||
HREF="x485.html"
|
||||
><I
|
||||
><I
|
||||
>tutor4c.oph</I
|
||||
></I
|
||||
></A
|
||||
>, and will produce the expected results
|
||||
when run.
|
||||
</P
|
||||
><P
|
||||
> An alternative is to use a <TT
|
||||
CLASS="LITERAL"
|
||||
>.charmapbin</TT
|
||||
>
|
||||
directive to replace the entire character map directly. This
|
||||
specifies an external file, 256 bytes long, that is loaded in at
|
||||
that point. A binary character map for the Commodore 64 is
|
||||
provided with the sample programs
|
||||
as <TT
|
||||
CLASS="FILENAME"
|
||||
>petscii.map</TT
|
||||
>. There are also three
|
||||
files, <TT
|
||||
CLASS="FILENAME"
|
||||
>a2normal.map</TT
|
||||
>, <TT
|
||||
CLASS="FILENAME"
|
||||
>a2inverse.map</TT
|
||||
>,
|
||||
and <TT
|
||||
CLASS="FILENAME"
|
||||
>a2blink.map</TT
|
||||
> that handle the Apple II's
|
||||
very nonstandard character encodings.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x287.html"
|
||||
ACCESSKEY="P"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.html"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c329.html"
|
||||