Date : Wed, 09 Jul 2008 01:32:13 +0100
From : jgh@... (Jonathan Graham Harston)
Subject: ROM type byte inconsitancies
Jules Richardson wrote:
> Where's the type byte at in the ROM? I can check the 80286 copro ROMs if you
> want...
Byte 6 of the sideways ROM header:
8000: Language entry point
8003: Service entry point
8006: ROM type
8007: Copyright offset
8008: Version number
8009: ROM title
Sprow wrote:
> I'm confused:
> 9 AND 13 = 9
> 11 AND 13 = 9
> so shouldn't the 32016 client be doing AND &D, CMP &9?
Tiredness-induced typo?
The 32016 client does:
0312 D4 45 06 ?E. MOVB &06(R0),TOS ; Get ROM type
0315 E8 A5 0D ??. ANDB &0D,TOS ; Get CPU bits
0318 C4 A5 09 ??. CMPB &09,TOS ; Is it 32016?
031B 1A 18 .. BNE &00000333 ; Not 32016, jump to error
The 80186 client does:
F000:1D7A 24 0F $. AND AL,00Fh ; Get CPU bits
F000:1D7C 3C 0B <. CMP AL,00Bh ; Is it 80186?
F000:1D7E 75 16 u. JNZ 1D96h ; Not 80186, jump to error
F000:1D80 B0 01 0. MOV AL,001h ; AL=1
F000:1D82 EB E5 ke JMP 1C69h ; Jump to enter code
The 6502 Tube and CoPro clients do:
LDY #&06:LDA (&EE),Y :\ Get ROM type
AND #&4F:CMP #&40:BCC NotLanguage :\ b6=0, not a language
AND #&0D:BNE Not6502Code :\ type<>0 and <>2, not 6502 code
.LF8FA
LDA #&01:JMP (&00F2) :\ Enter code with A=1
The 65Tube emulator client does:
LDY #&06:LDA (&F4),Y :\ Get ROM type
AND #&4D:CMP #&40:BCC LFA2A :\ b6=0, Not a language
AND #&0D:BEQ LF9E6 :\ code=%x1xx00x0, enter 6502 code
CMP #&01:BNE LFA0E :\ code<>%x1xx00x1, not 6502 code
The Z80 client v1.20 does:
.LF82A
XOR A
LD (INCPM),A ; Set flag to reboot to CPM
LD A,(HL) ; Get ROM type
BIT 6,A
JR Z,LF83D ; If not a language, give error
BIT 3,A
JR Z,LF856 ; If not Z80 code, give error
LD A,&01 ; Set 'starting language'
LD HL,(PROG) ; Fetch program address
JP (HL) ; And enter it
The Z80 client v2.00 does:
F94D XOR A
F94E LD (WDAA),A ;Set flag to reboot to CPM
F951 LD A,(HL) ;Get romtype
F952 BIT 6,A
F954 JR Z,C ;If not a language, give error
F956 AND $0D
F958 CP $08
F95A JR NZ,W973 ;If not Z80 code, give error "Not Z80 code"
F95C LD A,$01 ;Set 'starting language'
F95E LD HL,(WDA3) ;Fetch program address
F961 JP (HL) ;And enter it
So:
32016 does (type AND 13)=9 matching 9 and 11
80186 does (type AND 15)=11 matching 11
6502 does (type AND 13)=0 matching 0 and 2
65Tube does (type AND 13)=0 or 1 matching 0, 1, 2, 3
Z80 v1.20 does (type AND 8)=8 matching 8,9,10,11,12,13,14,15
Z80 v2.00 does (type AND 13)=8 matching 8 and 10
Sprow CoPro does (type AND 15)=13 matching 13
Which means that
Documented As <--- Recognised By -------------
0 6502 BASIC 6502 65Tube
1 Turbo6502 65Tube
2 6502 6502 65Tube
3 68000 65Tube
4 - -
5 - -
6 - -
7 - -
8 Z80 Z80v1 Z80v2
9 32016 Z80v1 32016
10 - Z80v1 Z80v2
11 80186 Z80v1 32016 80186
12 80286 Z80v1
13 ARM Z80v1 ARM
14 - Z80v1
15 - Z80v1
> The Master MOS's OSByte ROM header checking does
> IF bit6 clear "This is not a language"
> AND 13 * 2
> IF nonzero "I cannot run this code"
> so 13x2 (%11010) seems to be being used to deduce whether it can be run by
That's after the MOS has already rotated the ROM type left one bit
to transfer the "service" bit into the carry, so it's still
effectively checking with AND #&0D.
I'm begining to think the "always set bit 1" was an early
definition when there was only BASIC or 6502, &x0 or &x2,
supplanted by a full list later on.
The only sideways ROMs I've encountered are BASIC, 6502 and Z80
using 0, 2 and 8 so I've no examples to inform me.
I'm tempted to add an annotation to the 32016 technical reference
manual to the effect of recommending using CPU_32016 (9) and not
CPU_32016 | ROM_OTHER_BITS (11).
--
J.G.Harston - jgh@... - mdfs.net/User/JGH
Youth has now fled. Their best years have been passed in the service
of the party. They are ageing and their ideals have also passed,
dispersed by the contrarities of daily struggles.