]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/INC/MSHALO.ASM
1 ; SCCSID = @(#)ibmhalo.asm 1.1 85/04/10
2 ; On 2K (800h) boundaries beginning at address C0000h and ending at EF800h
3 ; there is a header that describes a block of rom program. This header
4 ; contains information needed to initialize a module and to provide PCDOS
5 ; with a set of reserved names for execution.
7 ; This header has the following format:
12 ; rom_length DB ? ; number of 512 byte pieces
13 ; init_jmp DB 3 dup (?)
14 ; name_list name_struc <>
19 ; name_text DB ? DUP (?)
20 ; name_jmp DB 3 DUP (?)
23 ; The name list is a list of names that are reserved by a particular section
24 ; of a module. This list of names is terminated by a null name (length
27 ; Consider now, the PCDOS action when a user enters a command:
29 ; COMMAND.COM has control.
30 ; o If location FFFFEh has FDh then
31 ; o Start scanning at C0000h, every 800h for a byte 55h followed
32 ; by AAh, stop scan if we get above or = F0000H
33 ; o When we've found one, compare the name entered by the user
34 ; with the one found in the rom. If we have a match, then
35 ; set up the environment for execution and do a long jump
36 ; to the near jump after the found name.
37 ; o If no more names in the list, then continue scanning the module
38 ; for more 55h followed by AAh.
39 ; o We get to this point only if there is no matching name in the
40 ; rom. We now look on disk for the command.
42 ; This gives us the flexibility to execute any rom cartridge without having
43 ; to 'hard-code' the name of the cartridge into PCDOS. Rom modules that
44 ; want to be invisible to the DOS should not have any names in their lists
45 ; (i.e. they have a single null name).
47 ; Consider a new release of BASIC, say, that patches bugs in the ROM version.
48 ; Clearly this version will be available on disk. How does a user actually
49 ; invoke this new BASIC?? He cannot call it BASIC on the disk because the
50 ; EXEC loader will execute the ROM before it even looks at the disk! Only
53 ; o Keep things consistent and force the user to have his software named
54 ; differently from the ROM names (BASIC1, BASIC2, etc).
66 name_text
DB 1 DUP (?
)
70 ASSUME
CS:TRANGROUP
,DS:NOTHING
,ES:NOTHING
,SS:NOTHING
73 ; Check for IBM PC Jr rom cartrides. DS:DX is a pointer to name
83 ; check for PC Jr signature in rom
87 CMP BYTE PTR ES:[0FFFEh],0FDh
101 ; start scanning at C000
109 ; check for a valid header
111 CMP WORD PTR ES:[DI],0AA55h
119 ; trundle down list of names
122 MOV BL,ES:[DI].rom_length
; number of 512-byte jobbers
123 XOR BH,BH ; nothing in the high byte
125 SHL BX,1 ; number of paragraphs
127 AND BX,0FF80h ; round to 2k
131 MOV CL,ES:[DI] ; length of name
132 INC DI ; point to name
134 OR CX,CX ; zero length name
135 JNZ SCAN_TEST
; nope... compare
136 ADD AX,BX ; yep, skip to next block
139 ; compare a single name
144 REPE CMPSB ; compare name
145 JZ SCAN_FOUND
; success!
147 ADD DI,CX ; failure, next name piece
151 ; found a name. save entry location
154 CMP BYTE PTR DS:[SI],'?'
156 CMP BYTE PTR DS:[SI],' '
165 ; execute a rom-placed body of code. allocate largest block
176 ; set terminate addresses
178 MOV AX,(set_interrupt_vector
SHL 8) + int_terminate
182 MOV DX,OFFSET RESGROUP
:EXEC_WAIT
190 ; and create program header and dup all jfn's
203 ; copy in environment info
206 MOV DS:[PDB_environ
],AX
208 ; set up correct size of block
210 POP BX ; BX has size, DS has segment
213 MOV DS:[PDB_block_len
],DX
215 ; change ownership of block
221 MOV DS:[arena_owner
],DX
224 ; set up correct stack
238 ; set up initial registers and go to the guy