M m The Magazine of the APPLE, KIM, PET and Other Systems - 6502.org

Page created by Ronnie Howard
 
CONTINUE READING
M m The Magazine of the APPLE, KIM, PET and Other Systems - 6502.org
m m ®
The Magazine of the A P P L E , K I M , PET

      and O th er           System s
M m The Magazine of the APPLE, KIM, PET and Other Systems - 6502.org
Apple |                                          o       f t w                     a          r e
                                                        from RAINBOW
                                                                                                       -»*« c w z t t r       4cc Von
                                                                                                                              4   So.i     .«•-« tc - t i l K f -

                                                                  NEW!
     M in i       UEP   1e   TEXT EDITOP                                                               ,          z r l : « c f case -
                                                                                                       .>■ t r a c t # ' s « : : z r 2 I

     PIE TEXT EDITOR Machine Language,                                                                   HIGH RESOLUTION CHARACTER
cursor-based text editor for 16K Apple.                                                              GENERATOR Machine language program
• Features format capabilities of most text                                                          for 16K Apple.
  editors.                                                                                           • Define your own character set and graphic
• All commands are control characters.                                                                 shapes.
• Enables you to define your own function                                                            • Complete English upper/lower case charac­
  commands.                                                                                            ter set.
Order PIE on Cassette:................... $19.95                                                     • Complete Greek Alphabet with upper/low­
  On D iskette.................................$24.95                                                  er character set.
                                                                                                     • Scroll, vary window size, invert characters,
                                                                                                       switch back and forth between two char­
                                                                                                       acter sets.

                                                                                                     Order Hi-Res Char. Gen. on Diskette $19.95

                                                        SARGON for 24K Apple
                                                        • Flip back and forth between board and
                                                          text with ESC.
                                                        •Correct wrong moves
                                                        •Analyze your position
                                                        Order SARGON on Cassette........... $19.95

                                                        Call or write today for your FREE Apple
                                                        Software Catalog. We welcome B/A-VISA              M|T MTV KfY T9 tTte BMC RfPBCCe«Mi
FASTGAMMON                                              and Mastercharge. Sorry, no CODs. Please     3-D ANIMATION
A high quality, challenging game for you                add $1.25 shipping and handling. Califor­    • Define a 3-D lo-res shape.
and the computer.                                       nia residents add 6% Sales Tax.              •Animate with full perspective.
                                                                                                     • Includes 3 demo shapes.
Order FASTGAMMON on Cassette. $19.95                    We ship promptly on receipt of your pre­     Order 3-D ANIMATION on diskette .$24.95
On Diskette....................................$24.95   paid order. Order direct from:

                                                         Garden Plaza Shopping Center
                                             9719 Reseda Blvd., Northridge, Ca 91324 (213) 349-5560
M m The Magazine of the APPLE, KIM, PET and Other Systems - 6502.org
§ P O W E R S O F T , IN C .                                                                                   products for the
  P. O. BOX 157
  PITMAN, NEW JERSEY 080 7 1
  (609) 589-5500                                                                                              APPLE n
  APPLESOFT II UTILITY                                                                                                    (Diskette Only) $12.45
         The Applesoft II U tility program provides the user with the following features, a) Complete automatic renumbering of any Applesoft II
  program, b) The creation of an EXEC File for subroutine file creation. This feature allows you to incorporate the same subroutine in various pro­
  grams. c) No modification of the program in machine memory (RAM), d) Automatic running of the program. No programmer should be without
  this excellent utility program. REQUIREMENTS: Disk II, Applesoft II, 16K of memory.

  REAL ESTATE ANALYSIS PROGRAM                                                                                                                       $14.95
         The Real Estate Analysis Program provides the user with three features, a) A powerful real estate investment analysis for buy/sell decisions
  and time to hold decisions for optimal rental/commercial investments, b) Generation of complete amorization schedules consistent with banking
  practices and schedules, c) Generation of depreciation schedules for selecting the best depreciation schedule for your use and a determination of
  optimal switch over points to straight line to maximize depreciation. All three features are designed for video screen or printer output. In addition,
  the program will plot; cash flow before taxes vs. years, cash flow after taxes vs. years, adjusted basis vs. years, capital gains vs. years, pre-tax pro­
  ceeds vs. years, post-tax proceeds vs. years, and return on investment (%) vs. years. REQUIREMENTS: Applesoft II, 16K of memory without DOS
  or 32K of memory with DOS (Disk II).

  ADDRESS FILE GENERATOR                                                                                                                             $19.95
         A professional piece of software which allows the user to create four different types of address files: a) Holiday File, b) Birthday File,
  c) Home Address File, and d) Commercial Address File. The program contains a menu of seven major commands: 1) Create a File, 2) Add to File,
  3) Edit File, 4) Display File, 5) Search File, 6) Sort File, and 7) Reorganize File. Most of the major commands have subordinate commands which
  adds to the flexibility of this powerful software system. We doubt you could buy a better program for maintaining and printing address files.
  REQUIREMENTS: Disk II, Apple Printer Card, 32K of memory with Applesoft ROM Card or 48K of memory without Applesoft ROM Card.

  SUPER CHECKBOOK                                                                                                                                    $19.95
        A totally new checkbook program with a unique option . . . Bar Graphs. These bar graphs, outputed to a printer or video screen, provide
 trend analysis data on code expense, income, expenses, or gain/loss on a month by month basis. The program contains a total of fourteen options:
 1) Check/Deposit Entry & Modification, 2) Reconciliation of Checks or Deposits, 3) Sort by Check Number, 4) Sort by Code for Year, 5) Sort by
 Code for Month, 6) Output Year to Date, 7) Output Month Activity, 8-11) Printer/Video Plot Trend Analysis-Bar Graphs, 12) Account Status,
 13) Reconciled Check Status, and 14) Quit. An excellent program for maintaining your checkbook, or that of a small business. REQUIREMENTS:
 Disk II, 32K of memory with Applesoft ROM Card or 48K of memory without Applesoft ROM Card.

  FUNCTION GRAPHS AND TRANSFORMATIONS                                                          $14.95
        This program uses the Apple II high resolution graphics capabilities to draw detailed
 graphs of mathematical functions which the user defines in Basic syntax. The graphs appear in a
 large rectangle whose edges are X and Y scales (with values labeled by up to 6 digits). Graphs
 can be superimposed, erased, drawn as dashed (rather than solid) curves, and transformed. The
 transformations available are reflection about an axis, stretching or compressing (change of scale),
 and sliding (translation). The user can alternate between the graphic display and a text display
 which lists the available commands and the more recent interactions between user and program.
 Expected users are engineers, mathematicians, and researchers in the natural and social sciences;
 in addition, teachers and students can use the program to approach topics in (for example)
 algebra, trigonometry, and analytic geometry in a visual, intuitive, and experimental way which
 complements the traditional, primarily symbolic orientation. REQUIREMENTS: 16K of
 memory with Applesoft ROM Card or 32K of memory without Applesoft ROM Card.

                                                              Available at y o u r local com puter store

                                                 Call or w rite fo r our free SOFTWARE & ACCESSORIES CATALOG

                      P />
        CL *
                                                             DEALER INQUIRIES INVITED
                                 -o
                                                                                                                        • C heck o r M o n e y O rd e r
        Q_
        t v 
                                 ~o                                                                                     • I nclud e $ 1 .0 0 fo r
                                                                                                                          s h ip p in g and h a n d lin g
M m The Magazine of the APPLE, KIM, PET and Other Systems - 6502.org
BOX 120
                                                                                                     ALLAMUCHY, N.J. 07820
                                                       inc.                                          201-362-6574

