Just a few notes about the Miniassembler and the 65C02 opcodes support in the
different Apple ][ models.

The Miniassembler (the thing with the "!" prompt you use to assemble programs from
the command line) appeared at first in the original Apple ][ ROM in 1977. Back
then, you had to type F666G from the Monitor or CALL -2458 from BASIC to enter it.
I believe you had to type Ctrl-C (and not just Return) to get out of it.

The Miniassembler was shifted out of the Apple ][+ to make room for the new
Appplesoft BASIC. There are, from then, three models that don't have the
Miniassembler: the ][+, the original (unenhanced) //e, and the original (16 Kb ROM,
no 3.5" support) //c.

The following model, the Apple //e Enhanced, included again the Miniassembler, this
time being easier to call: you just had to type "!" at the Monitor's command prompt
to enter it. All the later models (the later revisions of the //c -3.5" drive
support with 32 Kb ROM and memory expansion //c-, all //gs, the Platinum //e and
the //c+) maintain it in the same way as in the //e Enhanced.

There are several Apple ][ models that support the 65C02-specific opcodes: all the
revisions of the //c, the //c+ and the //gs. Obviously, as the original //c don't
have the Miniassembler, it only supports them in Monitor's dissasembles (L
command). As far as I know, the Apple //e never supported the 65C02 opcodes,
neither did the Apple //gs with the 65816-specific opcodes or 16-bit code.

One more note: if you're going to use the Miniassembler, take into account that
every line entered (except the first) should start with an space, as pictured in
Steve Conrad's e-mail.

Greetings,

Antonio Rodr�guez (Grijan)
<ftp://grijan.cjb.net:21000/>

Steve Conrad ha escrito:

> >From a BBS I am on
>
> Jun 15, 2003 14:54 from Scalar
>
> The Apple II series has assembly programming built into the system ROM.
>
> In all version of the ROM, the monitor provides a "disassembler", which will
> take an arbitrary bank of memory and attempt to spit it out as assembly code.
> This is the "L" command in the system monitor.
>
> In the Applesoft/Floating point Apples (all Apple IIe and onward, later II+
> models) there is also a built-in code assembler, accessible with the "!"
> command in the monitor.
>
> Note that that later IIe could be "enhanced" with a revision upgrade of the CPU
> from "6502" to "65C02" which are functionally identical but the 65C02
> supporting some additional opcodes. These opcodes are not known to the built-in
> assembler/disassembler in the enhanced IIe. (Don't know if a IIc or IIgs will
> display them.)
>
> Getting to the disassembler/assember:
>
> >From basic, enter the monitor with the command "CALL-151"
>
> ]CALL -151
>
> *
>
> At the monitor prompt type a memory address and an "L" to dump that region as
> assembly code. It will disassemble as much as will fit the screen, so the data
> amount varies with the length of the opcodes.
>
> *F800L
>
> F800-   4A          LSR
> F801-   08          PHP
> F802-   20 47 F8    JSR   $F847
> F805-   28          PLA
> F806-   A9 0F       LDA   #$0F
> F808-   90 02       BCC   $F80C
> F80A-   69 E0       ADC   #$E0
> F80C-   85 2E       STA   $2E
> F80E-   B1 26       LDA   ($26),Y
> F810-   45 30       EOR   $30
> F812-   25 2E       AND   $23
> F814-   51 26       EOR   ($26),Y
> F816-   91 26       STA   ($26),Y
> F818-   60          RTS
> F819-   20 00 F8    JSR   $F800
> F81C-   C4 2C       CPY   $2C
> F81E-   B0 11       BCS   $F831
> F820-   C8          INY
> F821-   20 0E F8    JSR   $F8OE
> F824-   90 F6       BCC   $F81C
> *
>
> It will attempt to disassemble any type of data, and cannot distinguish between
> non-machine code and real code. In fact if you give it the wrong starting
> address (F801L rather than F800L) it will not know the difference and you'll
> possibly see what looks like valid assembly but is in fact completely wrong.
> It'll spit out wrong data until there's an error and it prints ??? or BRK until
> the data is good again.
>
> To access the assembler, just type "!" on a monitor line by itself.
>
> *!
>
> !
>
> To start assembling, specify the starting memory range and a colon followed by
> the first opcode. To keep on assembling, start each line with a space followed
> by the opcode. To finish, type return on a line by itself to exit the
> assembler. Here's a very simple program I just made up to fill a bank of memory
> with 256 copies of the number 3:
>
> !300:LDY #0
> ! LDA #3
> ! STA $2000,Y
> ! INY
> ! CPY #0
> ! BNE 304
> ! RTS
> !
>
> *
>
> As you type each line, it will be replaced with the assembled code.
>
> !300:LDY #0
>
> is replaced by
>
> 0300-   A0 00          LDY #00
>
> Note that I did not know the branch target address for BNE UNTIL I had entered
> the code. This is one of the big limitations of this built-in assembler. It
> cannot calculate the address of branching for you. For larger handwritten
> programs like this, sometimes the branch is entered invalid and then you go
> back and fix it once the code is fleshed out and the target address can be
> known.
>
> This is purely a line-editor assembler, and can only encode what you tell it.
> If you don't know the branch target yourself, the built-in Apple II assembler
> cannot help you.
>
> If you want a better assembler, you need a product like MERLIN, which offers a
> word-processor environment to edit the code, along with the ability to used
> labels to mark branches. This way you can designate a spot in the code as a
> branch target, and the MERLIN assembler will automatically determine the target
> address for you when you are done and compile the code.
>
> MERLIN also supports labeling commonly-used data locations, so that you can use
> a common name rather than direct addresses which may mean nothing to the
> beginner at assembly.
>
> A third benefit of an assembly-language compiler is something called "memory
> portability". The branch opcodes are location independant, and the programming
> code can be used anywhere in memory and still run properly. However branch
> codes can only run code 128 bytes forward or back from the current location.
> branching further requires a JMP command.
>
> JMP is an absolute address, and the target address of a JMP will not change if
> the program is moved in memory. A program written for the 0300-03CF memory
> block that uses a JMP will crash if you relocate it to 2000-20CF and try to run
> it there. If written by hand, you'd have to manually re-edit the code to redo
> the JMP's so they will point to valid machine code in the new memory range.
>
> With MERLIN, you can change the address where the code is to be run, and when
> compiled MERLIN will automatically retarget all the JMP's so that the program
> will still work when run in a different section of memory.
>
> [Antique And Older Computers> msg #24007
>
> Steve Conrad
> 810 Main
> Henrietta, MO 64036
> 816-494-5692                                     http://sasha91.0pi.com
> www.fortunecity.com/rivendell/stonekeep/600
>
>    It is no secret (nor should it come as any surprise) that humankind's
> most noble impulses often surface during the most trying of times, that
> human spirit rises to the challenge when faced with adversity, that human
> strength is born from human failings...Is it any wonder, then, that the
> SDF-1 crew became a tighter family after the fortress had been exiled than
> it had before?
>
>      From the log of Captain (later Admiral) Henry Gloval
>
> --
> Apple2list is sponsored by <http://lowendmac.com/> and...
>
>     /      Buy books, CDs, videos, and more from Amazon.com     \
>    / <http://www.amazon.com/exec/obidos/redirect-home/lowendmac> \
>
>       Support Low End Mac <http://lowendmac.com/lists/support.html>
>
> Apple2list info:        <http://lowendmac.com/lists/apple2.html>
>   --> AOL users, remove "mailto:";
> Send list messages to:  <mailto:[EMAIL PROTECTED]>
> To unsubscribe, email:  <mailto:[EMAIL PROTECTED]>
> For digest mode, email: <mailto:[EMAIL PROTECTED]>
> Subscription questions: <mailto:[EMAIL PROTECTED]>
> Archive: <http://www.mail-archive.com/apple2list%40mail.maclaunch.com/>
>
> Using a Mac? Free email & more at Applelinks! http://www.applelinks.com


-- 
Apple2list is sponsored by <http://lowendmac.com/> and...

    /      Buy books, CDs, videos, and more from Amazon.com     \
   / <http://www.amazon.com/exec/obidos/redirect-home/lowendmac> \

      Support Low End Mac <http://lowendmac.com/lists/support.html>

Apple2list info:        <http://lowendmac.com/lists/apple2.html>
  --> AOL users, remove "mailto:";
Send list messages to:  <mailto:[EMAIL PROTECTED]>
To unsubscribe, email:  <mailto:[EMAIL PROTECTED]>
For digest mode, email: <mailto:[EMAIL PROTECTED]>
Subscription questions: <mailto:[EMAIL PROTECTED]>
Archive: <http://www.mail-archive.com/apple2list%40mail.maclaunch.com/>

Using a Mac? Free email & more at Applelinks! http://www.applelinks.com

Reply via email to