[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Which Hex Address Start In ROM?
[Please note that I've directed followups to
comp.sys.apple2.programmer.]
Bryan Parkoff <BParkoff@satx.rr.com> wrote:
> Which Hex Address Start In ROM?
>
> I am curious that all Apple II, II+, //c, //e, and IIgs v1/3 start with
> $F800-$FFFF such as ROM Monitor Routine.
Only the ][ and ][+ monitor firmware is completely contained within the
$F800-$FFFF area. The IIe and later machines have extended portions of
the monitor code which jump outside this area. In the unenhanced IIe,
this is mostly associated with the 80-column firmware, but later
machines (as well as the enhanced IIe firmware) have additional monitor
commands and features like a mini-assembler.
> When each of them is turned on by the power supply, it jumps to $F800 to do
> Reset routine, Scan 1-7 devices, and Intever/Applesoft BASIC Interpreter.
Not exactly. In fact, the code at $F800 is part of the lo-res graphics
drawing routines, and is not used at reset time.
When the 6502 or 65C02 processor is reset, it fetches the contents of
memory locations $FFFC and $FFFD, and uses them as the address of the
initial piece of code to execute. The bytes are arranged in "little
endian" order, i.e. the low order byte goes first (this is normal for
pointers on the 6502 family). On most Apple II models (][+ and later),
these locations contain $62 and $FA, i.e. the first piece of code
executed after a reset is at $FA62. This routine is known as "RESET".
It initializes the processor, monitor firmware and aspects of the
hardware, and ultimately attempts to warm or cold start the computer.
The precise details vary between machines and firmware revisions.
The main point is that the RESET routine attempts to determine whether
it is possible to warm start the computer, by checking whether memory
location $03F4 contains a value which is equal to the result of
exclusive-ORing the contents of memory location $03F3 with the value
#$A5. If the test passes, the computer will warm start by jumping to
the location pointed to by the vector at $03F2 and $03F3 (which is in
RAM, and can be modified by applications). When you are booted into an
operating system, this is typically the warm start entry point for DOS
3.3 or BASIC.SYSTEM. Otherwise it points to the warm entry point for
Applesoft BASIC.
If the test of memory location $03F4 fails, then the cold start routine
is executed. This begins at memory location $FAA6. It clears the
screen and prints the "Apple ][" message (which varies slightly between
machines and firwmare versions), then scans the slots to locate a
bootable device. If none is found, most machines drop into Applesoft
BASIC, while the IIgs displays a "Check Startup Device" error message
with a sliding Apple symbol.
The old monitor ROM used in the Apple ][ is different: its reset vector
points to $FF59, which is the "cold" entry point of the monitor itself.
Pressing the RESET key (with CTRL if necessary) on an original Apple ][
will always drop into the monitor. There is no code in the old monitor
ROM to support scanning slots for a boot device, so it is up to the user
to manually boot or return to BASIC (or whatever) by typing in the
appropriate command.
> I need to know which address that it starts so I can study assembler
> better.
This isn't the best way to learn assembly language. I'd suggest getting
a book on the 6502 processor (or whichever variety your machine uses),
and supplement it with one of the Apple II Technical Reference manuals;
the Apple ][ and IIe versions of these manuals contain a listing of the
monitor firmware, as does the first edition of the Apple IIc Technical
Reference.