HUDSON DIGITAL ELECTRONICS INC.
      THE HDE DISK SYSTEM.
       HERE’S WHAT ONE USER HAS TO SAY .
      REPRINTED BY PERMISSION FROM THE 6502 USER NOTES - ISSUE NO. 14
       PR O D UC T R EVIEW of the HDE D ISC S Y S ­                            fo rg o t to say lin e s can a ls o be m oved around                 and read the d isc d ire c to ry to see if it c an find
       TEM by the edito r,                                                     and d e le te d . This isn 't the c o m p le te list of              it. If it's on th e disc it w ill read it in and e x e c u te
           A n um ber of you have a sked fo r d e ta ils                       FO DS e d ito r c om m a nds, ju s t the one s that                  it. Sim ple right? I’ve added several com m ands
       a b o u t th e HD E fu ll size d isc system .                           im m e d ia te ly c o m e to mind.                                   to m y system and R E ALLY a p p re c ia te having
          The system is b ase d a ro u n d th e SYKES 8 "                         A n o th e r very p o w e rfu l fe a tu re of th e s ys­          th is a b ility . Som e of the th in g s I've add e d
       drive w ith th e 6 5 0 2 b ase d in te llig e n t c o n tro l­         tem is the a b ility to a c tu a lly e x e c u te a file c o n ­      in c lu d e a d is a s s e m b le r, an e x p a n d e d v e r­
       ler.                                                                   ta in in g a s trin g of com m a nds. For exam ple,                   sio n of XIM (the e x te n d e d m a c h in e la nguage
          T his d rive is so ft s e c to re d , IBM c o m p a tib le ,        th e n e w s le tte r m a ilin g lis t is now b e in g s to re d      m o n ito r from Pyram id Data). H y p e rta p e , and a
       and sin g le d e n s ity w h ic h le ts you s to re a bo ut            on disc. W hen I w a nt to m ake la bels, I w o uld                   n u m b e r of sy s te m u tilitie s w h ic h m ake life
       a q u a rte r m e g a b y te of data on a disc.                        n o rm a lly have to load each le tte r file and run                 easier. By the way, to g e t back to th e system ,
           The s ystem softw are, c a lle d FO DS (File O ri­                 th e la b e ls p rin tin g program . But w ith FODS. I               all you nee d to do is e x e c u te a BR K in s tru c ­
       e n te d Disc S ystem ), m anage s s e q u e n tia l file s            can b u ild up a “ JO B " file o f c o m m a n d s and               tio n
       on th e disc m uch th e s am e w ay file s are w rit­                  e x e c u te it.                                                         HDE a ls o p ro v id e s a p ie c e of s o ftw a re th a t
       te n on m a g n e tic ta p e - one a fte r a no ther.                     The jo b file in tu rn c a lls each le tte re d la bel            le ts you in te rfa c e M ic ro s o ft 9 d ig it BASIC to
       W hen a file is d e le te d , from a s e q u e n tia lly               file in and runs the la b e l p rin te r a u to m a tic a l­         th e ir dis c system . The s o ftw a re a llo w s you to
        m anage d file system , th e space th a t th e file                   ly. T he w ay c o m p u te rs are su p p o s e d to o p e r­         load the BASIC in te rp re te r its e lf fro m d is c as
       o c c u p ie d is n o t im m e d ia te ly re a llo c a te d , as in    ate rig h t?                                                        w e lla s s a v in g a n d lo a d in g BASIC P ro g ra m s to
       so m e d is c o p e ra tin g s ystem s. As it tu rn s out,                H e re 's a lis tin g o f th e jo b file I use to p rint         and from th e disc. This p a rtic u la r ve rsio n of
       th is can be an a d v a n ta g e as w ell as a d is a d ­              m a iling labels:                                                   th e s o ftw a re d o e s n 't a llo w fo r saving BASIC
       va n ta g e sin ce d e le te d file s on the FO DS sy s ­             :LIS P R TLB L                                                       data but H D E m e n tio n e d th a t th is a b ility m ay
       tem c a n be re co v e re d a fte r th e file has bee n               0 0 0 5 LO D A:RUN % LABEL:LO D B:JM P.E000:                         be p o s s ib le w ith a fu tu re version .
       d e le te d . (This has saved my s a n ity m ore th a n                LOD C JM P .E 0 00:                                                      The firs t th in g I do w ith a new p ie c e of s o ft­
       once!) Of c o u rs e w h e n you w a nt to re co ve r                 0 0 1 0 LO D D:JMP.EOOO:LOD E .JM P .E 000:                          w a re a fte r I g e t used to using it is try to b lo w it
       so m e of the d is c s p ace ta k e n up by a nu m b e r              LO D F :JM P ,E 000:                                                 up. I d id m anage to fin d a w e ak s p o t or tw o in
       of th e s e d e le te d files, you can sim p ly re -p a ck            0 0 1 5 LO D G :JM P.EO OO :LO D-HJM P.EO O O:                       th e very firs t version of FO DS (a p re -re le a s e
       or co m p re s s th e d is c and all the a c tiv e file s             LO D UMP.EOOO:                                                       version) b u t the later, re le a s e v e rs io n has
       w ill be s h ifte d d o w n u n til th e re a re no d e le te d       0 0 2 0 LO D J:JMP.EOOO:LOD K :JM P .E 000:                          bee n very tight.
       file s han g in g a ro u n d using up space.                          LO D L :JM P .E 000:                                                      The sta n d a rd s o ftw a re th a t is in c lu d e d w ith
           FO D S has th is a b ility to re pack a disc.                     0 0 2 5 LO D M:JMP.EOOO.LOD MC: JM P.E000:                           the sy s te m c o n s is ts of th e dis c d riv e r s o ft­
          W hen saving and lo a d in g in FO DS you w o rk                   LO D N J M P .E 0 0 0 :                                              ware, th e system text, e d ito r and th e BASIC
      w ith nam ed file s, not tra c k and s e c to r d ata or               0 0 3 0 LO D 0:JM P.EO O O :LO D P:JM P .E 000:                      s o ftw a re in te rfa c e . S e vera l c o m m a n d e x te n ­
       I.D. bytes. This m akes life a lo t easier. I've                      LO D R :JM P .E 000:                                                s io n s m ay also be in clude d. All th e n e c e s s a ry
      se e n som e d is c s y s te m s w h e re you have to                  0 0 3 5 LO D S:JMP.EOOO:LOD T:JM P ,E000:                           s tu ff like a p o w e r supp ly, th e K IM -4 in te rfa c e
      sp e c ify tra ck and s e c to r in fo a n d /o r I.D. bytes.          LO D V :JM P .E 000:                                                card, and all ca b le s and c o n n e c to rs are in ­
      W h a t a pain th a t can be!                                          0 0 3 5 LO D S:JMP.EOOO:LOD T:JM P .EOOO:                           c lu d e d . It to o k m e a b o u t 4 5 m in u te s to get
          If you ju s t w a nt to save a sou rc e file te m p o r­           LO D V :JM P .E 000:                                                th in g s up and ru n n in g the firs t tim e I p u t the
      arily, you can do th a t on w h at's know n as                         0 0 4 0 LOD W:JMP.EOOO:LOD XYZ: JM P.E000:                          system to g e th e r.
      “ s c ra tc h -p a d s ” . T here are tw o of th e s e on a            0 0 4 5 LO D EXCH:JMP.EOOO:LOD C O M P:                                  A d m itte d ly , a dual fu ll siz e d is c s y s te m from
      disc, “ s c ra tc h -p a d A" and “ s c ra tc h -p a d B” ,            JMP.E000:                                                           HD E is p ro b a b ly b e yo nd the m e ans of m ost
      each of these te m p o ra ry disc file s can hold up                                                                                       h o b b y is ts but if you o r your c o m p a n y is lo o k ­
                                                                                 R e m e m b e r the M O S /A R E S C O a s s e m b le r I
      to 1 6K or if “ B" is not used. "A " can hold one                                                                                          ing fo r a d y n a m ite 6 5 0 2 d e v e lo p m e n t s ys­
                                                                             re v ie w e d s e v e ra l is s u e s a g o ? W e ll HDE w e nt
      file up to 3 2 K in le ngth. T he only file s th a t can                                                                                   tem, I w o u ld rec o m m e n d th is one. I've used
                                                                             and fixed up all th e pro b le m areas th a t I
      be te m p o ra rily saved on s c ra tc h pad are file s                                                                                    the R o c k w e ll System 65 w h ile I w as at M OS
                                                                             m e n tio n e d in the re v ie w a nd th e n to o k it
      that have b ee n b u ilt using the s y s te m te x t                                                                                       and fe e l th a t d o lla r fo r d ollar, fe a tu re fo r
                                                                             s e v e ra l s te p s fu rth e r. The HDE a s s e m b le r is
      e d ito r.                                                                                                                                 fe a tu re , th e HDE sy s te m c o m e s out on top.
                                                                             an h o n e s t to g o o d n e s s tw o-pass a s s e m b le r
          B e in g a dye d in the w o o l as s e m b ly la n ­                                                                                   The only place the H D E s y s te m fa lls s hort
                                                                             w h ic h can a s s e m b le a n y w h e re in m em o ry u s ­
     g u a g e pro g ra m m e r. I really a p p re c ia te th e                                                                                  w hen s ta c k e d up next to the S ystem 6 5 is in
                                                                             in g m u ltip le s o u rc e file s from th e disc. The a s ­
      FO D S text e d ito r! This lin e o rie n te d e d ito r is                                                                                the a rea of pack a g in g . At th is po in t, th e re is no
                                                                             s e m b le r is an o p tio n a l part of the system .
     u p w a rd s c o m p a tib le w ith th e M O S /A R E S C O                                                                                 c a b in e t fo r th e disc d rives a va ila b le from HDE
     e d ito r but in c lu d e s a b o u t e v e ry th in g you                 If y o u 're th e kind of p e rs o n (as I am) w h o                  So far, I've got n o th in g but g o o d th in g s to
     c o u ld ask fo r in a lin e e d ito r. There is a fu ll and            e n jo y s having th e a b ility to c u s to m iz e , m o d i­      say a bo ut HD E and th e ir p ro d u c ts . E v e ry th in g
     s e m i-a u to m a tic lin e n u m b e rin g fe a tu re , lin e s       fy. a nd e x pa nd e v e ry th in g you ow n - yo u 'll             I've re ce ive d from them has b ee n in d u s tria l
     can b e e d ite d w h ile th e y a re b eing e n te re d or             e n jo y th e system e x p a n s io n a b ilitie s FO DS            qu a lity . That in c lu d e s th e ir d o c u m e n ta tio n
     re c a lle d and e d ite d la ter, s trin g s can be lo ­               has to offer. A d d in g a new c om m a nd is as                    and p ro d u c t supp ort. I'm very im p re s s e d w ith
     c a te d and s u b s titu te d , th e line nu m b e rs can              s im p le as w ritin g th e program , g iv in g it a                w h a t I've s een fro m th is c o m p a n y so far and
     be re s e q u e n c e d , the file size can be found,                   u n iq u e th re e le tte r nam e and s aving it to disc.           q u ite e n th u s ia s tic o v e r w h a t m y KIM has
     the hex a d d re ss of a lin e can be k now n and                       W h e n e v e r y o u ty p e th o s e th re e le tte rs the         b e c o m e sin c e a c q u irin g th e d is c sy s te m and
     c o m m e n ts can be a p p e n d e d to an a s sem bly                 sy s te m w ill firs t go th ro u g h its ow n c om m a nd          its a s s o c ia te d softw are.
     file a fte r it has been fo u n d c o rre c t. O ops! I                 table, see th a t its not th e re and then g o out                                                                             ERIC

      THANK YOU MR. REHNKE!
                H D E P R O D U C T S - B U IL T T O BE U S E D W IT H C O N F ID E N C E
                  A V A IL A B L E D IR E C T OR F R O M T H E S E F IN E D E A LE R S :
                                                                                                                                 LONG ISLAN D
JO H N S O N COMPUTER                 PLAINSM AN MICROSYSTEMS                                           ARESCO              COMPUTER GENERAL STORE LONE STAR ELECTRONICS
       Box 523                                       Box 1712                                P.O. Box 43                             103 A tlantic Avenue                                 Box 488
 Medina, Ohio 44 256                             Auburn. Ala. 36 8 3 0                   Audubon. Pa. 19407                         Lynbrook. N.Y. 11 563                        M anchaca. Texas 78 6 5 2
    216-72 5-4 560                                  8 0 0 -6 3 3 -8 7 2 4                      2 1 5-63 1-9 052                        51 6-88 7-1 500                                5 1 2 -2 8 2 -3 5 7 0
m

               1 m                 m           M                                      August 1979
                                                                                      Issue Number Fifteen

                               Table of C ontents
    APPLE II Serial O u tp u t Made Sim ple                               5                             Staff
         by Donald W. Bixby
                                                                          9                         Publisher.
    Extending the SYM-1 M onitor                                                                  Robert M. Tripp
         by Nicholas Vrtis
    Replace that PIA w ith a VIA                                         17                          Editor
         by E. D. Morris, Jr.                                                                    Shawn Spilman
    PET Cassette I/O •-                                                  19                    Business Manager
         by Ronald C. Smith                                                                      Maggie,E. Fisher,,
    TOKENS                                                               20
                                                                                              Circulation Manager
         by E. D. Morris, Jr.                                                                    Carol A. Stark
    A B etter LIFE fo r your APPLE                                       22
         by L. William Bradford                                                                    Distribution
                                                                                                 Eileen M,Enos
    EPROM for the KIM                                                    25   ;                 Jane.t Santaguida
         by William C. Clements, Jr.
                                                                         29   *                Micro-Systems Lab
    W hat’s Where in the APPLE
                                                                                               James R. Witt, Jr.
         by Prof. William F. Luebbert                                                           Stephen L. Allen
    The MICRO Software Catalog: XI                                   . 38
         by Mike Rowe                                                                            Comptroller -
                                                                                              ■ Donna M. Tripp
    Interfacing the Analog Devices 7570J A/D Converter                   40 "■
         by Dr. Marvin L DeJong                                                   MICRO™ Is published monthly by:
