[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Native /// bootstrapping?



David Empson wrote:
> schmidtd <schmidtd@my-deja.com> wrote:
> 
>> On Feb 23, 5:57 pm, lyricalnan...@dosius.ath.cx (Steve Nickolas)
>> wrote:
>> > I'm trying to figure out how the SOS bootloader loads sos.kernel, and
>> > I'm
>> > not really getting it (although apparently the bootloader flips the
>> > system
>> > up to the topmost memory bank).
>> 
>> Jeppson has a pretty good discussion of the boot sequence:
>> "Boot Sequence: On power-up, or after control-reset, the boot process
>> begins in ROM#1 (ROM#2 doesn't yet exist). Low-level diagnostics are
>> performed. Then block 0 is read from the disk in the built-in drive.
>> This is the SOS boot code and is present on every disk that has been
>> formatted by the System Utilities program. It must be present for a
>> successful boot. It consists of one block of "absolute" code and is
>> loaded into the computer at $A000, where it begins to run.
>> 
>> The boot code begins by locating and switching in the highest bank of
>> RAM. Then it goes back to the disk and loads in five more blocks
>> (blocks 1..5). These are placed in $A200..ABFF. Block 1 currently
>> contains all zeros; blocks 2..5 are the disk directory. The boot code
>> then scans the directory and locates SOS.Kernel, which it loads into
>> memory at $1E00..73FF."
>> http://apple3.org/Documents/Magazines/AppleIIIBits.html
> 
> Drive-by curiosity makes me ask...
> 
> How does that tally with the original layout of ProDOS 5.25" boot disks,
> which have the ProDOS boot loader in block 0 and the SOS boot loader in
> block 1?
> 
> Is there some trick the Apple /// is doing to recognise valid code in
> block 0 and if it can't find it, trying block 1 instead, or is part of
> the ProDOS boot block actually a SOS stub loader (at some offset into
> the block) which fetches and executes block 1?
> 
> The ProDOS boot block starts with an $01 byte, which is not a valid 6502
> instruction.
>

I'm attempting a rudimentary conversion from whatever the heck asm this is
written in.

XBOOT:    .BYTE     1                   ; (ProDOS boot ID)
ENTRY:    SEC                           ; (Apple /// enters XBOOT 'ORA $38')
BCS       ENTRY1              ; branch if not Apple /// native mode
JMP       GOAPL3              ; go do Apple /// boot!
ENTRY1:   STX       UNIT                ; save unit number

Apparently the "01 38" is valid 6502, and disassembles to "ORA ($38, X)".

-uso.