Mervu
Mervu
DOCTYPE html>
<html lang="en">
<!-- __ _ _ _ __| |_ (_)__ _____
/ _` | '_/ _| ' \| |\ V / -_)
\__,_|_| \__|_||_|_| \_/\___| -->
<head>
<title>Full text of "Merlin 816 Macro Assembler Manual"</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/
>
<script>window.archive_setup=[]</script>
<script src="//archive.org/includes/jquery-1.10.2.min.js?v1.10.2" type="
text/javascript"></script>
<script src="//archive.org/includes/analytics.js?v=1a4ce02" type="text/javas
cript"></script>
<script src="//archive.org/includes/bootstrap.min.js?v3.0.0" type="text/java
script"></script>
<script src="https://archive.org/includes/node_modules/react/dist/react.js?v
15.1.0" type="text/javascript"></script>
<script src="https://archive.org/includes/node_modules/react-dom/dist/react-
dom.js?v15.1.0" type="text/javascript"></script>
<script src="https://archive.org/includes/archive.min.js?v=1a4ce02" type="te
xt/javascript"></script>
<link href="//archive.org/includes/archive.min.css?v=1a4ce02" rel="styleshee
t" type="text/css"/>
<link rel="SHORTCUT ICON" href="https://archive.org/images/glogo.jpg"/>
</head>
<body class="navia ">
<a href="#maincontent" class="hidden-for-screen-readers">Skip to main conten
t</a>
<!-- Wraps all page content -->
<div id="wrap">
<div id="navwrap1">
<div id="navwrap2">
<div id="nav-tophat" class="collapse">
<div class="linx">
<h5>Featured</h5>
<a href="https://archive.org/details/texts"><span cl
ass="iconochive-texts" aria-hidden="true"></span><span class="sr-only">texts</s
pan> All Texts</a>
<a href="https://archive.org/search.php?query=mediat
ype:texts&sort=-publicdate"><span class="iconochive-latest" aria-hidden="true">
</span><span class="sr-only">latest</span> This Just In</a>
<a href="https://archi
ve.org/details/smithsonian" title="Smithsonian Libraries">Smithsonian Libraries<
/a> <a href="https://ar
chive.org/details/fedlink" title="FEDLINK (US)">FEDLINK (US)</a>
<a href="https://archive.org/details/g
enealogy" title="Genealogy">Genealogy</a>
<a href="https://archive.org/details/lincolncollection" title
="Lincoln Collection">Lincoln Collection</a>
<a href="https://archive.org/details/additional_collection
s" title="Additional Collections">Additional Collections</a>
</div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-2">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/texts"><img class=" clipW clipH" src="ht
tps://archive.org/services/img/texts" style="height:180px"></a></div><a class="s
tealth boxy-label" href="https://archive.org/details/texts">eBooks & Texts</
a></center> </div><!--/.widgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7 col-sm-p
ush-2">
<div class="linx">
<h5>Top</h5>
<a href="https://archi
ve.org/details/americana" title="American Libraries">American Libraries</a>
<a href="https://archive.or
g/details/toronto" title="Canadian Libraries">Canadian Libraries</a>
<a href="https://archive.org/detai
ls/universallibrary" title="Universal Library">Universal Library</a>
<a href="https://archive.org/detai
ls/cdbbsarchive" title="Shareware CD-ROMs">Shareware CD-ROMs</a>
<a href="https://archive.org/details/o
pensource" title="Community Texts">Community Texts</a>
<a href="https://archive.org/details/gutenberg"
title="Project Gutenberg">Project Gutenberg</a>
<a href="https://archive.org/details/biodiversity" titl
e="Biodiversity Heritage Library">Biodiversity Heritage Library</a>
</div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-4">
<div class="widgets">
<center>
<a href="https://openlibrary.org"><img src="https://archive.org/images/widgetOL.
png" class="img-responsive" style="margin-bottom:15px"/><b>Open Library</b></a><
/center>
</div><!--/.widgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7">
<div class="linx">
<h5 class="hidden-xs"> </h5>
<a href="https://archi
ve.org/details/iacl" title="Children's Library">Children's Library</a>
<a href="https://archive.org/det
ails/NYPLLabs" title="NYPL Labs Archive">NYPL Labs</a>
</div>
</div><!--/.col-sm-2-->
</div><!--/.row-->
<div class="row toprow fivecolumns movies">
<div class="col-sm-2 col-xs-7 col-sm-p
ush-4">
<div class="linx">
<h5>Featured</h5>
<a href="https://archive.org/details/movies"><span c
lass="iconochive-movies" aria-hidden="true"></span><span class="sr-only">movies
</span> All Video</a>
<a href="https://archive.org/search.php?query=mediat
ype:movies&sort=-publicdate"><span class="iconochive-latest" aria-hidden="true"
></span><span class="sr-only">latest</span> This Just In</a>
<a href="https://archi
ve.org/details/prelinger" title="Prelinger Archives">Prelinger Archives</a>
<a href="https://archive.or
g/details/democracy_now_vid" title="Democracy Now!">Democracy Now!</a>
<a href="https://archive.org/det
ails/occupywallstreet" title="Occupy Wall Street">Occupy Wall Street</a>
<a href="https://archive.org/d
etails/nsa" title="TV NSA Clip Library">TV NSA Clip Library</a>
</div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-2">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/tv"><img class=" clipW clipH" src="https
://archive.org/services/img/tv" style="height:180px"></a></div><a class="stealth
boxy-label" href="https://archive.org/details/tv">TV News</a></center>
</div><!--/.widgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7 col-sm-p
ush-2">
<div class="linx">
<h5>Top</h5>
<a href="https://archi
ve.org/details/animationandcartoons" title="Animation & Cartoons">Animation
& Cartoons</a> <a href=
"https://archive.org/details/artsandmusicvideos" title="Arts & Music">Arts &
Music</a> <a href="htt
ps://archive.org/details/opensource_movies" title="Community Video">Community Vi
deo</a> <a href="https:
//archive.org/details/computersandtechvideos" title="Computers & Technology"
>Computers & Technology</a>
<a href="https://archive.org/details/culturalandacademicfilms" title="Cultu
ral & Academic Films">Cultural & Academic Films</a>
<a href="https://archive.org/details/ephemera"
title="Ephemeral Films">Ephemeral Films</a>
<a href="https://archive.org/details/moviesandfilms" title=
"Movies">Movies</a> </div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-4">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/911"><img class=" clipW" src="https://ar
chive.org/services/img/911" style="height:135px"></a></div><a class="stealth box
y-label" href="https://archive.org/details/911">Understanding 9/11</a></center>
</div><!--/.widgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7">
<div class="linx">
<h5 class="hidden-xs"> </h5>
<a href="https://archi
ve.org/details/newsandpublicaffairs" title="News & Public Affairs">News & Pu
blic Affairs</a> <a hre
f="https://archive.org/details/spiritualityandreligion" title="Spirituality &
; Religion">Spirituality & Religion</a>
<a href="https://archive.org/details/sports" title="Sports Vide
os">Sports Videos</a> <
a href="https://archive.org/details/television" title="Television">Television</a
> <a href="https://arch
ive.org/details/gamevideos" title="Videogame Videos">Videogame Videos</a>
<a href="https://archive.org/
details/vlogs" title="Vlogs">Vlogs</a>
<a href="https://archive.org/details/youth_media" title="Youth M
edia">Youth Media</a> </div
>
</div><!--/.col-sm-2-->
</div><!--/.row-->
<div class="row toprow fivecolumns audio">
<div class="col-sm-2 col-xs-7 col-sm-p
ush-4">
<div class="linx">
<h5>Featured</h5>
<a href="https://archive.org/details/audio"><span cl
ass="iconochive-audio" aria-hidden="true"></span><span class="sr-only">audio</s
pan> All Audio</a>
<a href="https://archive.org/search.php?query=mediat
ype:audio&sort=-publicdate"><span class="iconochive-latest" aria-hidden="true">
</span><span class="sr-only">latest</span> This Just In</a>
<a href="https://archi
ve.org/details/GratefulDead" title="Grateful Dead">Grateful Dead</a>
<a href="https://archive.org/detai
ls/netlabels" title="Netlabels">Netlabels</a>
<a href="https://archive.org/details/oldtimeradio" title=
"Old Time Radio">Old Time Radio</a>
<a href="https://archive.org/details/78rpm" title="78 RPMs and Cyli
nder Recordings">78 RPMs and Cylinder Recordings</a>
</div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-2">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/etree"><img class=" clipW clipH" src="ht
tps://archive.org/services/img/etree" style="height:180px"></a></div><a class="s
tealth boxy-label" href="https://archive.org/details/etree">Live Music Archive</
a></center> </div><!--/.widgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7 col-sm-p
ush-2">
<div class="linx">
<h5>Top</h5>
<a href="https://archi
ve.org/details/audio_bookspoetry" title="Audio Books & Poetry">Audio Books &
Poetry</a> <a href="ht
tps://archive.org/details/opensource_audio" title="Community Audio">Community Au
dio</a> <a href="https:
//archive.org/details/audio_tech" title="Computers & Technology">Computers &
Technology</a> <a href
="https://archive.org/details/audio_music" title="Music, Arts & Culture">Mus
ic, Arts & Culture</a>
<a href="https://archive.org/details/audio_news" title="News & Public Affair
s">News & Public Affairs</a>
<a href="https://archive.org/details/audio_foreign" title="Non-English Aud
io">Non-English Audio</a>
<a href="https://archive.org/details/audio_podcast" title="Podcasts">Podcasts
</a> </div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-4">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/librivoxaudio"><img class=" clipW clipH"
src="https://archive.org/services/img/librivoxaudio" style="height:180px"></a><
/div><a class="stealth boxy-label" href="https://archive.org/details/librivoxaud
io">Librivox Free Audiobook</a></center> </div><!--/.wi
dgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7">
<div class="linx">
<h5 class="hidden-xs"> </h5>
<a href="https://archi
ve.org/details/radioprograms" title="Radio Programs">Radio Programs</a>
<a href="https://archive.org/de
tails/audio_religion" title="Spirituality & Religion">Spirituality & Religio
n</a> </div>
</div><!--/.col-sm-2-->
</div><!--/.row-->
<div class="row toprow fivecolumns software">
<div class="col-sm-2 col-xs-7 col-sm-p
ush-4">
<div class="linx">
<h5>Featured</h5>
<a href="https://archive.org/details/software"><span
class="iconochive-software" aria-hidden="true"></span><span class="sr-only">so
ftware</span> All Software</a>
<a href="https://archive.org/search.php?query=mediat
ype:software&sort=-publicdate"><span class="iconochive-latest" aria-hidden="tru
e"></span><span class="sr-only">latest</span> This Just In</a>
<a href="https://archi
ve.org/details/tosec" title="Old School Emulation">Old School Emulation</a>
<a href="https://archive.or
g/details/softwarelibrary_msdos_games" title="MS-DOS Games">MS-DOS Games</a>
<a href="https://archive.o
rg/details/historicalsoftware" title="Historical Software">Historical Software</
a> <a href="https://arc
hive.org/details/classicpcgames" title="Classic PC Games">Classic PC Games</a>
<a href="https://archive
.org/details/softwarelibrary" title="Software Library">Software Library</a>
</div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-2">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/internetarcade"><img class=" clipW" src=
"https://archive.org/services/img/internetarcade" style="height:64px;position:re
lative;left:-50px"></a></div><a class="stealth boxy-label" href="https://archive
.org/details/internetarcade">Internet Arcade</a></center>
</div><!--/.widgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7 col-sm-p
ush-2">
<div class="linx">
<h5>Top</h5>
<a href="https://archi
ve.org/details/open_source_software" title="Community Software">Community Softwa
re</a> <a href="https:/
/archive.org/details/softwarelibrary_msdos" title="MS-DOS">MS-DOS</a>
<a href="https://archive.org/deta
ils/softwaresites" title="Software Sites">Software Sites</a>
<a href="https://archive.org/details/apkar
chive" title="APK">APK</a>
<a href="https://archive.org/details/tucows" title="Tucows Software Library"
>Tucows Software Library</a>
<a href="https://archive.org/details/vintagesoftware" title="Vintage Softw
are">Vintage Software</a>
<a href="https://archive.org/details/vectrex" title="Vectrex">Vectrex</a>
</div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-4">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/consolelivingroom"><img class=" clipW" s
rc="https://archive.org/services/img/consolelivingroom" style="height:127px"></a
></div><a class="stealth boxy-label" href="https://archive.org/details/consoleli
vingroom">Console Living Room</a></center> </div><!--/.
widgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7">
<div class="linx">
<h5 class="hidden-xs"> </h5>
<a href="https://archi
ve.org/details/softwarelibrary_zx_spectrum" title="ZX Spectrum">ZX Spectrum</a>
<a href="https://archiv
e.org/details/atari_2600_library" title="Atari 2600">Atari 2600</a>
<a href="https://archive.org/detail
s/zx_spectrum_library_games" title="ZX Spectrum Library: Games">ZX Spectrum Libr
ary: Games</a> <a href=
"https://archive.org/details/library_magnavox_odyssey2" title="Magnavox Odyssey
2">Magnavox Odyssey 2</a>
<a href="https://archive.org/details/bally_astrocade_library" title="Bally As
trocade">Bally Astrocade</a>
<a href="https://archive.org/details/sega_genesis_library" title="Sega Gen
esis">Sega Genesis</a>
<a href="https://archive.org/details/softwarelibrary_apple" title="Apple Compute
r">Apple Computer</a> </div
>
</div><!--/.col-sm-2-->
</div><!--/.row-->
<div class="row toprow fivecolumns image">
<div class="col-sm-2 col-xs-7 col-sm-p
ush-4">
<div class="linx">
<h5>Featured</h5>
<a href="https://archive.org/details/image"><span cl
ass="iconochive-image" aria-hidden="true"></span><span class="sr-only">image</s
pan> All Image</a>
<a href="https://archive.org/search.php?query=mediat
ype:image&sort=-publicdate"><span class="iconochive-latest" aria-hidden="true">
</span><span class="sr-only">latest</span> This Just In</a>
<a href="https://archi
ve.org/details/flickrcommons" title="Flickr Commons">Flickr Commons</a>
<a href="https://archive.org/de
tails/flickr-ows" title="Occupy Wall Street Flickr">Occupy Wall Street Flickr</a
> <a href="https://arch
ive.org/details/coverartarchive" title="Cover Art">Cover Art</a>
<a href="https://archive.org/details/m
aps_usgs" title="USGS Maps">USGS Maps</a>
</div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-2">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/metropolitanmuseumofart-gallery"><img cl
ass=" clipW clipH" src="https://archive.org/services/img/metropolitanmuseumofart
-gallery" style="height:180px"></a></div><a class="stealth boxy-label" href="htt
ps://archive.org/details/metropolitanmuseumofart-gallery">Metropolitan Museum</a
></center> </div><!--/.widgets-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7 col-sm-p
ush-2">
<div class="linx">
<h5>Top</h5>
<a href="https://archi
ve.org/details/nasa">NASA Images</a>
<a href="https://archive.org/details/solarsystemcollection">Solar
System Collection</a> <
a href="https://archive.org/details/amesresearchcenterimagelibrary">Ames Researc
h Center</a> </div>
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-5 col-sm-p
ull-4">
<div class="widgets">
<center class="items_list"><div class="items_list_im
g"><a href="https://archive.org/details/brooklynmuseum"><img class=" clipW clipH
" src="https://archive.org/services/img/brooklynmuseum" style="height:180px"></a
></div><a class="stealth boxy-label" href="https://archive.org/details/brooklynm
useum">Brooklyn Museum</a></center> </div><!--/.widgets
-->
</div><!--/.col-sm-2-->
<div class="col-sm-2 col-xs-7">
<div class="linx">
<h5 class="hidden-xs"> </h5>
</div>
</div><!--/.col-sm-2-->
</div><!--/.row-->
</div><!--/#nav-tophat-->
</div><!--#navwrap1-->
</div><!--#navwrap2-->
<!-- Begin page content -->
<div class="container container-ia">
<a name="maincontent" id="maincontent"></a>
<h1>
Full text of "<a href="/details/Merlin_816_Macro_Assembler_Manual">Merli
n 816 Macro Assembler Manual</a>"
</h1>
<h2 class="pull-right">
<small><a href="/details/Merlin_816_Macro_Assembler_Manual">See other fo
rmats</a></small>
</h2>
<br class="clearfix" clear="right"/>
<pre>Merlin 8/16
The Complete Macro Assembler System
For the Apple* llgs, 128K lie and He
Hype file;
L-Lcck files
IBnlock files
D-Delete files
E-Exhune files
Hsnfy files
R-Ranane files
TAG-Menu change
S-Sort directory
f-Chsnpe file date
/-Create directory
ll-Shou voiuna rsses
B-Toggle ball j nou OH
P-T039 J e prompting, nc
L laid jirw
Di<t nwair.il
F Full rcrsf^ liitor
Swi t^Kl :le .
U mliin wm
9 C-Jtt
PUBLISHING .'INC.
Merlin 8/16
Complete Macro Assembler System
For the Apple Ilgs and 128K He/He
by Glen Bredon
Produced by:
Roger Wagner Publishing, Inc.
1050 Pioneer Way, Suite P
El Cajon, California 92020
Customer Service & Technical Support:
619/442-0522
ISBN 0-927796-28-7
1M188
The Roger Wagner Publishing, Inc. software product that you have just received
from Roger Wagner Publishing, Inc., or one of its authorized dealers, is provide
d to
you subject to the Terms and Conditions of the Software Customer Licensing
Agreement. Should you decide that you cannot accept these Terms and Conditions,
then you must return your product with all documentation and this License marked
"REFUSED" within the 30 day examination period following the receipt of the
product
1. License. Roger Wagner Publishing, Inc. hereby grants you upon your receipt
of this product, a nonexclusive license to use the enclosed Roger Wagner
Publishing, Inc. product subject to the terms and restrictions set forth in this
License Agreement.
2. Copyright. This software product, and its documentation, is copyrighted by
Roger Wagner Publishing, Inc. You may not copy or otherwise reproduce the
product or any part of it except as expressly permitted in this License.
3. Restrictions on Use and Transfer. The original and any backup copies of this
product are intended for your personal use in connection with a single computer.
You may not distribute copies of, or any part of, this product without the expre
ss
written permission of Roger Wagner Publishing, Inc.
Limitations of Warranties and Liability
Roger Wagner Publishing, Inc. and the program author shall have no liability or
responsibility to purchaser or any other person or entity with respect to liabil
ity,
loss or damage caused or alleged to be caused directly or indirectly by this sof
tware,
including, but not limited to any interruption of service, loss of business or
anticipatory profits or consequential damages resulting from the use or operatio
n of
this software. Some states do not allow the exclusion or limitation of implied
warranties or liability for incidental or consequential damages, so the above
limitation or exclusion may not apply to you.
ProDOS and DOS 3.3 are copyrighted programs of Apple Computer, Inc. licensed
to Roger Wagner Publishing, Inc. to distribute for use only in combination with
Merlin 8/16.
APPLE COMPUTER, INC. MAKES NO WARRANTIES, EITHER EXPRESS
OR IMPLIED, REGARDING THE ENCLOSED COMPUTER SOFTWARE
PACKAGE, ITS MERCHANTABILITY OR ITS FITNESS FOR ANY
PARTICULAR PURPOSE. THE EXCLUSION OF IMPLIED WARRANTIES
IS NOT PERMITTED BY SOME STATES. THE ABOVE EXCLUSION MAY
NOT APPLY TO YOU. THIS WARRANTY PROVIDES YOU WITH
SPECIFIC LEGAL RIGHTS. THERE MAY BE OTHER RIGHTS THAT YOU
MAY HAVE WHICH VARY FROM STATE TO STATE.
Copyrights
The Merlin 8/16 documentation and software are copyrighted 1987 by Roger
Wagner Publishing, Inc. This documentation and/or software, or any part thereof,
may not be reproduced in any form or by any means, electronic or mechanical,
including photocopying, recording, storage in an information retrieval system, o
r
otherwise, without the prior written permission of the publisher.
We have tried our best to give you a quality product at a fair price, and made t
he
software copy able for your personal convenience. Please recommend our product t
o
your friends, but respect our wishes to not make copies for others. Thanks!
Apple, ProDOS, and DOS 3.3 are trademarks or Apple Computer, Inc.
Merlin 8/16 is a trademark of Roger Wagner Publishing, Inc.
About the Manual
This manual was formatted using MacAuthor from Icon Technology, Ltd, 9 Jarrom
Street, Leicester LE2 7DH, England, and Apple's LaserWriter printer.
OUR GUARANTEE
This product carries the unconditional guarantee of satisfaction or your money b
ack.
Any product may be returned to place of purchase for complete refund or
replacement within thirty (30) days of purchase if accompanied by the sales rece
ipt
or other proof of purchase.
Glen Bredon is a professor at Rutgers University in New Jersey where he has taug
ht mathematics for
over twenty years. He purchased his first computer in 1979 and began exploring i
ts internal operations
because "I wanted to know more than my students." The result of this study was M
erlin, the first in a
series of best selling assemblers (Merlin, Merlin Pro, Merlin 64, and Merlin 128
) for the Apple and
Commodore personal computers. Glen has also written other utilities including Pr
osel, the popular
ProDOS program selector. A native Calif omian and concerned environmentalist, Gl
en spends his
summers away from mathematics and computing, preferring the solitude of the Sier
ra Nevada mountains
where he has helped establish wilderness reserves.
r
r
r
i
!
MERLIN 8/16
Table of Contents
INTRODUCTION
System Requirements 1
Suggested Reading 2
Making Back-up Copies of Merlin 8/16 3
Personalizing Merlin 8/16 4
GETTING STARTED WITH MERLIN 8/16
Entering a Source Listing 5
Editing a Source Listing 8
Assembling a Source Listing 9
Saving Programs 12
Running Programs 14
The Rest of This Manual . , 16
THE MAIN MENU
The Main Menu f 17
THE MERLIN 8 EDITOR
Merlin 8 Full Screen Editor Commands 23
Merlin 8 Control Key Commands , . 24
Merlin 8 Open Apple Key Commands 27
Merlin 8 Editor Command Summary 33
Merlin 8 Command Mode , , 36
General Guidelines for the Command Mode . 36
About the Merlin 8 Editor Documentation , 36
Command Mode Commands Ii( 37
Assembling a Merlin 8 File t . . . t 47
THE MERLIN 16 EDITOR
Merlin 16 Full Screen Editor Commands . . 48
Merlin 16 Control Key Commands .... 48
Merlin 16 Open Apple Key Commands , 52
Merlin 16 Command Box 61
General Guidelines for the Command Box Commands . . . , 61
About the Command Box Documentation ........... 61
Command Box Commands t ;..>..... 63
Merlin 16 Editor Command Summary 70
Assembling a Merlin 16 File 73
THE ASSEMBLER
The Assembler , , * < * , , . , 74
About the Assembler Documentation , . . , . 75
Preliminary Definitions 76
Assembler Syntax Conventions , . , . 77
Source Code Format 77
Local Labels 78
Variables 79
Number Format 80
Expressions Allowed by the Assembler , , . , t , , , , 81
Immediate Data Syntax 83
Addressing Modes 83
Special Forced Non-Zero Page Addressing 85
Sweet 16 Opcodes 85
65C02 and 65802 Opcodes 86
Assembler Pseudo Opcode Descriptions 87
Formatting Pseudo Ops 103
String Data Pseudo Ops 107
Data and Storage Allocation Pseudo Ops 110
Using Data Tables in Programs 113
Conditional Pseudo Ops 1 14
Using Conditional Assembly 1 16
Miscellaneous Pseudo Ops 119
MACROS
Why Macros 127
Macro Pseudo Ops 127
How a Macro Works 128
More About Defining a Macro 133
Nested Macros 134
Macro Libraries and the USE Pseudo-Op 136
THE LINKERS
The Merlin 8/16 Linkers 137
Why a Linker 137
About the Linker Documentation 138
Pseudo Opcodes for Use with Relocatable Code Files 140
The Merlin 8 Linker 144
Linker Name Files 145
The Linking Process 146
Using Merlin 8 Linked Files 147
The Merlin 16 Linkers 150
The Absolute Linker . 151
The Linker Command File 154
Using Merlin 16 Linked Files 155
Preface
MERLIN 8/16
Merlin 8/16 is an extremely powerful, comprehensive Macro Assembler system for t
he Apple Ugs or
128K Ile/IIc. It consists of four main modules and numerous auxiliary and utilit
y programs which
comprise one of the most complete assembler systems available for any personal c
omputer. Merlin
8/16's four main modules are:
- FILE MANAGEMENT system, for disk I/O, file management, ProDOS interpreter, etc
.
- EDITOR system, for writing and editing programs with word-processor-like power
.
- ASSEMBLER system, with Macros, Macro libraries, conditional assembly, linked f
iles, etc.
- LINKER system, for generating relocatable code modules, library routines, run-
time packages, etc.
However, Merlin 8/16 is more than just the sum of these four parts. Here are som
e of the other features
offered by Merlin 8/16:
- Merlin 8/16 comes with three assemblers: Merlin 16 (ProDOS), Merlin 8 (ProDOS)
, and Merlin 8
(DOS 3.3). On the Apple Ilgs, or Apple He or lie computers with the 65802 or 658
16 chip, Merlin
16 assembles programs written for the 6502, 65C02, 65802 and 65816 microprocesso
rs. On the
standard 128K lie or lie, Merlin 8 assembles programs written for the 6502, 65C0
2 and 65802
microprocessors.
- Merlin 8/16 is compatible with existing Merlin and Merlin Pro source files.
- Merlin 8/16 recognizes over 50 Pseudo Opcodes for extreme programming flexibil
ity.
- Merlin 8/16 has over 70 commands for ultimate editing and assembling power.
- Merlin 8/16 produces a fully commented, disassembled source listing of Appleso
ft BASIC.
- Merlin 8/16 comes with Sourceror, a powerful symbolic disassembler to generate
Merlin 8/16 source
code from binary programs.
- Merlin 8/16 comes with many sample programs, libraries and other aids to get y
ou going with
assembly language fast.
- Merlin 8/16 is copyable and hard disk compatible.
Introduction
INTRODUCTION
Merlin 8/16 is the most comprehensive macro assembler system for the Apple Ilgs
or 128K He/lie
offering virtually every feature and function that a programmer needs, thus maki
ng it unlikely that
you'll outgrow it. At the same time, Merlin 8/1 6's easy built-in editor and fas
t assemblies make it a
pleasure to use whether you're writing a few lines of code or 30,000!
SYSTEM REQUIREMENTS
To run Merlin 8/16, you'll need at least one disk drive, and one of the followin
g:
* Apple Ilgs or
* Apple He or
* 128K Apple He or
* Laser 128 or Laser 128 EX
Merlin 8 will run on all the computer systems listed above; Merlin 16 requires a
65802 or 65816
microprocessor such as in the Apple Ilgs, or a modified Apple He, He or compatib
le.
Merlin 8/16 supports a wide variety of 80 column display devices including the A
pple, the Videx
standard and Ultraterm cards, the Checkmate Multi-View, the Applied Engineering
Viewmaster 80, and
many others.
Merlin 8/16 works with all printers, producing formatted listings with page brea
ks and titles.
If you're familiar with assembly language programming already, you will find it'
s easy to adapt to
Merlin 8/16. It follows the programming standards of the 65xx family of micropro
cessors, and its
assembler-directed commands, or pseudo-ops, are a super-set of just about every
other assembler. That
is, assembler directives like HEX, ASC, DS, etc. that you've used in other assem
blers are used in
Merlin 8/16, and better still, you'll find a new complement of functions to make
programming easier.
These include assembling directly to or from disk files, multiple data formats f
or numbers and strings, a
complete set of assembler utilities such as cross-referencing and a source code
generator (Sourceror),
macro capabilities and more.
If you're new to assembly language programming, Merlin 8/16 is the easiest assem
bler there is.
However, the Merlin 8/16 manual does not make any attempt to teach the technique
s of assembly
language programming itself. Those techniques are covered in various tutorial bo
oks available from a
number of publishers, including Roger Wagner Publishing. Because everyone has di
fferent goals and
objectives, you should seek out those books which best match your current needs
and experience.
Page 1
Merlin 8/16 User's Manual
Introduction
SUGGESTED READING
Some of the books we recommend include:
APPLE HGS MACHINE LANGUAGE FOR BEGINNERS - Roger Wagner, COMPUTE! Books,
Greensboro, NC 27408. Approximately 600 pages of new material, this Ilgs assembl
y language
tutorial covers a myriad of subjects such as writing your first routines, callin
g machine language
routines from Applesoft, ProDOS 8 and 16, and concludes with a Ilgs drawing prog
ram using
Quickdraw, scrollable windows, and pull-down menus. The encyclopedic appendix in
cludes examples of
all machine language instructions.
s APPLE HGS TECHNICAL REFERENCE - Michael Fischer, Osbourne-McGraw-Hill. Filled
with
relevant technical material, this book is an outstanding resource for the advanc
ed programmer interested
software development on the Ilgs.
APPLE IIGS TOOLBOX REFERENCE - Apple Computer, Inc. This 2-volume set is a highl
y
technical reference for using the Ilgs toolbox. Does not include programming exa
mples or tutorial
information.
s APPLE PRODOS - by Gary Little. Brady Communications Co., Bowie, MD 20715. A go
od tutorial
book on how to write assembly language programs that use ProDOS.
ASSEMBLY LINES: THE BOOK - by Roger Wagner. Roger Wagner Publishing, Inc. El Caj
on, CA
92020. A tutorial on assembly language programming designed specifically for the
novice. It gives a
description of all 6502 instructions, disk access, reading and writing DOS 3.3 f
iles, sound generation,
basic math, keyboard and screen techniques and more.
ASSEMBLY COOKBOOK FOR THE APPLE II/IIE - by Don Lancaster. Howard Sams & Co.
,
Indianapolis, IN 46268. This interesting book will give you real insights into D
on Lancaster's view of
programming theory and practice. A good addition to any library.
n/ BENEATH APPLE DOS - by Don Worth and Peter Lechner. Brady Communications Co.,
Bowie, MD
20715.
^ BENEATH APPLE PRODOS - by Don Worth and Peter Lechner. Brady Communications Co
., Bowie,
MD 207 15. These two books are the classic reference books for learning about th
e inner workings of
DOS 3.3 and ProDOS. A must if you intend to do any programming in this area. Mor
e of a reference
than a tutorial.
ENHANCING YOUR APPLE II (Volume 1) - by Don Lancaster. Howard Sams & Co., In
dianapolis,
IN 46268.
ENHANCING YOUR APPLE II AND HE (Volume 2) - by Don Lancaster. Howard Sams &
Co.,
Indianapolis, IN 46268. These two books are a continuation of Don Lancaster's un
ique instruction in
the art of assembly language programming. More tips here on different kinds of s
hort programs.
Page 2
Introduction
INSIDE THE APPLE IIC - by Gary Little. Brady Communications Co., Bowie, MD 20715
. An
overview of the entire Apple lie system, from the assembly language programmer's
viewpoint.
INSIDE THE APPLE IIGS - Gary Bond, Sybex. Contains a lot of important informatio
n but
by-passes some of the rules for producing code compatible with future system upg
rades.
NOW THAT YOU KNOW APPLE ASSEMBLY LANGUAGE, WHAT CAN YOU DO WITH IT? -
by Jules Guilder, Redlig Systems, Inc., 2068 79th Street, Brooklyn, NY 11214. A
good applications
tutorial with lots of good subroutines for input and output, printer drivers and
more. An excellent
follow-up book to Assembly Lines: The Book.
PROGRAMMING THE 65816 - David Eyes and Ron Lichty, Prentice Hall Press, New York
, NY
10023. In-depth coverage of the differences between the 65816, 6502, 65C02, and
65802 chips and how
to best utilize them from a programming standpoint. Also includes a programming
tutorial, code
samples and a reference section.
/ THE APPLE IIGS TOOLBOX REVEALED - Danny Goodman, Bantam Computer Books. Detail
s the
philosophy of the toolbox and methods of accessing it, but lacks programming exa
mples.
THE ELEMENTARY APPLE IIGS - William B. Sanders, COMPUTE! Books, Greensboro, NC
27408. An introductory book to the Ilgs with information on Applesoft, Hi-Res an
d Super Hi-Res
graphics, and sound on the Ilgs.
65816/65802 ASSEMBLY LANGUAGE PROGRAMMING - by Michael Fischer. Osborne
McGraw-Hill , Berkely, CA 94710. A thorough treatment of the 6502, 65C02, 65802
and 65816
microprocessors. The size of this book (nearly 700 pages) gives you an idea of w
hy this manual for
Merlin 8/16 does not attempt to cover programming on the 6500 family microproces
sors itself.
Page 3
Getting Started
2. The percent (%) prompt appears at the bottom of the Main Menu. Press F if you
are using Merlin
16. If you are using Merlin 8, press E to go the Editor, then A and Return to en
ter the Add Mode.
3. Since we are entering an entirely new program, a 1 appears at the top right c
omer of the screen.
This number indicates the line the cursor is on in the listing. The 1 and all su
bsequent line numbers
which appear serve roughly the same purpose as line numbers in BASIC except that
in assembly
source code, line numbers are not referenced for jumps to subroutines or in GOTO
-like statements.
4. On line 1, type an asterisk (*). Entering an asterisk as the first character
in any line is similar to a
REM statement in BASIC - it tells the assembler this is a remark line and anythi
ng after the asterisk
is to be ignored. Type the title DEMO PROGRAM 1 after the asterisk and press the
Return key.
* DEMO PROGRAM 1
5. After Return, the cursor moves to the beginning of line 2.
6. An asterisk is not needed to just create a blank line. To create a blank line
, with no text following
it, press Return again.
7. The cursor once again drops down one line, and a 3 appears at the top right c
omer of the screen.
Page 5
Getting Started
8. Press the space bar once and the cursor moves to the next field. Type ORG, pr
ess space again, type
$8000 and then press Return.
* DEMO PROGRAM 1
ORG $8000
The above step instructs the assembler to create the following program so that i
t can run at memory
location $8000. Merlin 8/16 almost always assembles your program in the same pla
ce in memory, but
the ORG (for Origin) is used to tell Merlin 8/16 where you want the program to e
ventually be run.
This is so that JMPs, JSRs and other location dependent code within your program
is properly written
with the final location in mind.
You'll notice that when you press the space bar, Merlin 8/16 automatically moves
the cursor to the next
field on the line. You'll recall that in assembly language programming, the posi
tion of text on each line
determines what kind of information it is. Labels for routines and entry points
are in the first position.
On line 3 you skipped this field by pressing the space bar first, before enterin
g any text. The second
position is for the command itself. The command can either be a command such as
LDA, RTS, etc., or
it can be a directive to Merlin 8/16 itself, to be used during the assembly to w
rite a file to disk, create a
label, call up a macro, or any of Merlin 8/16's many assembler commands.
9. With the cursor at the beginning of line 4, type BELL and space to the next f
ield, type EQU and
space again, then type $FBDD and press Return.
BELL EQU $FBDD
This defines the label BELL to be equal to hex FBDD. This use of a label is know
n as an equate or
constant. Wherever BELL appears in an expression, it will be replaced with $FBDD
. Why don't we
just use $FBDD? For one thing, BELL is easier to remember than $FBDD. Also, if a
later assembly
required changing the location of BELL, all that needs changing is the EQU state
ment, rather than all
the other $FBDD's throughout the listing.
10. At the beginning of line 5, type START and press space, type JSR and space a
gain, type BELL and
another space, then type a semicolon (;) followed by RING THE BELL and then pres
s Return.
START JSR BELL ; RING THE BELL
Following the opcode is the operand, in this case BELL. The operand is the targe
t information of
the opcode. Where to JSR to, what value to load, etc.
Semicolons are like asterisks, used to mark a comment. Semicolons, however, are
used to mark the
start of a comment at the end of a line that contains other commands.
1 1. On line 6 type DONE and space, then type RTS and press Return.
Page 6
Getting Started
12. The program has been completely entered. If you wanted to exit the Add Mode,
you would press
Open-Apple-Q ("Quit"). Since you are not done, do not exit yet.
13. The screen should now appear like this:
* DEMO PROGRAM 1
ORG $8000
BELL EQU $FBDD
START JSR BELL ; RING THE BELL
DONE RTS
Note that throughout the entry of this program, each bit of text has been moved
to a specific field. Here
is a summary of the fields as used so far:
Label Opcode Operand ; Comment
START JSR BELL ; RING THE BELL
Field One is reserved for labels. START is an example of a label.
Field Two is reserved for opcodes, such as the Merlin 8/16 pseudo-opcodes or dir
ectives such as ORG
and EQU, and the JSR and RTS opcodes.
Field Three is for operands, such as $8000, $FBDD and, in this case, BELL.
Field Four contains comments which are preceded by a semi -colon (;).
It should be apparent from this exercise that it is not necessary to input extra
spaces in the source file
for formatting purposes, even if these spaces seem to exist in a listing you may
be using.
In summary, on each line:
1) Do not space for a label. Space once after a label or if there is no label, o
nce at the beginning for
the opcode.
2) Space once after the opcode for the operand. Space once after the operand for
the comment. If there
is no operand, type a space and a semicolon for a comment if desired.
Page 7
Getting Started
TYA
START JSR BELL ; RING THE BELL
DONE RTS
The three new lines (5, 6, and 7) have been inserted, and the subsequent origina
l source lines (now lines
8 and 9) have been moved down.
Page 8
Getting Started
Open- Apple-Delete always deletes the line above the cursor. (Open-Apple-D will
delete the line the
cursor is on.)
3. Press Open- Apple-Delete twice more.
Lines 5 and 6 from the previous example have been deleted, and the subsequent li
nes renumbered. The
listing appears the same as when you first entered it into to the Editor.
While adding, editing, or deleting an existing line, you have many options withi
n the line, all of which
are accessed by using Control characters. To demonstrate using our BELL routine:
L Move the cursor to the beginning of line 6. The cursor should be over the D in
DONE.
2. Type Control-D. The character under the cursor disappears, and the text of th
e label moves to the
left. Type Control-D again, and yet a third and fourth time. DONE has been delet
ed, and the cursor
is positioned at the beginning of the label field.
3 . Type DONE in again and note that the text is inserted in the label field but
the opcode field does not
move. The listing appears the same as when you first entered it into the Editor.
The other Control Character commands function similarly. All of the editing comm
ands are discussed
in the Merlin 16 and Merlin 8 Editor sections of this manual.
ASSEMBLING A SOURCE LISTING
The next step in using Merlin 8/16 is to assemble the source code into object co
de.
1 . If you are using Merlin 16, press Open-Apple-A to assemble and skip to step
3.
If you are using Merlin 8, press Open-Apple-Q to enter the Command Mode. After t
he colon (:)
prompt, type*ASM and press Return.
Page 9
Getting Started
Assembling
=FBDD
008000 20 DD FB
008003 60
DEMO PROGRAM 1
BELL
START
DONE
ORG
EQU
JSR
RTS
$8000
$FBDD
BELL
8000 20 DD FB
8003 60
* DEMO PROGRAM 1
BELL
START
DONE
ORG $8000
EQU $FBDD
JSR BELL
RTS
START =$8000
BELL
=$FBDD
Page 10
Getting Started
If instead of completing the above listing, the system beeps and displays an err
or message, note the line
number referenced in the message, and press Return until the "End assembly..." m
essage appears. Then
refer back to the section where the program was first entered and compare the li
sting with the one shown
in this manual. Look especially for elements in incorrect fields. Using the edit
ing functions you've
learned, change any lines in your listing which do not look like those in the li
sting, then assemble
again.
If all went well, to the right of the column of line numbers down the middle of
the screen is the now
familiar, formatted source code.
To the left of the line numbers is a series of numeric and alphabetic characters
. This is the object code,
which are the opcodes and operands assembled to their machine language hexadecim
al equivalents.
Merlin 16 example:
008000 20 DD FB 5 START JSR BELL ;ring the bell
Merlin 8 example:
8000 20 DD FB 5 START JSR BELL ;ring the bell
Left to right, starting on line 5, the first group of characters is the routine'
s starting address in memory.
See the definition of ORG in the section on the Assembler. On the left of line 5
, the number 20
appears after the colon. This is the one-byte hexadecimal code for the opcode JS
R.
NOTE: The label START is not assembled into object code; neither are comments, r
emarks, or
pseudo-ops such as ORG. Such elements are for the convenience and utility of the
programmer only
and the use of the assembler program.
Each pair of hexadecimal digits is one byte. The next two bytes on line 5 bear a
curious resemblance to
the last group of characters on line 4; have a look. In line 4 of the source cod
e we told the assembler
that the label BELL was EQUated to address $FBDD. In line 5, when the assembler
encountered BELL
as the operand, it substituted the specified address. The sequence of the high-
and low -order bytes was
reversed, turning $FBDD into DD FB. This is a 65xx microprocessor convention.
The rest of the information presented should explain itself. The total errors en
countered in the source
code was zero. If you count the bytes following the addresses, you'll see there
were four bytes of object
code generated.
Page 11
Getting Started
SAVING PROGRAMS
There is an important step before running a program you have assembled. You shou
ld always save the
source code first in case your program crashes when you run it and causes your c
omputer to hang. If
you save the program first, you'll be able to load it again and continue editing
it. To save the source
code, you will have to return to the Main Menu, and use the SAVE SOURCE command.
Then you
would use the SAVE OBJECT CODE. Note that SAVE OBJECT CODE can only be used if t
here has
been a successful assembly.
Here are the steps to follow for Merlin 16:
1. After a successful assembly, Merlin 16 returns automatically to the Main Menu
. (You can also
return to the Main Menu in Merlin 16 by pressing Open-Apple-Q) If the Merlin 16
system disk is
still in the drive, remove it and insert an initialized data disk.
Press D for DISK COMMAND, then type PREFIX followed by the pathname for your dat
a disk.
For example, if the volume name of your data disk was MYDISK, the complete line
would look
like this:
Disk command :PREFIX/M YD ISK
When you press Return, Merlin 16 will change the current prefix in the Main Menu
box.
2. After the per cent (%) prompt, press S to SAVE SOURCE. The system is now wait
ing for a
filename. Type DEMOl and press Return. After the program has been saved, the pro
mpt returns.
3. Press C and Return to catalog the data diskette. The source code has been sav
ed as DEMOl.S and is
a text file. The .S suffix is automatically appended by Merlin 16 to the filenam
e by the SAVE
SOURCE command. This is a file-labeling convention which indicates the subject f
ile is source
code.
4. After the per cent (%) prompt, press Return to go to the Main Menu and press
O for SAVE
OBJECT CODE. To avoid confusion, the object file should be saved under the same
name as was
earlier specified for the source file. Press Y to accept DEMOl as the object nam
e. The object code
file is saved as a BIN file.
NOTE: There is no danger of overwriting the source file because no suffix is app
ended to the object
code file name. In our example, the object file will be saved as DEMOl.
5. Press C to catalog again and note the files titled DEMOl.S and DEMOl.
Page 12
Getting Started
Getting Started
RUNNING PROGRAMS
There are two methods of running programs after you have completed a successful
assembly. Method A
is the recommended procedure. It requires a little more time but it is much safe
r.
Method A: Running a program from BASIC
1. Save the source code.
2. Save the object code.
3. Press Q to Quit.
4. Load BASIC if necessary.
5. BLOAD the object file from the Applesoft BASIC prompt (]).
If you are using ProDOS, be sure to include the complete pathname. In our exampl
e, this would be:
BLO AD/MYDISK/DEMO 1 (Return)
If you are using DOS 3.3, you would type:
BLOAD DEMOl (Return)
6. To run the program, type CALL followed by the appropriate load address. The D
EMOl program
had an ORG of $8000 which is 32768 in decimal. Thus, from the Applesoft prompt y
ou would
type:
CALL 32768 (Return)
If you are ninning DEMOl, you will hear the beep indicating DEMOl actually works
.
Method B: Running a program from the Monitor
1 . If you are using Merlin 16, return to the Editor if necessary by pressing F.
If you are using Merlin 8, return to the Editor if necessary by pressing E.
Page 14
Merlin 8/16 User's Manual
Getting Started
2. From the Merlin 16 Editor, press Open-Apple-0 to open the Command Box.
From the Merlin 8 Editor, press Open-Apple-Q to enter the Command Mode (:).
3 . Type GET $8000 and press Return where $8000 is the address used in the ORG s
tatement. The
GET command tells Merlin 8/16 to take the program you've just assembled and tran
sfer it to Main
Memory at the specified location.
4. From the Merlin 16 Editor, press Open-Apple-O to open the Command Box, and ty
pe MON and
press Return and the Monitor prompt (*) appears.
In Merlin 8, type MON and press Return and the Monitor prompt (*) appears.
5 . Type the ORG ad ress followed by a G and press Return to run the program. In
our example, you
would type 8000G and press Return. A beep is heard. The demonstration program DE
MO 1 was
responsible for it. It works!
NOTE: With Method B, do not forget to use the GET command to move the code to Ma
in Memory.
If you assemble your program and then go directly to the Monitor you will not se
e your program. It
only gets there after you move it to Main Memory or run it. Also, if your progra
m is loaded in one
location but runs in another, you must run the program before you can use the Mo
nitor to examine the
code at the final location.
6. You can return to the Main Menu from the Monitor by pressing Control-Y and Re
turn.
APPLE IIGS USERS: Method B cannot be used to test programs that call Applesoft o
r Monitor
routines in the address range $D000-$FFFF (such as DEMO PROGRAM #1 that calls th
e BELL
routine at $FBDD). This is because on the GS, these routines are actually locate
d in bank $FF of
memory, while the routine you're testing, at that point, is in bank $00. When yo
ur routine calls the
Applesoft or Monitor routine, it will not jump to the proper bank, and the resul
ts are unpredictable.
You can use Method A to test this type of program, or use whatever instructions
may be provided for
testing the program, as will likely be the case with listings from magazines or
other sources.
Page 15
Getting Started
Page 16
Merlin 8/16 User's Manual
Main Menu
Page 17
Merlin 8/16 User's Manual
Main Menu
S (Save Source)
Use this to save a source file to disk . This will save a text for ProDOS and a
binary file for the DOS
3.3 version. As with the load command, you do not include the .S suffix.
NOTE: The address and length of the current source file are shown on the Main Me
nu, and are for
information only. You do not need use these for saving; Merlin 8/16 does this au
tomatically. As in
the Load Source command above, the last loaded or saved filename will be display
ed. You can press Y
to save the same filename, or the space bar for a new file name. You can cancel
the command by
pressing Return.
Page 18
Main Menu
A (Append File)
This loads in a specified source file and places it at the end of the file curre
ntly in memory. It operates
in the same way as the Load Source command, and does not affect the default file
name. It does not
save the resultant combined (appended) file; you are free to do that if you wish
.
D (Drive Change - DOS 3.3 Merlin 8 only)
When you press D, the drive used for saving and loading will toggle from one to
two or two to one.
The currently selected drive is shown on the menu. When Merlin 8 is first starte
d, the selected drive
will be the one used at startupt. To change the slot number, press C for to disp
lay the current disk's
catalog. Then give the disk command CATALOG,Sn, where n is the slot number. This
action will
catalog the newly specified drive.
See the C command for the method of changing drive specification with the ProDOS
versions.
D (Disk Command - ProDOS)
This allows you to issue disk-related commands. The following commands are avail
able:
BLOAD
pathname [,A$....]
BRUN
pathname [,A$.]
pathname [,A$....
pathname,A$adrs ,L$len
BSAVE
DELETE
pathname
LOCK
pathname
^ONLINE
PFX
pathname
(shorthand for Prefix)
POP
PREFIX
pathname
RENAME
SLOT
slot number
UNLOCK
pathname
A disk command returns to the disk command mode. You can then issue another disk
command or just
press Return to go back to the Main Menu.
Main Menu
main zero page and the $D000-$FFFF ROMs. In Merlin 16, Brun and "-" act the same
and both
switch in the main zero page and the $D000-$FFFF ROMs. Using an RTS from such a
program
will return to Merlin 8/16. Most of the utility programs supplied with Merlin 8/
16 such as
Sourceror, XREF, etc. can be run by either method. You cannot use Brun to run pr
ograms such as
the ProDOS FILER. In addition, such programs do not return to Merlin 8/16 and th
e /RAM/
volume is left disconnected by this procedure.
Online
This command scans all attached disk devices, including RAM disks and hard disks
, and reports each
volume name. This is handy for identifying the volume name of all available ProD
OS disk devices.
Pfx, Prefix
If you are not sure of the volume or subdirectory pathname, you can type PFX= or
PFX=1 to
specify Slot 6, Drive 1, or PFX=2 for Slot 6, Drive 2.
When Prefix or Pfx is entered without a pathname, this command sets the prefix t
o the volume part
of the current prefix. For example, if the current prefix is /MERLIN/LIB and you
type Pfx and
press Return at the disk command prompt, the prefix will revert to /MERLIN.
Pop
Typing POP as a disk command "pops" the directory level in the current prefix by
one level. For
example, if the current prefix was "/MERLIN. 16/SAMPLES/GRAPHICS", typing POP wo
uld
change the prefix to "/MERLIN. 16/SAMPLES".
Slot
Slot is used to set the slot which subsequent PFX= commands will use to set the
prefix from. That
is to say, it does not itself set the prefix to a given slot, but rather identif
ies which constant slot
future PFX= commands will use. For example, the following steps would set a pref
ix to that of the
disk in a specified slot:
1) Press D for Disk Command, then type Online. This will help remind you know wh
ich slots,
drives, and pathnames are currently active. (This is an optional step).
2) While still at the Disk Command prompt, type Slot n where 'n' is the desired
slot and press Return.
3) At the Disk Command prompt type PFX=n where 'n' is the desired drive number a
nd press Return.
4) Finally, press Return alone at the prompt. Note that the Prefix now shows the
pathname of the
specified slot and drive. Simply put, typing the Disk Commands Slot 5 then PFX=
will set the prefix to slot 5.
Page 20
Main Menu
Page 21
Main Menu
Page 22
Page 23
Control-F (Find)
Finds the next occurrence on the current line of the character typed after the C
ontrol-F. The cursor
changes to an inverse F to indicate the Find Mode. To move the cursor to the nex
t occurrence on the
line, press the desired character key again. Typing any other character will exi
t the Find Mode and enter
the text typed at that position.
Control-! or TAB (Toggle insert cursor)
Toggles the cursor mode between the insert cursor designated by an inverse I, an
d overstrike cursor
which appears as an inverse block. The insert mode of the cursor should not be c
onfused with entering
the Full Screen Editor using the Add and Insert commands. The cursor can be in t
he insert mode
regardless of whether lines are being added or inserted. The insert mode of the
cursor refers only to
whether individual characters are being inserted or typed over.
The character insert mode defaults to ON upon entry. When you change it with Con
trol-I, it remains
that way until changed again. Thus, moving from one line to another has no effec
t on this status.
Control-L (Lower case convert)
The Merlin 8/16 PARMS file can be configured so that unless the cursor is in a c
omment or an ASCII
string, lower case characters will be converted to UPPER CASE characters. To ove
rride this conversion,
or to reinstate it, just use the Control-L command. This conversion is also in e
ffect when you use the
Open-Apple-F, Open-Apple-W, or Open-Apple-L find commands to specify the text to
find. Even if
enabled in the PARMS file, this conversion is defeated when the tabs are zeroed.
Page 24
Page 25
Page 26
Merlin 8/16 User's Manual
Page 27
You can tell when the routine is finished by the fact that during the exchange s
equence, the line number
at the top right is missing. The line number will return when there are no more
matches for the change
text, or when you press Control-X.
(5F (Find text)
The C5F command opens a window which asks for the text to find. It then finds th
e first occurrence of
the text in the entire text file. The text can be anywhere on a line. After the
first find, you can find
the next occurrence by typing another (3F. You can edit the line,and then type C
5F to go to the next
occurrence.
During the search function, one or more plus (+) signs will be shown next to the
line number at the top
right of the screen. This is only an indicator that the search function is activ
e. The number of plus signs
shown is arbitrary, and has no relation to the total number of occurrences.
In Merlin 16, if the C5F command is used after text has been selected, only the
selected text will be
searched for the text to be found. When the search has been completed, the text
is no longer selected.
Thus, you can use the (3Y, C5C or C5X commands to search just a portion of your
listing.
The C5B command and the Control-S status command both cancel the Find mode, as d
oes failure to find
the text below the current line.
The (3\V command is identical to C5F except that it finds only whole words bound
ed by non-
alphanumeric characters. If you type either (3W or (5F to find the next occurren
ce, this mode will
change accordingly.
In all cases the line containing the text is moved to the center of the screen,
unless it is within the first
10 lines of the start of the source.
C5l (Insert line)
Pressing (3l will insert a blank line at the cursor. Also see (3TAB.
C5L (Locate label, marker or line number)
This command will locate the first occurrence of a label or any text in the labe
l column. Only the
characters typed are compared with the labels. Thus the search string LOOP would
jump to the label
LOOP2 if LOOP did not occur first. To find a specific label when there may be an
other similar label,
end the input with a single space.
Page 28
If a number is entered after this command, the cursor will move to the beginning
of the line number
specified. This is particularly handy when editing a source file from a printed
listing.
The intended use for i! is command is to move rapidly to a particular place in t
he source. You can use
create your own 'markers' to enhance the capability of this command. Thus, if a
line has *7 in it, you
can specify *7 as the text to find for this command and it will locate it.
In all cases the line containing the text is moved to the center of the screen,
unless it is within the first
10 lines of the start of the source.
C^N (End of source)
This command moves the cursor to the end of the source listing.
c3Q (Quit full screen editor)
This command returns to the Command Mode.
<3R (Replace)
This command exchanges the current line with the contents of the 'undo' buffer.
Therefore, pressing
C5R a second time will cancel the effect of the first press.
Using c3R when the cursor is on blank line will place the contents of the 'undo'
buffer on the line and
place the empty line in the 'undo' buffer.
The (5R command can be used to move a single line. Place the cursor at the begin
ning of the line to
be moved and press C5R. Move the cursor to the desired location, press Return to
insert a blank line,
and press CiR again.
3R can be used by itself to easily interchange two lines. Just place the cursor
on the first line, press
C5R, move the cursor to the second line and press (3R again. Then move the curso
r back to where the
first line was and press C5R for the third, and final time. Also see (3D.
(3T (Return to line marker (vertical "Tab")
This command returns to the line marked by the last Control-T command.
Page 29
3V (Paste)
Pastes the contents of the clipboard at the line containing the cursor. Only ful
l lines are moved. Using
this command does not change the contents of the clipboard, so this command can
be used to replicate a
range of lines.
If the C5V paste command is issued when a range of text has been selected, the t
ext on the clipboard will
be inserted before the last line of selected text.
(5W (Find word)
The CW command is identical to <3F except that it finds only whole words boun
ded by non-
alphanumeric characters. If you type either (3W or (3F to find the next occurren
ce, this mode will
change accordingly.
If the CiW command is used after text has been selected, only the selected text
will be searched for the
word to be found. When the search has been completed, the text is no longer sele
cted. The search can
be cancelled with Control-X.
<3X (Cut to Clipboard)
C5X starts the select mode to cut text. The first time <3X is pressed, the cu
rrent line is selected and is
shown in inverse. Use the down arrow or Escape keys to extend the selection if d
esired, or press any
other key to cancel the selection. Additional selected lines are shown in invers
e. Use the up arrow key
to adjust the range selected if you go too far. The select mode will be canceled
if you move the cursor
above the first selected line or past the top of the current screen.
The second time (5X is pressed the selected text is cut from the listing and is
placed on the clipboard.
Merlin 8 has no "copy" command, but if you immediately follow the C3X command th
at cuts a portion
of text with CiV (for paste), the desired text will be on the clipboard, and the
original listing will be
restored.
If you are unfamiliar with the idea of a "clipboard", this is just an analogy to
how you might put a
piece of paper clipped from a magazine, letter, etc. on a clipboard, to hold it
temporarily while you were
getting ready to put it in its final location. In Merlin 8, the clipboard refers
to a memory buffer that
holds the text you have cut while you decide where you want the final text place
d. Using the clipboard,
you can cut tet from one source file, load another, and then paste the text into
a second file. The
clipboard is cleared when a file is assembled.
Page 30
^Delete (Delete)
This command deletes the line above the cursor and places it in a special 'undo'
buffer which is
independent of the clipboard.
The c5R command replaces the current line wiLh the contents of the 'undo' buffer
. Therefore, you could
use (3 Delete to delete a line, move the cursor to another line, press Return, &
lt;3l or C^Tab to insert a
line, and press (3R to replace that line with the deleted line.
<3TAB (Insert line)
Pressing C5TAB will insert a blank line at the cursor. Also see C$1
C$Down arrow (Move half-screen down)
Moves the cursor down 10 lines; that line then becomes the center line on the sc
reen. This command
has the effect of moving the current line to the top of the screen and then movi
ng the cursor to what
was the bottom line on the screen.
C$Up arrow (move half-screen up)
Moves the cursor up 10 lines; that line then becomes the center line on the scre
en. This command has
the effect of moving the current line to the bottom of the screen and then movin
g the cursor to what
was the 1st line on the screen.
Page 31
C58 (Asterisk)
Produces a line of 32 asterisks. Overstrikes existing line, if any. Undo wiiii C
oniral-R.
(59 (Box)
Produces an asterisk, 30 spaces, and then another asterisk. This and the (38 com
mand can be used to
produce a large box for titles and other information. Overstrikes existing line,
if any. Undo with
Control-R.
C5- (Hyphen)
Produces a line of 1 asterisk and 31 hyphens. Overstrikes existing line, if any.
Undo with Control-R.
<3= (Equal sign)
Produces a line of 1 asterisk and 31 equal signs. Overstrikes existing line, if
any. Undo with
Control-R.
Page 32
r
Merlin 8/16 User's Manual The Merlin 8 Edi
MERLIN 8 EDITOR COMMAND SUMMARY
CONTROL KEY COMMANDS (line oriented)
The Control Key commands consist of cursor moves and line oriented commands.
Page 34
OOPS
Virtually any Editor action can be undone. You should remember that the proper u
ndo command is of
the same 'type' as the command you want to undo. Thus, any Control key command i
s undone by
Control-R. This includes the (38, C59, (3-, and <3= commands which are consid
ered line oriented
commands for this purpose.
The line deletion commands <3D and (^Delete are undone by creating an empty l
ine with (3Tab
followed by C3R. If you forget to create the empty line, type another CiR and th
en insert the empty
line to receive the undo buffer contents.
The C5R command undoes itself.
A Cut (C5X) is undone by a Paste (<3V) without moving the cursor off its line
.
If you are entering a line of text in response to a prompt, such as a filename,
PRTR initialization, or
dialog box, you can press Control-C or Control-X to cancel the line.
ED. 16
The full screen editor in Merlin 8 can be replaced with a version written specif
ically for the 65802 or
65816 chip. This editor is named ED.16 on both DOS 3.3 and ProDOS Merlin 8 disks
. To enable
ED. 16 on the DOS 3.3 disk, change line 80 of the HELLO program to BRUN ED.16 in
stead of ED as
is now done. On the ProDOS disk, you will have to rename ED to ED.OLD, and renam
e ED.16 to
ED. Although ED.16 is provided on the Merlin 8 disks, it is unlikely you will ev
er need it. We
recommend that if you do have the 65802 or 65816 that you use Merlin 16 instead
of Merlin 8.
EDMAC and KEYMAC
These are macro utilities that will automatically type entire phrases or lines i
n your source file with a
single keystroke. EDMAC is for use with the full screen editor, KEYMAC is for us
e with the line
editor (presuming that ED has not been loaded). See the Utilities section of thi
s manual for a description
of the actual keyboard definitions in these files. EDMAC and KEYMAC can be activ
ated within Merlin
8 by typing BRUN EDMAC or BRUN KEYMAC from the Main Menu, as appropriate.
Editor Technical Information
The ED and ED. 16 files have been arranged so that certain parameters can be cha
nged with a little effort.
At relative byte 3 in the file there is an address that points to the main part
of the program, hereinafter
referred to as START, that is past a relocating header. At START+10 is a table o
f command characters
used without the <3 key. This table ends in a zero. Following this is the tab
le of the key commands
used with the (5, again ending in zero. If you are inclined, you can change thes
e definitions to change
the command keys of the editor.
Page 35
A (Add)
A [ only option for this command ]
The Add command places you in the Full Screen Editor at the end of the existing
source listing if any
Adding lines is much like entering additional BASIC lines with auto line numberi
ng. To exit from
ADD mode, press <3Q.
You may enter an empty line by pressing space then Return. This is useful for vi
sually blocking off
different parts of a listing.
Page 37
E (Edit)
This enters the full screen editor, with the cursor on the specified line.
C (Change)
Change (d-string d-string)
Change (line number) <d-string d-string>
Change (range) <d-string d-string>
Change (range list) <d-string d-string>
C "hello"goodbye [ finds "hello" and if told to do so will change it to "goodbye
"]
C 50 "hello"bye [ changes in line 50 only ]
C 50,100 "Hello"BYE [ changes lines 50 through 100 ]
C 50,60/65,66 "AND "OR [ changes in lines 50 through 60 and lines 65 and 66]
This changes occurrences of the first string to the second string. The strings m
ust have the same
delimiters. For example, to change occurrences of speling to spelling throughout
the range 20,100, you
would type C 20,100 "speling "spelling. If no range is specified the entire sour
ce file is used.
Before the change operation begins, you are asked whether you want to change all
or some. If you
select some by pressing the S key, the editor stops whenever the first string is
found and displays the
line as it would appear with the change.
If you then press the Y key, the change will be made. If you press Return, the c
hange will not be
made. Typing any control character such as Escape, Return or any others will res
ult in the change not
being made. Any other key, such as Y or even N, will accept the change. Control
-C or the slash (/)
key will abort the change process.
This copies the line number or range to just above the specified number. It does
not delete anything.
COPY
COPY 10 TO 20 [
COPY 10,20 TO 30 [
Page 38
CW (Change word)
Change (d-string d-string)
Change (line numbers) <d-string d-string>
Change (range) <d -string d-string>
Change (range list) <d-string d-string>
CW "PTR'TRT [ change all "PTR"s to "PRT's ]
CW 20 "PTR'TRT [ as above but only in line 20 ]
CW 20,30 "PTR"PRT [ do the same as the above but for lines 20 through 30 ]
CW 1,9/20,30 "PTR"PRT [ same as above but include lines 1 through 9 in the range
]
This works similar to the CHANGE command with the added features as described un
der Find Word
(FW).
D (Delete)
Delete (line number)
Delete (range)
Delete (range list)
D 10 [ deletes line number 10 ]
D 10,32 [ deletes lines 10 through 32 ]
D 20,30/10,12 [ deletes ranges of lines 10 through 12 and 20 through 30 ]
This deletes the specified lines. Unlike BASIC, the line numbers are fictitious;
they change with any
insertion or deletion.
NOTE: When deleting several blocks of lines at the same time, you must specify t
he higher range
first for the correct lines to be deleted.
F (Find)
Find (d-string)
Find (line number) <d-string>
Find (range) <d-string>
Find (range list) <d-string>
F "A String" [ finds lines with "A String" ]
F 10 "STRING" [ finds "STRING" if in line 10]
F 10,20 "HI" [ finds lines in range of 10 through 20 that contain "HI"]
F 10,20/50,99 "HI" [ finds lines that contain "HI" in range of 10 through 20 and
50 through 99 ]
Page 39
Merlin 8/16 User's Manual
FIX
FIX [ only option for this command ]
This undoes the effect of the TEXT command. It also does a number of technical h
ousekeeping chores.
It is recommended that FIX be used on all source files from external sources tha
t are being converted to
Merlin 8 source files, after which the file should be saved.
NOTE: The TEXT and FIX commands are somewhat slow. Several minutes may be needed
for their
execution on large files. FIX will truncate any lines longer than 255 characters
.
FW (Find Word)
FW (d-string)
FW (line number) <d-string>
FW (range) <d-string>
FW (range list) <d-string>
FW "LABEL"
FW 20 "LABEL"
FW 20,30 "PTR"
FW 20,30/50,99 "PTR"
This is an alternative to the FIND command. It will find the specified word only
if it is surrounded, in
source, by non-alphanumeric characters.
Therefore, FW "CAT" will find:
CAT
CAT-1
(CAT.X)
Page 40
GET
Page 41
The listing can be aborted by Control-C or with the slash (/) key. You may stop
the listing by
pressing space and then advance a line at a time by pressing space again. By hol
ding down space, the
auto-repeat feature of the Apple will result in a slower listing. Any other key
will resume the normal
speed. This space bar technique also works during assembly and the symbol table
printout. Any other
key will restart it. The space bar pause also works during assembly and the symb
ol table printout.
LEN (Length)
LEN [ only option for this command]
This gives the length in bytes of the source file, and the number of bytes free.
MON (Monitor)
MON [ only option with this command ]
This exits to the Monitor. You may return to the Merlin 8 Main Menu by pressing
Control-C,
Control-B, or Control-Y. These commands re-establish important zero page pointer
s from a safe area
inside Merlin 8. Thus Control-Y will give a correct entry even if you have damag
ed the zero page
pointers while in the Monitor. DOS is not connected while using this entry to th
e Monitor.
You may return to the editor directly by typing OG and pressing Return but unlik
e the above
commands, this uses the zero page pointers stored at $0A-$0F. Therefore, you mus
t be sure that these
pointers have not been altered. For normal usage, any of the three Control comma
nds should be used to
return to Merlin 8.
When you exit to the Monitor with the MON command, the RAM-based $D000-$FFFF mem
ory is
enabled, and therefore, Merlin 8 and it's symbol table if any. If you want to ex
amine the ROM
memory that would normally correspond to Applesoft and the F8 Monitor, you shoul
d quit Merlin 8
with the Main Menu Quit command, and enter the Monitor with Call -151. Under Pro
DOS, this
procedure necessitates loading BASIC.SYSTEM which removes Merlin 8 from memory.
MOVE
MOVE (line number) TO (line number)
MOVE (range) TO Okie number)
MOVE 10 TO 20 [ Move line 10 to just before 20]
MOVE 10,20 TO 30 [ Move lines 10 through 20 to just before line 30 ]
This is the same as COPY but after copying, automatically deletes the original r
ange.
Page 42
Merlin 8/16 User's Manual
NEW
NEW [ only option for this command ]
Deletes the present source file in memory.
P (Print without format)
Print
Print (line number)
Print (range)
Print (range list)
P t print entire file ]
P50 [ print line 50 only ]
P50, 100 [ print lines 50 through 100 ]
PI, 10/20,30 [ print 1 through 10 and then print lines 20 through 30 ]
This is the same as LIST except that line numbers are not added. See PRTR for fo
rmatted printouts.
Page 43
No output is sent to the printer until a LIST, PRINT, or ASM command is issued.
See Control-0 for
information on inserting Control characters in the printer init string. The PRTR
command only affects
the next output command, and is canceled at the end of the listing.
Q (Quit)
Q [ only option for this command ]
Exits to Main Menu.
TABS
TABS <number><, number><,...> <'tab character^
TABS [ clear all tabs ]
TABS 10,20 [ set tabs to 10 & 20 ]
TABS 10,20 " " [ as above, space is tab character ]
This sets the tabs for the editor, and has no effect on the assembler listing. U
p to nine tabs are
possible. The default tab character is a space, but any may be specified. The as
sembler regards the
space as the only acceptable tab character for the separation of labels, opcodes
, and operands. If you
don't specify the tab character, then the last one used remains. Entering TABS a
nd a Return will set all
tabs to zero.
TEXT
TEXT [ only option for this command ]
This converts all spaces in a source file to inverse spaces. The purpose of this
is for use on word
processing type text files so that it is not necessary to remember to zero the t
abs before printing such a
file. This conversion has no effect on anything except the Editor's tabulation.
The command FIX
undoes the effect of the TEXT command.
Page 44
r
Merlin 8/16 User's Manual
USER
USER
USER 1 [ example for use with XREF ]
USER 0: FILENAME [ example for use with PRINTFILER ]
This does a JSR to the routine at $3F5, This is the location of the Applesoft am
persand vector which
normally points to a RTS. USER is designed to connect the various utilities supp
lied with Merlin 8
and for user defined printer drivers. You must be careful that your printer driv
er does not use zero page
addresses, with the exception of the I/O pointers and $60-$6F, because this is l
ikely to interefere with
Merlin 8's heavy usage of zero page. Several supplied utilities operate through
the USER command.
VAL
VAL "expression"
VAL "PTR [ return value of label "PTR" ]
VAL "LABEL" [ gives the address (or value) of LABEL for the last assembly
done or "unknown label" if not found. ]
VAL "$1000/2" [ returns $0800 ]
VAL "%1000" [ returns $0008 ]
This will return the value of the expression as the assembler would compute it.
All forms of label and
literal expressions valid for the assembler are valid for this command. Note tha
t labels will have the
value given them in the most recent assembly.
VID (VIDeo)
VID (slot number)
VID 3 [ turns on 80 column display ]
This command selects an 80 column display device. To turn off the display, use E
scape Ctrl-Q for the
Apple He, lie or Ilgs video; use Escape-0 for the Videx UltraTerm. VID 3 is requ
ired to re-activate the
display if you have set the PARMS file to switch to 40 columns for the PRTR comm
and.
Page 45
W (Where)
Where (line number)
W50
WO
This prints in hex the location in memory of the start of the specified line. Wh
ere or WO will give
the location of the end of source.
Lists starting from the beginning of the last specified range. For example, if y
ou type L10J00, lines
10 to 100 will be listed. If then you use the period (.) command, the listing wi
ll start again at 10 and
continue until stopped. The end of the range is not remembered.
/ (slash)
/ <line number>
/ [ start to list at last line listed ]
/50 [ start listing at line 50 ]
This command continues the listing from the last line number listed, or, when a
line number is
specified, from that line. This listing continues to the end of the file or unti
l it is stopped as in LIST.
[period]
Page 46
!
r
Merlin 8/16 User's Manual
ASSEMBLING A MERLIN 8 FILE
Once you have entered and edited your source listing, you will want to assemble
it ASM does that
Remember to exit the Full Screen Editor by pressing ^Escape. When you see the co
lon (:) prompt,
type ASM and press Return.
ASM (Assemble)
ASM [ only option for this command ]
This passes control to the assembler, which attempts to assemble the source file
.
If you wish to have a formatted printed listing of an assembly, just use the PRT
R command
immediately before typing in the ASM command.
Control-C (Cancel assembly)
Terminates assembly and returns to the Command Mode.
Control-D (Toggle Display Status)
Control-D [ only option for this command ]
During the second pass of assembly, pressing Control-D will toggle the list flag
, so that the listing
will either stop or resume. The next LST opcode in the source overrides this, bu
t another Control-D
can be used again.
~i
The Merlin 8 Editor
Page 47
Merlin 8/16 U
Page 48
Merlin 8/16 User's Manual
Control-F (Find)
Finds the next occurrence on the current line of the character typed after the C
ontrol-F. The cursor
changes to an inverse F to indicate the Find Mode. To move the cursor to the nex
t occurrence on the
line, press the desired character key again. Typing any other character will exi
t the Find Mode and enter
the text typed at that position.
Control-I or TAB (Toggle insert cursor)
Toggles the cursor mode between the insert cursor (inverse I) and overstrike cur
sor (inverse block). The
cursor can be in the insert mode regardless of whether lines are being added or
inserted. The insert mode
of the cursor refers only to whether individual characters are being inserted (i
nverse J) or typed over
(inverse block).
The character insert mode defaults to ON upon entry. When you change it with Con
trol-I, it remains
that way until changed again. Thus, moving from one line to another has no effec
t on this status.
Control-L (Lower case convert)
The Merlin 16 PARMS file can be configured so that, unless the cursor is in a co
mment or an ASCII
string, lower case characters will be converted to UPPER CASE characters. To ove
rride this
conversion, or to reinstate it, just use the Control-L command. This conversion
is also in effect when
you use the Open-Apple-F, Open-Apple-W, or Open-Apple-L find commands to specify
the text to find.
Even if configured in the PARMS file, this conversion is defeated when the tabs
are zeroed.
Control-N (End of line)
Moves the cursor to the end of the line.
Page 49
Control-R (Restore)
This command restores the original line. For example, if you have used Control-Y
to delete all
characters to the end of the line, you can press Control-R to undo the effects o
f the Control-Y
command.
Control-S (Status box)
This command displays a status box showing the number free and used bytes in the
current source
listing workspace.
Control-T (Set marker on current line - Vertical "Tab")
This command can be used to set a marker at the current line for recall by the O
pen-Apple-T command.
Control-W (Find word)
This command moves the cursor to the beginning of each word in the line (alphanu
meric).
Control-X (Cancel global Exchange, etc.)
This command can be used to cancel any global exchange, text selection or string
search while it is in
progress.
Control-Y (Delete to end of line)
Deletes all characters from the cursor to the end of the line.
Arrow keys (Cursor movement)
The arrow keys move the cursor in the specified direction.
Delete (Delete character)
Deletes the character to the left of the cursor. Also see Control-D.
Page 50
Page 51
Page 52
Page 53
3. Normally, the Exchange function searches for complete words, that is, charact
ers bounded by spaces
or other non-alphanumeric characters. Suppose, however, that you wished to repla
ce LDA #LABEL
with LDA LABEL. Because this is a search string of two words, a variation is req
uired. To search for a
literal character string that may be part of a larger word, hold down the closed
Apple or Option key as
you press the Return key after you've input the replacement string. Thus, for ou
r example, you could
enter:
Change: LDA#L
To: LDA L
<3F (Find text)
The C^F command opens a window which asks for the find text. It then finds the f
irst occurrence of the
text in the entire text file. The text can be anywhere on a line. After the firs
t find, you can find
the next occurrence by typing another C5F. You can edit the line and then type C
5F to go to the next
occurrence.
If there are more occurrences to be found, one or more plus (+) signs will be sh
own next to the line
number at the top right of the screen. This starts from the line below the curre
nt line, and only indicates
the number of lines remaining with occurrences, and not the total number of occu
rrences.
If the (3F command is used after text has been selected, only the selected text
will be searched for the
text to be found. When the search has been completed, the text is no longer sele
cted. Thus, you can
use the (3Y, (3C or (3X commands to search just a portion of your listing. You c
an also use the
TRON command before starting the search to ignore comments during the search.
Control-X, and the (3B command and Control-S status command both cancel the Fmd
mode, as does
failure to find the text below the current line.
The (5W command is identical to C5F except that it finds only whole words bounde
d by non-
alphanumeric characters. If you type either C5W or C5F to find the next occurren
ce, this mode will
change accordingly.
In all cases the line containing the text is moved to the center of the screen,
unless it is within the first
10 lines of the start of the source.
3H (Half screen)
Pressing <3H toggles the half or split screen mode. In this mode, the bottom
ten lines are frozen in a
window. A bar is shown above these lines to separate the frozen text from the sc
roll window. Pressing
C5H will cancel the half screen mode and refresh the screen.
Page 54
Page 55
<3R (Replace)
This command exchanges the current line with the contents of the 'undo' buffer.
Therefore, pressing
C5R a second time will cancel the effect of the first press.
Using (3R when the cursor is on a blank line will place the contents of the 'und
o' buffer on the line and
place the empty line in the 'undo' buffer.
The C5R command can be used to move a single line. Place the cursor at the begin
ning of the line to
be moved and press (3R. Move the cursor to the desired location, press Return to
insert a blank line,
and press <3R again.
3R can be used by itself to easily interchange two lines. Just place the cursor
on the first line, press
<3R, move the cursor to the second line and press C5R again. Then move the cu
rsor back to where the
first line was and press (3R for the third, and final time. Also see C5D.
<3T (Jump to marker line - Vertical "Tab")
This command returns to the line 'remembered' by the last Control-T command.
$V (Paste)
Pastes the contents of the clipboard at the line containing the cursor. Only ful
l lines are moved. Using
this command does not change the contents of the clipboard, so this command can
be used to replicate a
range of lines.
If the C5V paste command is issued when a range of text has been selected, the t
ext on the clipboard will
be inserted before the last line of selected text
3W (Find word)
The (5W command is identical to ClF except that it finds only whole words bounde
d by non-
alphanumeric characters. If you type either (5W or to find the next occurrence,
this mode will
change accordingly. Either search mode can be cancelled by pressing Control-X.
If the C5W command is used after text has been selected, only the selected text
will be searched for the
word to be found. When the search has been completed, the text is no longer sele
cted.
Page 56
3X (Cut)
This command is similar to Copy (<3C), but selected text is removed from the
screen after being copied
to the clipboard. The first time <3X is pressed, the current line is selected
and is shown in inverse. Use
the down arrow or Escape keys to extend the selection if desired, or press any o
ther key to cancel the
selection. Additional selected lines are shown in inverse. Use the up arrow key
to adjust the range
selected if you go too far. The select mode will be canceled if you move the cur
sor above the first
selected line or past the top of the current screen.
The second time <3X is pressed the selected text is cut and is placed on the
clipboard.
One use for this command is to use CiB to move to the beginning of the listing,
then 3Y to select all
of the text to the end of the listing, and then <3X to cut the entire listing
and place it on the clipboard.
Pressing any other key will cancel the select mode.
If text has been selected, you can press the Right arrow key and the selection w
ill be extended to the
middle of the next page. This method can be used to quickly select a large secti
on of the listing. Do
not hold the Right arrow down continuously or the keyboard buffer will fill and
the selection will
continue after you release the Right arrow key.
C5Y (Select text)
This command selects all text to be cut or copied from the current line to the e
nd of the listing. CjSX 01
3C will cut or copy the text, while pressing any other key will cancel the selec
tion.
This technique can be used to move the entire listing to the clipboard.
(3Z (Center screen)
This command repositions the screen so that the line the cursor is on becomes th
e centered line on the
screen.
3 Delete (Delete)
This command deletes the line above the cursor and places it in a special 'undo'
buffer which i;
independent of the clipboard.
Page 57
Page 58
Page 59
<3- (Hyphen)
Produces a line of 1 asterisk and 31 hyphens. Overstrikes existing line, if any.
Undo with the
Control-R command.
* [Closed Apple]
This command speeds up cursor movement and keyboard input. For example, pressing
and holding
down the down arrow key will scroll the listing. If you press and hold down the
Closed Apple key
while you press the up or down arrow key, the scroll rate will be increased.
Page 60
Page 61
ASM (Assemble)
ASM [ only option for this command ]
This passes control to the assembler, which then assembles the source file.
Assembly may be terminated at any point by pressing Control-C or Escape.
During the second pass of assembly, pressing Control-D will toggle the list flag
, so that the listing
will either stop or resume. The next LST opcode in the source overrides this, bu
t another Control-D
can be used again.
FIX
FIX [ undoes the TEXT command ]
HXS [ same but removes multiple spaces except in comments
and ASCII strings ]
This undoes the effect of the TEXT command. It also does a number of technical h
ousekeeping chores.
It is recommended that FIX be used on all source files from external sources tha
t are being converted to
Merlin 16 source files, after which the file should be saved.
NOTE: FIX will truncate any lines longer than 255 characters.
Page 63
GET
GET ( obj adrs )
GET [ put object code in Main Memory at the address specified in the
source's ORG ]
GET $4000 [ put object code at location $4000 in Main Memory ]
This command is used to move the object code, after an assembly, from its locati
on in Auxiliary
Memory to its ORG location in Main Memory. The address must be above the existin
g source file, if
any, and it will not be allowed to overwrite DOS. You can do a NEW if you want t
o load it lower in
memory than allowed, but you must remember to save the source first. You cannot
use GET to put
object code at memory locations lower than $901, but you can go to the Monitor a
fterwards and use it
to move the object to any desired location. However, any such move using the Mon
itor may destroy
your source or other data necessary to the assembler's operation. Caution should
be used.
The GET command does not check if a valid object code has been assembled.
This command is supplied for convenience only. The recommended method for testin
g a program is to
save the source code first, save the object code, and then run the program from
BASIC or with the G
command from the Monitor.
HEX-DEC CONVERSION
128 = $0080
$80 = 128
If you type a positive or negative decimal number in the Command Box, the hex eq
uivalent is returned.
If you type a hex number using the $ prefix, the decimal equivalent is returned.
All commands accept
hex numbers.
L (List)
List
List (line number)
List (range)
List (range list)
L I list entire file ]
L 20 [ list line 20 only ]
L 20,30 [ list 20 through 30 ]
L 20,30/40,42 [ list 20 through 30 and then list lines 40 through 42
Page 64
Lists the source file with line numbers. Control characters in source are shown
in inverse, unless the
listing is being sent to a printer or other nonstandard output device.
The listing can be aborted by Control-C or with the slash (/) key. You may stop
the listing by
pressing the space bar and then advance a line at a time by pressing the space b
ar again. By holding
down the space bar, the auto-repeat feature of the Apple will result in a slower
listing. Any other key
will resume the normal speed. This space bar technique also works during assembl
y and the symbol
table printout. Any other key will restart it.
This exits to the Monitor. You may return to the Merlin 16 Main Menu by pressing
Control-C,
Control-B, or Control-Y. These commands re-establish important zero page pointer
s from a safe area
inside Merlin 16. Thus Control-Y will give a correct entry even if you have dama
ged the zero page
pointers while in the Monitor. DOS is not connected while using this entry to th
e Monitor.
You may return to the editor directly by typing OG and pressing Return, but unli
ke the above
commands, this uses the zero page pointers stored at $0A-$0F. Therefore, you mus
t be sure that these
pointers have not been altered. For normal usage, any of the three Control comma
nds should be used to
return to Merlin 16.
NOTE: When you exit to the Monitor with the MON command, the RAM-based $D000-$FF
FF
memory is enabled, and therefore. Merlin 16 and its symbol table if any. If you
want to examine the
ROM memory that would normally correspond to Applesoft and the F8 Monitor, you s
hould quit
Merlin 16 with the Main Menu Quit command, and enter the Monitor with Call -151.
This procedure
necessitates loading BASIC.SYSTEM which removes Merlin 16 from memory.
MON (Monitor)
MON
NEW
NEW
Page 65
Page 66
S YM (Symbol table)
The SYM command will print the symbol table from the last assembly to be printed
. Care should be
taken to ensure that a valid symbol table exists before this command is used.
The SYM: command inverts the print locals flag and then prints the symbol table
with local labels
first. Thus, it is not necessary to change this bit in the PARMS fde to see the
local label list.
If a string is specified with either SYM and SYM:, only those labels starting wi
th the string will be
printed
NOTE: If the printing is aborted and the SYM command is reissued, only a partial
listing will result.
This is because symbol flagging is done during the sorting of the table. However
, if the printing is
allowed to continue to the end, the entire symbol table will be printed the next
time SYM or SYM: is
used. If aborted during an alphabetical printout, the SYM command will restart w
here it left off.
TABS
TABS <number><, number><,...> <'tab character^
TABS [ clear all tabs ]
TABS 10,20 [ set tabs to 10 & 20 ]
TABS 10,20 " " [ as above, space is tab character ]
This sets up to 9 tabs for the editor, and has no effect on the assembler listin
g. The default tab character
is a space, but any may be specified. Space is the only acceptable tab character
for the separation of
labels, opcodes, and operands. If you don't specify the tab character, then the
last one used remains.
Entering TABS and a Return will set all tabs to zero.
TEXT
TEXT [ only option for this command ]
This converts all spaces in a source file to inverse spaces. The purpose of this
is for use on word
processing type text files so that it is not necessary to remember to zero the t
abs before printing such a
file. This conversion has no effect on anything except the Editor's tabulation.
The command FIX
undoes the effect of the TEXT command.
Page 67
UNNEW
UNNEW [ on iy option for this command ]
This command restores a text file cleared by a NEW command. Note that the first
two characters of the
source file cannot be restored, so some additional editing will be necessary. Al
so see NEW.
USER
USER
USER 1 [ example for use with XREF ]
USER 0: FILENAME [ example for use with PRINTHLER ]
This does a JSR to the routine at $3F5. This is the location of the Applesoft am
persand vector which
normally points to a RTS, USER is designed to connect the various utilities supp
lied with Merlin 16
and for user defined printer drivers. You must be careful that your printer driv
er does not use zero page
addresses, with the exception of the I/O pointers and $60-$6F and $90-$9F, becau
se this is likely to
interefere with Merlin 16's heavy usage of zero page. Several supplied utilities
operate through the
USER command. Specifically, XREF is a USER type utility. Also see the descriptio
n of USER files
supplied with Merlin 8/16 as described in the Utilities section of this manual.
Page 68
VAL
VAL "expression"
VAL "LABEL" [ gives the address (or value) of LABEL for the last assembly
done or "unknown label" if not found. ]
VAL "$ 1000/2" [ returns $0800 ]
This will return the value of the expression as the assembler would compute it (
or was used in the last
assembly). All forms of label and literal expressions valid for the assembler ar
e valid for this command.
VID (VIDeo)
VID (slot number)
VID 3 [ turns on 80 column display ]
This command selects an 80 column display device. To turn off the display, use E
scape Ctrl-Q for the
Apple He, lie or Ilgs video; use Escape-0 for the Videx UltraTerm. VID 3 is requ
ired to re-activate the
display if you have set the PARMS file to switch to 40 columns for the PRTR comm
and.
W (Where)
Where (line number)
W 50 [ where is line 50 in memory ]
W [ where is end of source file ]
This prints in hex the location in memory of the start of the specified line. Wh
ere or W0 will give
the location of the end of source.
. [period]
[ only option for this command ]
Lists starting from the beginning of the last specified range. For example, if y
ou type LI 0,1 00, lines
10 to 100 will be listed. If you then use the period (.) command, the listing wi
ll start again at 10 and
continue until stopped. The end of the range is not remembered.
/ (slash)
/ <line number>
/ [ start to list at last line listed ]
/50 [ start listing at line 50 ]
This command continues the listing from the last line number listed, or, when a
line number is
specified, from that line. This listing continues to the end of the file or unti
l it is stopped as in LIST.
Page 69
Merlin 8/16 User's Manual
Page 70
Page 71
Page 72
The maximum line length is actually 192 but you can only edit the first 80 chara
cters. Lines longer
than 80 characters will be truncated if they are edited. This can be important i
f you are using TXTED as
mentioned in the Utilities section.
An assembly will delete the contents of the clipboard.
EDMAC, TXTED, and AUTO.EDIT
A macro program called EDMAC is also included on the Merlin 16 disk, which will
automatically
generate phrases like "LDA #$" in your source file with a single key * command T
XTED is a
modified full screen editor that breaks lines when you press Return, and can del
ete Returns as well
AUTO.EDIT is an automated text editor that can speed up making the same change i
n a number of
places m a source file where the Find or Exchange commands would not be appropri
ate See the
description of these utilities in the Utilities section of this manual for more
ionformation.
OOPS
Virtually any editor action can be undone. You should remember that the proper u
ndo command is of
the same 'type' as the command you want to undo. Thus, any Control key command i
s undone by
Control-R. This mcludes the 08, 09, 0-, and 0= commands which are considered lin
e oriented
commands for this purpose.
The line deletion commands OD and ODelete are undone by creating an empty line w
ith OTab
followed by OR. If you forget to create the empty line, type another OR and then
insert the empty line
to receive the undo buffer contents.
The OR command undoes itself.
A Cut (OX) is undone by a Paste (0 V) without moving the cursor off its line.
If you are entering a line of text in response to a prompt, such as a filename,
PRTR initialization or
dialog box, you can press Control-C or Control-X to cancel the line.
Page 73
The Assembler
THE ASSEMBLER
In Merlin 8/16, the Editor is used to create and edit the source listing from wh
ich the final program, or
object code, will be assembled. The Assembler is that part of Merlin 8/16 which
actually interprets
your source code to create the final program.
The Assembler portion of Merlin 8/16 is distinct only in concept. In practice, b
oth the Editor and
Assembler are resident in the machine at all times, and thus both are available
without having to be
aware of which is in operation at any given time. This is in contrast to many ot
her assemblers, in
which the Editor and Assembler are completely separate programs, necessitating t
he switching between
them by loading and running independent programs, and often requiring that you s
ave the source file to
disk before an assembly can even be done.
This section of the documentation explains the syntax of those commands, or dire
ctives, that can be
used in the source listing itself, and which direct Merlin 8/16 to perform some
function while
assembling the object code. These are in contrast to the Editor commands which a
re used primarily to
edit an existing line of text.
For example, in the simplest assembler possible, only commands like LDA, JSR, et
c. would be
recognized by the assembler. However, the first time you want to create a data t
able, an instruction is
required by the assembler which will define one or more bytes that are a pure nu
mber value, as opposed
to specific opcodes. This is addressed in virtually all assemblers by creating t
he assembler directive, or
pseudo opcode HEX.
Thus the assembler can create a byte of data like this:
1 LABEL HEX F7 ; STORES BYTE '$F7' i
Now, suppose the data you wanted to store was an ASCII character string. With on
ly the HEX
directive, you'd have to look up all the ASCII character equivalents, and encode
them in your program
with individual HEX statements.
Wouldn't it be nice, though, if the assembler itself had a larger repetoire of n
ew commands or directives
that included ones for defining character strings? You bet! And Merlin 8/16 has
a lot of them
The simplest is ASC, and a typical line would look like this:
1 LABEL ASC 'THIS IS A TEST' ; STORE ENTIRE CHARACTER STRING
When assembled, Merlin 8/16 would automatically look up the ASCII character equi
valents, and store
the bytes in memory at wherever that statement occurred in your program Along wi
th the Editor, the
variety and power of assembler directives is the other biggest factor in determi
ning the power of a given
assembler. Merlin 8/16 is outstanding in this area with a wide complement of dir
ectives for every
occasion.
Page 74
The Assembler
This section of the documentation will explain the syntax to use in your source
files for each directive,
and document the features that are available to you in the assembler.
ABOUT THE ASSEMBLER DOCUMENTATION
The assembler documentation is broken into three main sections:
1) Preliminary Definitions
2) Assembler Syntax Conventions
3) Assembler Pseudo Opcode Descriptions
The last two sections are each broken down further into the following:
Assembler Syntax Conventions:
1) Number Format
2) Source Code Format
3) Expressions Allowed by the Assembler
4) Immediate Data Syntax
5) Addressing Modes
6) Sweet 16 Opcodes
7) Native vs. Emulation mode in Merlin 16
Assembler Pseudo Opcode Descriptions:
1) Assembler Directives
2) Formatting Pseudo Ops
3) String Data Pseudo Ops
4) Data and Storage Allocation Pseudo Ops
5) Miscellaneous Pseudo Ops
6) Conditional Pseudo Ops
7) Pseudo Ops for Macros
8) Variables
The Assembler Syntax Conventions illustrate the syntax of a line of assembly cod
e, the proper method
to specify numbers and data, how to construct assembler expressions and the prop
er syntax to use to
specify the different addressing modes allowed by the 65xx microprocessors. This
section should be
understood prior to using the assembler, otherwise it is will be difficult to de
termine the acceptable
methods to construct a proper expression as the operand for a pseudo op.
The Assembler Pseudo Opcode Descriptions illustrate the functions of the many Me
rlin 8/16 pseudo
ops, the correct syntax to use and examples of each pseudo op's use.
Page 75
The Assembler
PRELIMINARY DEFINITIONS
The type of operand for almost all of Merlin 8/16's pseudo ops and the 65xx micr
oprocessors can be
grouped into one of four categories:
1) Expressions
2) Delimited Strings (d-strings)
3) Data
4) Filenames or Pathnames
Expressions
Expressions are defined in the Assembler Syntax Conventions section of this Chap
ter.
Delimited Strings
Delimited Strings are defined in the Editor section of the manual, but that defi
nition is repeated here for
continuity.
Several of the pseudo opcodes, and some of the 65xx opcodes such as LD A, allow
their operand to be a
string. Any such string must be delimited by a non-numeric character other than
the slash (J) or comma
(,). Such a string is called a "d-string" or delimited string. The usual delimit
er is a single or double
quote mark ( " or ').
Examples:
"this is a d-string"
'this is another d-string"
another one@
Zthis is one delimited by an upper case zZ
"A"
'A'
NOTE: Delimited strings that are used as the object of any 65xx opcode must be e
nclosed in single or
double quotes. If not, the assembler will interpret the d-string to be a label,
expression or data instead.
Take special note that some of the pseudo ops as well as the 6502 and 65C02 opco
des use the delimiter
to determine the hi-bit condition of the resultant string. In such cases the del
imiter should be restricted
to the single or double quote.
Data
Data is defined as raw hexadecimal data composed of the digits through 9 and the
letters A through F.
Page 76
Page 77
The Assembler
A line may contain a label by itself. This is equivalent to equating the label t
o the current value of the
address counter.
Source Opcode and Pseudo Opcode Conventions
The assembler examines only the first 3 characters of the OPCODE, with certain e
xceptions such as
macro calls and the DEND opcode. For example, you can use PAGE instead of PAG. H
owever,
because of the exception, the fourth letter should not be a D. The assembler lis
ting will not be aligned
with an opcode longer than five characters unless there is no operand or you cha
nge the tab settings.
Operand and Comment Length Conventions
pie maximum allowable combined OPERAND + COMMENT length is 64 characters. You wi
ll get
an OPERAND TOO LONG error if you use more than this. A comment line by itself is
also limited
to 64 characters.
LOCAL LABELS
A local label is any label beginning with a colon (:). A local label is attached
to the last global label
and can be referred to by any line from that global label to the next global lab
el. You can then use the
same local label in other segments governed by other global labels. You can choo
se to use a
meaningless type of local label such as :1, :2, etc., or you can use meaningful
names such as :LOOP,
:EXIT, and so on.
Example of local labels:
1
START
LDY
#0
LDX
#0
:L00P
LDA
(JUNK) ,Y
STA
( JUNKDEST) , Y
5
INY
CPY
#100
BNE
:LOOP
LOOP 2
LDY
#0
:L00P
LDA
(STUFF) , Y
;:loop is now local to loop2
10
STA
(STUFFDEST) , Y
11
INY
12
CPY
#100
13
BNE
:LOOP
14
RTS
Page 78
The Assembler
Note that local labels do not save space in the symbol table, while variables do
. Local labels can be
used for forward and backward branching, while variables cannot Good programming
practice dictates
the use of local labels as branch points, variables for passing data, etc.
VARIABLES
Labels beginning with a right bracket (]) are regarded as variables. They can be
redefined as often as you
wish. The designed purpose of variables is for use in macros, but they are not c
onfined to that use.
Forward reference to a variable is impossible, that is, with correct results, bu
t the assembler will assign
some value to it Therefore, a variable should be defined before it is used.
It is possible to use variables for backwards branching, using the same label at
numerous places in the
source. This simplifies label naming for large programs and uses much less space
than the equivalent
once-used labels.
For example:
1
2
3
4
5
6
7
8
9
10
11
N0G00D
] JLOOP
] JLOOP
LDY
LDA
BEQ
JSR
INY
BNE
LDX
INX
STA
LDA
BNE
#0
TABLE, Y
N0G00D
DOIT
DATA,X
TBL2,X
] JLOOP
] JLOOP
#-1
BRANCH TO LINE 2
BRANCH TO LINE 8
Page 79
The Assembler
NUMBER FORMAT
The assembler accepts decimal, hexadecimal, and binary numerical data. Hex numbe
rs must be preceded
by the dollar sign ($) and binary numbers by the per cent sign (%), thus the fol
lowing four numbers are
all equivalent:
Dec Hex Binary Binary
100 $64 11100100 %01100100
as indicated by the last binary number, leading zeros are ignored.
Immediate Data vs. Addresses
In order to instruct the assembler to interpret a number as immediate data as op
posed to an address, the
number should be prefixed with a pound sign (#). The # here stands for number or
data. For example:
LDA #100 LDA #$64 LDA #%1100100
These three instructions will all load the accumulator with the number 100, deci
mal.
A number not preceded by # is interpreted as an address. Therefore:
LDA 1000 LDA $3E8 LDA %1111101000
are equivalent ways of loading the accumulator with the byte that resides in mem
ory location $3E8.
Use of Decimal, Hexadecimal or Binary Numbers
We recommend that you use the number format that is appropriate for clarity. For
example, the data
table:
DA $1
DA $A
DA $64
DA $3E8
DA $2710
is a good deal more mysterious than its decimal equivalent:
DA 1
DA 10
DA 100
DA 1000
DA 10000
Page 80
The Assembler
Similarly,
ORA #$80
is less informative than
ORA mooooooo
which sets the hi-bit of the number in the accumulator.
EXPRESSIONS ALLOWED BY THE ASSEMBLER
Primitive Expressions
Expressions are built up from "primitive expressions" by use of arithmetic and l
ogical operations. The
primitive expressions are:
1. A label.
2. A number (either decimal, $hex, or %binary).
3. Any ASCII character preceded or enclosed by quotes or single quotes.
4. The asterisk character (*) which stands for the current address.
All number formats accept 16-bit data and leading zeros are never required. In c
ase 3, the "value" of the
primitive expression is just the ASCII value of the character. The hi-bit will b
e on if a quote (") is used
and the value greater than $7F. The hi-bit will be off if an apostrophe (') is u
sed and the value less than
$80.
Arithmetic and Logical Operations in Expressions
The assembler supports the four arithmetic operations: +, -, / (integer division
), and * (multiplication).
IraTso supports the three logical operations: ! (Exclusive OR), . (OR), and &
; (AND).
Building Expressions
Expressions are built using the primitive expressions defined above, either with
or without arithmetic
and/or logical operations. This means that expressions can take the form of prim
itives or primitives
operated on by other primitives using the arithmetic and logical operators.
Some examples of legal expressions are:
(primitive expression =1)
(primitive expression = 32 dec)
(primitive consisting of a label)
(primitive consisting of letter "A")
(primitive = current value of PC)
#01
#$20
LABEL
#"A"
Page 81
The Assembler
Parentheses are not normally allowed in expressions. They are not used to modify
the precedence of
expression evaluation. All arithmetic and logical operations are evaluated left
to right. Thus, 2+3*5
would assemble as 25 and not 17.
Parentheses are used to retrieve a value from the memory location specified by t
he value of the
expression within the parentheses, much like indirect addressing. This use is re
stricted to certain pseudo
ops, however.
Page 82
The Assembler
For example:
DO ($300)
will instruct the assembler to generate code if the value of memory location $30
0 is non-zero at the
time of assembly.
Example of Use of Assembler Expressions
The ability of the assembler to evaluate expressions such as LAB2-LAB1-1 is very
useful for the
following type of code:
COMPARE
LDX
# EOD ATA-DATA- 1
LOOP
CMP
DATA, X
BEQ
FOUND
; found
DEX
BPL
LOOP
JMP
REJECT
; not found
DATA
HEX
CACFC5D9
EODATA
EQU
With this type of code, you can add or delete some of the DATA and the value whi
ch is loaded into the
X index for the comparison loop will be automatically adjusted.
ADDRESSING MODES
Because of the different processors in use in the Apple lie, He, and Ilgs machin
es, Merlin 8/16 not only
supports all the addressing modes of the 65xx microprocessors, but the different
assemblers are
customized to the systems they are most likely to be used on.
Page 83
Merlin 8
When either version of Merlin 8 is started, the assembler assumes a 6502 micropr
ocessor state for
assemblies. If you are assembling code for a 65C02 processor, you must use the a
ssembler XC opcode
once at the beginning of the listing anywhere before an actual 65C02 opcode is u
sed. The requirement
for the XC enable directive is a safety feature, so that you don't inadvertently
use a 65C02 opcode like
STZ or INC in a program designed for a 6502 machine. Because the assembler would
otherwise
generate no errors with the extended opcodes, a program that unwittingly used an
improper code would
be very hard to debug.
If you are using Merlin 8 to write a program for the 65802, you must use two XC
pseudo-ops at the
beginning of the source listing to enable the 65802 instructions. Because the 65
802 does not support
more than 64K of addressable memory, Merlin 8 does not feature any long addressi
ng modes, although
macros to duplicate these functions can be written.
Merlin 16
Because Merlin 16 is most likely to be used on an Apple Ilgs, the startup defaul
t for the assembler logic
is to have 65816 opcodes enabled, thus avoiding the need for using the XC direct
ives. If you will be
using Merlin 16 to assemble code for Apple He compatible computers, you may want
to consider
changing the PARMS file for Merlin 16 to require the use of the XC directives as
a safety device to
prevent accidental use of 65816 opcodes in programs written for the Apple lie. E
ven Apple Computer
is not above these hazards, as evidenced by the use of a 65C02 instruction in a
version of ProDOS that
was intended to have been compatible with 6502 machines.
In regards to the M and X bits of the 65816, the assembler logic of Merlin 16 st
arts out assuming the
processor will be in the Emulation Mode, since this is the power-up state of the
microprocessor.
Remember, this is an assumption about your source code, and has nothing to do wi
th the actual
program code of Merlin 16 itself. Like the XC default, you can change the PARMS
file to start a
source listing in any setting of the M and X bits you prefer.
When programming for the 65816, Merlin 16 uses the following definitions for add
ress expressions:
Page 84
The Assembler
Merlin 16 allows the use of the 4th character in the opcodes ADC, AND, CMP, EOR,
LDA, ORA,
SBC and ST A to force the long addressing modes, as shown by the previous exampl
e.
In addition, the instructions JML and JSL are always assembled in the long form,
and JSR and JMP are
always assembled in the short or 64K address form.
Page 85
The Assembler
Standard Opcode:
Alternate Opcode:
TCS
TSC
XBA
TCD
TDC
BCC
BCS
TAS
TSA
SWA
TAD
TDA
BLT
BGE
Page 86
The Assembler
(alternate syntax)
[ equate START to $1000 ]
| equate CHAR to ASCII value of A ]
[ PTR equals present address in the assembled source listing ]
[ LABEL equals the decimal value of 55 ]
Page 87
The Assembler
Note that labels are CASE SENSITIVE. Therefore, the assembler will consider the
following labels
as different labels:
START [ upper case label ]
Start [ mixed case label ]
start [ lower case label ]
EXT (EXTernal label)
label EXT [ label is external labels name ]
PRINT EXT [ define PRINT as external ]
This pseudo op defmes a label as an external label for use by the Linker. The va
lue of the label, at
assembly time, is set to $8000, but the final value is resolved by the Linker. T
he symbol table will
list the label as having the value of $8000 plus its external reference number (
0-$FE). See the
Linker section of the manual for more information on this opcode.
ENT (ENTry label)
label ENT
PRINT ENT [ define PRINT as entry label ]
This pseudo-op will define the label column as an ENTRY label. An entry label is
a label that may
be referred to as an EXTernal label by another REL code module, which may refer
to the ENT label
just as if it were an ordinary label. It can be EQUated, jumped to, branched to,
etc. The true address
of an entry label will be resolved by the Linker.
See The Linker section of the manual for more information on this opcode.
Page 88
ORG expression
ORG
ORG $1000 [ start code at $1000 ]
ORG START+END [ start at value of expression ]
ORG [re-ORG]
Establishes the address at which the program is designed to run, and where it wi
ll be automatically
BLOADed in memory if it is a BINary type object file. This is not necessarily wh
ere Merlin 8/16
will actually assemble the code with the ASM command. ORG defaults to $8000. Ord
inarily there
will be only one ORG and it will be at the start of the program. If more than on
e ORG is used, the
first one establishes the BLOAD address, while the second actually establishes a
new origin for any
code that follows it. This can be used to create an object file that would load
to one address though
it may be designed to run at another address.
NOTE: If you need to back up the object pointers you must use DS-1 . This cannot
be done by
ORG*-l. y
ORG
$1000
1000 :
AO
00
LDY
#0
1002:
20
21
10
JSR
MOVE
1005:
4C
12
10
JMP
CONTINUE
0300:
ORG
$300
8D
08
CO
6 PAGE3
STA
MAINZP
0303:
20
ED
FD
JSR
COUT
0306:
8D
09
CO
STA
AUXZP
0309:
60
9
10
RTS
ORG
1012:
A9
CI
11 CONTINUE
LDA
#"A
1014:
20
00
03
12
JSR
PAGE 3
;"M0VE" IS
;N0T LISTED
;R0UTINE TO
;BE MOVED
; REORG
Sometimes, you will want to generate two blocks of code with separate ORGs in on
e assembly.
There are four ways of doing this involving four different directives. These are
DSK, S AV, DS and
REL. All four are described later in this manual, and are presented here in the
interest of continuity.
Page 89
Merlin 8/16 User's Manual
The Assembler
******************
* MULTIPLE ORG'S *
* SOLUTION # 1 *
* DSK COMMAND *
******************
6
7
DSK FILEONE
ORG $8000
LDA #0
10
11
DSK FILETWO
12
ORG $8100
13
LDY #1
; ANOTHER PROGRAM, FILE CLOSED
******************
* MULTIPLE ORG'S *
* SOLUTION # 2 *
* SAV COMMAND *
******************
6
7
ORG $8000
; LOAD ADDRESS FOR 1ST
LDA #0
SAV FILEONE
10
11
ORG $8100
12
LDY #1
13
SAV FILETWO
Page 90
ine Assembler
This might be useful, for example, if you wanted your code to skip over the Hi-R
es page 1 area of
memory. Please read the section on S AV for more information about multiple ORGs
in a program.
1
2
3
4
5
6
7
8
9
10
11
12
******************
* MULTIPLE ORG'S *
* SOLUTION # 3 *
* DS COMMAND *
******************
ORG $8000
LDA SO
DS \
LDY II
LOAD ADDRESS OF FILE
SAMPLE PROGRAM LINE
FILL WITH $0 TO NEXT PG
or could have been DS $8100-*
SAMPLE LINE OF 2ND SEGMENT
THIS WILL START AT $8100
1 ******************
2 * MULTIPLE ORG'S *
3 * SOLUTION #4B *
4 * REL COMMAND *
5 ******************
6
7 REL
8 DSK FILETWO.L
9 LDA #0
Page 91
The Assembler
This example is for the Merlin 16 Linker only. These two files would be linked f
or the desired
ORG addresses with a Link command file like this:
******************
* MULTIPLE ORG'S *
* LINKER *
* COMMAND FILE *
5
******************
6
7
ORG $8000
LNK F I LEONE. L
SAV FILE1
10
11
ORG $8100
12
LNK FILETWO.L
13
SAV FILE2
Although the Linker is normally used to combine several source files, or to comm
unicate label
values between programs, it can be used to assemble even unrelated files.
REL (RELocatable code module)
REL
REL [ only option for this opcode ]
This opcode instructs the assembler to generate code files compatible with the r
elocating linker.
This opcode must occur prior to the use or definition of any labels. See the Lin
ker section of this
manual for more information on this opcode.
OBJ (set OBJect)
OBJ expression
OBJ $4000 [use of hex address]
OBJ START [ use with a label ]
The OBJ opcode is accepted only prior to the start of the code and it only sets
the division line
between the symbol table and object code areas in memory, which defaults to $800
0. The OBJ
address is accepted only if it lies between $4000 and $BFE0. This may cause a pr
oblem if you try to
assemble a listing OBJ'ed to $300, for example.
Nothing disastrous will happen if OBJ is out of range; when you return to the Ma
in Menu to save
your object file, no object file address and length values will be displayed on
the screen, and Merlin
8/16 will simply beep at you if you try to save an object file.
Page 92
The Assembler
The main reason for using OBJ is to be able to quit the assembler directly, test
a routine in memory,
and then be able to immediately return to the assembler to make any corrections.
If you want to do
this, simply use the GET command (Example: GET $300) in the DOS 3.3 version of M
erlin 8
before quitting to BASIC.
In the ProDOS version of Merlin 8/16, this isn't an option because you can't tem
porarily quit
Merlin 8/16 to BASIC. For ProDOS, it is recommended that you disregard the use o
f OBJ entirely.
To test a program from the Main Menu, you should save the source code, save the
object code, then
quit to BASIC.SYSTEM. Then BLOAD the object file. The file will automatically lo
ad at the
proper location.
Most people should never have to use OBJ. If the REL opcode is used then OBJ is
disregarded. If
DSK is used then you can, but may not have to, set OBJ to $BFE0 to maximize the
space for the
symbol table.
In Merlin 16, the address range of the symbol table is printed in hex, at the en
d of an assembly.
This allows you to see when a new OBJ value may be needed. You can also use the
DSK command
should the object file become too big.
Page 93
The Assembler
Page 94
The Assembler
6 ORG $8000
7
8 DSK FINAL. OB J ; OUTPUT FILE
9 JSR HOME
10 PUT FILE1 ; Named "T.FILE1" on disk (Merlin 8, DOS 3.3)
11 PUT FILE2 ; Named "T.FILE2" on disk
12 PUT FILE3 ; Named "T.FILE3" on disk
13 ; Named "FILE1.S, etc. on ProDOS disk)
And here are the text files that the Master program calls in by using the PUT co
mmands:
1 * FILE1
2
3 LDX #0
4 LOOP1 LDA STRING1,X
5 BEQ FILE2
6 JSR COUT
7 INX
8 BNE LOOP1
9 STRING1 ASC "THIS IS FILE 1"
10 HEX 8D00
* FILE2
2
3
FILE2 LDX
#0
4
LOOP2 LDA
STRING2,X
BEQ
FILE3
JSR
COUT
INX
BNE
LOOP2
STRING2 ASC
10
HEX
8D00
1
* FILE3
FILE3 LDX
#0
LOOP3 LDA
STRING3,X
BEQ
DONE
JSR
COUT
INX
8
BNE
LOOP3
DONE RTS
10
STRING3 ASC
11
HEX
8D00
Each PUT file (FILE1, FILE2, FILE3) prints a message identifying which file is i
n operation.
Page 95
The Assembler
DOS 3.3 NOTE: Drive and slot parameters are accepted in the standard DOS syntax.
The
"filename" specified must be a text file with the "T." prefix. If it doesn't hav
e the M T." prefix in the
disk catalog, the "filename" specified must start with a character less than "@"
in ASCII value.
This tells Merlin 8/16 to look for a file without the "T." prefix. The "!" chara
cter can be used for
this purpose. For example:
Disk file name = T.SOURCE CODE [ name in catalog ]
PUT file name = SOURCE CODE [ name in PUT opcode ]
Disk file name = SOURCE CODE [ name in catalog ]
PUT file name = ! SOURCE CODE [ name in PUT opcode ]
ProDOS NOTE: Drive and slot parameters are not accepted; pathnames must be used.
Note that
the above name conventions do not apply to ProDOS, since all source files under
ProDOS are text
files.
NOTE: "Insert" refers to the effect on assembly and not to the location of the s
ource. The file
itself is actually placed just following the main source. These files are only i
n memory one at a
time, so a very large program can be assembled using the PUT facility.
There are two restrictions on a PUT file. First, there cannot be macro definitio
ns inside a file which
is PUT; they must be in the Master source file or in a USE file. Second, a PUT f
ile may not call
another PUT file with the PUT opcode. Of course, linking can be simulated by hav
ing the Master
program just contain the macro definitions and call, in turn, all the others wit
h the PUT opcode.
Any variables, such as ]LABEL, may be used as "local" variables. The usual local
variables ]1
through ]8 may be set up for this purpose using the VAR opcode.
The PUT facility provides a simple way to incorporate often used subroutines, su
ch as SENDMSG
or PRDEC, in a program.
Page 96
Merlin 8/16 User's Manual
The Assembler
USE filename
USE MACRO LIBRARY
USE IMACROS
USE MACROS,S5,Dl
USE /LIB/MACROS
This works similarly to PUT but the file is kept in memory. It is intended for l
oading a macro
library that is US Ed by the source file.
It can also be used for including a common library of equates in source files to
avoid having to type
them into every new program you write. For example, this equate file:
**********************
* COMMON EQUATE FILE *
**********************
Could be included in every program you write using the USE command:
**********************
* SAMPLE PROGRAM *
**********************
Normally, the assembled listing will print out all the labels defined in the EQU
ATES file, but you
could use LST ON and LST RTN at the beginning and end of the EQUATES file to sup
press the
listing of just the defined labels.
Page 97
The Assembler
Page 98
The Assembler
all of the code that used to reside at $2000 is shown at $6000. Then you run you
r program and it
crashes again!
You go into the Monitor and find that none of your code is at $6000. It's just a
bunch of hex
garbage! The answer is that when more than one ORG statement is used, Merlin 8/1
6 does not
physically move the generated code to the new address, it adds it to the end of
the previous code.
Therefore, the code that should have started at $6000 was assembled with all of
its addresses correct
for $6000, but its actual location was still down at $2000.
Merlin 8/16 SAV's the day! You need to assemble your source as one file since th
e two sections
refer to each other, but each section needs to be put in different memory locati
ons. The answer is to
assemble the entire file with SAV's. Each section will be saved as a binary file
with the proper load
address. Thus in the following example, when the entire file is assembled, two b
inary files will be
generated and saved. The first will be called FILE1 and will have a load address
of $800. The second
will be called FILE2 and will have a load address of $6000.
Therefore, SAV is used to save sections of code to separate individual binary fi
les during an
assembly. With SAV, you can assemble code that may not be continuous in memory b
ut which
must be assembled all at once because the sections refer to each other, and may
share labels, data,
and/or subroutines.
See the example of the multiple-ORG files using SAV at the beginning of this sec
tion for an
illustration of the SAV command.
NOTE: The Linker provides an alternate way of acheiving this same result. A link
er is used more
often for large programs because the each segment can be individually created, a
ssembled, and then
linked into the final program without re-assembling the other segments, thus sav
ing time during
program development
TYP (set ProDOS file type for DSK and SAV)
TYP expression
TYP $00 [no file type]
TYP $06 [ binary file type ]
This sets the file type to be used by the DSK or SAV opcodes. The default is the
BIN type. Valid
file types for Merlin 8 are 0,6,$F0-$F7 t and $FF (no type, BIN, CMD, user defin
ed, SYS). In
Merlin 16, there are no restrictions on the filetypes available.
Page 99
Merlin 8/16 User's Manual
The Assembler
The first purpose is the most often used reason for utilizing the DSK opcode.
NOTE: Using DSK will slow assembly significantly. This is because Merlin 8/16 wi
ll write a
sector to disk every time 256 bytes of object code have been generated. If you d
on't need a copy of
the object code on disk, you should not use the DSK opcode, or use a conditional
to defeat it. This
is illustrated in the APPLES OFT.S source also.
The assembly speed of source programs that use DSK, PUT, USE or S AV can be impr
oved
significantly by putting the referenced files on a RAM disk.
Here is an example listing of a program that creates two separate object files u
sing the DSK
command:
1 * DSK SAMPLE *
2 DSK FILEONE ; ASSEMBLE 'FI LEONE 1 TO DISK
3 ORG $300 ; ' FILEONE' AT $300 (CALL 768)
4 COUT EQU $FDED
5 HOME EQU $FC58
6 JSR HOME
7 LDX #0
8 L00P1 LDA STRING1,X
Page 100
The Assembler
9 BEQ D0NE1
10 JSR COUT
11 INX
12 BNE LOOP1
13 DONE1 RTS
14 STRING1 ASC "THIS IS ONE"
15 HEX 8D00
16
17 DSK FILETWO /ASSEMBLE 'FILETWO 1 TO DISK
IB ORG $8000 ; 'FILETWO 1 AT $8000 (CALL 32768)
19
20 LDX #0
21 LOOP2 LDA STRING2,X
22 BEQ DONE2
23 JSR COUT
24 INX
25 BNE LOOP 2
26 DONE 2 RTS
27 STRING2 ASC "NOW IT'S TWO"
28 HEX 8DO0
DUM expression
DUM $1000
DUM LABEL
DUM END-START
The Assembler
This starts a section of code that will be examined for the values of labels but
will produce no object
code. The expression must give the desired ORG of this section. It is possible t
o re-ORG such a
section using another DUMMY opcode or using ORG. Note that although no object co
de is
produced from a dummy section, the text output of the assembler will appear as i
f code is being
produced, so you can see the addresses as they are referenced.
DEND (Dummy END)
DEND
DEND [ only option for this opcode ]
This ends a dummy section and re-establishes the ORG address to the value it had
upon entry to the
dummy section.
DUM and DEND are used most often to create a set of labels that will exist outsi
de of your
program, but that your program needs to reference. Thus, the labels and their va
lues need to be
available, but you don't want any code actually assembled for that particular pa
rt of the listing.
Sample usage of DUM and DEND:
1
2
ORG
$1000
3
4
IOBADRS
$37EB
DUM
IOBADRS
IOBTYPE
DFB
I0BSL0T
DFB
$60
IOBDRV
DFB
I0BV0L
DFB
10
IOBTRCK
DFB
11
I OB SECT
DFB
12
DS
13
IOBBUF
DA
14
DA
15
IOBCMD
DFB
16
IOBERR
DFB
17
ACTVOL
DFB
18
PREVSL
DFB
19
PREVDR
DFB
20
DEND
21
22
START
LDA
#SLOT
23
STA
I0BSL0T
24
* And
so on
;pointer to DCT
Note that no code is generated for lines 5 through 20, but the labels are availa
ble to the program
itself, for example, on line 23.
Page 102
The Assembler
AST expression
AST 30
ASTNUM
This sends a number of asterisks (*) to the listing equal to the value of the op
erand. The number
format is base 10, so that AST10 will send decimal 10 asterisks, for example. Th
e number is treated
modulo 256 with being 256 asterisks.
CYC (calculate and print CYCle times for code)
This opcode will cause a program cycle count to be printed during assembly. A se
cond CYC opcode
will cause the accumulated total to go to zero. CYC OFF causes it to stop printi
ng cycles. CYC
AVE will average in the cycles that are underterminable due to branches, indexed
and indirect
addressing.
The cycle times will be printed or displayed to the right of the comment field a
nd will appear similar
to any one of the following:
5 , 0326 or 5' ,0326 or 5", 0326
The first number displayed, the 5 in the example above, is the cycle count for t
he current
instruction. The second number displayed is the accumulated total of cycles in d
ecimal.
An apostrophe or single quote after the cycle count indicates a possible added c
ycle, depending on
certain conditions the assembler cannot forsee. If this appears on a branch inst
ruction then it
indicates that one cycle should be added if the branch occurs. For non-branch in
structions, the single
quote indicates that one cycle should be added if a page boundary is crossed.
CYC
CYC OFF
CYC AVE
CYC FLAGS
CYC
CYC OFF
CYC AVE
CYC FLAGS
Page 103
The Assembler
A double quote after the cycle count indicates that the assembler has determined
that a branch would
be taken and that the branch would cross a page boundary. In this case the extra
cycle is displayed
and added to the total.
The CYC opcode will also work for the extra 65C02 opcodes in Merlin 8/16. It wil
l not work for
the additional 65C02 opcodes present in the Rockwell 65C02, i.e. RMB#, SMB#, BBR
# and BSS#.
These opcodes are not supported by Merlin 8/16, except when USEing the ROCKWELL
macro
library. All of these unsupported opcodes are 5-cycle instructions with the usua
l possible one or
two extra cycles for the branch instructions BBS and BBR.
In Merlin 8, the CYC opcode will also work for the 65802 opcodes, but it will no
t add the extra
cycles required when M=0 or when X=0, In Merlin 16, there is an additional optio
n, CYC FLAGS,
that will print out the current assembler status of the registers sizes, M and X
. This can be useful
for verifying that register states are as you want them throughout a listing. Th
e CYC function in
Merlin 16 does correctly take the M and X bits into account when calculating cyc
le times.
I macro exapand on ]
t print only macro call ]
I print only generated code ]
EXP ON will print an entire macro during the assembly. The OFF condition will pr
int only the
PMC pseudo-op. EXP defaults to ON. This has no effect on the object code generat
ed. EXP
ONLY will cause expansion of the macro to the listing omitting the call line and
end of macro line.
However, if the macro call line is labeled, it is printed. This mode will print
out just as if the macro
lines were written out in the source.
Page 104
The Assembler
Page 105
The Assembler
Page 106
The Assembler
Page 107
The Assembler
Page 108
The Assembler
This puts a delimited string into memory with a leading length byte. Otherwise i
t works the same
as the ASC opcode. This facility is mainly intended for use with ProDOS which us
es this type of
data extensively.
Note that following HEX bytes, if any, are not counted in the length. Thus, alth
ough the third
example above will not generate an error, it should not be used since any hex by
tes appended to the
end of a defined string would not be printed or otherwise recognized by a routin
e using the length
byte as part of the descriptor for the string data.
Page 109
The Assembler
Page 110
The Assembler
is a properly formatted DFB statement which will generate the hex object code:
34 64 DE OB 09
assuming that LAB1=$81A2 and LAB2=$77C4.
ADR (Define Long Address - 3 bytes Merlin 16 only)
ADR expression
ADR $01FDF0 [ results: F0 FD 01 in memory ]
ADR 10,$020300 [ results: OA 00 00 00 03 02 ]
ADR LAB 1 ,L AB2 [ example of use with labels ]
This stores the three-byte value of the operand, usually an address, in the obje
ct code, low -byte, hi-
byte, then bank byte. This pseudo op also accepts multiple data separated by com
mas such as ADR
1,10,100).
ADRL (Define Long Address - 4 bytes - Merlin 16 only)
ADRL expression
ADRL $01FDF0 [ results: F0 FD 01 00 in memory ]
ADRL 10,$020300 [ results: OA 00 00 00 00 03 02 00 ]
ADRL LAB 1 ,LAB2 [ example of use with labels ]
This stores the four-byte value of the operand, usually an address, in the objec
t code, low-byte, hi-
byte, bank byte, then hi-byte of the high word. This pseudo op also accepts mult
iple data separated
by commas (such as ADR 1,10,100).
The decision as to whether to use ADR or ADRL will depend largely on whether the
addresses
defined are to be used as an indirect pointer (for example, JSR [PTR]), or as a
address to be accessed
with two LDA type instructions (LDA LABEL, LDA LABEL+2).
HEX (define HEX data)
HEX hex-data
HEX 0102030F [ results: 01 02 03 OF in memory ]
HEX FD,ED,C0 [ results: FD ED CO in memory ]
This is an alternative to DFB which allows convenient insertion of hex data. Unl
ike all other cases,
the $ is not required or accepted here. The operand should consist of hex number
s having two hex
digits, thus you would use OF, not F. They may be separated by commas or may be
adjacent. An
error message will be generated if the operand contains an odd number of digits
or ends in a comma,
or in any case, contains more than 64 characters.
Page 111
The Assembler
DS (Define Storage)
DS experesssion
DS expression 1, expression!
DS\
DS 10
DS 10,$80
DSN
DS \$80
DS \expression2
This reserves space for string storage data. It zeros out this space if the expr
ession is positive. DS
10, for example, will set aside 10 bytes for storage.
Because DS adjusts the object code pointer, an instruction like DS-1 can be used
to back up the
object and address pointers one byte.
The first alternate form of DS, with two expressions, will fill expressionl byte
s with the value of
the low -byte of expression2, provided expression! is positive. If expression! i
s missing, is used
The second alternate form, DS \ will fill memory with zeroes until the next memo
ry page. The
"DS \expression2" form does the same but fills using the low-byte of expression!
.
Notes for REL files and the Linker
The back slash (\) options are intended for use mainly with REL files and work s
lightly differently
with these files. Any DS \ opcode occurring in a REL file will cause the linker
to load the next file
at the first available page boundary, and to fill with zeroes or the indicated b
yte. Note that for REL
files, the location of this code has no effect on its action. To avoid confusion
, you should only use
this code at the end of a fde.
Page 112
The Assembler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
DATA
HOME
COUT
START
PRINT1
LOOP1
PRINT2
DONE
DATA1
DATA2
DATA3
TABLE
ORG
EQU
EQU
JSR
LDY
LDA
JSR
LDX
LDA
BEQ
JSR
INX
BNE
LDA
JSR
LDA
JSR
INY
CPY
BCS
JMP
RTS
DFB
ASC
HEX
DFB
DEMO *
$8000
$FC58
$FDED
HOME
#0
DATA1 , Y
COUT
#0
DATA2 , X
PRINT2
COUT
LOOP1
DATA3 , Y
COUT
#$8D
COUT
#$03
DONE
PRINT1
; CLEAR SCREEN
;SET Y TO ZERO
; PRINT NUMBER TO BE SQUARED
;SET X TO ZERO
;LOOP TO PRINT TEXT
#177,178,179
M SQUARED IS N
00
#177,180,185
Notice how the data portion of the program (DATA1, DATA2, DATA3) is referenced i
n the main body
of the program. Also notice that for the purpose of illustration several data de
finition styles have been
used. The actual numbers printed by the program (example, 3 SQUARED IS 9) are st
ored in the
program as defined bytes (DFB) on lines 28 and 31. This could just as easily bee
n done with the ASC
pseudo-op. The pseudo-op HEX is also used on line 30 to create the zero byte tha
t terminates the string
" SQUARED IS ". 6
Page 113
The Assembler
DO (DO if true)
DO expression
DO
DO 1
DO LABEL
DO LAB1/LAB2
DO LAB1-LAB2
DO LABEL- 1
[ if LABELoO then on ]
[ifLABl<LAB2thenoff ]
[ if LAB1=LAB2 then off ]
This together with ELSE and FIN are the conditional assembly pseudo ops. If the
operand evaluates
to zero, then the assembler will stop generating object code (until it sees anot
her conditional). See
the section on "Building Expressions" for more examples of testing for certain v
alues. Except for
macro names, it will not recognize any labels in such an area of code. If the op
erand evaluates to a
non-zero number, then assembly will proceed as usual. This is very useful for ma
cros.
It is also useful for sources designed to generate slightly different code for d
ifferent situations. For
example, if you are designing a program to go on a ROM chip, you would want one
version for the
ROM and another with small differences as a RAM version for debugging purposes.
Conditionals
can be used to create these different object codes without requiring two sources
.
Similarly, in a program with text, you may wish to have one version for Apples w
ith mousetext
characters and one for those without. By using conditional assembly, modificatio
n of such programs
becomes much simpler, since you do not have to make the modification in two sepa
rate versions of
the source code.
Every DO should be terminated somewhere later by a FIN and each FIN should be pr
eceded by a DO.
An ELSE should occur only inside such a DO/FIN structure. DO/FIN structures may
be nested up
to eight deep, possibly with some ELSE's between. If the DO condition is off, i.
e. value 0, then
assembly will not resume until its corresponding FIN is encountered, or an ELSE
at this level
occurs. Nested DO/FIN structures are valuable for putting conditionals in macros
.
This inverts the assembly condition for the last DO. Thus, ON becomes OFF and OF
F becomes
ELSE
ELSE
ON.
Page 114
The Assembler
This checks to see if char is the leading character of the replacement string fo
r ]var. IF cannot be
used for testing whether a label is equal to a value, etc. Use the DO pseudo-op
for value tests.
NOTE: Position is important since the assembler checks the first and third chara
cters of the
operand for a match. If a match is found then the following code will be assembl
ed. As with DO,
this must be terminated with a FIN, with optional ELSEs between. The comma is no
t examined,
so any character, such as the equal sign, may be used there. For example:
IF "=]1
could be used to test if the first character of the variable ] 1 is a double quo
te (") or not, perhaps
needed in a macro which could be given either an ASCII or a hex parameter.
In Merlin 16, IF can be used to check the status of the assembler M & X bits
. MX is interpreted as
though it has a value in the range 0-3, depending on the current MX flag. The MX
can then be
included in an expression to control a conditional assembly. This is intended fo
r use in macros to
determine register length. For example:
IF MX/2
DO if M is short
IFMX/2-1
DO if M is long
IFMX&l
DO if X is short
IFMX&l-l
DO if X is long
IF MX/3
IFMXI3/3
IFMX-2/-1
IFMX-3/-1
IFMX+1&3
IF MX
Page 115
The Assembler
HOME
EQU
$FC58
COUT
EQU
$FDED
t
BELL
EQU
$FBDD
FLAG
EQU
t
i
t
BEGIN
JSR
HOME
t
t
DO
FLAG
PARTI
LDA
# H A H
TCD
LUU1
EiLbJli
PART2
LDA
# M B"
TCD
LUU1
r in
BELL
JSR
BELL
DO
FLAG-1
r
t
PART 2 A
LDA
# H b H
JSR
COUT
ELSE
PARTI A
LDA *
a M
JSR
COUT
FIN
DONE
RTS
Page 116
The Assembler
Using IF to test the first character of a parameter passed to a macro lets you a
dd a variety of possible
addressing modes to a macro that will depend on the input parameters. Assume we
start with a
simple macro to move data from one location to another:
The MOV macro moves data from ]1 to ]2:
MOV MAC
LDA ]1
STA ]2
<
We can then construct a more sophisticated macro that uses MOV, but which suppor
ts a wide
variety of addressing modes:
The MOVD macro moves data from ]1 to ]2 with many available syntaxes
MOVD
MAC
MOV
]i;]2
IF
Ui
INY
IF
(,]2
; MOVD
(ADR1) , Y; (ADR2) , Y
MOV
]i;]2
ELSE
; MOVD
(ADR1) , Y;ADR2
MOV
]i;]2+i
FIN
ELSE
IF
(,]2
; Syntax
INY
IF
; MOVD
#ADR1; (ADR2) , Y
MOV
]1/$100;]2
ELSE
; MOVD
ADR1; (ADR2) , Y
MOV
]1+1;]2
FIN
ELSE
; Syntax
MOVD ????;ADR2
IF
]1/$100;]2+1
; MOVD
#ADR1;ADR2
MOV
ELSE
; MOVD
ADR1; ADR2
MOV
] 1+1; ] 2+1
FIN
FIN
FIN
;& IFs,
deduct FINs. Must
<
Page 117
The Assembler
MOVD #ADR1;ADR2
MOVD #ADR1; (ADR2) , Y
Here's a macro that can be created for use with the 65816 to push an immediate v
alue on the stack
using PEA, or to first load the contents of another memory location, and then pu
sh that value on the
stack with a PHA. This type of operation is very common when programming on the
Apple Ilgs.
PushWord
MAC
DEFINE MACRO
IF #=
= ]1
PEA
]1
ELSE
OTHERWISE
LDA
]1
PHA
FIN
EOM
Page 118
The Assembler
STARTCHK
LDA
#<STARTCHK
STA
PTR
LDA
#>STARTCHK
STA
PTR+1
LDY
#$00
LDA
#$00
7
8
PHA
LOOP
PLA
10
EOR
(PTR) , Y
11
PHA
12
INC
PTR
13
BNE
CHK
14
INC
PTR+1
; YEP
15
CHK
LDA
PTR+1
16
CMP
#>PR0GEND
17
BCC
LOOP
; NOT YET...
18
LDA
PTR
19
CMP
#<PR0GEND
20
BCC
LOOP
; NOPE
21
BEQ
LOOP
22
CHKCS
PLA
23
CMP
CHKSUM
24
BNE
ERROR
; ERROR HANDLER
25
26
REAL START
???
27
???
Page 119
The Assembler
998 PROGEND
9 99 CHKSUM
RTS
CHK
ERR (force
ERRor)
ERR expression
ERR Expression
ERR ($300)-$80
ERR *-l/$4100
ERR \$5000
"ERR expression" will force an error if the expression has a non-zero value and
the message
"BREAK IN LINE ???" will be printed. This may be used to ensure your program doe
s not exceed,
for example, $95FF by adding the final line:
ERR *-l/$9600
NOTE: The above example would only alert you that the program is too long, and w
ill not
prevent writing above $9600 during assembly, but there can be no harm in this, s
ince the assembler
will cease generating object code in such an instance. The error occurs only on
the second pass of
the assembly and does not abort the assembly.
Another available syntax is:
ERR ($300)-$4C
which will produce an error on the first pass and abort assembly if location $30
0 in main memory
does not contain the value $4C. The primary purpose for this function is to allo
w your source file to
check to see if a USR defined opcode routine has been loaded prior to the assemb
ly. This does not
check a memory location in the object code,
NOTES ON REL FILES AND THE ERR PSEUDO OP
The "ERR Nexpression" syntax gives an error on the second pass if the address po
inter reaches
expression or beyond. This is equivalent to ERR *-l/expr, but when used with REL
files, it
instructs the Linker to check that the last byte of the current module does not
extend to expression or
beyond. The expression must be absolute. If the Linker finds that the current mo
dule does extend
beyond expression, linking will abort with a message "Constraint error:" followe
d by the value of
expression in the ERR opcode. You can see how this works by linking the PI files
which are a
series of sample file on the Merlin 8/16 disks. They should be linked to an addr
ess over $8 1C.
Note that the position of this opcode in a REL file has no bearing on its action
, so that it is best to
put it at the end.
Page 120
The Assembler
FLAG
KBD
"Assemble Part 1
or Part 2? (0/1)"
DO
FLAG-1
' DO IF FLAG =
PARTI
LDA
r'A"
JSR
COUT
PRINT "A"
FIN
DO
FLAG
DO IF FLAG = 1
PART2
LDA
#"B"
JSR
COUT
PRINT "B"
FIN
DONE
RTS
Instead of pressing or 1, you can use the fact that KBD will accept a label as i
nput to accept a Y or
N input:
N EQU ; NO =
Y EQU 1 ; YES = 1
FLAG KBD "Assemble Part 1 or Part 2? ( Y/N) "
Page 121
The Assembler
Page 122
The Assembler
MX expression
MX %00 [ M & X = 16 bit modes ]
MX %01 [ M = 16 bits, X = 8 bits ]
MX %10 [ X = 8 bits, M = 16 bits ]
MX %11 [ X = 8 bits, M = 8 bits ]
MX 3 [ sameasMX%ll ]
This pseudo-op is used to inform Merlin 8/16 of the intended status of the long
status of the 65802
or 658 16 processor. In Merlin 8, it functions only when the assembler is in the
65802 mode, i.e.
when two consetutive XC opcodes have been given. The assembler cannot determine
if the
processor is in 16 bit memory mode (M status bit=0) or 16 bit index register mod
e (X status bit=0).
The purpose of the MX opcode is to inform the assembler of the current status of
these bits.
Three of the above examples use binary expressions as the operand of the MX opco
de. Note that
any valid expression may be used as long as it is within the range of 0-3.
NOTE: This opcode must be used when using 65802 or 65816 instructions on either
Merlin 8 or
Merlin 16 to inform the assembler of the proper mode to use in order to insure p
roper assembly of
immediate mode commands such as LDA #expression, etc.
At startup, Merlin 16 assumes the MX setting to be MX %1 1, that is, Emulation M
ode with both
Accumulator and Memory register sizes set to 8 bits, although this default can b
e changed in the
Merlin 16 PARMS file.
PAU (PAUse)
PAU
PAU [ only option for this opcode ]
On the second pass, PAU causes assembly to pause until a key is pressed. This ca
n also be done
from the keyboard by pressing the space bar. This is handy for debugging.
Page 123
The Assembler
USRADS
= $B6DA
PUTBYTE
= $E5F6
;see below
EVAL
= $E5F9
;see below
PASSNUM
= $2
ERRCNT
= $1D
; error count
VALUE
- $55
OPNDLEN
= $BB
NOTFOUND
= $FD
WORKSP
= $280
Your routine will be called by the USR opcode with A=0, Y=0 and carry set. To di
rect the
assembler to put a byte in the object code, you should JSR PUTBYTE with the byte
in A.
PUTBYTE will preserve Y but will scramble A and X. It returns with the zero flag
clear so that
BNE always branches. On the first pass PUTBYTE only adjusts the object and addre
ss pointers, so
that the contents of the registers are not important. You must call PUTBYTE the
same number of
times on each pass or the pointers will not be kept correctly and the assembly o
f other parts of the
program will be incorrect!
If your routine needs to evaluate the operand, or part of it, you can do this by
a JSR EVAL. The X
register must point to the first character of the portion of the operand you wis
h to evaluate, thus set
X=0 to evaluate the expression at the start of the operand. On return from EVAL,
X will point to
the character following the evaluated expression. The Y register will be 0, 1, o
r 2 depending on
whether this character is a right parenthesis, a space, a comma, or the end of a
n operand.
Any character not allowed in an expression will cause assembly to abort with a B
AD OPERAND or
other error. If some label in the expression is not recognized then location NOT
FOUND will be
non-zero. On the second pass, however, you will get an UNKNOWN LABEL error and t
he rest of
your routine will be ignored. On return from EVAL, the computed value of the exp
ression will be
in location VALUE and VALUE+1, low-byte first. On the first pass this value will
be insignificant
if NOTFOUND is non-zero.
Page 124
The Assembler
Appropriate locations for your routine are $300-$3CF and $8A0-$8FF. You must not
write to
$900.
You may use zero page locations $60-$6F, but should not alter other locations. A
lso, you must not
change any thing from $226 to $27F, or anything from $2C4 to $2FF. Upon return f
rom your
routine with an RTS, the USR line will be printed on the second pass.
When you use the USR opcode in a source file, it is wise to include some sort of
check in source
that the required routine is in memory.
If, for example, your routine contains an RTS at location $3 10 then:
ERR ($310) -$60
will test that byte and abort assembly if the RTS is not there. Similarly, if yo
u know that the
required routine should assemble exactly two bytes of data, then you can roughly
check for it with
the following code:
LABEL USR OPERAND
ERR *-LABEL-2
This will force an error on the second pass if USR does not produce exactly two
object bytes.
It is possible to use USR for several different routines in the same source. For
example, your
routine could check the first operand expression for an index to the desired rou
tine and act
accordingly. Thus "USR 1, whatever" would branch to the first routine, "USR 2,st
uff" to the
second, etc.
In Merlin 16, the USR opcode has been extended to allow up to 10 USR opcodes, US
RO through
USR9. The Merlin 8 USR is equivalent to USRO and is upward compatible. The numbe
r 0-9 is
doubled and placed in the X Register and then a JSR $B6DA is done, the standard
USR vector. At
$B6DA you can place a JMP ( VECTORTB L,X) instruction, where VECTORTBL is a list
of
addresses of your routines placed at any free spot such as page 3. To use routin
es that would not fit
on page 3, you could set the source address at $A,B higher though you may have t
o copy this to
$E00A,$E00B, or you could set HIMEM lower. To do the latter, set both $C,D and $
73,74 to the
lower address.
USR routines are entered in native 8 bit mode and can be exited in any mode. The
documented
routines that can be called must be entered in native 8 bit mode.
An example source file with 3 USR routines is provided in the Merlin 16 file
S OURCE/US R. EX AMPLE .S .
Page 125
The Assembler
XC
XC (twice in a row)
NOTE: On Merlin 8, if XC is used at the beginning of the listing, the 65C02 opco
des are enabled.
If XC is used twice, that is, if it is used on the first two lines of the listin
g, the 65802/65816 codes
can also be assembled.
On Merlin 8, some of the 65802 long addressing codes are not enabled since they
have no
application on the 65802. In Merlin 16, all 65816 opcodes are enabled. With Merl
in 16, you will
not have to use the XC pseudo-ops unless you have altered the PARMS file to requ
ire their use.
The XC pseudo-op will not enable the extended BIT opcodes used on the Rockwell 6
5C02 chip.
There is, however, a macro library file included on the Merlin disk that can be
US Ed to implement
these additional codes.
To use Sourceror to disassemble 65C02 code with the older (unenhanced) He ROMs,
you must first
BRUN MON.65C02. See the section on Sourceror for details. This utility is not ne
eded with the
newer He (enhanced) or lie (Unidisk 3.5 compatible) ROMs.
Whether you are using the ProDOS or DOS 3.3 version of Merlin 8, you must use th
e XC opcode
as the very first line in your code. This serves as a flag to tell Merlin 8 that
you are using the
65C02 or 65802 opcodes.
You may wonder why the XC opcode is needed. After all, if simply using it on a l
ine within a
source listing enables the extended opcodes within Merlin 8/16, surely the abili
ty to assemble the
opcodes are there all along. Why burden the user with an extra requirement? The
reason is in the
interest of efficient de-bugging and ultimately, your sanity. Merlin 8 does its
best to alert you to
possible errors in a source listing, but what happens if you use 65C02 opcodes o
n the older 6502
microprocessor? The 6502 will perform quite unpredictably, and yet Merlin 8 can'
t tell what system
your program ultimately is destined for, so an error is not necessarily in order
.
The solution is to make the programmer deliberately set a flag signifying that h
e knows he's using
the extended codes. That way you're less likely to get in the habit of using cod
es like INC
(Increment accumulator directly, available on the 65C02), and then accidentally
use the same opcode
on a 6502.
Page 126
Macros
MACROS
WHY MACROS?
Macros represent a shorthand method of programming that allows multiple lines of
code to be generated
from a single statement, or macro call. They can be used as a simple means to el
iminate repetitive
entry of frequently used program segments, or they can be used to generate compl
ex portions of code
that the programmer may not even understand.
Examples of the first type of macro call are presented throughout this manual an
d in the files called
MACROS.S and MACROS.816.S on the Merlin 16 disk, MACROS.S on the Merlin 8 ProDOS
disk,
and T.MACRO LIBRARY on the Merlin 8 DOS 3.3 disk. Examples of the second, more c
omplex
type, can be found in the FPMACROS.S on the Merlin 8 ProDOS disk and in the T.FP
MACROS
and T.RWTS MACROS libraries found on the DOS 33 disk.
Macros can also be used to simulate opcodes from other microprocessors such as t
he Rockwell 65C02
extended bit-related opcodes, as shown in the ROCKWELL.S file on the Merlin 8 Pr
oDOS disk and the
T.ROCKWELL MACROS file on the DOS 3.3 disk.
Macros literally allow you to write your own language and then turn that languag
e into machine code
with just a few lines of source code. Some people even take great pride in how m
any bytes of source
code they can generate with a single macro call.
MACRO PSEUDO OPS
MAC (begin MACro definition)
Label MAC
This signals the start of a macro definition. It must be labeled with the macro
name. The name is
then reserved and cannot be referenced by anything other than that macro pseudo-
op. For example,
DA NAME will not be accepted if NAME is the label assigned to MAC.
EOM (End of Macro
< (Alternate form)
EOM
< (alternate syntax)
This signals the end of the definition of a macro. It may be labeled and used fo
r branches to the end
of a macro.
Page 127
Macros
Page 128
Macros
INK
MAC
INC
]1
BNE
DONE
A
5
DONE
INC
]1+1
; increment location + 1
; NO OPCODE NEEDED
<
Macros
Let's suppose you want to use several variables within a macro definition. No pr
oblem! Merlin 8/16
lets you use 8 variables within a macro, ]1 through ]8. Here's another example:
MOVE MAC ; define a macro named MOVE
LDA ] 1 ; load accum with variable ] 1
STA ]2 ; store accum in location ]2
< ,- this signals the end of the macro
This is a macro that moves a byte or value from one location to another. In this
example, the variables
are ]1 and ]2. When you call the MOVE macro you provide a parameter list that "f
ills in" variables ]1
and ]2. What actually happens is that the assembler substitutes the parameters y
ou provide at assembly
time for the variables. The order of substitution is determined by the parameter
's place in the parameter
list and the location of the corresponding variable in the macro definition. Her
e's how MOVE would be
called and then filled in:
MOVE $00; $01
MOVE: macro being called
$00: takes place of ]1 (1st variable)
$01 : takes place of ]2 (2nd variable)
Then, the macro will be expanded into assembly code:
MOVE $00; $01
LDA $00 {$00 in place of ]1}
STA $01 {$01 in place of ]2)
It is very important to realize that anything used in the parameter list will be
substituted for the
variables. For example,
MOVE # K A H ; DATA
would result in the following:
MOVE # "A" ; DATA
LDA #"A H
STA DATA
You can get even fancier if you like:
MOVE #"A"; (STRING) ,Y
LDA #"A"
STA (STRING), Y
As illustrated, the substitution of the user supplied parameters for the variabl
es is quite literal. It is also
possible to get into trouble this way, but Merlin 8/16 will inform you with an e
rror message if you get
too carried away.
Page 130
Macros
In order to use the macros provided with Merlin, or to write your own, study the
macro in question and
try to visualize how the required parameters would be substituted.
The number of values must match the number of variables used in the macro defini
tion. A BAD
VARIABLE error will be generated if the number of values is less than the number
of variables used.
No error message will be generated, however, if there are more values than varia
bles.
Note that in giving the parameter list, the Macro is followed by a space, and th
en each parameter
separated with a semicolon. When used in the opcode column, the macro name canno
t be the same as
any regular opcode or pseudo opcode, such as LD A, STA, ORG, EXP, etc. Also, it
cannot begin with
the letters DEND or POPD.
The PMC and > forms of a macro call are not subject to the above restrictions.
In that case, the
macro name will be in the operand column, and a comma is usually used to separat
e the macro from the
parameter list. For example,
> MOVE,#10;#20
The assembler will accept some other characters in place of the comma between th
e macro name and the
expressions in a macro call. You may use any of these characters:
. / , - ( and the space character
The semicolons are required, however, between the expressions, and no extra spac
es are allowed.
NOTE: When the assembler sees a macro name in the opcode field like FIND, it fir
st looks to see if
there is a macro defined by that name. If, for example, the needed macro library
was not included with
the USE function, or wasn't defined at the beginning of the source listing, and
thus the macro was not
found, then the first three characters (FIN) are taken as the opcode. If this is
a legal opcode or pseudo
opcode, and in this example FIN is, then it is treated as such, and no error is
generated. This can be a
Macros
source of confusion, but fortunately there are few such potential conflicts in t
he macro definitions. This
can also be avoided by using, for example, an underscore as the first character
of a macro, as in
_FindControl.
Macros will accept literal data. Thus the assembler will accept the following ty
pe of macro call:
MUV MAC ; MACRO DEFINITION
LDA ]1
STA ]2
<
MUV (PNTR) ,Y;DEST
MUV #3; FLAG, X
with the resultant code from the above two macro calls being:
MUV (PNTR) , Y;DEST ; macro call
LDA (PNTR) , Y ; substitute first parm
and,
Page 132
Macros
ERROR
DO
MAC
LDA
#$88
JSR
COUT
JSR
COUT
;D0 IT AGAIN
JSR
COUT
;END OF MACRO *
FIN
You can also give the EOM or < opcode a label so you could branch to it:
****************** * SAMPLE PROGRAM * ******************
DO (
ERROR
MAC
LDA
#$88
LDY
#$04
ERR0R1
DEY
; BEGIN COUNTDOWN
BEQ
FINISH
JSR
COUT
JMP
ERR0R1
FINISH
*
<
;END OF MACRO
FIN
Page 133
Macros
Labels inside macros are updated each time the macro NAME, PMC or > NAME is en
countered.
Error messages generated by errors in macros usually abort assembly because of p
ossibly harmful
effects.
NOTE: Such messages will usually indicate the line number of the macro call rath
er than the line
inside the macro where the error occurred. Thus, if you get an error on a line i
n which a macro has been
used, you should check the macro definition itself for the offending statement.
NESTED MACROS
Macros may be nested to a depth of 15. Here is an example of a nested macro in w
hich the definition
itself is nested. This can only be done when both definitions end at the same pl
ace.
TRDB MAC
TR ] 1+1;] 2+1
TR MAC
LDA ]1
STA ]2
<
In this example TR LOC;DEST will assemble as:
LDA LOC
STA DEST
and TRDB LOC;DEST will assemble as:
LDA LOC+1
STA DEST+1
LDA LOC
STA DEST
A more common form of nesting is illustrated by these two macro definitions:
CH EQU $24
POKE MAC
LDA #]2
STA ]1
<
HTAB MAC
POKE CH;]1
<
The HTAB macro could then be used like this:
HTAB 20 ; htab to column 20 decimal
Page 134
Macros
LDA
STA
#20
CH
]2
11
in
in POKE macro
in POKE macro,
HTAB macro
1st parm
Merlin 16 supports an additional macro variable, ]0, which returns the number of
variables in the
parameter list of the macro call. This lets you create macros with a flexible in
put. For example, here's
a macro that uses the number of input variables to decide whether to store a val
ue just pulled off the
stack:
PullByte
could be used to pull a value off the stack and leave it in the accumulator, whe
reas
PullByte LABEL
would pull the value off the stack and then store it in location LABEL. You coul
d even get more fancy
by adding the IF MX tests to see whether one or two PL As and STAs were needed t
o get a two-byte
word off the stack in the 8 bit mode, as opposed to a single PLA/STA pair in the
16 bit mode.
Page 135
Macros
There are a number of macro libraries on the Merlin 8/16 disks. These libraries
are examples of how
one could set up a library of often used macros.
The requirements for a file to be considered a macro library are:
1) Only Macro definitions and label definitions exist in the file.
2) The file is a text file.
3) If it is a DOS 3.3 library, the file name must be prefixed with "T."
4) The file must be accessable at assembly time, i.e. it must be in an active di
sk drive.
The macro libraries included with Merlin 8/16 include:
DOS 3.3
T.MACRO LIBRARY
T.FPMACROS
T.OUTPUT
T.PRDEC
T.ROCKWELL MACROS
T.RWTS
<none>
ProDOS
Macro Libary functions
Page 136
The Linkers
Page 137
Page 138
The Linkers
There are two other pseudo opcodes that behave differently when used in a REL fi
le, relative to a normal
file. These are:
DS - define Storage opcode.
ERR - force an ERRor opcode.
Each of these five pseudo opcodes will be defined or redefined in this section a
s they relate to REL files.
Also, an Editor command unique to REL files will be defined: LINK.
In order to use the Linker, the files to be linked must be specifed. The Linker
uses a file containing the
names of the files to be linked for this purpose. The format of this linker name
file differs from DOS
3.3 and ProDOS. These differences will be illustrated here.
Page 139
Page 140
The Linkers
For example:
LDA #>EXTERNAL+8
DFB >EXTERNAL-1
[ illegal expression ]
[ legal expression ]
Object files generated with the REL opcode are given the file type LNK under Pro
DOS. This is the
type that will show if the disk is cataloged by Merlin 8/16. This type is file t
ype $F8. These
restrictions do not apply to the Merlin 16 Linkers.
EXT (define a label EXTernal to the current REL module)
label EXT
EXT labell,label2,etc.
PRINT EXT [ define label PRINT as EXT ]
EXT LABEL 1, LABEL2 [ define LAB ELI and LABEL2 and entries - Merlin 16 only ]
This defines the label in the label column as an external label. This means that
references to this
label within the source will assume the value for LABEL is an as-yet undefined a
ddress, presumably
found in another module that will be ultimately linked with this source file. An
y external label
must be defined as an ENTry label in its own REL module, otherwise it will not b
e reconciled by
the Linker since the label would not have been found in any of the other linked
modules. The
EXTernal and ENTry label concepts are what allows REL modules to communicate and
use each
other as subroutines, etc.
The value of the label is set to $8000 and will be resolved by the Linker. In th
e symbol table
listing, the value of an external will be $8000 plus the external reference numb
er ($0-$FE) and the
symbol will be flagged with an X.
In Merlin 16, the EXT and ENT opcodes accept the following syntax:
ENT LABEL 1, LABEL2, LABEL3
This makes it possible to declare absolute symbols as entries. Thus, if LABEL 1
was an equate
instead of a location in the code, then it can still be used as an external by o
ther modules.
Thus, it does not have to be equated in ail the files using it. For example, if
all three modules in a
linked system used the labels HOME, COUT and BELL, the first module could define
these labels
with the usual HOME EQU $FC58, etc. equates, and then use ENT HOME, COUT, BELL t
o make
these equates available to the other modules being linked. This would avoid havi
ng to define the
labels in each of the other modules.
With this particular syntax, you must not use a label in the label column. That
will cause the
assembler to assume you are using the more usual syntax.
Page 141
The Linkers
NOTE: Using this function instead of putting all the common equates in all the s
ource files, most
easily accomplished by a common USE file, does take more space in the Linker sym
bol library, and
hastens the time of a memory overflow.
ENT (define a label as an ENTry label in a REL code module)
label ENT
ENT labell, labeI2, etc.
PRINT ENT [ define label PRINT as ENTry ]
ENT LABEL1, LABEL2 [ defme LABEL 1 and LABEL2 and entries - Merlin 16 only ]
This defines the label in the label column as an ENTry label. This means that th
e label can be
referred to by an EXTemal label in another source file somewhere. This facility
allows other REL
modules to use the label as if it were part of their source file. If a label is
meant to be made
available to other REL modules it must be defined with the ENT opcode, otherwise
other modules
wouldn't know it existed and the Linker would not be able to reconcile it.
The following example of a REL module segment illustrates the use of this opcode
:
21
STA
POINTER
22
INC
POINTER
23
BNE
SWAP
24
JMP
CONTINUE
25 SWAP
ENT
26
LDA
POINTER
27
STA
PTR
28
LDA
POINTER+1
29
STA
PTR+1
30 * etc.
Note that the label SWAP is associated with the code in line 26 and that the lab
el may be used just
like any other label in a program. It can be branched to, jumped to, used as a s
ubroutine, etc.
ENT labels will be flagged in the symbol table listing with an E.
Page 142
DS (Define Storage)
DS \
DS Expression
DS \ [ skip to next REL file, fill mem with zeros to next
page break ]
DS \1 [ skip to next REL file, fill mem with the value 1 to
next page ]
When this opcode is found in an REL file, it causes the Linker to load the next
file in the linker
name file at the first available page boundary, and to fill memory either with z
eros or with the value
specified by the expression- If used, this opcode should only be placed at the e
nd of your source file.
Notice that DS expression , for example DS 5, still has the usual function even
in REL files.
Page 143
The Linkers
Page 144
The Linkers
The Linker will not save the object file it creates. Instead, it sets up the obj
ect file pointers for the
Main Menu Save Object Code command and returns directly to the Main Menu upon th
e completion of
the linking process.
LINKER NAME FILES (ProDOS)
The linker name file is just a specially formatted file containing the pathnames
of the LNK files to be
linked. This file is most easily created by assembling a source file with the pr
oper format, as follows:
Each pathname in the source file should be given the form STR "pathname", 00
NOTE: The 00 must be include at the end. The entire source file must end with a
BRK, i.e. another
00. This tells the Linker that there are no more pathnames in the file. Thus, if
you want to link the
LNK files names /MYDISK/START, /MYDISK/MID, AND /OTHERDISK/END, you would make a
source file containing these lines:
STR "/MYDISK/START.OO
STR "/MYDISK/MID M ,00
STR 7OTHERDISK/END",00
BRK
It is best to use full pathnames as shown, but this is not required. You should
then assemble this file
and save the object code as, for example, /MY DISK/MYPROG/NAMES. You can use any
pathname
you want here; it is not necessary to have NAMES in a subdirectory nor to call i
t NAMES. Then you
can link these files to address $803 by typing NEW and then:
LINK $803 "/MYDISK/MYPROG/NAMES "
The file type used by the Save Object Code command is always the file type used
in the last assembly.
Thus it is BIN unless the last assembly had a TYP opcode and then it will be tha
t type. This will be
used by the Save Object Code command after you link a group of files. That is, t
he Linker does not
change this type. If you make a mistake and the file gets saved under a type you
did not want, just
assemble an empty file, which would reset the object type to BIN ($06). You will
, however, have to
link the files again.
Page 145
The Linkers
Page 146
The Linkers
REL
DSK
FILE1.L
ROMP
y r \j3
>? UEjU
BEGIN2
EXT
; EXTERNAL LABEL
BEGIN
JSR
HOME
; CLEAR SCREEN
LDX
#$00
; INITIALIZE COUNTER
LOOP
LDA
STRING, X
; GET CHARACTER
BEQ
DONE
; END OF STRING
JSR
COUT
I NX
BNE
LOOP
; ALWAYS
DONE
JMP
BEGIN2
STRING
ASC
"THIS IS
FILE #1"
HEX
8D,00
; END OF STRING
LST
OFF
And this is the second part:
********************************
* RELOCATING
LINKER SAMPLE *
PART
TWO
********************************
REL
DSK
FILE2.L
HOME
EQU
$FC58
COUT
EQU
$FDED
BEGIN2
ENT
; ENTRY LABEL
LDX
#$00
; INITIALIZE COUNTER
LOOP
LDA
STRING, X
; GET CHARACTER
BEQ
DONE
; END OF STRING
JSR
COUT
Page 147
The Linkers
I NX
BNE
LOOP
ALWAYS
DONE
RTS
END OF
PROGRAM
STRING
ASC
HEX
LST
STRING
Having entered and assembled each of the source files, FILE1.L and HLE2.L will b
e created on the disk.
These are the intermediate REL files that will be linked to create the final app
lication program. Now
you need to create the file containing the list of files to be linked. Li this e
xample, the file will be
called NAMES and it will link the FILE1.L and FILE2.L files.
For the DOS 3.3 version of Merlin 8, you would just use the editor to type in th
e lines:
There are no leading spaces; the names FILE1.L and FTLE2.L go in the label colum
n of the Editor.
This file is then saved as a text file using the Write Text File command from th
e Main Menu.
Remember to add a space at the beginning of the filename to save under if you wi
sh to avoid the T.
prefix in the name.
To link the file, type NEW to clear the source workspace, then type LINK $8000 "
NAMES" and press
Return, The file NAMES will be read to determine which files to link. If there a
re no errors, you will
be returned to the Main Menu when the link is complete. At that point, use the S
ave Object Code
command to save the object file to disk under the name FINAL.OB J.
To test the program, use this Applesoft BASIC program:
10 TEXT: HOME
20 PRINT CHR$ (4) ;"BL0AD FINAL. OBJ"
30 CALL 32768: REM $8000
40 VTAB 12: HTAB 15: PRINT "IT REALLY WORKS!"
50 LIST: END
To create the names file for the ProDOS version of Merlin 8, you will need to cr
eate a separate source
file for the names list. This is because the ProDOS Linker requires that the nam
es list be in a special
format. Remember that each name in the ProDOS Merlin 8 names list must be define
d with the STR
pseudo-op, terminated with a zero, and that the list itself is terminated with a
zero also. To create the
names list, type in this text:
FILE1.L
FILE2.L
Page 148
The Linkers
********************************
********************************
DSK "NAMES"
STR, "FILE1.L\00
STR "FILE2.L",00
BRK
Assemble this file, which will create the actual NAMES file for the Linker, and
save the source file
under the file name NAMES. This will actually be saved on the disk as NAMES. S,
so you needn't
worry about any confusion when you use NAMES in the Linker.
To link the files under ProDOS, type NEW to clear the workspace, and then type L
INK $8000
"NAMES" and press Return. When the link is complete, use the Save Object Code co
mmand at the
Main Menu and save it under the name HNAL.OB J. You can use the same Applesoft p
rogram shown
for the DOS 3.3 example to test the program.
In looking at the example, notice how the ENT and EXT pseudo-ops are used to com
municate the label
BEGIN2 between the two programs. Also notice how there is no conflict over the u
se of the labels
LOOP, DONE and STRING.
Compare this example to the sample program shown for the PUT directive. Notice h
ow the same resul
of combining separate source files is achieved, but without the disadvantages of
PUT files discussed at
the beginning of this chapter.
Page 149
The Linkers
Page 150
The Linkers
The linking process in Merlin 16 is controlled by a linker command file. The lin
ker command files are
a more advanced form of the Merlin 8 NAME files, and have much more flexibility.
They support
comments, are able to do batch assemblies before linking, and are able to create
multiple output files.
Let's look at each Merlin 16 Linker:
THE ABSOLUTE LINKER (LINKER)
To start the link, you must first delete any source file in memory to provide th
e memory for reading the
Link command file. Remember to save the file first if necessary. To start the li
nk, type Open-Apple-0
to open the Command Box, and then type LINK "FILENAME" and press Return, where F
ILENAME is
the name of the linker command file. The LINK command from the Merlin 16 editor
has slightly
different syntax from the Merlin 8 Linker in that you do not specify an address.
Instead, the address is
provided within the command file with an ORG directive.
NOTE: The command file is just a text file looking very much like a standard sou
rce file, but you do
not assemble it.
The command file can have comments in the usual comment format for source files.
Commands to the
Linker are put in the opcode field. Commands supported are:
ASM, PUT, OVR, LNK (or LINK), ORG, ADR, SAV, TYP, EXT, ENT, DAT, LKV, END, and
LIB.
These have the following syntax and meanings:
ASM pathname
ASM FILENAMES
Assemble the source file specified in pathname. The source should do a DSK or SA
V to create the
LNK file to ultimately be used by the Linker. All ASMs must be done before any o
ther linker
commands. The ASM command is a conditional operation, and only assembles those s
ource files that
have been changed since the last time the files were linked. This is a convenien
ce feature that lets you
create a command file to build a final application. Re-assemblies will only be d
one on just those parts
of the application that have changed since your last linking.
To determine whether to do an assembly, the ASM command checks bit of the "auxty
pe" of the
source file. It does not do the assembly if this set. Otherwise it sets that bit
and does the assembly.
You can defeat this by zeroing the appropriate bit in the PARMS file. See the Te
chnical Information
section for details. This bit is cleared whenever you save a source file, so thi
s will force assembly of
that file. Also see the PUT command below.
Page 151
LNK pathname
LNK FILENAME.L
Link the LNK file specified. Generally you will have several of these in a row.
ADR address
ADR $2000
Sets the load address of the next linked file. Must be used only after an ORG se
tting the run time
address. The ORG automatically sets this address, so you don't have to have an A
DR command if it is
the same as the ORG. The load address is the address put in the auxtype of the f
ile. For non-BIN files
it could have some other meaning.
Page 152
The Linkers
SAV pathname
SAV FINAL.SYSTEM
Saves the linked file. This must be in the command file or there will be no resu
lting linked file. It
should come after all the LNKs for a given output file. The Absolute Linker supp
orts up to 64 separate
output files. r
SAV must only be used after one or more LNKs. It is not to be used to save the o
bject code after an
ASM. The assembly source should do this with the SAV or DSK command, or DSK if l
inking is to
be done and the Linker is not just being used to do batch assemblies. All ASMs m
ust precede any
LNKs and SAVs. * 3
TYP byte
TYP $06
Sets the file type for the next linked file. If all the SAVs are to use the same
type output file, this need
only be used once in the command file.
EXT
EXT
Tells the Linker to print addresses of all resolved externals and not only the o
nes with errors This is
turned off after each SAV
ENT
ENT
Tells the Linker to print the entry list. This should come after all the linking
of all output files.
DAT
DAT
Causes the Linker to print the current date and time.
END
END
Marks end of linker command file. Optional.
Page 153
The Linkers
This would take the LNK file FILE.L and adjust all internal address references,
i.e. JMPs, JSRs, etc. for
a load address of $2000. The final object file would be saved on the disk under
the name FILE.
LKV byte
LKV $02
ORG $2000
LNK FILE.L
SAV FILE
Page 154
The Linkers
The default filetype for S AV is BIN, i.e. type $06. Thus, if you were writing a
SYStem file, you
would have to add a TYP command to tell the Linker to save the final object file
with the appropriate
file type:
ORG $2000 ; DEFINE LOAD ADDRESS
LNK FILE.L ; SPECIFY LNK FILE
TYP $FF ; SYSTEM FILETYPE
SAV FILE ; SAVE THE OBJECT FILE
If TYP is used, all succeeding SAVs, within a given Link operation, use the curr
ent TYP value.
ASM is added to a command file to automatically re-assemble a file that might ha
ve been changed
without a re-assembly of a new copy of the corresponding LNK file:
Although linked files may be of any filetype and are not restricted to use by BA
SIC, here's an exampL
that combines the output from two assemblies to create an object file that is lo
aded and called from
BASIC. Compare this to a similar PUT file example. This is the first part of the
program:
********************************
* RELOCATING LINKER SAMPLE *
* PART ONE *
********************************
REL
DSK
FILE1.L
HOME
EQU
$FC58
C0UT
EQtJ
$FDED
BEGIN2
EXT
? EXTERNAL LABEL
BEGIN
JSR
HOME
; CLEAR SCREEN
LDX
#$00
; INITIALIZE COUNTER
LOOP
LDA
STRING, X
; GET CHARACTER
BEQ
DONE
; END OF STRING
JSR
COUT
I NX
BNE
LOOP
; ALWAYS
Page 155
Merlin 8/16 User's Manual
The Linkers
REL
DSK
FILE2.L
HOME
EQU
$FC58
COUT
EQU
$FDED
BEGIN2
ENT
; ENTRY LABEL
LDX
#$00
; INITIALIZE COUNTER
LOOP
LDA
STRING, X
; GET CHARACTER
BEQ
DONE
; END OF STRING
JSR
COUT
INX
BNE
LOOP
; ALWAYS
DONE
RTS
; END OF PROGRAM
STRING
ASC
"THIS IS
FILE #2 K
HEX
8D,00
; END OF STRING
LST
OFF
Having entered and saved these source listings, you would then enter and save th
is Linker command file:
********************************
* MERLIN 16 LINKER NAMES FILE *
********************************
LKV
$00
ASM
ASM
PARTI. S
PART 2 . S
; ASSEMBLE IF NEEDED
; ASSEMBLE IF NEEDED
ORG
$8000
LNK
LNK
FILEl.L
FILE2.L
; LINK FILE
; LINK FILE
TYP
SAV
$06
FINAL. OB J
; BINARY
Page 156
The Linkers
These are assembled and linked together by typing LINK "FILENAME" where FILENAME
is
whatever name the command file has been saved under on the disk. Before linking
the command file,
remember to clear the workspace with NEW from the Command Box.
The generated object file, FINAL. OBJ could be tested with this Applesoft progra
m:
10 TEXT: HOME
20 PRINT CHR$(4);"BLQAD FINAL. OBJ"
30 CALL 32768: REM $8000
40 VTAB 12: HTAB 15: PRINT "IT REALLY WORKS!"
50 LIST: END
Things to notice in the linker command file are the way that all the assemblies
are done first, before any
use of ORG or LNK instructions. In general, all ASMs should be done at once, fol
lowed by ORG and
all LNKs.
The ORG $8000 specifies the load address of the final object file. This is used
when linking the two
LNK files called FILE1.L and FILE2.L into the final output file called FINAL.OBJ
.
Both ASM and the check for the proper version of Linker with LKV are optional, a
nd are not
specifically required for this example. The main reason for including LKV in a c
ommand file is to
make sure that the proper Linker is used for linking a particular command file.
If you are developing
both ProDOS 8 and ProDOS 16 applications at the same time, it would be easy to a
ccidentally have the
wrong Linker in the machine when you were trying to link a file for the other op
erating system.
In looking at the example, notice how the ENT and EXT pseudonops are used to com
municate the label
BEGIN2 between the two programs. Also notice there is no conflict over the use o
f the lables LOOP
DONE and STRING.
Compare this example to the sample program show for the PUT directive. The same
result of
combining separate source files is achieved, but without the disadvantages of PU
T files discussed at the
beginning of this Chapter.
Page 157
The Linkers
For example:
*************** A A*** ********AAAA
* MERLIN 16 LINKER NAMES FILE *
* MULTIPLE OUTPUT SAMPLE *
********************************
LKV
$00
ASM
ASM
PROGIA.S
PROGIB.S
; ASSEMBLE IF NEEDED
; ASSEMBLE IF NEEDED
ORG
$2000
LNK
LNK
FILE1A.L
FILE1B.L
; LINK FILE
; LINK FILE
IIP
SAV
PROGRAM1
ASM
ASM
PROG2A.S
PROG2B.S
; ASSEMBLE IF NEEDED
; ASSEMBLE IF NEEDED
ORG
$8000
LNK
LNK
FILE2A.L
FILE2B.L
; LINK FILE
; LINK FILE
TYP
SAV
$06
OVERLAY
; FILETYPE = BINARY
; SAVE 2ND OUTPUT FILE
Page 158
The Linkers
In addition to the linker commands of the standard Linker, the GS Linker has the
following commands:
VER (version)
VER $01
This is used to specify the version of the OMF, i.e. the System Loader, that is
to be used with the
output object file. Versions 1 and 2 are supported. Thus, the operand must be $1
or $2. The VER
instruction should come before any other linking instructions except ASMs, which
are not dependent on
the version of the Loader in use. ProDOS 16 version 1.2 uses version 2 of the lo
ader format, and this
is the default version used by the GS Linker if VER is not specified. You will h
ave to decide what
OMF version to use. If you specify OMF version 1, your file can be loaded by any
version of ProDOS
16. If you specify OMF version 2, ProDOS 16 vers. 1.2 or later will be required.
KND address
KND $80
KND $8000
This specifies the value that you want put in the KIND location of the OMF heade
r. You would use 1
byte for VER $1 and 2 bytes for VER $2. This must come after the VER so that the
format is known
to the Linker. If in doubt, ignore this command and accept the default.
ALI address
ALI $10000
This specifies the ALIGN field in the file header. It defaults to 0. Use only $1
0000 to align to a bank
boundary or $100 to align to a page boundary. In most cases, you should leave th
is at the default 0.
NOTE: Our tests indicate that the bank align does not work on OMF version 1.
DS address
DS $2000
This tells the Linker to reserve this number of bytes to be zeroed by the loader
at the END of the
program. This number is put in the RESSPC field of the header. Using this instea
d of reserving space
with a DS in the source file will result in smaller object files.
QUICK LINK (LINKER.GS ONLY)
In LINKER.GS, but not in the other Linkers, the command LINK =, or simply LINK w
ithout a file
name, from the Command Box will assemble the file given by the default file name
, i.e. the name
appearing when you give the Load or Save commands from the Main Menu, then will
link the resulting
file. This assumes that a LNK file was produced by the DSK and REL opcodes. The
linked file will
then be saved using the name of the LNK file with the last two characters cut of
f.
Page 159
The Linkers
It is suggested that you add a .L suffix to the DSK filename, i.e. MYFILE.L, so
the saved file will be
MYFILE. For example, a source file with the lines:
REL
DSK MYFILE.L
could be saved to disk, and then assembled and linked with the Editor LINK comma
nd, and the final
object file will be saved on the disk under the name MYFILE.
NOTE: This command does not require a linker command file, and that it uses the
defaults in the Link
which produces an S16 filerype in object module format version 2, and of "kind"
$1000, i.e. code
segment that cannot be loaded to special memory. This syntax should not be used
if you wish load
preferences different than the defaults, or if you require the advanced features
of a command file. The
command LINK1 can be used to produce a file in object module format 1 of "kind"
and type S 16.
If there is a source file in memory when this command is issued, you will be ask
ed if it is OK to save
the source file to disk using the current name. If you agree, that file will aut
omatically be saved under
the default file name Caution: this can be dangerous. If the workspace is empty
when the LINK
command is used, then the file given by the default file name will be loaded, as
sembled, linked and the
object file saved.
MULTIPLE LNK INPUT FILES
If you have multiple LNK files being linked to create the final object file, you
should use a command
file. However, Linker.GS does provide a short-cut way of linking up to 10 LNK fi
les without requiring
a command file. If the LNK file produced by the assembly has a name ending in ".
x" where x is a digit
from to 9, i.e. MYFILE. 3, then the Linker will not immediately link that file i
nto the output file.
Instead, it will look for the file with the same name but ending in .0, i.e. MYF
ILE. 0, and will link that
file with subsequently numbered LNK object files, i.e. MYFILE. 1, MYFILE.2, MYFI
LE.3, etc., until
it finds no more.
Up to 10 files can be linked without using a linker command file with this metho
d. Note that only the
default name source file is re-assembled. The source files for the other LNK fil
es in the sequence are not
assembled; only the LNK files are used as is, in the final object file. If a fil
e is missing from the
sequence, i.e. MYFILE.2 not present on the disk, the linking is terminated at th
at point, although no
error is generated. Thus some care must be taken to make sure that all the neede
d files are on the disk.
Page 160
The Linkers
******
* S
******************* *******
IMPLE PI 6 SYSTEM FILE *
* MERLIN 16 ASSEMBLER *
********************************
1
2
3
4
5
6
7
8
9
10 PRODOS
11 KYBD
12 STROBE
13 SCREEN
14
15 ENTRY
16
17
18 PRINT
19 LOOP
20
21
22
23
24
25
2 6 GETKEY
27
28
29
30
31
32 QUIT
33
34
35
36
37
38 PARMBL
39 FLAG
40
41 ERROR
42
43 MSSG
MX %00
REL
DSK P16. SYSTEM. L
EQU
EQU
EQU
EQU
PHK
PLB
LDX
LDA
BEQ
STAL
INX
INX
BNE
CMP
BCC
JSL
DA
BRK
ASC
$E100A8
$O0COO0
$OOC010
$000400
#$00
MSSG,X
GETKEY
SCREEN ,X
LOOP
LDAL KYBD
AND #$00FF
#$0080
GETKEY
STAL STROBE
PRODOS
$29
ADRL PARMBL
BCS ERROR
BRK $00
ADRL $0000
DA $00
$00
; LINE 1 ON SCREEN
; GET PROGRAM BANK
; SET DATA BANK
; INIT X-REG
; GET CHAR TO PRINT
; END OF MSSG.
; "PRINT 14 IT
; NEXT TWO CHARS
; X = X + 2
; WRAP-AROUND PROTECT
; CHECK KEYBOARD
; CLEAR HI BYTE
; KEYPRESS?
; NOPE
; CLEAR KEYPRESS
; DO QUIT CALL
; QUIT CODE
; ADDRESS OF PARM TABLE
; NEVER TAKEN
; SHOULD NEVER GET HERE,
; PTR TO PATHNAME
; ABSOLUTE QUIT
; WE'LL NEVER GET HERE?
Page 161
The Linkers
Page 162
The Linkers
Page 163
TECHNICAL INFORMATION
Technical Information
The source is placed at START OF SOURCE when loaded, regardless of its original
address.
The important pointers are:
START OF SOURCE in $A,$B (set to $901 unless changed)
HIMEM in $C,$D (defaults to $9853 in DOS 3.3,
defaults to $AA00 in ProDOS)
END OF SOURCE in $E,$F
Note that HIMEM does not change unless a USER routine or utility program changes
locations $73,
$74. Such a change will be copied automatically into locations $C, $D.
GENERAL INFORMATION (DOS 3.3 ONLY)
When you exit to BASIC or to the Monitor, these pointers are saved on the RAM ca
rd at $E00A-
$E00F. They are restored upon re-entry to Merlin 8/16.
Entry into Merlin 8/16 replaces the current I/O hooks with the standard ones and
reconnects DOS. This
is the same as typing PR#0 and IN#0 from the keyboard. Entry to the Editor disco
nnects DOS, so that
you can use labels such as INIT without disastrous consequences. Re-entry to the
Main Menu
disconnects any I/O hooks that you may have established via the editor's PR# com
mand, and reconnects
DOS. Exit from assembly due to completion of assembly or Control-C also disconne
cts I/O hooks.
Re-entry after exit to BASIC is made by the ASSEM command. Simply use ASS EM whe
rever a DOS
command is valid, for example, at the BASIC prompt. A BRUN MERLIN or a disk boot
will also
provide a warm re-entry and will not reload Merlin 8 if it is already there. A r
eload may be forced by
typing BRUN BOOT ASM which would then be a cold entry, erasing any file in memor
y.
The DOS 3.3 version does not perform the same volume checking as the ProDOS vers
ion. However, it
is possible to simulate this with the following code:
LST
XXX KBD "INSERT MYFILE DISK AND TYPE <RETURN>"
PAUSE
The assembler will stop at KBD on the first pass and assign a value to XXX where
XXX is any
dummy label you desire. PAUSE will force a pause on the second pass and LST make
s sure you will
see the KBD line. On the second pass, assembly resumes when you press any key. I
t is not necessary
to type and press Return.
Page 164
Technical Information
SYMBOL TABLE
The symbol table is printed after assembly unless LST OFF has been used. It is d
isplayed first sorted
alphabetically and then sorted numerically. The symbol table can be canceled at
any time by pressing
Control-C. Stopping it in this manner will have no ill effect on the object code
which was generated.
The symbol table is flagged as follows:
MD = Macro Definition
M = Label defined within a Macro
V = Variable (symbols starting with "]")
? = A symbol that was defined but never referenced
X = External symbol
E = Entry symbol
Local labels are not shown in the symbol table listing. In Merlin 16, this can b
e enabled by changing
the PARMS file.
When in EDIT mode, Merlin 8/16 takes total control of input and output. The effe
ct of typing a control
character will be as described in this manual and not as described in the manual
for your 80 column card.
For example, Control-L will not blank the screen, but is the case toggle. Contro
l-A, which acts as a
case toggle on many 80 column cards, will not do this in the Editor and simply p
roduces a Control-A in
the line being edited.
ULTRATERM INFORMATION
The Ultraterm is an 80 column display card manufactured by Videx. If you do not
have this card, skip
to the next page. When in the Editor, the Ultraterm mode can be altered by the E
SCAPE sequence
given in the Ultraterm manual. Thus, the following commands give the indicated e
ffects:
Page 165
ESC 6 80 x 48
ESC 7 132 x 24
ESC 8 128 x 32
Exit to the Main Menu will return to the default state as set up in the HELLO pr
ogram for DOS 3.3 or
the PARMS file for ProDOS. The same is true of a VID 3 command.
Except for the normal 24 x 80 format, support for the Ultraterm depends on the c
ard being in slot 3.
There may be problems if you try to send things to the printer while in some of
the Ultraterm modes.
It is recommended that you switch to 40 columns before doing this. Using a PRTRl
"<Control-I>80N"
command sometimes overcomes the problem
MEMORY ALLOCATION WITH MERLIN 8/16
The memory areas $300-$3EF in main memory and $800-$FFF in auxiliary memory are
available for
user supplied USER and USR routines. The page 3 area in main memory is intended
for I/O interface
routines. One cannot send a character to COUT, for example, from auxiliary memor
y. Merlin does not
use these areas. Zero page locations $90-$9F are not used by Merlin and are rese
rved for USER routines
(note that the XREF program uses these locations). Zero page locations $60-$6F a
re reserved for user
supplied routines and may be used as you wish. No other zero page locations are
available.
CONFIGURING MERLIN 8 (ProDOS)
Configuration data is kept in a file called PARMS which is loaded when the assem
bler is run. To
change the data just change the \+Italic\source\-Italic\ file PARMS.S and reasse
mble it.
To load the file, set the prefix to /MERLIN 8 and type L to load a source file.
Then type
SOURCE/PARMS at the prompt. When you are done making changes, reassemble the fil
e. Use S to
SAVE the source code as /MERLIN/S OURCE/PARMS . Remember that Merlin 8 adds the
.S suffix
automatically. Then save the object code as /MERLIN/PARMS by using the O command
.
CONFIGURING MERLIN 8 (DOS 3.3)
The data statements in the Applesoft boot program HELLO contain the configuation
information. To
change the data just LOAD HELLO, change the data in the DATA statements and SAVE
HELLO.
DATA DESCRIPTION FOR MERLIN 8 CONFIGURATIONS
DATA # DEFAULT PURPOSE
1 60 Number of lines per page (for PRTR) .
2 Lines to skip at page perforation (0 sends a form feed
character.
3 80 Number of characters per line (for PRTR).
Page 166
Technical Information
Page 167
Page 168
Technical Information
Page 169
Technical Information
7
8 Y
9 y
10 N
11 n
12
13 SAVOBJ
EQU
EQU
EQU
EQU
KBD
1
1
"Save object code? (Y,N) H
14
15
16
ORG
$8000
17 DATA
ORG
$E4F3
18
19
20
21
22
DFB
DFB
DFB
DFB
60
80
$80
Page 170
Technical Information
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
ORG
ORG
DFB
$E009
$83
end of # columns
SOURCE
above
$900 for
any purpose:
$901
DA
SOURCE
; Start of source
DA
$9E00
; Reserved
DA
SOURCE
;End of source
DFB
DFB
;# of symbol columns
DFB
Page 171
Technical Information
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
S2
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
DFB $05
DFB %01000000
ORG
ORG $B23E
DFB $9F&"[
Page 172
135
orc:
9D OD
136
137
ASC
"$F1 H
138
ASC
"$F2"
139
ASC
$F3"
140
ASC
"$F4"
141
ASC
"$F5"
142
ASC
"$F6
143
ASC
$F7"
144
145
ORG
146
147
ERR
*-DATA-
148
14 9 * ================================== = ====m
150 * Screen editor variable parameters:
151 * Cursors are: insert, find in insert mode,
152 * overstrike, find in overstrike mode.
153 *
154
155 ORG $DFBC
156
157 CURSORS INV 'IF F'
158
159 DFB $A0 ; Cursor blink rate
160
161 *===========================================
162 * Screen editor cmd chars:
163 * The cursor keys (although here) must NOT
164 * be changed or the editor will not work
165 * correctly.
1 66 *
167
168
DFB
$9F&"U"
; Don't change
169
DFB
$88
. ii
r
170
DFB
$9F&"I"
171
DFB
$9F "T"
172
DFB
$9F&"B"
173
DFB
$9F&"N"
174
DFB
$9F&"R"
/Cancel changes
175
DFB
$9F&"S"
; Status box
176
DFB
$9F H F"
;Find char
177
DFB
$9F&"W"
;Next word
178
DFB
$9F&"L"
179
DFB
$9F&"D"
180
DFB
$FF
181
DFB
$9F& H Y"
;Clear to end-of-line
Page 173
Technical Information
182
DFB
$9Ft"0"
183
184
* Odpti 3'D'dIp
Icpv rvnci ^ *
185
186
DFB
#"X"
;Cut
187
DFB
#"C M
188
DFB
#V"
Paste
189
DFB
1 lip II
Find
190
DFB
#"W H
! Fi nd wnrrl
191
DFB
#"E"
/Exchange text
192
DFB
#"T"
; Go to A T splprtpri noint
193
DFB
$9FS"I H
194
DFB
#"1"
. ii
195
DFB
$9Fi" ["
196
DFB
#"B"
;Go to beginning
197
DFB
#"N"
Go to end
198
DFB
$DF
199
DFB
#"L"
; Locate text
200
DFB
# " Z "
201
DFB
$9FS"J M
: Don ' t rh^ncip
f lj\J 1 1 \* \_* i 1 CJ. 1 IMC
202
DFB
^F^'K"
. ii
203
DFB
#"Y"
204
DFB
$9FS"U"
205
DFB
$9FS"H"
. 11
206
DFB
#"D"
Dpi pfp t- h i q 1 i np
207
DFB
#"8"
j Li np of ?) ^tpri
208
DFB
#"9 M
209
DFB
#"-"
/Line of dashes
210
DFB
#" = "
211
DFB
#"1"
;PRTR1 + assemble
212
DFB
# M 2"
213
DFB
#"3"
;PRTR3 + assemble
214
DFB
#"4"
215
DFB
# "A"
;ASM command
216
DFB
#"0"
Quit to rn^in TTipnn
217
DFB
#"H"
218
DFB
#"0"
219
DFB
#6"
220
DFB
1 " R "
/Replace line
221
222
ORG
223
224
ERR
*-DATA-99
225
226
Page 174
Technical Information
Screen Blanking
The PARMS file for Merlin 16 supports an optional setting for telling Merlin 16
to blank the screen if
nothing is typed for an extended period. Pressing any key, such as Return, will
restore the normal
screen display.
This is intended to protect your monitor screen in situations where the computer
is left unattended for
long periods of time, and Merlin 16 is the only program generally run on that co
mputer. Any video
image will tend to "bum" itself into a monitor screen if left on continuously fo
r several hours a day,
every day, for a period of many months. Note this is not a specific problem to M
erlin 8/16.
You should not concern yourself with this unless you are in a working environmen
t where the Merlin
16 menu is left on all day when the computer is unattended.
Because it can be disconcerting to have the screen suddenly go blank if you are
not aware of this feature,
Merlin 16 is shipped with this feature disabled. To enable screen blanking, set
the high bit of the flag
near line 120 of the Merlin 16 PARMS.S file. See the comments in the source list
ing for details.
Page 175
Technical Information
SCOOOn
$900 i
$800
$400
$3F0
$300
$200
$100
$oL
I/O locations
Macros
(USE files)
mfflffikifrmmmi L I L L L L L L LUL UUHU JM M
Unused space
www^w^w wmM mm
Source file
Misc. Vectors
Stack
Zero Page
$FFFF
$D000
$C000h
$1800
$800
$400
$300
$200
$100h
$o[
Bankl
Monitor
Merlin 16
I/O locations
Symbol table
or Clipboard
USER programs
(XREF, etc.)
or
(free space)
Free space
Merlin's Stack
Page 176
Technical Information
Merlin 8 - ProDOS
BankO
$FFFFa
ProDOS
$D000h
$C000
SA600
($9E00with|
Screen Editor)
S900
$800.
$400
$3F0
$300h
$200
$100
$0
I/O locations
Macros
(USE files)
Unused space
www
Source file
Misc. Vectors
$FFFF
$F800U
$D00O
$C000
$8000
$1000
$800h
$400.
Bankl
Monitor
Merlin 8
VO locations
Object code and
linking dictionary
Symbol table
or Clipboard
USER programs
(XREF, etc.)
or
(free space)
Free space
"1
Merlin's Stack
Page 177
Technical Information
Merlin 8 - DOS 3.3
BankO
Bank 1
J
1
Monitor
Integer BASIC
(if loaded)
VO locations
DOS 3 J
Macros
(USE files) ,
f ...
Unused space
Source file
Misc. Vectors
Input Buffer
Stack
1
1 Zero Page
$FFFF
SF800
$D000n
$C000i
$8000
$1000
$800
$400
$300
$200
$100
Monitor
Merlin 8
I/O locations
Object code and
linking dictionary
Symbol table
or Clipboard
USER programs
(XREF, etc)
or
(free space)
Free space
Used by XREF
Merlin's Stack
Page 178
f
Merlin 8/16 User's Manual
Error Messages
ERROR MESSAGES
BAD ADDRESS MODE
The addressing mode is not a valid 6502 instruction; for example, JSR (LABEL) or
LDX
(LABEL),Y.
BAD BRANCH
A branch (BEQ, BCC, etc.) to an address that is out of range, i.e. further away
than +127 bytes.
NOTE: Most errors will throw off the assembler's address calculations. Bad branc
h errors should
be ignored until previous errors have been resolved.
BAD EXTERNAL
EXT or ENT in a macro or an equate of a label to an expression containing an ext
ernal, or a branch
to an external (use JMP).
BAD INPUT
This results from either no input, i.e. Return alone or an input exceeding 37 ch
aracters in answer to
the KBD opcode's request for the value of a label.
BAD LABEL
This is caused by an unlabeled EQU, MAC, ENT or EXT, or a label that is greater
than 13
characters, or one containing illegal characters. A label must begin with a char
acter at least as large
in ASCII value as the colon and may not contain any characters less than the dig
it zero.
BAD OBJ
An OBJ after code start or OBJ not within $4000 to $BFE0.
BAD OPCODE
Occurs when the opcode is not valid, or misspelled, or the opcode is in the labe
l column.
BAD ORG
Results from an ORG at the start of a REL file.
Page 179
Error Messages
BAD PUT
This is caused by a PUT inside a macro or by a PUT inside another PUT file.
BAD REL
A REL opcode occurs after some labels have been defined.
BAD SAV
This is caused by a SAV inside a macro or a SAV after a multiple OBJ after the l
ast SAV.
BAD VARIABLE
This occurs when you do not pass the number of variables to a macro that the mac
ro expects. It can
also occur for a syntax error in a string passed to a macro variable, such as a
literal without the final
quote.
BREAK
This message is caused by the ERR opcode when the expression in the operand is f
ound to be non-
zero.
DICTIONARY FULL
Overflow of the relocation dictionary in a REL file.
DUPLICATE SYMBOL
On the first pass, the assembler finds two identical labels.
FILE TYPE MISMATCH
A file specified to be loaded, such as a source file, or REL file during a Link,
does not have the
expected file type.
FORMAT ERROR
A command has been incompletely typed, for example, typing PRTR instead of PRTR
1.
ILLEGAL CHAR IN OPERAND
A non-math character occurs in the operand where the assembler is expecting a ma
th operator. This
usually occurs in macro calls with improper syntax resulting from the textual su
bstitution.
Page 180
Error Messages
Page 181
MEMORY IN USE
This error results from trying to load a file into a part of memory already in u
se. This could be by
loading a tool-large PUT file, appending a file without sufficient remaining mem
ory, or loading a
USE library. It can also occur from loading a USER function when one is already
in memory. In
Merlin 8, the error occurs if you try to load a utility like SOURCEROR when the
Editor (ED) is
already loaded. Use REMOVE.ED before loading another utility.
MISALIGNMENT - MERLIN 16
This means that the value of a label on the second pass differs from what it was
on the first pass and
should indicate a forward reference that the assembler could not resolve. The mo
st common cause is
a forward reference to a zero page equate or dummy section. Misalignment may als
o be caused by a
previous error. A misalignment error is given only once in order to avoid the er
ror routine on all
subsequent labels, all of which are likely to be misaligned.
NESTING ERROR
Macros nested more than 15 deep or conditionals nested more than 8 deep will gen
erate this error.
NOT A MACRO
A Macro name has been used that has not been previously defined.
NOT RESOLVED
This is a Linker error that alerts you to the fact that an EXT label reference i
n one of the linked files
could not be not be found in any of the other linked files.
OBJECT SPACE OVERFLOW - MERLIN 16 ONLY
If the available object file space has been exceeded, the assembler prints this
message. This disables
the Object file save command at the Main Menu.
OUT OF MEMORY
This is a memory error from the Full Screen Editor. It is caused by trying to cu
t or copy more text
to the clipboard, or to paste more text into the document than there is free mem
ory to accomodate.
Page 182
Merlin 8/16 User's Manual
Error Messages
RANGE ERROR
When saving a source file larger than 32K, you may get this error, in particular
if are using a
standard DOS 3.3 and have not booted on the Merlin 8 DOS 3.3 diskette. This is d
ue to a
limitation of DOS itself. The problem can be temporarily fixed however by changi
ng byte $A964
in memory from $7F to $FF. (For those experienced with a disk sector editor, you
can change Track
1, Sector 8, Byte $64 from $7F to $FF to make this change permanent on whatever
DOS 3.3 disk
you wish).
SYNTAX ERROR
The proper syntax has not been used in a command, either because of typing error
s, or extra or
omitted characters or parameters.
TWO EXTERNALS
Two or more externals in an operand expression.
UNKNOWN LABEL
Your program refers to a label that has not been defined. This also occurs if yo
u try to reference a
MACRO definition by anything other than PMC or >. It can also occur if the ref
erenced label is
in an area with conditional assembly OFF. The latter will not happen with a MACR
O definition.
256 EXTERNALS
The file has more than 255 externals.
NOTE: When an error occurs that aborts assembly, the line containing the error i
s printed to the
screen. This may not have the same form as it has in the source, since it shows
any textual
substitutions that may have occurred because of macro expansion. If it is in a m
acro call, the line
number will be that of the call line and not of the line in the macro which is u
nknown to the assembler.
Page 183
Sourceror
SOURCEROR
Sourceror is a sophisticated and easy to use co-resident disassembler designed t
o create Merlin 8/16
source files out of binary programs, usually in a matter of minutes. There are t
wo versions of
Sourceror in Merlin 8/16. Sourceror on the Merlin 16 disk disassembles 6502, 65C
02, 65802 and
65816 object code. Sourceror on the Merlin 8 diskettes disassembles 6502, 65C02,
and 65802 object
code and is not designed for use on the Ilgs.
USING SOURCEROR ON MERLIN 16
To use Sourceror on the Merlin 16 diskette, follow these steps:
1. From the Main Menu, press D for Disk Command.
2. At the Disk Command prompt type: BRUN SOURCEROR/OBJ
3. Press F to enter the Editor.
4. Press Open-Apple-0 to open the Command Box.
5. Type DIS "MYFILE" where MYF1LE is the name of the object file to be disassemb
led.
The DIS command is available in Merlin 16 only and uses the following syntaxes:
DIS "MYFILE" [ disassemble MYFILE at the original running address ]
DIS $1000"MYFILE" [ disassemble MYFILE at the specified address of $1000 ]
SYS files are always assumed to have a running address of $2000. If a non-zero a
ddress is specified in
the DIS command, that address is taken as the initial running address. If the ad
dress is not specified,
the Merlin 16 Sourceror uses the information in the AUXTYPE field for the runnin
g address.
USING SOURCEROR ON MERLIN 8
NOTE: On the ProDOS version of Merlin 8, the Full Screen Editor uses the same pa
rt of memory as
Sourceror. Therefore you will have to temporarily deactivate the Full Screen Edi
tor. This is not
necessary with the DOS 33 version of Merlin 8.
To deactivate the Full Screen Editor on Merlin 8 ProDOS version:
1. From the Main Menu, press D for Disk Command.
Page 184
Page 185
Sourceror
Page 186
Sourceror
This backup feature allows you to repeat a disassembly if you have, for example,
used a HEX or other
command, and then change your mind.
H (Hex)
This creates the HEX data opcode. It defaults to one byte of data. If you insert
a one byte hex number
using one or two digits after the H, that number of data bytes will be generated
.
L (List)
This is the main disassembly command. It disassembles 20 lines of code. It may b
e used in multiples,
thus 2000LLL will disassemble 60 lines of code starting at $2000. In the Merlin
8 Sourceror, if a JSR
to the SWEET 16 interpreter is found, disassembly is automatically switched to t
he SWEET 16 mode.
The L command always continues the present mode of disassembly, SWEET 16 or norm
al.
NOTE: If an illegal opcode is encountered, the bell will sound and opcode will b
e printed as three
question marks in flashing format. This is only to call your attention to the si
tuation. In the source
code itself, unrecognized opcodes are converted to HEX data, but are not display
ed on the screen.
N (Normal - Merlin 8 only)
This is the same as L, but forces disassembly to start in normal 6502 mode.
O (Org - Merlin 16 only)
This command can be used to change the ORG on the fly during disassembly. It is
useful for programs
that move code to other locations after loading. The syntax for this command is
address O newaddress.
Do not use any spaces in this command syntax, and note that it uses the letter O
and not zero.
ADRS ONEW ADRS [ backup to ADRS and place and ORG to NEWADRS there ]
Therefore a command of 10450300 followed by a Return would tell Sourceror to bac
kup to address
1045 and place an ORG $300 there.
Q (Quit)
This ends disassembly and goes to the final processing which is automatic. If yo
u type an address
before the Q, the address pointer is backed to, but does not include, that point
before the processing.
For example, if at the end of the disassembly, the lines included:
Page 187
Sourceror
2341- 4C 03 E0
2344- A9 BE 94
JMP 5E003
LDA $94BE,Y
and the last line was garbage, you could type 2344Q and press Return. This would
cancel the last line,
but retain all the previous lines.
In Merlin 8, this allows you to look at memory in a format that makes imbedded t
ext stand out. For
example, to look at the data from $1000 to $10FF, you would type 1000R and press
Return. After
that, R and Return will bring up the next page of memory. The numbers you use fo
r this command are
totally independent of the disassembly address.
You may also disassemble, then use (address)R and Return, then L and Return, and
the disassembly will
proceed just as if you never used R at all. If you don't intend to use the defau
lt address when you return
to disassembly, it may be wise to note where you wanted to resume, or to use the
/ command before the
R command. Merlin 16 prints ASCII during disassembly.
S (SWEET 16 - Merlin 8 only)
This is similar to L, but forces the disassembly to start in SWEET 16 mode. SWEE
T 16 mode returns
to normal 6502 mode whenever the SWEET 16 RTN opcode is found.
T or TT (Text)
This attempts to disassemble the data at the current address as an ASCII string.
Depending on the form
of the data, this will automatically be disassembled under the pseudo-opcode ASC
, DCI, INV or FLS.
The appropriate delimiter ( " or ') is automatically chosen. The disassembly wil
l end when the data
encountered is inappropriate, or when 62 characters have been treated, or when t
he high bit of the data
changes. In the last condition, the ASC opcode is automatically changed to DCL
Sometimes the change to DCI is inappropriate. This change can be defeated by usi
ng TT instead of T
in the command.
Occasionally, the disassembled string may not stop at the appropriate place beca
use the following code
looks like ASCII data to Sourceror. In this event, you may limit the number of c
haracters put into the
string by inserting a one or two digit hex number after the T command.
T or TT may also have to be used to establish the correct boundary between a reg
ular ASCII string and a
flashing one. It is usually obvious where this should be done.
R (Read)
Page 188
Merlin 8/16 User's Manual
Sourceror
W, WW, or W- (Word)
This disassembles the next two bytes at the current location as a DA opcode. Opt
ionally, if the
command WW is used, these bytes are disassembled as a DDB opcode.
If W- is used as the command, the two bytes are disassembled in the form DA LAB
EL- 1. The latter is
often the appropriate form when the program uses the address by pushing it on th
e stack. You may
detect this while disassembling, or after the program has been disassembled. In
the latter case, it may
be to your advantage to do the disassembly again with some notes in hand.
/ (Cancel)
This essentially cancels the last command. More exactly, it re-establishes the l
ast default address (the
address used for a command not necessarily attached to an address). This is a us
eful convenience which
allows you to ignore the typing of an address when a backup is desired.
As an example, suppose you type T to disassemble some text. You may not know wha
t to expect
following the text, so you can just type L to look at it. Then if the text turns
out to be followed by
some HEX data such as $8D for a carriage return, simply type / to cancel the L a
nd type the appropriate
H command.
Page 189
Sourceror
FINAL PROCESSING
After the Q command, the program does some last minute processing of the assembl
ed code. If you
press Reset at this time, you will return to Merlin 8/16 and lose the disassembl
ed code.
The processing may take from a second or two for a short program and up to sever
al minutes for a long
one. Be patient.
When the processing is done, you are returned to Merlin 8/16 with the newly crea
ted source in the
Editor. You can use the Editor to edit or assemble the listing. After a successf
ul assembly, you can
save the new code with the Main Menu Save Source and Save Object Code commands.
NOTE: If you are using the ProDOS version of Merlin 8, you can enter the Editor
and type USER1 to
get rid of Sourceror and free up the memory used by the disassembler. This is no
t necessary in the
DOS 3.3 version.
Page 190
Sourceror
Page 191
Sourceror.FP
Page 192
Sourceror.FP
Page 193
Sourceror.FP
For each question, remember to just press the Y or N keys. You do not have to ty
pe "Yes" or "No."
hi the example above, the PRTR command will send output to slot 1 and will print
"APPLESOFT
LISTING" as a header at the top of every page.
Merlin 8 will then ask "GIVE VALUE FOR SAVEOBJ :" This refers to whether or not
you want
to save object code generated by the assembly. It is recommended that you answer
0. This is all
you need to do to begin the printing process. If you answer 1 instead, you will
save object code at
the cost of slowing down the system. Saved object code allows you to verify it a
gainst where it was
taken from.
Merlin 8 will now execute the first assembler pass. The disk will be accessed a
few times,
sometimes with long periods between accesses. This is normal. The entire first p
ass takes about 2
minutes.
Merlin 8 will then begin to print out a completely disassembled and commented li
sting of
Applesoft. It will take about 105 pages including the symbol tables and nearly a
n hour and a half to
print out at a printer rate of 80 characters per second.
Page 194
Sourceror.FP
IMPORTANT: You must produce the source files before they can be cross-referenced
. This is done by
following the instructions on pages 192-194. Do this now if you have not already
done so.
Steps to print an Applesoft cross reference:
1. Start the Merlin 8 ProDOS diskette.
2. Insert the Sourceror.FP diskette.
3. Press L to LOAD, then type: /APPLESOFT/APPLESOFT and press Return.
4. Type Q to quit the Editor, and return to the Main Menu.
5. Insert the Merlin 8 ProDOS diskette.
6. Press D for Disk command, then type: BRUN /MERLIN.8/UTILITIES/XREFA and press
Return.
7. Enter the Editor, the type: PRTR1" "APPLESOFT XREF and press Return.
8. Then type: USER 3 and press Return.
9. Type ASM and press Return.
You'll be prompted as follows:
Print DO OFF areas ? (Y/N)
You may answer Y or N. {See the previous section for an explanation of these
questions...}
Page 195
Sourceror.FP
Utility Programs
UTILITY PROGRAMS
Page 197
Utility Programs
Page 198
Utility Programs
To remove the extra spaces in an APW source file, use the Command Box (<30) c
ommand FTXS to
remove unneeded spaces in the file.
Finally, save the converted source file to disk under a new name. Merlin 16 will
automatically add the
".S" suffix. For example, entering FILE as the name to save under would appear a
s FILE.S in the disk
directory.
Using CONVERTER
Rather than manually editing an entire source file, it is usually easier to use
a utility provided on the
Merlin 16 disk called CONVERTER. This utility will automatically make many of th
e changes
necessary to convert an APW source file to a form more acceptable to Merlin 16.
Converter is an
Applesoft BASIC program that can be run from either a file selector like ProSel,
the DeskTop, etc., or
by first setting the prefix to /MERLIN. 16/UTILITIES at the BASIC prompt, and th
en typing RUN
CONVERTER.
When the Converter runs, the first step is to place the disk containing the APW
file to be converted into
a disk drive. Then choose menu item #1 , Select a file from disk.
The program will then present a list of all the on-line disk volumes. Press the
number key or use the
arrow keys to select the disk you want to look at, and press Return.
The program will then display all the files in the main directory of that disk.
Subdirectories are
indicated by a slash at the end of the filename, for example, UTILITIES/. Select
ing a subdirectory will
then list all the files in that subdirectory. You can back out of a given subdir
ectory by pressing the
Escape key.
When you see the file that you want to convert, press the number key and press R
eturn.
The program will then load the existing source file into memory, make the necess
ary changes, and then
write a new file back to disk. The suffix ".S" will automatically be added to th
e new filename.
After the conversion, you may either select another file to change, or you can p
ress Open-Apple-Escape
to go back to the Main Menu. From there, you can either exit to BASIC, a program
selector, or select
another file to change.
Most Apple Ilgs programs make extensive use of the Apple Ilgs Toolset macros. At
the beginning of a
converted program you'll probably find an instruction similar to USE FILE.MACROS
. This tells the
assembler to use a library of macro definitions stored on the disk. Rather than
try to convert a macro
file for a given program, it is better to use another Merlin 16 utility, MACGEN,
to create a new library
of the macros needed for the program you're converting. The next section describ
es how to use
MACGEN.
Page 199
Using MACGEN
The Merlin 16 disk contains a complete set of Apple Ilgs Toolset macro definitio
ns, along with other
macro libraries such as MACROS.816 and UTIL.MACS. The brute-force way of using t
hese libraries
is to add whatever lines are necessary to use the particular macros you need. Fo
r example:
USE /MERLIN. 1 6 /TOOL. MACROS /MEM. MACS
USE /MERLIN . 1 6 /TOOL . MACROS / MI SC . MACS
etc.
The disadvantage to this approach is that the entire macro library is read into
memory, leaving little
remaining free memory for your actual program.
Usually you would write the program using whatever macro calls you wish, and the
n run the program
utility MACGEN. MACGEN looks through an entire source file, and makes a list of
every macro call.
It then compares this with all the calls in any existing macro libraries, and cr
eates a new and condensed
macro file of just those definitions used in your program. MACGEN must be used w
hen converting an
APW source file in order to create the condensed macro file needed by a particul
ar program.
When converting an APW source file, or when using MACGEN in your own program, he
re's what to
do:
1) MACGEN will need to be installed in Merlin 16. This is done by typing:
-/MERLIN. 16/UTILITIES/MACGEN
from the Main Menu.
2) Now load the source file to be scanned for macros. For an Apple Ilgs, ProDOS
16 program, the
first two actual instructions in your program, disregarding comment lines, shoul
d be:
REL
DSK FILENAME. L
where FILENAME is the name of the final object file you wish to create, and FILE
NAME. L will be
the intermediate relocatable link file. This LNK file will be used by the linker
to create the final object
file, presumably named FILENAME.
Following the REL and DSK instruction will be the USE FILENAME instruction that
loads the
condensed macro definition file, which would look something like this:
USE FILE. MACROS
For now, this should be either deleted, or you can add a semi-colon (;) to tempo
rarily make it a
comment, since the file has not been created yet. After making these changes, sa
ve the file to disk.
Page 200
Utility Programs
3) The editor workspace must be empty for MACGEN to operate, so type NEW in the
Command Box
to erase the source listing. Then, go to the Command Box again and type:
MAC "FILENAME "
where FILENAME. S is the source file to be scanned.
4) The source file will be read from the current disk directory, and the Macro G
enerator menu will
appear:
[S]earch directory for macros.
[D]isplay unresolved macro names.
[C]atalog directory.
[Q]uit macro generator.
Select :
MACGEN has already made a list of all the macro calls in your program, and press
ing D will display
them. This step is not required, but it may be of interest to you. You will now
tell MACGEN where
the macro libraries are that you want reconciled with the source listing.
Press S to start the search. MACGEN will ask what directory you want it to searc
h within for existing
macro libraries. In most cases, you will probably enter:
/MERLIN . 1 6/T00L . MACROS
but this can be any directory that has macro definition files in it.
As the macro files are read and compared to the source file, each filename will
be printed on the screen.
When the directory is processed, the menu above will be repeated. Since you will
probably want to use
MACROS. 8 16 also, press S again and type in:
/ MERLIN . 1 6 / GEN . MACROS
At this point, all macro definitions that could be found are copied into a new s
ource file in the Merlin
16 editor. Before quitting MACGEN, you may want to press D to display any macros
definitions that
were not found. You can either make a note of them to add later, or you can pres
s S again to scan
another directory for more macros. Note that unresolved macros may be due to UPP
ER/lower case use
that is inconsistent with the actual definitions. For example, _TLStartup might
not be resolved because
the actual name is _TLStartUp. Setting the PARMS file so that Merlin 16 is case
insensitive is one
way to eliminate this source of unresolved macros.
When you quit MACGEN, you'll want to save the condensed macro file for use by th
e converted APW
program. For example, for the program SAMPLE, you might want to save the macro f
ile under the
name SAMPLE.MACROS. This would be referenced in the source program with a line l
ike this:
Page 201
Utility Programs
Final Editing
There are certain further substitutions and editing that will need to be done to
complete the conversion
process. The easiest way to find the lines that need changes is to try to assemb
le the file (<3A), and see
where the errors occur. Remember that before you can use Linker. GS, you will ha
ve to re-install
Linker.GS by typing "-/MERLIN. 16/LINKER.GS" from the Main Menu, since MACGEN di
splaces
Linker.GS when it is loaded.
Some APW functions are duplicated in macro functions included in the UTIL.MACS a
nd
MACROS.816 files. Other functions in APW may have no equivalents, and so are con
verted to
comments by the Converter program. Following is a list of points to look for:
Comment/Line length: The Converter program automatically shortens lines to the 6
4 character
limit of the Merlin editor. Any text that is too long is turned into a comment w
ith an asterisk or a
semi-colon, and is made into a new line. This may make title boxes in the listin
g look uneven.
Case Sensitivity: In its original condition, Merlin 16 is case sensitive in its
handling of labels.
That is, it considers the label NAME to be different from Name or name. Case sen
sitivity gives you
more versatility in labels, for example, using the macro QUIT for ProDOS 16 and
Quit for ProDOS 8.
It also results in faster assembly speeds. APW, however, is not specifically cas
e sensitive unless the
CASE directive is used. In addition, many sample programs available for the Appl
e Ilgs written with
APW use a wide variety of conflicting -case labels. For example, a single progra
m may use pulllong,
PULLLONG, Pulllong and PullLong in different parts of the program, all referring
to the same macro.
Page 202
When converting an APW source file, you may either manually edit any conflicting
labels to be
consistent, or you may alternatively change the PARMS file for Merlin 16 to make
Merlin 16 case
insensitive (about line #120 in PARMS.S).
Duplicate Labels: APW blocks groups of labels in each START/END segment and cons
iders all
labels in that segment to be local, unless declared "known" to another segment b
y the APW using
pseudo-op. In Merlin 16, all labels are global unless preceded with a colon, as
in :LOOP. In
assembling a program, you may get "Duplicate Label" errors as Merlin 16 encounte
rs labels that were
used repeatedly in many different segments. To resolve these, you may either ren
ame offending labels,
i.e. LOOP1, LOOP2, etc., or you may put a colon in front of the offending label,
i.e. :LOOP.
The main caution has to do with when a label is declared "known" to one segment,
but may be local in
all others. For example, suppose you have a program with three program segments,
and the label
LOOP was used in segments #2 and #3, but only the LOOP in segment #3 was known t
o segment #1
through APW's using pseudo-op. Since Converter turns it into a comment, you woul
d have to pay
particular attention to the preserved using instruction and to the corresponding
START/END segment it
referenced when editing the source listing. In this example, you might leave the
label LOOP in
segment #3 alone, and change LOOP in segment #2 to :LOOP. Note that references t
o local labels
such as :LOOP cannot cross global labels. Thus, the following code segment would
not work:
BNE : DONE
TEST2 CMP #$7F
BEQ AGAIN
: DONE RTS
Processor Mode: Merlin 8 and Merlin 16, as configured in the original package, s
tart assembling a
file assuming that the microprocessor is in the 8-bit mode (MX %11). In the case
of Merlin 16, this is
done to rninirnize errors when assembling source files written with earlier (8-b
it) versions of Merlin,
such as Merlin, Merlin Pro, Merlin 8 or Big Mac. When assembling programs to run
under ProDOS
16, it is very important that you make sure the assembler starts assembling the
source in the full 16-bit
(MX %00) mode. There are two ways to handle this. The first is to just include t
he Merlin pseudo-op
MX %00 on one of the first lines of each source file. You may alternatively use
the macro M65816 1,
as defined in the Macros.816 file, which accomplishes the same function. The Con
verter program
automatically puts the proper instructions in when converting an APW program, so
this is only a
concern when manually converting a program, or writing a ProDOS 16 program from
scratch.
The other choice is to permanently change the appropriate bit in the flag in the
Merlin 16 PARMS file
(approx. line #75) so that Merlin 16 always starts in the 16-bit mode. Important
: If you do make this
change, you will have to be careful to remember to use an MX %l 1 (8-bit mode) i
nstruction in any of
your older ProDOS 8, etc. source files before assembling them with the altered M
erlin 16.
In addition, here are some of the APW pseudo-ops that are automatically handled
by the Converter, but
which may be of some interest:
Page 203
Utility Programs
65816 ON In APW, this enables the 65816 assembly mode. In Merlin 16, this is equ
ivalent to two
XC instructions, plus an MX %00. This is automatically added to converted APW so
urce files by
Converter, but there is also a macro named M65816 in MACROS.816 that can be used
.
LONGI ON/OFF Merlin 16 uses and 1 as substitutes for APW's ON and OFF operands.
LONGI
and LONGA have equivalent macros in MACROS.816.
START/END APW delimits each program segment within a listing with a START and EN
D
pseudo-op. All labels within a segment are considered local by APW except for th
e label that is
associated with the START instruction. Local labels in APW within a segment may
be made known to
other segments with the APW "using label" instruction, which is not the same as
Merlin 16's "using"
instruction. The Converter program changes START to ENT so that the particular l
abel on that line
can be referenced by other Merlin 16 source files, if needed. END is converted t
o a comment, since
END in Merlin 16 would signify the end of the entire source file. This structure
may have to be
considered when handling local/global labels and label conflicts.
SYMBOL ON/OFF In APW this determines whether the symbol table should be printed
at the end
of the source listing. In Merlin 16 this is controlled by the presence of LST ON
/OFF at the end of the
listing.
GEN ON/OFF In APW, GEN ON tells the assembler to print the expanded form of macr
os.
EXPMAC is an equivalent function macro in Merlin 16 that duplicates this. Note:
EXP is the actual
Merlin 16 directive. See EXP in the Merlin 8/16 manual.
Programmer's Note: The Converter uses the file DICTIONARY in the UTILITIES subdi
rectory in
part of the conversion process. The Dictionary file contains search & replac
e entries that translate APW
opcodes to Merlin 16 equivalents. For example, the file Dictionary has the entry
:
COPYtPUT
This tells the converter to replace the opcode COPY with PUT. Thus the APW sourc
e line:
COPY HIRES. STUFF
would become:
PUT HIRES . STUFF
The pound sign (#) is the delimiter between the search and replacement strings.
Replacement strings
may include spaces and semi-colons to move the new statements to the comment fie
ld, as is done with
END becoming ;END. A pseudo-op can be removed completely by leaving the replacem
ent field blank.
You can edit the Dictionary file with Merlin 16 to add new search & replace
definitions. Remember to
use the filename DICTIONARY/ when loading or saving. You will probably also want
to turn off the
formatting (tabbing to assembler fields) with the Command Box TAB command.
Page 204
Utility Programs
The Converter changes ON and OFF arguments to certain APW directives, such as ab
saddr, 65816, case,
longa, longi, etc., to 1 and so that the ON/OFF argument can be handled by an eq
uivalent Merlin 16
macro. These macros are presently defined in the file MACROS. 8 16 in the GEN.MA
CROS
subdirectory on the Merlin. 16 disk.
The source files for the Converter utility are also included on the Merlin. 16 d
isk. Although we do not
provide specific technical support for making alterations to this program, the s
ource files are
well-commented, and you may wish to make changes to the program for your own use
.
Sample APW Program: A sample program, called SIMP.SRC, is included on the Merlin
16 disk
in the directory SAMPLES. APW. You may want to try the procedure described here
to practice
converting an APW source file before tackling other files. A copy of the SIMP.SR
C in converted
Merlin format, and the final output file, SIMP, is included in the SAMPLES .Ml 6
directory. SIMP is
a ProDOS 16 S 16 type file that can be launched from the Finder or DeskTop.
As a general exercise in assembling, linking and running a ProDOS 16 application
that uses many
Apple Ilgs tools, there is also a program in the Samples.M16 directory called BR
ICKOUT. This file
can be assembled, linked and saved by linking the command file GAME.CMD.S. This
file was
converted from a listing originally in the APW format.
CROSS REFERENCE PROGRAMS
Xref - Xrefa
These utilities provide a convenient means of generating a cross-reference listi
ng of all labels used
within a Merlin 8/16 source program.
Such a listing can help you quickly find, identify and trace values throughout a
program. This becomes
especially important when attempting to understand, debug or fine tune portions
of code within a large
program.
Merlin 8/16 provides a printout of its symbol table only at the end of a success
ful assembly, provided
that you have not defeated this feature with the LST OFF pseudo op code. While t
he symbol table
allows you to see what the actual value or address of a label is, it does not al
low you to follow the use
of the label through the program.
This is where the XREF programs come in.
XREF gives you a complete alphabetical and numerical printout of label usage wit
hin an assembly
language program. XREFA gives a cross reference table by address. This is more u
seful for large
sources containing lots of PUT files. It also does not use as much space for its
cross-reference data and
therefore can handle larger source files than XREF.
Page 205
Utility Programs
As you can see from the above example, the definition or actual value of the lab
el is indicated by the
equal (=) sign, and the line number of each line in the source file that the lab
el appears in is listed to the
right of the definition, hi addition, the line number where the label is either
defined or used as a major
entry point is suffixed or flagged with an asterisk (*).
An added feature is a special notation for additional source files that are brou
ght in during assembly with
the PUT pseudo opcode. For example, 134.82 indicates line number 134 of the main
source file is the
line containing the PUT opcode and line number 82 of the PUT file is where the l
abel is actually used.
Using Xref
1. From the Main Menu, make sure you have saved the file and Merlin 8/16 is in t
he currently selected
drive.
Page 206
Utility Programs
Page 207
Utility Programs
DEF
DONE
MAC
CMP
BNE
ASL
<
DEF
FORMATTER
This program is provided to enhance the use of Merlin 8/16 as a general text edi
tor. It will
automatically format a file into paragraphs using a specified line length. Parag
raphs are separated by
empty lines in the original file.
To use Formatter, you should first BRUN it from Main Menu. Formatter will then l
oad itself into
high memory.
This will simply set up the editor's USER vector. To format a file which is in m
emory, issue the
USER command from the editor.
The formatter program will request a range to format. If you just specify one nu
mber, the file will be
formatted from that line to the end. Then you will be asked for a line length, w
hich must be less than
250. Finally, you may specify whether you want the file justified on both sides,
rather than just on the
left.
The first thing done by the program is to check whether or not each line of the
file starts with a space.
If not, a space is inserted at the start of each line. This is to be used to giv
e a left margin using the
editor's TAB command before using the PRINT command to print out the file.
Formatter uses inverse spaces for the fill required by two-sided justification.
This is done so that they
can be located and removed if you want to reformat the file later. It is importa
nt that you do not use the
FIX or TEXT commands on a file after it has been formatted unless another copy h
as been saved. For
files coming from external sources, it is desirable to first use the FIX command
on them to make sure
Page 208
Utility Programs
they have the form expected by Formatter. For the same reason, it is advisable t
o reformat a file using
only left justification prior to any edit of the file.
Don't forget to use the TABS command before printing out a formatted file.
KEYBOARD MACRO FILES
Edmac - Keymac
Edmac and Keymac are keyboard macro files for use with the Merlin 8/16 Editors.
Edmac is for use
with Merlin 8 and Merlin 16 full screen editors. Keymac is for the Merlin 8 line
editor. A macro
definition lets you type one key, and get a string of characters on the screen.
This should not be
confused with the assembler macros that Merlin 8/16 also supports.
An assembler macro is a definition of a set of assembler instructions, usually w
ith variables, that you
define within a given source listing. When the program is assembled, the assembl
er replaces the macro
call with the series of lines that have been assigned to that macro.
A keyboard macro is only a substitute for a small amount of typing that you migh
t do while you're in
the editor itself.
For example, you've probably typed LDA many times in assembly language programs.
With Edmac or
Keymac installed, you could type Solid-Apple-3 (Option-3 on the Apple Ilgs) and
the characters LDA #
would appear on the screen.
To install Edmac or Keymac, just BRUN it from the Main Menu, then enter the Edit
or and type USER
from the Merlin 16 Command Box or Merlin 8 Command Mode. When you type one of th
e Edmac or
Keymac Solid- Apple (Option- on the GS) commands shown on the following pages, t
he corresponding
text will be inserted.
Page 209
Utility Programs
AND
D
13
DV^
w
Q
J
pMD
n
1J
/I
UL D
p
Hi
N/A
TCpvbn^rH Ma fro Not A^icrnpd. .
C
o
N/A
tl
C
D
tllliA
T
1
N/A
JSR
JMP
LDA
10
BMI
*
N
11
BNE
12
ORA
13
BPL
14
BEQ
*
15
RTS
16
STA
N/A
N/A
Keyboard Macro Not Assigned. . .
17
BVS
N/A
18
LDX
19
LDY
#0
20
LD
#0
N/A
N/A
*
3
21
LDA
22
LABEL
= $
23
LABEL
DFB %
24
N/A
Keyboard Macro Not Assigned...
25
" s$9F
26
27
i Y
*
28
(/X)
A J
29
PLA
{down arrow)
30
TAY
31
PLA
TAX
33
PLA
A K
34
PHA
(up arrow)
35
TXA
PHA
37
TYA
38
PHA
Page 210
Utility Programs
39
ASC
11
40
ASC MM
41
ERR \
42
MAC
DEFINE A MACRO.
43
EOM
FINISH DEFINITION.
44
ADC
*
t
45
SBC
46
]LOOP
*
t
[
47
[]
Macros can be added or edited by adding or changing the data statements in KEYMA
C.S or EDMAC.S.
The only requirement for each definition is that it begin with the macro key its
elf, and that the assigned
string end with a "high bit off (value < $80) ASCII character.
MAKE DUMP
This Merlin 8/16 program will make a hex dump text file from an object file afte
r a valid assembly of
the source. Before using Make Dump, you should have already assembled and saved
the source code.
This is important because the existing source code in memory is destroyed when M
ake Dump is used.
To use Make Dump, BRUN it from the Main Menu. Then load the desired source file
and assemble it.
Finally, type USER from the Command Box or Command Mode of the Editor.
The current source in memory will be replaced with a hex dump of the previously
assembled object file.
The last line of the file will contain a BS AVE with the correct address and len
gth but without a
filename. You can use the Editor to insert the desired filename. You can then sa
ve the file for use as an
EXEC file. If you forget to insert the filename, Merlin 8/16 will give you a SYN
TAX ERROR when
the file is EXECed.
PRINTFILER
Printfiler is a utility designed to save an assembled listing to disk as a seque
ntial text file. It optionally
allows you to also select "file packing" for smaller space requirements and allo
ws you to turn video
output off for faster operation.
Text files generated by Printfiler can include the object code portion of a disa
ssembled listing,
something not normally available when saving a source file. This allows a comple
te display of an
assembly language program and provides the convenience of not having to assemble
the program to see
the object code.
Printfiler can also be used to save a source listing to disk as a text file with
the high bit clear (Merlin
source files normally have the high bit set), and with the option of each tab fi
eld filled with spaces for
compatibility with the APW (ORCA) assembler.
Page 211
Utility Programs
Printfiler Applications
Other examples of where Printfiler might be used include:
- Incorporating the assembled text file in a document being prepared by a word p
rocessor.
- Sending the file over a telephone line using a modem.
- Mailing the file to someone such as a magazine editor who wants to work with t
he complete
disassembly without having to assemble the program.
Using Printfiler
1 . Make sure that you've saved the source file before using Printfiler.
Merlin 16 version: Press D for Disk Command.
At the Command prompt type BRUN /MERLIN. 16/UTILITIES/PRINTFILER and press Retur
n.
Merlin 8 ProDOS version: Press D for Disk Command.
At the Command prompt type BRUN /MERLIN. 8/UTILITIES/PRINTFILER and press Return
.
Merlin 8 DOS 3.3 version: Press C to catalog the Merlin 8 disk.
At the Command prompt type BRUN PRINTFILER and press Return.
2. Press L to load the desired source file.
3. From the Main Menu select the drive to save the assembly to if necessary.
Merlin 16 version: Enter the Editor and press Open-Apple-0 to open the Command B
ox.
From the Command Box type USER "FILENAME" where FILENAME is the name of your fil
e.
You may also use the PRTR command if you wish page headers to be sent with your
listing. In
that case enter the following instead of the USER command: PRTR 1 "T.MYFILE" MY
PAGE
HEADER and press Return.
Merlin 8 version: Enter the Editor by pressing E from the Main Menu. From the Co
mmand Mode
prompt (:) type USER "FILENAME" where FILENAME is the name of your file. You may
also
use the PRTR command if you wish page headers to be sent with your listing. In t
hat case enter the
following instead of the USER command: PRTR 1 "T.MYFILE" MY PAGE HEADER and pres
s
Return.
There will be a short disk access and the name of the file used for the text sav
e will appear on the
screen.
Page 212
Utility Programs
Page 213
Utility Programs
Page 214
Utility Programs
When Type.Changer runs, the first step is to place the disk containing the file
whose type is to be
changed into a disk drive. Then do the following:
1) Choose menu item #1, Select a file from disk.
2) The program will then present a list of all the on-line disk volumes. Press t
he number or use the
arrow keys to select the disk you want to look at, and press Return.
3) The program will then display all the files in the main directory of that dis
k. Subdirectories are
indicated by a slash at the end of the filename, i.e. UTILITIES/. Selecting a su
bdirectory will then
list all the files in that subdirectory. You can back out of a given subdirector
y by pressing the
Escape key.
4) When you see the file whose type you want to change, press the number key and
press Return.
5) The program will then display the current filetype of that file showing both
abbreviated file code and
hex filetype. For example, an Applesoft BASIC file would be listed with a file c
ode BAS and a
filetype of $FC.
6) You can enter the new filetype you want as either the "official" file code, s
uch as BIN, S16, etc., or
the hex code, such as $FF. If entering the hex code, you must include the dollar
sign at the
beginning of the number.
7) After the change, the new file code and type will be displayed. Pressing a ke
y will return to the
Main Menu. At that point you can either exit to BASIC, a program selector, or se
lect another file
to change.
NOTE: The file codes and types are all contained in DATA statements within the T
ype.Changer
program. These may be added to or edited as you desire to support new and/or cus
tom file types.
ADDITIONAL MERLIN 8/16 RESOURCE FILES
The Merlin 8/16 disks contain a number of source files for your reference includ
ing PUT file examples,
general macros that can be used in any program, Classic Desk Accessories, and To
olbox macros for the
Ilgs. These files are provided as resource material and can be helpful in unders
tanding how these tools
are designed and implemented.
Page 215
Merlin 8/16 User's Manual
Index
INDEX
"!", Exclusive OR 81
"&", Logical AND 81
7 (,-.", in Macros 131
M II
' 1
as a logical OR 77,81
T,
to abort a Change 38
Division operator 81
Editor - to List from last line 46, 69, 72
Editor - to abort List 42
in file names 18
to abort a Find 39
Line Range Delimiter 36, 37, 61, 62
in Macros 131
Sourceror (Cancel) 189
* for Comments 5, 77, 78
. (period),
Listings 46, 69, 72
in Macros 131
256 Externals 183
A:AppendFile 19
About the Assembler Documentation 75
About the Command Mode Documentation 36
About the Command Box Documentation 61
About the Linker Documentation 138
Absolute addresses, and Linker 140, 144, 151
Accumulator mode addressing 83-85
Add/Insert Mode Editing Commands 5-7, 8-9,
37, 63, 72
Addition operation, in operands 81
Addressing Modes 83-85
ADR 111
Linker command 152
ADRL 111
ALI 159
All text, to select 29, 34, 57, 71
AND operation, in operands 81-82
Angle brackets in Documentation 36, 61
Append a file 19
Page 216
Index
Assembler,
to Pause 121, 123
Pseudo Opcode Descriptions 87
Syntax Conventions 77, 83
Assembling large files, and PUT, SAV, DSK
93-96, 98-99, 100-101, 147-148, 152, 153,
155-157
Assembly 9-11,47,52,63,73
ASM,
Command 9-11,47,63,72
and PRTR 43-44, 47, 66, 72
Linker command file 151,152
AST 103
Asterisks (*),
Comments 5, 77, 78
Line of in a comment 31, 34, 59, 71, 103
Auto edit 73, 197
Back-up copies of Merlin 3
Backing up Program Counter (DS) 89, 112
Backwards DELETE, in EDIT mode 26, 33, 50,
70 (see also Control-D)
Bad,
Address mode 179
Branch 179
External 179
Input 179
Label 179
OBJ 179
Opcode 179
ORG 179
PUT 180
REL 180
SAV 180
Variable 180
Beginning, move to,
of line of text 24, 33, 48
of source file 27, 34, 52
Bell, turning off 167, 172
BINary files 12,13,17
Binary numbers 80
BGE opcode 86
BLOAD 14, 19, 20, 21, 89
Block cursor 24, 26, 49, 167
BLT opcode 86
Branching,
to Variables and Local Labels 79, 86
BRK 180
BRUN 19,20,21
BSAVE 19
Bugs, common cause of 87
Building Expressions 81-82
C
C: Catalog 17-18
pause 17-18
CALL 14
Case sensitive labels 88
Center screen 30, 57
Change 38
Change drive 19
Change ProDOS filetype 214-215
Change Word 39
Changing Printfiler's Options 213-214
Changing Sourceror's Label Table 191
Character case change 24, 33, 49, 62
Character insert mode 24, 26, 33, 49, 70
Characters per line 34, 63, 73, 77, 167, 170,
172
Checksum, in object code 1 19-120
CHK 119-120
Classic Desk Accessories 197
Clipboard 30,34,52,73
Clock 197
Command box 8, 55, 61
Command mode (Merlin 8) 15, 34, 36
Command summary 33-34, 70-72
Comments 5, 77
Comment length 34, 63, 73
Conditional Assembly 82-83, 116-118, 151,
152
Page 217
Index
Disk files,
names - see "filenames"
renaming 19
Division operation, in operands 81
DO 114
DOS 3.3 technical information 164
Drive change 19
DS 90, 112
and Linker 112, 139, 143, 159
DSK 90, 100
and the Linker 147, 149, 155-156
DUM 101
Duplicate symbol 146, 180
Duplicating Merlin disk 3
DW 110
E
Edit command 38
Edit Mode Commands 33-34, 70-72
Editor 5-8,21
Edmac 35,73,209-211
ELSE 114
END 101, 153
End of line,
marker 23,48
move to 25, 33, 49
End of source, move to 29, 34, 55
ENT 88, 141, 142, 153
EOMor< 127
EQU(=) 87
ERR 120
and Linker 120-121, 139, 143
ERR: Memory Full 181
Error Messages (general) 1 79-183
Escape 26, 33, 50, 70
Evaluation of expressions 45, 69, 72, 81
Exchange, global 27, 34, 53
EXCLUSIVE OR operation, in operands 81-82
EXP ON/OFF/ONLY 104
EXT 141, 153
Expressions Allowed by the Assembler 81-83
Fast keys 50
Filenames,
ASM 151
DSK 90, 91, 100-101, 147, 155-156, 161
LIB 154
Link 144
Linker command files 154-155
Linker name files 144-145,148-149
LNK 147, 152, 155-156
Multiple LNK files 160
object 12, 13, 14, 19, 2
OVR 152
PUT 77, 93-96, 152
Quick Link 159-160
REL 147, 155-156, 161
SAV 90, 92, 98-99, 153
source 12, 13, 18, 19, 21, 22, 77
USE 77, 97, 136
Flletype mismatch error 146, 180
FIN 115
Find,
a character 24, 33, 49, 70
a string 25,28,39,54,71
a word 25, 28, 30, 39, 40, 50, 54, 56
Fmd and Replace (global exchange) 25, 27, 34,
38,53
FIX 40,63,72
FLS 108
Forced Assembly Errors 120, 121, 143
Formfeed, printer 166, 170
FW (Find Word) 40
Format error 180
Formatter 208-209
Formatting Pseudo Ops 103-106
Full Screen Editor,
commands 8-9
Merlin 8 23-35
Merlin 16 48-60
entering 5, 21, 23, 48
quitting 7, 44, 66, 71
Page 219
Index
G
GET 15,41,64,72
GET Command, and Linked files 146
Global Exchange 25, 27, 34, 38, 53
GS Linker 158, 161-162, 163
H
Half -screen editing 54
H (Hex) 187
Hard disks 170
HEX 111
Hex-Dec Conversion 41, 64
Hex data 80, 107, 110
I
IF 115
Illegal,
char in operand 180
file type 181
forward reference 181
relative adrs 181
Initialization string, for printer 43, 66, 175
Insert,
with TAB key 24, 26, 28, 49, 50
character mode 9, 26, 49, 50
lines 8, 26, 28, 55, 58
control characters 25,49
Integer division, in operands 81
Inverse spaces 44, 67
Immediate Data Syntax 80, 83
Immediate Data vs. Addresses 80
INV 108
K
KBD 121
Keyboard input during assembly 121
Keymac 35,209-211
KND 159
Page 220
Index
Listing,
CYCLE times 103-104, 167, 172
DO OFF 114, 167, 172
Macros 104
limiting bytes printed in 167, 172
LKV 154
LNK 152
Load a source file 18
Local Labels, Global Labels & Variables 78-80
Local Variables,
defining 79-80
and PUT files 96
Locate a label or line 28, 34, 55
Lock file on disk 19
Logical operations, in operands 81
Lower case/upper case,
to change 24
in labels 88
LST ON/OFF 105
LSTDO or LSTDO OFF 105
LSTDO, configuring 167, 172
LUP 122
M
MAC 127
Macgen (utility) 200-202
Macros 127-136
defining 127, 128-132, 133-134
and PUT files 96
libraries, and USE opcode 97, 136
libraries, provided with Merlin 136
listings 104
nested 134
Pseudo Ops for, 127-129
variables 129-133
Main menu 5, 17, 55
Making Back-up Copies of Merlin 3
Make dump 211
Markers 28-29, 55, 56
Maximum,
length of comments 34, 63, 73
length of labels 77
Memory,
IN USE 146, 182
full 181
full error, in Sourceror 191
status 25, 33, 50, 70
use by Merlin 166
Merlin,
Memory Map 176-178
internal entry points 124
Misalignment error 182
Miscellaneous Pseudo Ops 1 19-126
Mistakes, fixing 25, 29, 34 (see also
Control-R and C5R)
MONitor 42, 65, 72
MOVE 42 (see Cut, Copy & Paste)
Moving,
the cursor 26, 33, 48, 49, 50
text 29,42
Multiple input LNK files 160
Multiple output files 157
Multiplication operation, in operands 81
MX 84, 123
N
N (Normal - Sourceror) 187
Nesting error 182
Nested Macros 134
New 21,43,65,72
Not macro error 182
Not resolved error 146
Number Format (Binary, Decimal, Hex) 80
O
O: Object Save Command 12,21
command, and Linker 146, 153
O (ORG - Sourceror) 187
OBJ 92
Object code 13,21
Online command 19, 20
Page 221
PAG 106
Page Header, in listing 106
Parentheses,
and Precedence in Expressions 82
PARMS file 4, 34, 55, 72, 170
Paste 30,34,56
Pathnames 77
PAU 123
Personalizing Merlin 4, 72, 166
PFX 19,20
PMCor> 128
Precedence, in operand expressions 82
Prefix, ProDOS 13, 19, 20
Preliminary Definitions 75-76
Primitive expressions 81
Print command,
andPRTR 43,59,66
without line numbers 43,66
Printer,
slot#, in PRTR command 43,66
string, in PRTR command 43, 175
to print Catalog 17
Printfiler 211-214
PRinTeR 43, 59, 66, 175 (see also TTL, pg
106; PAG, pg 106)
ProDOS technical information 168
PUT 93-96, 137
linker command 152
Q(Quit),
to BASIC or program selector 22, 66
to Main Menu 7,44, 72
Sourceror 187
Quick Link 159
Page 222
r
to change 24, 37
labels 88
USE, 97
and Macro Libraries 97
USER 45, 68, 72
USR 97, 124-125
Using Sourceror 184-191
Utilities 197-215
V
VAL 45, 69, 72
Value of labels 45
VAR 98
Variables 79-80, 98, 115, 122, 131, 135
VER 159
Vertical Tabs 30, 33, 34, 56, 70, 71
VIDeo 45, 69
W
W: Write Text File, 21
W (Word - Sourceror) 189
W command 46, 69
Word find 25, 28, 30, 39, 40, 50, 56
Where 45, 69, 72
Why Macros? 127
Why a Linker? 137
Wild Cards,
in Delimited Strings 37
character, changing the 167
Word processing text files 44, 67
X
XC 84, 123
XREF 205-207
XREFA 208
Page 223
Index
Z
Zero Page Addresses used by Merlin for USR
commands 124
Zero page addressing, forced 85
Page 224
Hex
Dec
Binary
Hex
Dec
Binary
ASCII Character
$00
0000
0000
$80
128
1000
0000
A Q
NUL
Null
$01
a r\ a a
A A A 1
UUUI
$81
129
1 A A A
1 U U U
A A A 1
UUUI
A A
SOH
statu or neading
$02
a a a r\
UUUU
0010
$82
130
1000
010
A B
STX
Start of text
$03
0000
0011
$83
131
1000
0011
A C
ETX
Ena of text
$04
n n n n
uuuu
m nn
U1UU
$84
132
1 A A A
1 U UU
n i a a
U 1 u u
A D
EOT
End of transmission
$05
UUUU
A T A 1
Ul Ul
$85
133
1 A A A
1 U U U
A 1 A 1
U1U1
A E
ENQ
Enquiry
$06
onnn
uuuu
m i n
U 1 1 U
$86
134
i n n n
1 u u u
n 1 1 n
U 1 1 u
A"p
r
ACK
Acknowledge
$07
nn n n
mil
U 1 1 1
$87
135
i n n n
1 u u u
mil
U 1 1 1
TST7T
cen
$08
nn n n
UUUU
i nnn
x u u U
$88
136
i n n n
1 u u u
i n n n
1 u u u
a rj
H
Ob
Backspace
$09
00 00
$89
137
i n n n
i nm
1 u u 1
A T
1
HI
HOri Z 1 Ad
$0A
10
0000
1010
$8A
138
i nnn
1UUU
1 n i n
A T
U
Lie
Linefeed
$0B
11
0000
1011
$8B
139
i nnn
1 u u u
i ni 1
1 U 1 1
VI
Up Arrow
$0C
12
nnn n
1 1 nn
$8C
140
i n n n
1 u u u
linn
1 1 u u
li
pp
r r
Formfeed
$0D
13
0000
1101
$8D
141
l nnn
1UUU
Tim
1 1 U 1
A M
M
Return
$0E
14
0000
1110
$8E
142
1 nnn
u u u
1 1 1 n
1 1 u
CA
b/lllL OUt
$0F
15
0000
1111
$8F
143
i n n n
1 u u u
1111
1111
A/>
S I
bnirt in
$10
16
nn n i
UU U 1
nn n n
UUUU
$90
144
1 A A 1
1 U U 1
A A A A
UUUU
Ap
DLE
$11
17
UUU1
0001
$91
145
1001
0001
A Q
DC1
XON
$12
18
UUU 1
A A 1 A
UU 1 U
$92
146
1001
0010
A R
DC2
AUXON
$13
19
nn n i
UUU 1
nm i
UU 1 1
$93
147
1001
0011
A S
DC3
XOFF
$14
20
UUUI
0100
$94
148
1001
0100
A T
DC4
AUXOFF
$15
21
0001
0101
$95
149
1001
0101
A U
NAK
$16
22
a a a i
UUU1
QUO
$96
150
1001
0110
A V
SYN
Synchronous file
$17
23
0001
0111
$97
151
1001
0111
A w
ETB
$18
24
UUUI
10 00
$98
152
1001
1000
A x
CAN
Cancel line
$19
25
0001
1001
$99
153
1001
1001
A Y
EM
End of medium
$1A
26
0001
1010
$9A
154
1001
1010
A Z
SUB
Substitute
$1B
27
0001
1011
$ 9B
155
1001
1011
A [
ESC
Escape
$1C
28
0001
1100
S9C
156
1001
1100
A \
FS
$1D
29
0001
1101
$9D
157
1001
1101
A ]
GS
Group separator
$1E
30
000 1
1110
S9E
158
1001
1110
RS
Record separator
$1F
31
0001
1111
$9F
159
1001
1111
A _
US
Unit separator
$20
32
0010
0000
$A0
160
1010
0000
space
$21
33
0010
0001
SA1
161
1010
0001
$22
34
0010
0010
$A2
162
1010
0010
$23
35
0010
0011
$A3
163
1010
0011
$24
36
0010
0100
$A4
164
1010
0100
$25
37
0010
0101
$A5
165
1010
0101
$26
38
0010
0110
$A6
166
1010
0110
&
$27
39
0010
0111
$A7
167
1010
0111
$28
40
a a 1 a
UU 1U
100
$A8
168
1010
1000
$29
41
0010
1001
$A9
169
1010
10 01
$2A
42
A A 1 A
UU 1 U
1010
$AA
170
1010
1010
$2B
43
A A 1 A
UU1U
1 A 1 1
1U 1 1
$AB
171
1010
1011
$2C
44
0010
1100
$AC
172
1010
1100
$2D
45
0010
1101
$AD
173
1010
1101
$2E
46
0010
1110
$AE
174
1010
1110
$2F
47
A A 1 A
UU 1 U
1111
$AF
175
1010
1111
$30
48
0011
0000
$B0
176
1011
0000
$31
49
0011
0001
$B1
177
1011
0001
$32
50
0011
0010
$B2
178
1011
0010
$33
51
0011
0011
$B3
179
1011
0011
3
$34
52
A A 1 1
UU1 1
A 1 A A
Ul UU
$B4
180
1011
0100
$35
53
0011
0101
$B5
181
1011
0101
5
$36
54
n a i i
UU 1 1
A 1 1 A
U 1 1 U
$B6
182
1011
0110
$37
55
nm i
UU 1 1
A 1 1 1
Ul 1 1
$B7
183
1011
0111
$38
56
nm i
i n n n
1UUU
$B8
184
i m i
1 U 1 1
i nnn
1UUU
$39
57
0011
1001
$B9
185
1011
1001
$3A
58
0011
1010
$BA
186
1011
1010
$3B
59
0011
1011
$BB
187
1011
1011
$3C
60
0011
1100
$BC
188
1011
1100
<
$3D
61
0011
1101
$BD
189
1011
1101
$3E
62
0011
1110
$BE
190
1011
1110
>
$3F
63
0011
1111
$BF
191
1011
1111
$40
64
0100
0000
$C0
192
1100
0000
$41
65
0100
0001
$C1
193
1100
0001
$42
66
0100
0010
$C2
194
1100
0010
$43
67
0100
0011
$C3
195
1100
0011
$44
68
0100
0100
$C4
196
1100
0100
$45
69
0100
0101
$C5
197
1100
0101
$46
70
0100
0110
$C6
198
1100
0110
$47
71
0100
0111
$C7
199
1100
0111
G
$48
72
0100
1000
$C8
200
1100
1000
$49
73
0100
1001
$C9
201
1100
1001
$4A
74
0100
1010
$CA
202
1100
1010
$4B
75
0100
1011
$CB
203
1100
1011
$4C
76
0100
1100
$cc
204
1100
1100
$4D
77
0100
1101
$CD
205
1100
1101
$4E
78
0100
1110
$CE
206
1100
1110
$4F
79
0100
1111
$CF
207
1100
1111
$50
80
0101
0000
$D0
208
1101
0000
$51
81
0101
0001
$D1
209
1101
0001
$52
82
0101
0010
$D2
210
1101
0010
R
$53
83
0101
0011
$D3
211
1101
0011
$54
84
0101
0100
$D4
212
1101
0100
$55
85
0101
0101
$D5
213
1101
0101
$56
86
0101
0110
$D6
214
1101
0110
$57
87
0101
0111
$D7
215
1101
0111
$58
88
0101
1000
$D8
216
1101
1000
$59
89
0101
1001
$D9
217
1101
1001
$5A
90
0101
1010
$DA
218
1101
1010
$5B
91
0101
1011
$DB
219
1101
1011
[
$5C
92
0101
1100
$DC
220
1101
1100
$5D
93
0101
1101
$DD
221
1101
1101
$5E
94
0101
1110
$DE
222
1101
1110
$5F
95
0101
1111
$DF
223
1101
1111
$60
96
0110
0000
$E0
224
1110
0000
$61
97
0110
0001
$E1
225
1110
0001
$62
98
0110
0010
$E2
226
1110
0010
$63
99
0110
0011
$E3
227
1110
0011
$64
100
0110
0100
$E4
228
1110
0100
d
$65
101
0110
0101
$E5
229
1110
0101
$66
102
0110
0110
$E6
230
1110
0110
$67
103
0110
0111
$E7
231
1110
0111
$68
104
0110
1000
$E8
232
1110
1000
$69
105
0110
1001
$E9
233
1110
1001
$6A
106
0110
1010
$EA
234
1110
1010
$6B
107
0110
1011
$EB
235
1110
1011
$6C
108
0110
1100
$EC
236
1110
1100
$6D
109
0110
1101
$ED
237
1110
1101
$6E
110
0110
1110
$EE
238
1110
1110
$6F
111
0110
1111
$EF
239
1110
1111
o
$70
112
0111
0000
$F0
240
1111
0000
$71
113
0111
0001
$F1
241
1111
0001
$72
114
0111
0010
$F2
242
1111
0010
$73
115
0111
0011
$F3
243
1111
0011
$74
116
0111
0100
$F4
244
1111
0100
$75
117
0111
0101
$F5
245
1111
0101
$76
118
0111
0110
$F6
246
1111
0110
$77
119
0111
0111
$F7
247
1111
0111
$78
120
0111
1000
$F8
248
1111
1000
X
$79
121
0111
1001
$F9
249
1111
1001
$7A
122
0111
1010
$FA
250
1111
1010
$7B
123
0111
1011
$FB
251
1111
1011
$7C
124
0111
1100
$FC
252
1111
1100
$7D
125
0111
1101
$FD
253
1111
1101
$7E
126
0111
1110
$FE
254
1111
1110
$7F
127
0111
1111
$FF
255
1111
1111
Delete/ rubout
</pre> </div><!--/.container-->
</div><!--/#wrap-->
<!-- Timing ...
rendered on: www11.us.archive.org
seconds diff sec message stack(file:line:function)
=========================================================
0.0000 0.0000 petabox start var/cache/petabox/petabox/www/sf/downl
oad.php:1:require
|common/ia:55:require_once
|setup.php:317:log
0.0023 0.0023 call get_redis() var/cache/petabox/petabox/www/sf/downl
oad.php:1706:main
|download.php:643:getItem
|common/Item.inc:63:parseMetadata
|Item.inc:95:get_obj
|Metadata.inc:310:get_json_obj
|Metadata.inc:1413:_get_json_obj
|Metadata.inc:1728:log
0.0162 0.0139 redis_read start var/cache/petabox/petabox/www/sf/downl
oad.php:1706:main
|download.php:643:getItem
|common/Item.inc:63:parseMetadata
|Item.inc:95:get_obj
|Metadata.inc:310:get_json_obj
|Metadata.inc:1413:_get_json_obj
|Metadata.inc:1823:log
0.0194 0.0032 redis_read finish var/cache/petabox/petabox/www/sf/downl
oad.php:1706:main
|download.php:643:getItem
|common/Item.inc:63:parseMetadata
|Item.inc:95:get_obj
|Metadata.inc:310:get_json_obj
|Metadata.inc:1413:_get_json_obj
|Metadata.inc:1828:log
0.0387 0.0192 begin session_start var/cache/petabox/petabox/www/sf/downl
oad.php:1706:main
|download.php:875:stream
|download.php:1326:head
|common/Nav.inc:65:__construct
|Nav.inc:121:session_start
|Cookies.inc:61:log
0.0388 0.0002 done session_start var/cache/petabox/petabox/www/sf/downl
oad.php:1706:main
|download.php:875:stream
|download.php:1326:head
|common/Nav.inc:65:__construct
|Nav.inc:121:session_start
|Cookies.inc:67:log
0.1721 0.1333 bug dump var/cache/petabox/petabox/www/sf/downl
oad.php:1706:main
|download.php:875:stream
|download.php:1352:footer
|common/setup.php:145:footer
|Nav.inc:1638:dump
|Bug.inc:120:log
-->
<script type="text/javascript">
if (window.archive_analytics) {
var vs = window.archive_analytics.get_data_packets();
for (var i in vs) {
vs[i]['cache_bust']=Math.random();
vs[i]['server_ms']=172;
vs[i]['server_name']="www11.us.archive.org";
vs[i]['service']='ao_2';
}
if ($(".more_search").size()>0) {
window.archive_analytics.send_scroll_fetch_base_event();
}
}
</script>
</div>
</body>
</html>