m   SYMple Memory Expansion                                              42
                                                                                     MICRO Ink, Ino. ’
                                                                                     34 Chelmsford Street
         by John M. Blalock                                                          Chelmsford, Massachusetts       ■
                                                                                     6177256-5515
    Define HIRES Characters fo r the APPLE II                            44       Mailing address for all correspondence, subscrip­
                                                                                  tions and address changes Is:
         by Robert F. Zant                                                           MICRO                        ’ >
                                                                                     P. o : Box 6502
    Common Variables on the APPLE II                                     47          Chelmsford, MA 01824 „ —•
         by Robert F. Zant                                                        Application to mail at second-class postage rates
                                                                                  Is pending at: Chelmsford,-MA 01824.
    6502 B ibliography: Part XII                                         53       Publication Number; COTR 3S5770
                                                                                  Subscription in United States:
         by Dr. William R. Dial                                                      $15.00 per year/12 issues.
                                                                                  Entire contents copyright © 1979 by:
    BAD Review                                                           49          MICRO Ink, Inc.
         by Robert M. Tripp

                                                    Advertiser’s Index

    AB Computers                                       52          Programma International                                   BC
    ARESCO                                             52          Progressive Software                                      28
    ComputerComponents                                  4          P.S. Software House                                       52
    Computer Forum                                     16          PYGMY Programming                                         24
    The Computerist, Inc.                           6,7,8          Rainbow Computing, Inc.                                  IFC
    The Computer Shop                                  21          RNB Enterprises                                           46
    Connecticut microcomputers                         39          SKYLES Electronic Works                                44,45
    Electronic Specialists, Inc.                       37          Softape                                                   50
    Elliam Associates                                  43          Softouch                                                  24
    Enclosures Group                                   56          SubLOGiC                                                  37
    EXCERT, Inc.                                       27          SYBEX                                                     48
    H. Geller Computer Systems                         18          Weldon Electronics                                      IBC
    Hudson Digital Electronics                          2          West Side Electronics                                     52
    Powersoft, Inc.                                  1,37

                                                     S a n a a ©
^ tn n r > ln                             ■■ See if you qualify for a CCI of 0C P/F Card
                S J f jf jK Z                        II   and get great discounts on selected
                f 9 ■                                      purchases for your Apple and PET.        ■

          we have the Most complete Stock of apple and
               PET Software in southern California.
                 (Send for our catalog — $1.00)
      16K RAM CHIP SET FOR APPLE li                                                                          Reference Books For a p p l e and p e t Owners
Tested & Burned in Only........................ $95.00                                                            Programming the 6502 ................................... 9.95
                                                                                                                  pet User Manual (New from Commodore). . . . 9.95
                WORKSHOPS: Call for details.                                                                      MOS Tech Programming Manual (6502)....... 12.00
       • PET—3rd Saturday of the Month                                                                            MOS Tech Hardware M anual..........................12.00
      • apple—4th Saturday of the Month                                                                           Hands On Basic w ith a P e t...........................14.95
     • Telecommunications Line fo r Apple                                                                         32 Basic Programs fo r the P e t .................. 14.95
       users with Modems, 714-898-1984.                                                                           6502 Applications H andbook.....................12.95
                                                                                                                  Pet Machine Language G uide................... 9.95
                                                                                 CLASSES: Apple Topics
   we offer a series of classes on Apple II to aquaint owners with some of the unique features and capabilities
of their system. Topics covered are Apple Sounds, Low Res. Graphics, Hi Res. Graphics, Disk Basics, and How to Use
                   Your Reference Material. Sessions are held every Thursday Night at 7:00 p.m.
  HARDWARE FOR APPLE II                                                                                       PET HARDWARE
    •  upper & Lower Case Board
       Now you can display both upper and lower case characters on                                            •   PET 2001-8 Computer standard PET with integral cassette
       your video w ith the Apple li. includes assembled circuit board                                            and calculator type keyboard 8K bytes of memory
                                                                                                                  (7167 n e t).............................................................................. $795.00
       and instructions.......................................................................... 49.95
    • P rogram m er A id e .................................................................. $50.00          •   PET 2001-16N Computer PET with 16K bytes o f memory
                                                                                                                  and large keyboard w ith separate numeric pad and
    PRINTER SPECIALS FOR APPLE AND PET                                                                            graphics on keys. External cassette optional.
                                                                                                                  (15,359 n e t)........................................................................... $995.00
    •    TRENDCOM100 w ith interface fo r Apple or PET                                        $450.00
                                                                                                              •   PET 2001-16B Computer As above but has standard type­
    • LITE PEN used w ith TV or m onitor screen...............................34.95                               w rite r keyboard. No graphic keys..................................... $995.00
    • ALF Music Synthesizer Boards.................................................. 265.00                   •   PET 2001-32N Computer identical to 2001-16N w ith 32K
    • APPLE Disk u tility (DOS 3.2)......................................................... 25.00                bytes of memory. (31,743 net)...................................... $1295.00
    • Supertalker................................................................................279.00       •   PET 2001-32B Computer Identical to 2001-32B with 32K
    • APPLE Clock..................................................................................195.00         bytes of memory. (31,743 net)...................................... $1295.00

    •    Anadex DP-8000 with tracter
         8" paper width and Apple in te rfa c e ....................................... S1050                 PERIPHERALS
    •    Centronics 779-2 fo r Apple li                                                                       •   PET 2022 Printer 80 column dot matrix printe r w ith plain
         With parallel in te rfa c e ......................................................... $1245.00           paper or forms handling tractor feed. Has full PET
                                SOFTWARE FOR APPLE II                                                             g raphics................................................................................$995.00
 PASCAL from Programma................................................                               49 95    •   PET 2023 Printer 80 column dot matrix printer. Plain
 FORTH............................................................................................. 49 95         paper printer w ith full PET graphics..................................$849.00
 lisp—from Apple Software Bk No. 3 ................                                                   n /c    •   PET 2040 Dual Drive Mini Floppy Disk* Dual drive intelligent
 lisa —interactive disk assembler....................................................... 34.95                    mini floppy system. 343K net user storage
 WHATSIT—Excellent conversational data base                                                                       capacity........................................................................... $1295.00
 manager...............................................................32K 100.00 48K 125.00
 SARGON—Champ of 2nd west Coast Computer Faire ........................19.95                                      •R etrofit kit required fo r operation w ith PET 2001-8.
 apple pie—Excellent text e d ito r ........................................................24 95
 FORTE—Music editor in hires.............................................................. 19.95              SOFTWARE FOR PET
 FASTGAMMON—Excellent backgammon game                                                                        Mirrors and Lenses...... . 19.95
 w ith g ra p h ics......................................................Tape 20.00 Disk 25.00                                                                    Checkers and Baccarat                     7 95
 apple 21—Excellent blackjack game ...................................................9 95                   The S tates....................... . 14.95           Chess................................. 19.95
 BRIDGE CHALLENGER—Computer b ridg e ..                                                              14 95   Real Estate 1 & 2 ........         . 59.95           Series and Parallel
 FINANCIAL MANAGEMENT SYSTEM                                                                                 Momentum and Energy . .19.95                         Circuit Analysis.................. 19.95
 • Accounts Payable                                      • Ledger Processing                                 Projectile M o tio n ......        .19.95            Home A c co u n tin g ............ 9 95
 • Accounts Receivable                                   • payroll                                           M ortgage....................      . 14.95           BASIC Math......................... 29.95
 • inventory Control                                     • $800 Complete                                     Dow Jones.............               .7.95           Game Playing w ith basic
 • $200 Each Package                                     • $10 fo r Manual                                   Petunia Player S ftw r....... . 14.95                vol. I, li, ill.................... 9.95 each

                                                                WHY SHOULD YOU BUY FROM US?
 Because we can help you solve yo u r problem s and answer your questions. We d o n 't claim to know
          everything, b u t we try to help our customers to the fu ll e xte n t o f o ur resources.
____________________                  —Prices subject to change —

        COMPUTER COMPONENTS OF ORANGE COUNTY
                              6791 Westminster Ave., Westminster, CA 92683                                                                     714-891-2584
              Hours: Tues-Fri 11:00 AM to 8:00 PM—Sat 10:00 AM to 6:00 PM (Closed Sun, Mon)
       Master Charge, Visa, B of A are accepted. No COD. Allow 2 weeks fo r personal check to clear.
 Add $1.50 for handling and postage. For computer systems please add $10.00 for shipping, handling and
                              insurance. California residents add 6% Sales Tax.
APPLE II Serial Output Made Simple
Is the APPLE II simple serial output as easy to im ple­
ment as
,. .   .
          everyone
               »
                    claims?
                     ...  ■
                             Almost!
                             •    i
                                      But ■a few helpful*                                                cD*inalt I i B!?b?i
                                                                                                       5 King Philip Trail
hints gleaned from this designer’s experience may get                                                   Norfolk,ma02056
that output port into service quite a bit sooner.

 When Apple sent the new Apple II            high. I replaced the Apple circuit with a     110 baud. Naturally I wanted the fastest
 Reference Manual (January 1978), I          single inverter (74LS04) driving an           speed. For any speed higher than 110
 jumped at the article on page 114, "A       RS-232 driver integrated circuit manu­        baud, 1 stop bit is used instead of 2. This
 Simple Serial O utput” . A printer output   factured by Motorola (MC1488L). This          is easily changed by w riting location
 was badly needed in my system. I built      worked fine.                                  $03C6 with 0A.
 the RS-232 output as described,                                                           The routine TTOUT4 causes a 9.091
                                             The only other hardware problem related
 typed in the program, borrowed a ter­                                                     msec, delay (1/110 baud = 9.091 ms).
                                             to page 115 in Apple’s manual. The state­
 minal from my place of business and                                                       For 300 baud, I needed 3.333 ms. This
                                             ment, “ The signal output connects to
 started things up.                                                                        was accomplished by changing location
                                             pin 3 of the DB-25 connector” , is con­
An oscilloscope on the RS-232 output         fusing. It is correct if you are connecting   03D4 from D7 to4E.
disclosed that the signal was reaching       it to a DB-25 connector, which is to be       The printer will now work at 300 baud
+ 12v, but going only slightly negative.     used with a standard RS-232 cable with        with three problems remaining. The first
                                             the other end of the cable connected to       was simple, the second took two weeks
The printer did work correctly, but I was
                                             the printer. The cable connects pin 3 at      to figure out and the third was minor.
concerned. Examination of the RS-232C
                                             the source end to pin 2 of the receiving
specification disclosed that the printer                                                   When a carriage return is transmitted,
                                             end. If you are connecting directly to the
on the data receiving end must have 3K                                                     the program sends the carriage return to
                                             printer, use pin 2, not pin 3.
