My head exploded when trying to parse the ProDOS boot block.
My head exploded when trying to parse the ProDOS boot block.
And thus the reason no-one has replied. We are not willing to follow in your footsteps.
In article <alpine.DEB.2.21.2112201707330.6571@sd-119843.dedibox.fr>,
Steve Nickolas <usotsuki@buric.co> wrote:
My head exploded when trying to parse the ProDOS boot block.
I'm trying to see whether it's possible to remove the Apple /// stuff and
add some 6502-8086 diglot stuff, given that I have an 8086 boot block that >> does more or less the same thing, and that I could stuff into the second
block.
-uso.
I don't understand what you are asking. Are you trying to make a boot block that will work on 8086 and an Apple II? If so, you'll need to work out opcodes to start the block with that make sense for both architectures.
I don't understand why you'd want to do this and what you think this will achieve. For the Apple II part, the first byte needs to be $01 and will
not be executed. If you want it can be any value from $01 to $0f, but
higher values will result in wasted time (it will read more sectors into memory which will in general not be useful).
As for the ProDOS boot block, it's basic operation is to find the PRODOS
file in the volume directory, and boot from a 5.25" Disk II or a "Smartport" device (really, the ProDOS entry point). It looks at the boot slot
$CnFF to get the ProDOS entry point (generally $07, so the entry point is $Cn07), and then makes READBLOCK calls to find PRODOS. For Disk II, it creates a fake driver (so the rest of the code can think in terms of blocks), which then does the needed head moves (slower than needed, but short code) and re-uses the $Cn5C entry point to read the sector data. It's clever,
but not too complex.
You mention Apple ///, but again I don't know what you mean. There's
special code to handle $CnFF being >= $F9, and maybe that's for Apple ///, but I didn't trace through that code to figure out what it was doing.
My understanding is an Apple /// will boot from Block 1 (and Block 1 is usually all 0's on volumes created on an Apple II).
Kent
My head exploded when trying to parse the ProDOS boot block.
I'm trying to see whether it's possible to remove the Apple /// stuff and
add some 6502-8086 diglot stuff, given that I have an 8086 boot block that >does more or less the same thing, and that I could stuff into the second >block.
-uso.
I'm currently trying to write a small Apple ][ emulator in order to test
the code further, but I am very unfluent in 8086 being mainly a C
programmer.
For the Apple II part, the first byte needs to be $01
For the Apple II part, the first byte needs to be $01
It can be zero. The PROM loops while the value in $3D is < $800.
Then to make 6502/8086 compatible, the sequence can be
00 CD EB xx
which on 8086 is
00 CD ADD CH,CL
EB xx JMP SHORT [to x86-specific code]
and on 6502
00 ;1 sector read
CD EB xx CMP $xxEB
[6502 continues]
You'd be running already from 0000:7C00 if you're on a PC. Your read
will overwrite your existing code.
Since all of the registers will have been set already for the first
load, you could just
mov ax, 0x201
inc cx
pushf
push es
push bx
jmp far es:[0x004c]
and forget about retry.
Otherwise, yes it's possible to have a polyglot bootsector, even on a
5.25".
As for the ProDOS loader, block 1 is "reserved" (=unused). You could
put the original sector there. Then you wouldn't need to fit the actual loader in the boot sector.
0100- B8 01 02 MOV AX, 0201
0103- 41 INC CX
0104- 9C PUSHF
0105- 06 PUSH ES
0106- 53 PUSH BX
0107- EA 4C 00 00 00 JMP 0000:004C
12 bytes, eh? That's far more efficient than I'd come up with. xD
0100- B8 01 02 MOV AX, 0201
0103- 41 INC CX
0104- 9C PUSHF
0105- 06 PUSH ES
0106- 53 PUSH BX
0107- EA 4C 00 00 00 JMP 0000:004C
12 bytes, eh? That's far more efficient than I'd come up with. xD
The instruction at 0107 should read
0107- 26 FF 26 4C 00 JMP FAR ES:[004C]
It has to be indirect to use the vector.
If you're willing to bet that DS is also zero, then you can drop the first 26.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 27:14:09 |
Calls: | 6,646 |
Calls today: | 1 |
Files: | 12,193 |
Messages: | 5,328,055 |