<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Thu, 10 Jul 2008 00:20:01 +0100
From   : jgh@... (Jonathan Graham Harston)
Subject: ROM type byte inconsitancies

David Harper wrote:
> I question that this has anything to do with type bytes, etc.
> These bytes given above are actually at location 0000:0100 (not at 0:0) in
> the 80186 ROM. In fact all the bytes prior to these are set to 0, except for
> 4 bytes at location 0000:0030.
 
I think you've got the wrong end of the stick. All second processors,
on being instructed to execute some code in the second processor memory,
examine that code for a standard sideways ROM header. If there is a ROM
header, indicated by there being &00,"(C)" at entry_point+entry_point?7
then the ROM type byte at entry_point?6 is examined. If the ROM type
byte does not indicate that the code is language code, or it is not the
correct code for the second processor CPU, then an error is generated,
or the system is rebooted.
 
The full 80186 'enter code' routine shows this, and you can see other
second processor client code at http://mdfs.net/tube
 
; Enter code, checking for any ROM header
; ======================================
F000:1CFC 26           &     ES:
F000:1CFD A1 A0 05     ! .   MOV AX,[5A0h]    ; Get loaded code address
F000:1D00 26           &     ES:
F000:1D01 A3 A4 05     #$.   MOV [5A4h],AX    ; Store as current program
F000:1D04 26           &     ES:
F000:1D05 A1 A2 05     !".   MOV AX,[5A2h]    ; Get ...
F000:1D08 26           &     ES:
F000:1D09 A3 A6 05     #&.   MOV [5A6h],AX    ; Store ...
F000:1D0C 26           &     ES:
F000:1D0D A3 F6 05     #v.   MOV [5F6h],AX    ; Get ...
F000:1D10 06           .     PUSH ES          ; Save ES
F000:1D11 26           &     ES:
F000:1D12 C5 36 A0 05  E6 .  LDS SI,[005A0h]  ; Get loaded code address
F000:1D16 8C DB        .[    MOV BX,DS
F000:1D18 8B CE        .N    MOV CX,SI
F000:1D1A 83 C6 07     .F.   ADD SI,0007h     ; Point to copyright offset
F000:1D1D 8B D6        .V    MOV DX,SI
F000:1D1F 8A 04        ..    MOV AL,[SI]
F000:1D21 B4 00        4.    MOV AH,000h
F000:1D23 8B F1        .q    MOV SI,CX
F000:1D25 03 F0        .p    ADD SI,AX
F000:1D27 26           &     ES:
F000:1D28 89 36 F4 05  .6t.  MOV [005F4h],SI
F000:1D2C 26           &     ES:
F000:1D2D C4 3E B4 05  D>4.  LES DI,[005B4h]
F000:1D31 B9 04 00     9..   MOV CX,00004h    ; 4 bytes to match
F000:1D34 F3           s     REPE             ; Check if 0,"(C)"
F000:1D35 A6           &     CMSB
F000:1D36 07           .     POP ES           ; Restore ES
F000:1D37 75 1D        u.    JNZ 1D56h        ; No ROM header, jump to enter
code directly
F000:1D39 8B F2        .r    MOV SI,DX        ; SI=>copyright offset
F000:1D3B 4E           N     DEC SI           ; SI=>ROM type byte
F000:1D3C 26           &     ES:
F000:1D3D A0 B1 05      1.   MOV AL,[5B1h]    ; Get reboot/noboot flag
F000:1D40 0A C0        .@    OR AL,AL
F000:1D42 75 2A        u*    JNZ 1D6Eh        ; Jump to check without
rebooting
 
; Check ROM header, reboot if not OK
; ----------------------------------
F000:1D44 8A 04        ..    MOV AL,[SI]      ; Get ROM type byte
F000:1D46 A8 40        (@    TEST AL,040h     ; Check bit6 - language bit
F000:1D48 75 03        u.    JNZ 1D4Dh        ; Language, skip past
F000:1D4A E9 3E EE     i>n   JMP 10B8Bh       ; Not language, jump to boot DOS
F000:1D4D 24 0F        $.    AND AL,00Fh      ; Get CPU bits
F000:1D4F 3C 0B        <.    CMP AL,00Bh      ; Is it 80186?
F000:1D51 74 16        t.    JZ 1D69h         ; Yes, jump to enter code
F000:1D53 E9 35 EE     i5n   JMP 10B8Bh       ; Not 80186, jump to boot DOS
 
F000:1D56 26           &     ES:
F000:1D57 A0 B1 05      1.   MOV AL,[5B1h]    ; Get reboot/noboot flag
F000:1D5A 0A C0        .@    OR AL,AL
F000:1D5C 75 0B        u.    JNZ 1D69h        ; Noboot, jump to enter code
F000:1D5E 26           &     ES:
F000:1D5F A0 B2 05      2.   MOV AL,[5B2h]    ; Get another flag
F000:1D62 0A C0        .@    OR AL,AL
F000:1D64 74 03        t.    JZ 1D69h         ; Flag set, jump to enter code
F000:1D66 E9 22 EE     i"n   JMP 10B8Bh
 
F000:1D69 26           &     ES:
F000:1D6A FF 2E A0 05  .. .  JMPF [005A0h]    ; Enter code
 
; Check ROM header, generate error if not OK
; ------------------------------------------
F000:1D6E 26 C6 06 06 B1 05 &F.... MOV BYTE PTR [ES:0B106h],05
F000:1D73 00           .     ADD [BX+SI],AL
F000:1D74 8A 04        ..    MOV AL,[SI]      ; Get ROM type byte
F000:1D76 A8 40        .@    TEST AL,40h      ; Check bit6 - language bit
F000:1D78 74 0A        t.    JZ 1D84h         ; Not language bit, jump to
error
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 1D69h        ; Jump to enter code
 
F000:1D84 CD 4F        MO    INT 4Fh          ; Generate error
F000:1D86 FF 4E 6F 74  .Not  EQUB 255
F000:1D8A 20 61         a    EQUS "Not a langauge"
F000:1D8C 20 6C 61      la   
F000:1D8F 6E           n     
F000:1D90 67           g     
F000:1D91 75 61        ua    
F000:1D93 67           g     
F000:1D94 65           e     
F000:1D95 00           .     EQUB 0
 
F000:1D97 CD 4F        MO    INT 4Fh
F000:1D98 FF 4E 6F 74  .Not  EQUB 255
F000:1D9D 20 38 30      80   EQUS "Not 80186 code"
F000:1D9F 31 38        18    
F000:1DA1 36           6     
F000:1DA2 20 63 6F      co   
F000:1DA5 64           d     
F000:1DA6 65           e     
F000:1DA7 00           .     EQUB 0
 
F000:1DA8 00           .     EQUB 0
F000:1DA9 28 43 29     (C)   EQUS "(C)"     ; ROM header matching string
 
-- 
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.
 
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>