input impedance. The printer manual                                                        the printer, then autom atically sends a
stated only that the impedance was “ at      Now the fun began. The printer I used         line feed to the printer, then waits 200
least” 3K. Since the Apple circuit was       can be operated at 110 baud, 150 baud,        ms for the carriage return to be com­
uses a 2.2K resistor to - 12v, the source    or 300 baud, front panel switch select­       pleted. My printer requires the 200 ms.
impedance, when negative, is much too        able. Apple’s program was all written for     dealy, but others will be different. For ex­
                                                                                           ample, the DECwriter requires no delay.
                                                                                           After speeding up to 300 baud, I was not
                                                                                           getting enough delay. I changed location
                                                                                           03AC from 58 to FF, an arbitrary choice,
 10 REM PRINTER TEST AND MODIFY PROGRAM IN APPLESOFT BASIC                                 and this problem was fixed.
 15 CALL -936:PRINT:PRINT
                                                                                           The program is supposed to detect when
20 INPUT "110 OR 300 BAUD";A
30 IF As 110 THEN 70                                                                       the next column to be printed, COLCNT,
40 POKE 868,10                                                                             exceeds the number of columns avail­
50 POKE 882,78                                                                             able, WNDWDTH, and then transmit an
52 PRINT:INPUT "200 OR 0 MS CARRIAGE RETURN DELAY";M                                       automatic CR, LF, and delay. It won’t,
54 IF M=200 THEN M=255                                                                     it can’t and it didn’t. The intention of the
60 POKE 843,M                                                                              Apple program routine, FINISH is to
70 PRINT:INPUT "HOW MANY CHARACTERS TO A LINE";N                                           make CH equal to 39 and'then depend on
80 POKE 787,N                                                                              the system m onitor routines to generate
90 PRINT:PRINT                                                                             the CR, LF and delay. This doesn’t work.
 100 PRINT N;"CHARACTERS TO A LINE"                                                        I have modified their program to make
110 IF A*300 THEN 220                                                                      this happen w ithin the TTY routines. If
120 POKE 868,11                                                                            COLCNT equals or exceeds WNDWDTH,
130 POKE 882,215                                                                           the program branches to RETURN. This
132 PRINT:INPUT "200 OR 0 MS CARRIAGE RETURN DELAY";M                                      causes a carriage return and then
 134 IF M*200 THEN M=88                                                                    branches to AUTOLF, the same section
140 POKE 843,M                                                                             of program used for autom atic line feed
220 PRINT .'PRINT:INPUT "CHARACTERS TO BE PRINTED" ;A$                                     and delay by Apple.
230 PRINT:PRINT:PRINT A*
                                                                                           The last problem encountered involved
240 PRINT .'PRINT: PRINT "OUTPUT IS NOW GOING TO THE PRINTER AT A"; A; "BAUD
RATE"                                                                                      getting out of the printer routines and
250 CALL 778                                                                               back to the video display. New code was
260 FOR J=1 TO 10                                                                          written to solve this problem.
270 PRINT A$                                                                               The new program, shown here, has been
280 NEXT J                                                                                 relocated to addresses 30A through
300 CALL 914                                                                               3A2. W ith all the components, I believe
310 PRINT-.PRINT                                                                           it is self explanatory. I also wrote an
320 INPUT "CONTINUE (Y OR N)";B$                                                           A pplesoft BASIC program to modify and
330 IF B$r"Y" THEN 230                                                                     test the machine language program.
340 END

August, 1979                                       M IC R O -Th e 6502 Journal                                                   15:5
MICRO-WARE ASSEMBLER 65XX-1.0 PAGE 01
/   r—
                                                                              tm
                                                                                        FOR
                                                              P i« J 3
                                                                             AIM/SYM/KIM                                 RS-232 DRIVER ROUTINES
                                                                  8K STATIC RAM Pqwer                                    REVISED 3-30-79 BY DONALD W. BIXBY
                                                                                                                         REVISED 6-6-79 BY MICRO STAFF
                                                                  Sockets for 8K Eprom
                                                                                                                         TO CALL TTINIT FROM SYSTEM MONITOR: •
0540: 033D 85 3E                      STA     A2L
                                                                                                                                       0550: 033F A5 6E                      LDA     $006E
/ r                                                              b y C om m o d o re                                                   0560: 0541 85 3F                      STA     A2H
                                                                                           The O r ig in a l 6502 System
                                                                                                                                       0570: 0343 A0 00                      LDYIM   $00
                                                                                                                                       0580: 0345 20 2C FE                   JSR     $FE2C    USE MONITOR MOVE ROUTINE
                                                                                                                                                                             SEC              COMPUTE DISPLACEMENT
              20 m A C u rre n t Loop TTY In te rfa c e
                                                                                                                                       0590: 0348 38
                                                                                                                                       0600: 03*19 A5 6B                     LDA     $006B    TO ARRAYS
                                      A u d io C assette In te rfa c e                                                                 0610: 03*16 E5 69                     SBC     $0069
                                                                                                                                       0620: 034D 85 1C                      STA     EL
              15 User I/O lines
                                                                                                                                       0630: 034F A5 6C                      LDA     $006C
                                      2 In te rv a l Tim ers                                                                           0640: 0351 E5 6A                      SBC     $006A
                                                                                                                                       0650: 0353 85 1D                      STA     EH
              1 K - RAM                                                                                                                                                                       BACK TO BASIC
                                                                                                                                       0660: 0355 60                         RTS
                                       2K K IM M o n ito r R O M                                                                       0670:                                                                   •
                                                                                                                                                                             LDA     CL      •••ENTRY 770 - RECALL VARIABLES
                                                                                                                                       0680:    0356 A5 1A                                                  RECJ
              H ex K e ypad/LED D is play
                                                                                                                                       0690: 0358 85 3C                      STA     AIL     SET UP MOVE
                                                                                                                                       0700: 035A A5 1B                      LDA     CH
                                                                                                                                       0710: 035C 85 3D                      STA     A1H
                                                                                                                                       0720: 035E A5 18                      LDA     DL
                                                                                                                                       0730: 0360 85 6F                      STA     $006F START OF STRINGS
                                                                                                                                       0740: 0362 85 3E                      STA     A2L
                                                              The Ultimate Enclosure                                                   0750: 0364 A5 19                      LDA     DH
                                                                                                                                       0760: 0366 85 70                      STA     $0070
                                                                     for the KIM-1                                                                                           STA     A2H
                                                                                                                                       0770: 0368 85 3F
                                                                             P rotec ts Y o ur K IM -1                                 0780: 036A A5 69                      LDA     $0069 START OF NUMERICS
                                                                                                                                       0790: 036C 85 42                      STA     A4L
                                                                             N eat, A ttra c tiv e , P rofessional
                                                                                                                                       0800: 036E A5 6A                      LDA     $006A
                                                                                 F u ll A ccess to th e Expansion a n d                0810: 0370 85 43                      STA     A4H
                                                                                 A p p lic a tio n C on ne ctors
                                                                                                                                        0820: 0372 A0 00                     LDYIM $00
                                                                                                                                        0830: 0374 20 2C FE                  JSR     $FE2C USE MONITOR MOVE ROUTINE
                                                                  Enhances th e LED D is p la y w ith a Red Lense
                                                                                                                                        0840: 0377 18                        CLC             COMPUTE START
                                                                           R oom fo r th e K IM -1 a n d O ne
                                                                                                                                        0850: 0378 A5 69                     LDA     $0069 OF ARRAYS
                                                                           A d d itio n a l 8 o a rd such as
                                                                                                                                        0860: 037A 65 1C                     ADC     EL
           ENCLOSURE PLUS                                                  M E M O R Y PLUS o r V ID E O PLUS.
                                                                                                                                                                                     $006B
                                                                                                                                        0870: 037C 85 6B                     STA
           for KIM: $30°°                                                                                                                                                     LDA     $006A
                                                                                                                                        0880: 037E A5 6A
                                                                                                                                        0890: 0380 65 1D                      ADC    EH
                                                                                                                                        0900: 0382 85 6C                      STA     $006C
                                                            by R o c k w e ll In te rn a tio n a l
                                                                                                                                                                              SEC             COMPUTE END OF NUMERICS
                                                                                                                                        0910: 0384 38
                                     m                                            T he C o m p le te 6502 S ystem
                                                                                                                                        0920: 0385 A5 6F                      LDA     $006F
                     20 C o lu m n T he rm a l P rin te r                                                                               0930: 0387 E5 1A                      SBC     CL
                                                                                       H ig h Speed A u d io Cassette
                                                                                                                                        0940: 0389 85 6D                      STA     $006D
        20 C h a ra c te r LED D isplay
                                                                                                                                        0950: 038B A5 70                      LDA     $0070
                                                                                                     U p to 4K R A M o n b o a rd
                                                                                                                                        0960: 038D E5 1B                      SBC     CH
                                                                                                                                        0970: 038F 85 6E                      STA     $006E TEMP STORAGE
                                                                                                                                        0980: 0391 18                         CLC
                                                                                                                                        0990: 0392 A5 6D                      LDA     $006D
                                                                                               U p to 12K a d d itio n a l R O M        1000: 0394 65 69                      ADC     $0069
                                                                                                                                         1010: 0396 85 6D                     STA     $006D TEMP VALUE
                                                                                  V e rs a tile 8K R O M M o n ito r
                                                                                                                                         1020: 0398 A5 6E                     LDA     $006E
                                                                                                                                         1030: 039A 65 6A                     ADC     $006A
                              A IM    65: $37500 1K R A M -S 4 2 0 0 0 4 K R A M                                                         1040: 039C 85 6E                     STA     $006E TEMP VALUE
                                                                                                                                         1050: 039E A5 6D                     LDA     $006D SUBTRACT ONE
                                                                                                                                         1060: 03A0 DO 02                     BNE     A2
                                                                                                                                         1070: 03A2 C6 6E                     DEC     $006E END OF NUMERICS
                                                                                                                                         1080: 03A4C6 6D                      DEC     $006D                   A2
                                                                                                                                         1090: 03A6 60                        RTS             BACK TO BASIC
        ENCLOSURE                                                                                                                        0030-                                   * ROUTINE TO SAVE AND RECALL
           WITH BUILT IN                                                                                                                 0040:                         * COMMON VARIABLES FOR INTEGER BASIC
                                                                                                                                         0050-                                     * PROGRAMS ON THE APPLE II
        POWER SUPPLY
                                                                                                                                         0060:                                                                 *
        SPECIFICATIONS:                                                                                                                  0070.                         « WRITTEN 03/16/79 BY ROBERT F. ZANT
        INPUT: 110/220 VAC 50/60 Hz                                                                                                      0080•                             » MODIFIED 7/4/79 BY MICRO STAFF
        OUTPUT: +5V ® 5A                                                                                                                                               ■
                   + 24V ® 1A                                                                                                           0090:
                                                                                                                                        0 1 0 0 : 0 318                CL      •       $001A
        GROUNDED THREE-WIRE LINE CORD
                                                                                                                                                                       CH      ■       $001B
        ON/OFF SWITCH WITH PILOT LIGHT                                                                                                  0 1 1 0 : 0318
        Enclosure has room lor the AIM and one                                                                                          0 1 2 0 : 0302                         ORG     $0302
        additional board: MEMORY PLUS or VIDEO PLUS
                                                                                                                                        0130:    0302     4C   OF 03           JMP     RECALL •••ENTRY 770
                                                                                                                                        0140:    0305     00                   BRK
         AIM PLUS: $100°°                                      AIM and AIM PLUS: $475°°                                                                                        LDA     $00CC •••ENTRY 774 - SAVE VARIABLES
                                                                                                                                        0150:    0306     A5   CC
                                                                                                                                        0160:    0308     85   1A              STA     CL      SAVE END OF
                                                   6 7 7 / 2 5 6 -3 6 4 9                                                               0170:    030A     A5   CD              LDA     $00CD VARIABLE TABLE
                                                                                                                                        0180:    030C     85   1B              STA     CH
                                                                                                                                        0190:    030E     60                   RTS             BACK TO BASIC
                                                                                                                                        0200:
                                                                                                                                                                       RECALL LDA     CL       ENTRY 770 - RECALL VARIABLES
                                                                                                                                        0210:    030F     A5   1A
                                                                                                                                        0220:    0311     85   CC             STA     $00CC    RESET END OF
                                                                                                                                                                              LDA     CH       VARIABLE TABLE
                                          PO Box 3                                                                                      0230:    0313     A5   IB
                                                                                                                                        0240:    0315     85   CD             STA     $00CD
                                   S Chelmsford. (Tlfl OI824                                                                                                                  RTS              BACK TO BASIC
                                                                                                                                        0250:    0317     60

                                                                                                                                                                                                                  15:7
                                                                                                                                MICRO - The 6502 Journal
      August, 1979
032C   A9 A0             LDAIM $OOAO PRINT A SPACE
 032E   2C 09 03   TESTCT BIT    RTS1    IS CHARACTER A CONTROL?
 0331   F0 03              BEQ   PRNTIT IF SO, BRANCH TO PRINT IT
 0333   EE 07 03           INC    COLCNT IF NOT, INCREMENT COLUMN COUNT      A ll In c lu d e th e F o llo w in g Features:
 0336   20 5F 03   PRNTIT JSR    DOCHAR PRINT THE CHARACTER
 0339   68                 PLA           RESTORE CHARACTER                   ALL M E T A L H EAVY D U TY CASE

 033A   48                 PHA           AND PUT BACK ON THE STACK           O N /O F F S W ITC H an d P ILO T LIG H T

 033B   90 E6              BCC    TT0UT2 DO MORE SPACES FOR TAB CHAR
                                                                             11 5 /6 0 H r o r 230/50HZ IN P U T
 033D   49 0D              E0RIM $000D CHECK FOR CARRIAGE RETURN
 033F   0A                 ASLA          ELIMINATE PARITY                    G R O U N D E D THREE-WIRE

 0 3 ^0 DO 0D              BNE    FINISH DONE UNLESS HAVE CARRIAGE RETU      POWER C O R D

 0342 8D 07 03     AUTOLF STA     COLCNT CLEAR COLUMN COUNTER                POW ER PLUS 5: + 5V at 5A, ± 1 2 V a t 1A S7500
 0345 A9 8A                LDAIM $008A                                       POW ER PLUS SUPER 5: + 5V at 10A , ± 12V a t 1A $9500

 0347 20 5F 03             JSR    DOCHAR PRINT A LINE FEED                   POW ER PLUS 5/24: + 5 V a t 5A, + 2 4 a t2 .5 A , ± 1 2V a t 1A $95

 034A A9 58                LDAIM $0058
 034C 20 A8 FC             JSR   VIAIT   200 MS DELAY FOR CR LF
 034F AD 07 03     FINISH LDA     COLCNT
 0352 F0 07                BEQ    SETCH BRANCH IF COLUMN COUNTER = 0
 0354 E5 21                SBC   WNDWDT ELSE SUBTRACT WINDOW WIDTH
 0356 B0 30                BCS    RETURN RETURN IF IN THE MARGIN              SPECIFICALLY DESIGNED FOR THE A IM 65
 0358 AD 07 03             LDA    COLCNT
                                                                                  Sm all Enough to Fit In sid e th e A IM Enclosure
 035B 85 24        SETCH STA      CH     STORE NEW VALUE IN CH
 035D 68                   PLA           RESTORE THE STACK                        Enough Pow er fo r th e A IM 65 F u lly Loaded

 035E 60                   RTS           RETURN FROM TTOOT
                                                                                  Plus an A d d itio n a l Bo ard
 035F 8C 08 03     DOCHAR STY     YSAVE ROUTINE TO PRINT A
 0362 08                   PHP           CHARACTER                                W orks on 1 15 V /60 H r o r 230V/50HZ

 0363 A0 0B                LDYIM $000B FOR 11 BITS                                Provides R egulated + SV at 5A an d + 24V at 1A

 0365 18                   CLC           (2 STOP BITS)
                                                                                 G rou nd ed T hree-W ire Pow er C ord
 0366 48           TT0UT3 PHA                                                                                                         POWER A PLUS: $50°°
 0367 B0 05                BCS    MARK0U                                         O N /O F F S w itch a n d P ilo t Light

 0369 AD 59 CO             LDA    SPACE SEND A SPACE
 036C 90 03                BCC    TTOUT4
 036E AD 58 CO     MARK0U LDA     MARK   SEND A MARK
 0371 A9 D7        TT0UT4 LDAIM $00D7 DELAY 9.091 MS FOR 110 BAUD
 0373 48           DLY1    PHA
 0374 A9 20                LDAIM $0020                                                                            ALL THE POWER A
                   DLY2    LSRA                                                                                   KIM-1/SYM-1 NEEDS
 0376 4A
 0377 90 FD                BCC    DLY2                                                                                                     N e a t, C o m p a ct, E co n o m ica l

 0379 68                   PLA                                                                                                             Thousands in Use

 037A E9 01                SBCIM $0001                                                                                                     IN P U T : 115V/60H Z

 037C DO F5                BNE    DLY1                                                                                                     O U T P U T S : R eg u la te d + 5 V a t 1 . 4 A
                                                                                                                                                                         + 12V at 1.0A
 037E 68                   PLA                                                                                                                   U n re g u la te d + 8V u p to 4.3A
                                                                                                                                                                    + 16V u p to 1.0A
 037F 6A                    R0RA         NEXT BIT
 0380 88                   DEY           DECREMENT Y                                                                                       W ill Pow er a KIM -1/SYM -1 a n d on e
                                                                                                                                           A d d itio n a l Bo ard
 0381 DO E3                BNE    TT0UT3 IF Y IS NONZERO,                                                                                  Such as M E M O R Y PLUS o r V ID E O

 0383 AC 08 03             LDY    YSAVE DO THE NEXT BIT                                             POWER PLUS: $40°°                      PLUS

 0386 28                   PLP
 0387 60                    RTS           RETURN FROM DOCHAR
 0388 A9 8D         RETURN LDAIM $008D
 038A 20 5F 03              JSR   DOCHAR PRINT CARRIAGE RETURN
 038D A9 00                 LDAIM $0000
 038F 4C 42 03              JMP   AUTOLF                                        SUPERSCOPE C-190
 0392 A9 F0         VIDINI LDAIM $OOFO POINT TO VIDEO DISPLAY R0UTIN1           by Marantz
 0394 85 36                 STA    CSWL   LOW ORDER BYTE                        A H ig h Q u a lity Cassette R ecorder
 0396 A9 FD                 LDAIM $00FD                                         w ith a ll o f th e Features R eq uired
                                                                                fo r M ic ro c o m p u te r Systems:
 0398 85 37                 STA    CSWH   HIGH ORDER BYTE
 039A A9 28                 LDAIM $0028                                         V U M e te r D isplays R e co rd in g Level

  039C 85 21                STA   WNDWDT 40 COLUMN WINDOW WIDTH                 110V AC o r 6#VD C o r B a tte ry O p e ra tio n

 039E A9 00                 LDAIM $0000                                         Tape L o c a tio n C o u n te r

  03 A0 85 24               STA    CH     SET HORIZONTAL CURSOR                  T hree R eco rd ing M e th o d s

                            RTS           TO 0 AND RETURN FROM VIDINIT          V a ria b le Speed C o n tro l: - 20 %             SUPERSCOPE C-190: $90°°
  03A2 60
                                                                                 R em ote C o n tro l Leaves E le ctro n ics O N

                                                                                                                         6 1 7 / 2 5 6 -3 6 4 9
SYMBOL   TABLE 2000 209C
AUTOLF   0342    CH      0024    COLCNT   0307   CSWH     0037
CSWL     0036    DLYQ    0373    DLYR     0376   DOCHAR   035F
                                                                                                      (g(gMPyT§[s)0©T
FINISH   034F    MARK    C058    MARK0U   036E   PRNTIT   0336
RETURN   0388    RTSQ    0309    SETCH    035B   SPACE    C059
TESTCT   032E    TTINIT 030A     TTOUT    0321   TTOUTR   0323                                                  PO Box 3
TTOUTS   0366    TT0UTT 0371     VIDINI   0392   WAIT     FCA8                                           S Chelmsford, mfl OI824
WNDWDT   0021    YSAVE 0308

                                                  MICRO - The 6502 Journal                                                                                         August, 1979
 15:8
Extending the SYM-1 Monitor
  A program relocator, a program listing utility and a                                                         Nicholas vrtis
  selective, extended trace routine illustrate how true                                                    5863%°netSree s!e.
  monitor extensions can implement additional functions                                                  Kentwood, mi 49508
  and commands.

    When Synertek wrote the monitor for          my system, but then I decided to change          Before I go into a discussion about
 the SYM-1, they left it open-ended by           it to low memory.                             the programs, I would like to mention the
 vectoring many of the major functions                                                         interfaces to the SYM m onitor that are
 through a system RAM vector table. By              Almost everyone has scratch memory         used, and a few that aren’t but are sort
 changing the addresses in the vector            there to work on a program. After you         of handy anyway. The programs them­
 table, it is relatively easy to implement       enter it, check the memory dump, and          selves are not complicated, and I try to
 additional functions and commands.              run a few tests; you can use the program      keep them pretty well commented.
                                                 to relocate itself!
    The three routines described in this ar­                                                      The SYM manual contains a small ex­
 ticle are almost permanently resident in           Actually, what you have to do is block     ample showing how to add a command
 my system. They have been coded as              move the program to the desired ad­           to the monitor, but isn ’t really clear
 true m onitor extensions in that they use       dress and use the new UO command to           about how it works. For one thing, the
 only addresses already allocated to the         perform the relocation on the new copy.       monitor uses the unrecognized com­
 monitor and could easily be put into            Tell it the correct FROM and TO address,      mand vector for more than just the UO
 ROM.                                            but make the program starting address         through U7 user commands. It does a
                                                 the new location. There are three loca­       jump via this vector whenever it en­
    The programs are not complex or              tions that must be changed manually,          counters a command it cannot process,
 large, but that is also one of their good       and you are all set up.                       or a character that is non-hex.
 points. I have them sitting up in high
 memory where they are out of the way
 but available when needed.                                     MICRO-WARE ASSEMBLER 65XX-1.0 PAGE 01

    The first program is a modified ver­
 sion of one that appears in The First
 Book o f KIM. It is a program relocator         0010
 that adjusts all the branches, jumps, and       0020
 absolute address locations in a program         0030                       SYM-1 USER MONITOR FUNCTION EXTENSIONS
 so that you can relocate it. It is really the   0040                            MODIFIED 7/3/79 BY MICRO STAFF
 next best thing to a relocating loader.         0050                       UO - RELOCATE PROGRAM
                                                 0060                            P1 r FROM ADDRESS
                                                 0070                            P2 = TO ADDRESS
    The second routine is a little program
                                                 0060                            P3 = START OF PROGRAM
 lister that prints your program, putting        0090                       U1 - MINI-PROGRAM LISTER
 one instruction on each line. This is           0100                            P1 = PROGRAM STARTING ADDRESS
 easier to read and check than the stan­         0110                            P2 = PROGRAM ENDING ADDRESS
 dard Verify or Paper tape formats.              0120                       --- USER TRACE ROUTINE           Y-X-A-FLAGS-STACK
                                                 0130                            A626 = INCLUSIVE TRACE STARTING ADDRESS
    Finally, there is an extended trace          0140                            A62C = EXCLUSIVE TRACE ENDING ADDRESS
  routine that displays the values of all the    0150
 registers, and additionally allows you to       0160                       SYM COMMAND 'E 20O' WILL SET UP VARIOUS ADDRESSES
 specify that only a portion of your pro­        0170                       AND VALUES FOR THESE EXTENSIONS
 gram is to be traced. Did you ever              0180
 wonder what was happening to the                0190    0200                    ORG   $0200
 registers when one of your subroutines          0200    0200 53          INITCO =     $53     STORE "SD" USER ROUTINE VECTOR
                                                 0210    0201 44                       $44
 is executed only five times in a two thou­
                                                 0220
 sand repetition loop? This utility lets you
                                                 0230                     * CHANGE THE FOLLOWING WHEN RELOCATING THE PROGRAM
 determine just that. There is a price that      0240
 is paid, but I will get to that later.          0250    0202   32                     $32     STORE "22C” AND CHANGE
                                                 0260    0203   32                     $32     IF ADDRESS CHANGES
   If you have looked at the program             0270    0204   43                     $43
code yet, you may have wondered at the           0280    0205   2C                     $2C     STORE ",A66D"
unusual address. After all, who ever puts        0290    0206   41                     $41
an extension in low memory? When I               0300    0207   36                     $36
decided to write this article, I intended        0310    0208   36                     $36
to use addres $C00, where I have it on           0320    0209   44                     $44

August, 1979                                            MICRO - The 6502 Journal                                                  15:9
0330:   020A    OD                   =         $0D                                                                This means that it gets used for a lot
 0340:   020B    4D                   =         $4D       STORE "MA658" AND CHANGE                               of junk in addition to the defined user
 0350:   020C    41                   =         $41       MAX RECORD                                             commands. It also means that you can
 0360:   020D    36                   =         $36       TO BE
                                                                                                                 use characters other than Un as com­
 0370:   020 E   35                   =         $35       TWENTY-FOUR
                                                                                                                 mand extensions, if you want, as long as
 0380:   020F    38                   =         $38       BYTES LONG
                                                                                                                 they are not used for valid SYM com ­
 0390:   0210    OD                   =         $0D
                                      =                   STORE "18"
                                                                                                                 mands with the same number of para­
 0400:   0211    31                             $31
                                      =         $38
                                                                                                                 meters.
 0410:   0212    38
 0420:   0213    0D                   =         $0D
 0430:   0214    53                             $53       SET TRACE VECTOR                                          The monitor saves the command value
 0440:   0215    44                   =         $44                                                              in a location called LSTCOM. When a
 0450:   0216    38                   =         $38       STORING STRING "SD80C0,A67A"                           carriage return is entered, the monitor
 0460:   0217    30                   =         $30                                                              reloads the command into the A register
 0470:   0218    43                             $43                                                              and loads the number of parameters into
 0480:   0219    30                             $30                                                              X.
 0490:   021A    2C                   =         $2C
 0500:   021B    41                             $41                                                                 So, the first thing our monitor exten­
 0510:   021C    36                   =         $36                                                              sion should do is check the character in
 0520:   021D    37                   =         $37                                                              A against the value in LSTCOM. If they
 0530:   021E    41                   =         $41
                                                                                                                 are the same, the program was called
 0540:   021F    OD                   =         $0D
                                      =                   STORE "SD"
                                                                                                                 after normal command term ination. If
 0550:   0220    53                             $53
 0560:   0221    44                   =         $44                                                              they are different, the command was not
                                                                                                                 terminated properly and we want to
 0570:
                                                                                                                 make sure the carry is set and return
 0580:                      • CHANGE THE FOLLOWING WHEN RELOCATING THE PROGRAM                              *
 0590:
                                                                                                                 with an RTS instruction.
 0600:   0222    33                   -    $33        STORE "341" AND CHANGE IF ADDRESS
 0610:   0223    34                   =    $34                                                                     This will cause the monitor to print the
 0620:   0224    31                   =    $31                                                                   standard “ ER xx” message and return to
 0630:   0225    2C                        $2C        STORE ",A6?4"                                              command mode.
 0640:   0226    41                z       $41
 0650:   0227    36                =       $36                                                                      Once we know that the command was
 0660:   0228    37                =       $37                                                                   terminated properly, we have to deter­
 0670:   0229    34                        $34                                                                   mine which command it was. As I men­
 0680:   022A    OD                =       $0D                                                                   tioned earlier, the monitor does not
 0690:   022B    00                        $00        ZERO IS END OF EXEC REQUEST                                verify the command character as it is
 0700:                      fft«*f*fff* * • * * * * * * * • * • * * * * • • » * • » * * * « * • • * * * • • *
                                                                                                                 entered, so we could be here for any­
 0710:                      • PAGE ZERO ADDRESS LOCATIONS                                                    •   thing, including a “ valid” command with
0720:
                                                                                                                 the wrong number of parameters.
0730:
0740:    022C               CURAD     «        $00FE      SYM-1 "OLD ADDRESS LOW ORDER
0750:    022C               CURADK    •        $00FF      AND HIGH-ORDER                                            Finally, if we are on the right com­
0760:    022C               ADJUST    «        $00FC      SYM-1 PAGE ZERO SCRATCH AREA LOW-OF                    mand, and if it was terminated properly,
0770:    022C               ADJUSH    •        $00FD      AND HIGH ORDER                                         the last check is to make sure that exact­
0780:                                                                                                            ly the correct number of parameters has
0790:                       •    BY JIM BUTTERFIELD (SEE "THE FIRST BOOK OF KIM")                          •     been entered. If not, there will be miss­
0800:                       «    MODIFIED BY N. VRTIS TO RUN AS MONITOR                                    *     ing information, or information will be in
0810:                       •         EXTENSIONS ON THE SYM-i                                              *     the wrong place. For any errors, all the
0820:                       f                                                                              *     extension has to do is guarantee that
0830:                       «    THIS PROGRAM ADJUSTS ABSOLUTE AND RELATIVE                                «     the carry is set and return to the monitor
0840:                       •    ADDRESSES OF A PROGRAM SO IT CAN BE RELOCATED                             «     with an RTS instruction.
0850:                       •    OR EXPANDED                                                               f
0860:                       •    > > » > NOTES                                                             •
                                                                                                                   As an aside, the command processor
0870:                       •       1- PAGE ZERO REFERENCES ABOVE $8000 WILL NOT                           «
                                                                                                                 does not initialize the stack register, and
0880:                       •            BE CHANGED UNLESS SPECIFIED AS ABSOLUTE                           «
0890:                       «            THREE -BYTE INSTRUCTIONS                                          «
                                                                                                                 so, if you are debugging an extension
0900:                       «       2- ANY REFERENCES ABOVE $8000 WILL NOT BE                              «     and stop it before the RTS to the
0910:                       «            CHANGED                                                           *     monitor, you can quickly use up a lot of
0920:                       «       3- PROGRAM STOPS WHEN IT FINDS AN ILLEGAL                              •     the stack area. This only hurts if you
0930:                       •            OPERATION CODE (CAN USE $FF)                                      *     have a routine or two located there, as I
0940:                       «       4- DON'T RELOCATE DATA                                                 «     usually do.
0950:                       *                                                                              *
0960:                       • INPUT PARMS                                                                  •        The manual claims that locations $F8
0970:                       •       PARM1 - RELOCATE FROM ADDRESS                                          «     through $FF are reserved for monitor
0980:                       *               (FIRST OPCODE THAT WILL MOVE)                                  «     use. Did you ever wonder what they are
0990:                       •       PARM2 - RELOCATE TO ADDRESS (WHERE PARM1                               *     used for? Unfortunately, these locations
1000:                       *               WILL BE MOVED TO)                                              *     were not assigned a variable name in the
1010:                       «       PARM3 - PROGRAM START ADDRESS (FIRST                                   «     monitor assembly, so there are no cross
1020:                       *               INSTRUCTION IN PROGRAM                                         *     references to them in the listing. I have
1030:
                                                                                                                 tracked down most of the applications,
1040:    022C    CD 57 A6          CMP        LSTCOM SEE IF COMMAND TERMINATED PROPERLY
1050:    022F    F0 02             BEQ        JO
                                                                                                                 but I don’t guarantee that I didn’t miss
                                                     YES — SEE WHICH COMMAND
1060:    0231    38         COMERR SEC               ELSE SET CARRY AS ERROR FLAG                                one.
1070:    0232    60                RTS               AND RETURN TO MONITOR FOR ER XX
1080:                                                                                                              The most used locations are probably
1090:    0233 C9 14         U0       CMPIM >14    MAKE SURE IT IS "U0"                                           $FE and $FF. These are the locations
1100:    0235 F0 03                  BEQ   UOCOMM BRANCH IF IT IS

 15:10                                                               MICRO - The 6502 Journal                                              August, 1979
that the m onitor uses for almost all of         1110:: 0237 4C DE 02               JMP   U1     GO TRY AS U1 COMMAND
 it’s indirect addressing. If you look at the     1120:; 023A E0 03           UOCOMM CPXIM $03    MAKE SURE HAVE THREE PARMS

                                                         (\J
                                                         tjO
 command descriptions, this is where the                      DO F3                  BNE   C0MERR BRANCH FOR ERROR IF NOT

                                                          O
                                                  1130:

                                                         o
 “ OLD” address is kept.                          1140:
                                                  1150:                       • NOW COMPUTE THE ADJUSTMENT INCREMENT
    These programs use it in the same             1160:
 manner that the monitor does. It’s im­           1170: 023E 38                       SEC             SET BORROW
 possible to display these locations via          1180: 023F AD 4C A6                 LDA    P2L      GET LOW-ORDER "TO"
 the monitor commands directly, but do­           1190: 0242 ED 4E A6                 SBC    P 1L     CALC DIFFERENCE
                                                  1200: 0245 85 FC                    STA    ADJUST   SAVE IN PAGE ZERO LOW-ORDER
 ing a Verify or Memory will show you
                                                  1210: 0247 AD 4D A6                 LDA    P2H      SAME FOR HIGH-ORDER
 what they are pointing to. Also, if you          1220: 024A ED 4F A6                 SBC    P1H
 plan to use them, none of the monitor            1230: 024D 85 FD                    STA    ADJUSH   IT GOES INTO PAGE ZERO ALSO
 routines w ill change them, but almost           1240:
 any command will.                               1250:                        * NOW PUT PROGRAM POINTER Tu PACE ZERO
                                                 1260:
    Another important pair of locations is       1270: 024F 20 A7 e2                  JSR    P3SCH
 $FA and $FB. These contain the address          1280:
 of the next byte to be obtained as input        1290:                       * GET AN CPCODE HERE                                        *
 when processing in the execute mode. If         1300:
 your program modifies these locations,          1310:
 it can’t be invoked from the execute            1320: 0252 20 24 03         GETOP    JSR    DETLEN FIND OPCODE LENGTH AND TYPE
 mode.                                           1330: 0255 30 07                     BMI    TRIPLE MINUS IS LENGTH 3 OR BAD TYPE
                                                 1340: 0257 F0 2A                     BEQ    BRANCH ZERO IS A BRANCH
                                                 1350:
    As another aside about the execute
                                                 1360:
 mode, all input comes from RAM, so if           1370:                       • HERE, WE HAVE TO SKIP FORWARD TO NEXT OPCODE              *
 you do a JSR INCHR and expect to get            1380:
 keyboard input while in execute mode it         1390:
 w on’t work. The execute command is the         1400: 0259 20 n 03          SKIP 1   JSR   ADVANC
 only one that modifies these addresses.         1410: 025C F0 F4                     BEQ   GETOP AND THEN GO GET THE NEXT OPCODE
 The other locations are pretty much             1420:
 scratch locations; you can probably use         1430:
 them without affecting command opera­           1440:                       » GOT A 3 BYTE OPCODE / ILLEGAL / OR END (SPECIAL)          *
 tion, but I would not count on them be­         1450:
 ing the same after any call to monitor          1460:
 service routines.                              1470: 025E C8                TRIPLE INY            BUMP Y BY ONE
                                                 1480: 025F F0 OF                   BEQ     FIX3BY IF NOW ZERO IT IS A 3 BYTER
    The cassette routines use $FC and           1490:
                                                1500 : 0261 20 16 83         QblTDO JSR     CRLFSZ OUTPUT LAST ADDRESS
 $FD, as does the block move command.
                                                1510: 0264 20 42 83                 JSR     SPACE FOLLOWED BY A SPACE
 Terminal input uses $F8 as a character
                                                1520: 0267 A0 00                    LDYIM   $00    AND THE OPCODE
 buildup area, and terminal output uses         1530: 0269 B1 FE                    LDAIY   CURAD
 $F9 to hold the character as it is being       1540: 026B 20 FA 82                 JSR     0UTBYT
 output. There may be a few other uses,         1550: 026 E 18                      CLC            CLEAR THE CARRY
 but I would stay away from these unless        1560: 026F 60                       RTS            AND RETURN TO SYSTEM
 you are really desperate for page zero         1570:
 space, or you are writing monitor exten­       1580: 0270 C8                F1X3BY INY               MAKE Y=1 NOW
 sions.                                         1590: 0271 B1 FE                    LDAIY CURAD       L0W-0RDER PART OF ADDRESS
                                                1600: 0273 AA                       TAX               PUT INTO X
   The System RAM areas are much bet­           1610: 027 4 C8                      INY               NOW MAKE Y=2
ter documented in the monitor listing.          1620: 0275 B1 FE                    LDAIY CURAD       HIGH-0RDER PART OF ADDRESS
They have also been assigned names,             1630: 0277 20 B6 02                 JSR   ADJST       GO CHANGE ADDRESS IF NECESSARY
and therefore appear on the assembly            ID=02
cross reference list. These programs
                                                0010:
only deal with two main areas. This is                                                STAIY CURAD PUT HIGH-ORDER BACK
                                                0020:    027A   91 FE
$A630 through $A63F, and they are               0030:    027C   88                    DEY           MAKE Y=1
monitor scratch areas. The two bytes us­        0040:    027D   6a                    TXA           L0W-0RDER TO A
ed here are not used by the monitor, ac­        0050:    027E   91 FE                 STAIY CURAD PUT IT BACK ALSO
cording to the cross reference lists.           0060:    0280   4C 59 02              JMP   SKIP1 • GO SKIP FORWARD TO NEXT OPCODE
                                                0070:
   The locations $A64A through $A64F            0080:
are the addresses where the monitor col­        0090:                        • GOT A BRANCH - HAVE TO CHECK
lects input parameters. Each is a two           0100:                        • BOTH "TO " AND "FROM" ADDRESSES
byte parameter area, and all three areas        0110:
are initialized to zero at the start of com­    0120:
mand processing. The problems begin             0130:   0283    C8           BRANCH INY              MAKE Y=1
when you find that the labels P1, P2 and        0140:   0284    A6   FE             LDX     CURAD    GET CURRENT LOCATION LOW-ORDER
P3 are a little misleading. The monitor         0150:   0286    A5   FF             LDA     CURADH   AND HIGH-ORDER
starts collecting parameters in the P3          0160:   0288    20   B6 02          JSR     ADJST    FIX IT IF NECESSARY
area, and rotates the whole area 16 bits        0170:   028B    8E   30 A6          STX     SCR0     SAVE LOW-ORDER FOR NOW
                                                0180:   028E    A2   FF             LDXIM   $FF      SET FLAG FOR BACK REFERENCE
left for each new parameter. It works out
                                                0190:   0290    B1   FE             LDAIY   CURAD    GET RELATIVE BRANCH AMOUNT
all right for three parameters, but two
                                                0200:   0292    18                  CLC
parameters will end up in P3 and P2,                                 02             ADCIM   $02
                                                0210:   0293    69                                   ADJUST THE OFFSET
while one ends up in P3.                        0220:   0295    30   01             BMI     OVER     BRANCH IF BACKWARDS BRANCH

August, 1979                                            MICRO - The 6502 Journal                                                       15:11
0230:     0297   E8                      INX               FORWARDS - MAKE FLAG ZERO
 0240:     0298   8E   31 A6       OVER   STX      SCR 1    SAVE THIS ALSO                              The addresses I used for the high and
 0250:     029B   18                      CLC                                                       low trace lim its are entries in the jump
 0260:     029C   65   FE                 ADC      CURAD  CALCULATE "TO" LOW-ORDER                  table. I picked these for two reasons.
 02 70:    029E   AA                      TAX             PUT INTO X                                The first is that I don’t use the jump
 0280:     029F   AD   31 A6              LDA      SCR 1  00 OR FF, REMEMBER?                       table, so am not worried about changing
 0290:     02A2   65   FF                 ADC      CURADH CALCULATE "TO" HIGH-ORDER
                                                                                                    it. The second is slightly more im port­
 0300:     02A4   20   B6 02              JSR      ADJST FIX IT IF NECESSARY
                                                                                                    ant. If you will note, the default values
 0310:     02A7   CA                      DEX             TAKE BACK OFFSET
 0320:     02A8   CA                      DEX
                                                                                                    set in these locations during system
 0330:     02A9   8A                      TXA              PUT LOW-ORDER BACK INTO A                reset turn out to cover normal user RAM.
 0340:     02AA   38                      SEC              RE-CALCULATE RELATIVE BRANCH             This means I don’t have to worry about
0350:      02AB   ED   30 A6              SBC      SCR0                                             making sure they get set every tim e I
 0360:     02AE   91   FE                 STAIY    CURAD AND PUT IT BACK                            reset the system.
0370:      02BO   20   CE 02              JSR      SIGNCH GO CHECK FOR SIGN CHANGE
0380:      02B3   4C   59 02              JMP      SK1P1 GO SKIP FORWARD TO NEXT OPCODE               There are a number of obscure SYM
0390:                                                                                               monitor routines used here, and some
0400:                                                                                               explanation of their function is in order
0410:                          • EXAMINE ADDRESS AND ADJUST IT IF NEEDED                            now. Where possible, the names corres­
0420:                          • HIGH-ORDER IS IN A                                                 pond to names in the monitor listing.
0430:                          • LOW-ORDER IS IN X
0440:
                                                                                                      The routine P3SCR takes the two
0450:
                                                                                                    bytes from the P3 area and moves them
0460:      02B6   C9   80      ADJST      CMPIM   $80      MAKE SURE REFERENCE NOT TOO FAR
0470:
                                                                                                    to page zero locations $FE and $FF for
           02B8   B0   13                 BCS     OUT      DONE IF TOO HIGH
0480:      02BA   CD   4F A6              CMP     P1H      CHECK HIGH-ORDER FIRST
                                                                                                    indirect addressing. P2SCR does the
0490:      02BD   DO   03                 BNE     TEST 2   BRANCH IF NOT EQUAL                      same thing, but with the P2 data instead
0500:      02BF   EC   4E A6              CPX     P1L      EQUAL - NEED TO CHECK LOW-ORDER ALSO     of P3. To my knowledge, there is no
0510:      02C2   90   09      TEST2      BCC     OUT      BRANCH IF LOW                            P1SCR or equivalent.
0520:      02C4   48                      PHA              ELSE SAVE HIGH-ORDER ON STACK
0530:      02C5   8A                      TXA              PUT LOW-ORDER INTO A                       CRLFSZ is a very handy routine that
0540:      02C6   18                      CLC                                                      outputs a carriage return, a line feed,
0550:      02C7   65   FC                 ADC     ADJUST ADD LOW-ORDER ADJUSTMENT                  and the contents of $FF and $FE (i.e. the
0560:      02C9   AA                      TAX            PUT BACK INTO X                           current address). The routine INCCMP
0570:      02CA   68                      PLA            PULL HIGH-ORDER BACK OUT                  does a 16 bit add of 1 to the contents of
0580:      02CB   65   FD                 ADC     ADJUSH ADD IN HIGH ORDER ADJUSTMENT              CURAD, and compares the result to the
0590:      02CD   60           OUT        RTS            AND RETURN                                value of P3. The compare is ignored in
0600:
                                                                                                   the relocate program; but for the lister,
0610:
0620:                          * CHECK TO MAKE SURE SIGN                                           P3 has the program ending address so it
0630:                          * BEFORE BRANCH IS SAME AS AFTER                                    knows when to quit. There is a reverse of
0640:                                                                                              this routine, called DECCMP, that sub­
0650:                                                                                              tracts 1 and does the compare. It isn’t
0660:      02CE   4D   31 A6   SIGNCH EOR         SCR 1   SEE IF SIGNS ARE THE SAME                used in these routines, but might be han­
0670:      02D1   10   OA             BPL         SIGNOK BRANCH IF THE SAME                        dy some time.
0680:      02D3   48                  PHA                 SAVE "A" ON STACK
0690:      02D4   20   16 83          JSR          CRLFSZ OUTPUT CURRENT ADDRESS                      There are two other SYM m onitor loca­
0700:      02D7   20   42 83          JSR         SPACE AND                  A SPACE               tions used which are not labeled monitor
0710:      02DA   4C   77 81          JMP         ERNOCR AND           ERROR MESSAGE               addresses. The ERNOCRLF label is a
0720:      02DD   60           SIGNOK RTS                 RETURN IF SIGN IS OK                     few instructions into the ERMSG rou­
0730:
                                                                                                   tine. It is after the carriage return and
0740:
                                                                                                   line feed subroutine jump. Unfortunate­
0750:                          • SYM-1 FUNCTION - MINI LISTER
07 60 :                        • BY: NICK VRTIS — LS1/CCSD —           APRIL 1979
                                                                                                   ly, where I enter, ERMSG has already
0 7 70 :                       •                                                                   pushed Aon the stack, so always JMP to
0780:                          • LIST A PROGRAM BY INSTRUCTION PER LINE                            it from a subroutine and let it do the
0790:                          •                                                                   return from your subroutine, or else your
0800:                          • INPUT PARMS:                                                      stack will get out of sync.
0810:                          •         PARM1 - PROGRAM STARTING ADDRESS
0820:                          •            PARM2 - PROGRAM ENDING ADDRESS                            The last address I call DBRTN. I use it
0830:                                                                                              in the extended trace. It is actually the
0840:                                                                                              last couple of instructions of the normal
0850:       02DE C9    15      U1   CMPIM         $15      MAKE SURE ON RIGHT COMMAND              trace routine. It does a check of the carry
0860:       02E0DO     04           BNE           U1ERR     BRANCH IFWRONG                         and continues tracing if the carry is
0870:       02E2 EO    02           CPXIM         $02       MAKE SURE 2 AND ONLY 2 PARMS   GIVEN   clear; otherwise it returns to the monitor.
0880:       02E4FO     02           BEQ           U1STRT    BRANCH TOSTART IF CORRECT
                                                                                                   This works out conveniently since the
0890:       02E6 38          U1ERR SEC
                                                                                                   routines INSTAT and DELAY return with
0900:       02E7 60                 RTS
0910:       02E8 20    9C 82 U1STRT JSR           P2SCR    SET UP BEGINNING ADDRESS
                                                                                                   the carry set if a key is down or the break
0920:
                                                                                                   key on the terminal has been pressed.
0930:
0940:                • LIST PROGRAM EITHER 1 AT A TIME OR "MAXRC" AT A TIME                          The remaining addresses and routines
0950:                •#•••••»••                                                                    used in the programs are defined ade­
0960:                                                                                              quately in the SYM manual, so I won’t
0970:   02EBAD 58 A6 LISTER       MAXRC if OF LINES CONTROLLED LDA
                                                               BY "MAXRC”                          bother discussing them here.
0980:   02EE8D 31 A6              COUNT SAVE IN SCRATCH AREA STA
0990:                                                                                                  The relocate program should not be
1000: 02F1 20 16 83 LISTLP JSR    CRLFSZ PUT OUT CURRENT ADDRESS                                   d ifficu lt to follow. The program is made

15:12                                                             MICRO - The 6502 Journal                                     August, 1979
possible by the subroutine DETLEN. I             1010:
                                                   1020:    02F4 20 42 83            CUR0P    JSR   SPACE LEADING SPACE
  have to give credit to Jim Butterfield and
                                                   1030:    02F7 20 24 03                     JSR   DETLEN MAKE SURE GOT CURRENT LINE LENGTH
  The First Book o f KIM for that routine
                                                   1040:    02FA A0 00                        LDYIM $00    INIT Y TO ZERO
  and for most of the relocate program.            1050:
  DETLEN not only determines the instruc­          1060:    02FC    B1   FE          CURRLP LDAIY    CURAD GET CURRENT OPCODE
  tion length, but also classifies it as one      1070:     02FE    20   FA 82              JSR      0UTBYT OUTPUT IT
  of four types: a branch (Y = 0) an ab­          1080:     0301    C8                      INY             BUMP TO NEXT BYTE
  solute address reference (Y = FF) an ‘‘in­      1090:     0302    CC   32 A6              CPY      BYTES SEE IF DONE
  valid" instruction (Y = FE) and all others      1100:     0305    DO   F5                 BNE      CURRLP LOOP FOR CURRENT NUMBER OF BYTES
  (Y = number of bytes in the instruction).       1110:
                                                  1120:     0307    20   1A 03               JSR    ADVANC   ADVANCE TO NEXT INSTRUCTION
    The invalid opcodes detected are only         1130:     030A    B0   OC                  BCS    PGMDON   SEE IF TO END
  those with bits 0 and 1 on. This is not all-    1140:     030C    CE   31 A6               DEC    COUNT    ELSE DECREASE LINE COUNT
  inclusive, but it does cover quite a few of     1150:     030F    10   E0                  BPL    LISTLP   GOT MORE TO DO IF POSITIVE
  the undefined opcodes. The normal pro­          1160:
  cedure for operating the program is to          1170:     0311 20 IB 8A                    JSR    INCHR WAIT FOR ANY CHARACTER
  insert an FF after the last program state­      1180:     0314 F0 02                       BEQ    PGMDON EQUAL MEANS C/R AND HE WANTS QUITS
  ment, since the relocate program stops          1190:     0316 DO D3                       BNE    LISTER ELSE CARRY ON
                                                  12 00 :
  when it encounters an “ invalid” opcode.        1210:                          ••••*••« *•••*••••••**••« ••••*••» •**» *# » ******# # #
                                                  1220:                          • END OF PROGRAM ENCOUNTERED - RETURN TO MONITOR
     This sometimes catches an attempt to         1230:                          « •*•**•******•************••*•*••****•**•*•« •**■
  relocate a data area instead of a pro­          1240:
  gram, which is a definite no-no. The pro­       1250: 0318       18            PGMDON CLC                  CLEAR CARRY FOR OK RETURN
  gram can’t tell the difference between          1260: 0319       60                   RTS                  AND RETURN
  most data and instructions, so make             1270:
  sure you stop it before it tries to “ fix ”     1280:
  the “ addresses” in your data. If you get       1290:                          * ADVANCE TO NEXT INSTRUCTION
  into the habit of collecting your data          1300:
  areas in one place, your programs will be       1310:
  easier to relocate.                             1320 : 031A      AE 32 A6      ADVANC LDX         BYTES GET BYTE COUNT
                                                  1330 : 031D      20 B2 82      ADVILP JSR         INCCMP BUMP CURRENT ADDRESS
    If you follow the code, you will see          1340 : 0320      CA                   DEX                DECREASE COUNT
 that there is a lot more work involved in        1350 : 0321      DO FA                BNE         ADVILP LOOP UNTIL ALL BYTES ARE COUNTED
                                                  1360 : 0323      60                   RTS                RETURN HERE
 relocating a branch instruction than in
                                                  1370
 fixing an absolute address reference.
                                                  1380
 This is because the program has to com­          1390                           * DETERMINE THE INSTRUCTION LENGTH
 pute the effective FROM and TO ad­               1400
 dresses before it can determine whether          1410
 the relative byte count has changed.             1420 : 0324      A0 00         DETLEN LDYIM $00            INIT Y TO ZERO
                                                  1430 : 0326      B1 FE                LDAIY CURAD          PICK UP CURRENT OPCODE
    I have also included a routine to verify      1440
 that the sign (bit 7) of the new displace­       1450                           * ENTER HERE IF "A" ALREADY HAS OPCODE IN IT
 ment is the same before and after the            1460
 relocation. This routine was added               1470 : 0328      A8            DETLN1 TAY                  SAVE IN Y
 shortly after the first tim e I relocated a      1480 : 0329      A2 07                LDXIM $07            GOT SEVEN TABLE ENTRIES TO CHECK
 backward branch into a forward branch,          1490
 by overflowing the sign, and started ex­        1500 : 032B       98            CHKLOP TYA                PUT OPCODE BACK INTO A
 ecuting one of the 6502’s INMI instruc­         1510 : 032C       3D    82 03          ANDX        TABOUT -01 REMOVE THE DON’T CARE BITS
                                                 1520 : 032F       5D    89 03          EORX        TABTST -01 TEST THE REST
 tions (INMI = Ignore Non-Maskable In­
                                                 1530 : 0332       F0    03             BEQ         FOUND BRANCH IF FOUND THE MATCH
 terrupt).
                                                 1540 : 0334       CA                   DEX                ELSE TRY NEXT ENTRY
                                                 1550 : 0335       DO    F4             BNE         CHKLOP UNTIL ALL ARE LOOKED AT
    The program lister was really easy to        1560
 do with subroutine DETLEN available. I          1570 : 0337       BC 99 03      FOUND       LDYX   TABLEN GET LENGTH FROM TABLE
 have a CRT running at 1200 baud, so I           1580 033A         8c 32 A6                  STY    BYTES SAVE THE LENGTH
 set the program up to list a screenfull of      1590 033D         BC 91 03                  LDYX   TABTYP NOW LOAD THE OPCODE TYPE
 lines at a time, and then wait for any key      1600 0340         60                        RTS           AND RETURN
 before continuing with the listing. If you      1610
 have a printer, or run at a slower baud         1620
 rate, you might want to ignore the MAX­         ID=03
 RC count, do a call to INSTAT after each
 line, and only stop when the break key is       0010
 entered. Remember, INSTAT returns               0020
 with the carry set if the break is entered,     0030
                                                 0040                            *   ALTERNATE USER TRACE ROUTINE
 and clear otherwise.                                                            *
                                                 0050
                                                 0060                            •   BY: NICK VRTIS —        LSI/CCSD    FEBRUARY 1979
    The e x te n d e d tra c e ro u tin e is     0070                            •
 probably the hardest to understand. It          0080                            «   ALTERNATE TRACE ROUTINE TO PRINT ADDITIONAL DATA
 also requires one hardware change as            0090                            *
 outlined in the SYM manual. That                0100                            «   WILL PRINT PROGRAM COUNTER-Y-X-A-FLAGS-STACK
 change is the installation of jumpers           0110                            •   ONLY PRINTS FOR PROGRAM ADDRESS IN RANGE OF ADDRESS
 W-24 and X-25. These enable software            0120                            «        SPECIFIED BY:
 control of the debug flip-flops, but only       0130                            *           A62C - EXCLUSIVE ENDING ADDRESS
 up to a certain point.                          0140                            •                (SYM DEFAULT IS 0000)

August, 1979                                          MICRO - The 6502 Journal                                                              15:13
You can also read