Академический Документы
Профессиональный Документы
Культура Документы
01101010b
o,q
175o
10
789d
16
6A5h
donde 4 es el ltimo cociente (menor que la base) y los restantes dgitos son los restos en
orden inverso.
1.3. - ESTRUCTURA ELEMENTAL DE LA MEMORIA.
1.3.1. - BIT.
Toda la memoria del ordenador se compone de dispositivos electrnicos que pueden
adoptar nicamente dos estados, que representamos matemticamente por 0 y 1.
Cualquiera de estas unidades de informacin se denomina BIT, contraccin de binary
digit en ingls.
1.3.2. - BYTE.
Cada grupo de 8 bits se conoce como byte u octeto. Es la unidad de almacenamiento
en memoria, la cual est constituida por un elevado nmero de posiciones que almacenan
bytes. La cantidad de memoria de que dispone un sistema se mide en Kilobytes (1 Kb =
1024 bytes), en Megabytes (1 Mb = 1024 Kb), Gigabytes (1 Gb = 1024 Mb), Terabytes (1
Tb = 1024 Gb) o Petabytes (1 Pb = 1024 Tb).
Los bits en un byte se numeran de derecha a izquierda y de 0 a 7, correspondiendo con
los exponentes de las potencias de 2 que reflejan el valor de cada posicin. Un byte nos
permite, por tanto, representar 256 estados (de 0 a 255) segn la combinacin de bits que
tomemos.
1.3.3. - NIBBLE.
Cada grupo de cuatro bits de un byte constituye un nibble, de forma que los dos
nibbles de un byte se llaman nibble superior (el compuesto por los bits 4 a 7) e inferior (el
compuesto por los bits 0 a 3). El nibble tiene gran utilidad debido a que cada uno
almacena un dgito hexadecimal:
1000
0001
1001
0010
1010
10
0011
1011
11
0100
1100
12
0101
1101
13
0110
1110
14
0111
1111
15
1010 1010b
+ 0011 1100b
-------------1110 0110b
Por esta razn, el nmero 80h, cuyo complemento a dos es l mismo, se considera
negativo (-128) y el nmero 00h, positivo. En general, para hallar el complemento a dos
de un nmero cualquiera basta con calcular primero su complemento a uno, que consiste
en cambiar los unos por ceros y los ceros por unos en su notacin binaria; a continuacin
se le suma una unidad para calcular el complemento a dos. Con una calculadora, la
operacin es ms sencilla: el complemento a dos de un nmero A de n bits es 2n-A.
Otro factor a considerar es cuando se pasa de operar con un nmero de cierto tamao
(ej., 8 bits) a otro mayor (pongamos de 16 bits). Si el nmero es positivo, la parte que se
aade por la izquierda son bits a 0. Sin embargo, si era negativo (bit ms significativo
activo) la parte que se aade por la izquierda son bits a 1. Este fenmeno, en cuya
demostracin matemtica no entraremos, se puede resumir en que el bit ms significativo
se copia en todos los aadidos: es lo que se denomina la extensin del signo: los dos
siguientes nmeros son realmente el mismo nmero (el -310): 11012 (4 bits) y 111111012
(8 bits).
1.6. - AGRUPACIONES DE BYTES.
Tipo
Definicin
Palabra
2 bytes contiguos
Doble palabra
16 bytes
Pgina
Segmento
64 Kbytes
Sin signo
255
2 bytes
65.535
4 bytes
4.294.967.295
8 bytes 18.446.744.073.709.551.615
Tipo
Positivo
Negativo
1 byte
127
-128
2 bytes
32.767
-32.768
4 bytes
2.147.483.647
-2.147.483.648
x y x AND y x OR y x XOR y
00
01
10
11
Volver al ndice
La premonicin.
En 1973, el centro de investigacin de Xerox en Palo Alto desarroll un equipo
informtico con el aspecto externo de un PC personal actual. Adems de pantalla y
teclado, dispona de un artefacto similar al ratn; en general, este aparato (denominado
Alto) introdujo, mucho antes de que otros los reinventaran, algunos de los conceptos
El microprocesador.
El desarrollo del primer microprocesador por Intel en 1971, el 4004 (de 4 bits), supuso
el primer paso hacia el logro de un PC personal, al reducir drsticamente la circuitera
adicional necesaria. Sucesores de este procesador fueron el 8008 y el 8080, de 8 bits. Ed
Roberts construy en 1975 el Altair 8800 basndose en el 8080; aunque esta mquina no
tena teclado ni pantalla (slo interruptores y luces), era una arquitectura abierta
(conocida por todo el mundo) y cuyas tarjetas se conectaban a la placa principal a travs
de 100 terminales, que ms tarde terminaran convirtindose en el bus estndar S-100 de
la industria.
El Apple-I apareci en 1976, basado en el microprocesador de 8 bits 6502, en aquel
entonces un recin aparecido aunque casi 10 veces ms barato que el 8080 de Intel. Fue
sucedido en 1977 por el Apple-II. No olvidemos los rudimentos de la poca: el Apple-II
tena un lmite mximo de 48 Kbytes de memoria. En el mismo ao, Commodore sac su
PET con 8 Kbytes. Se utilizaban cintas de casete como almacenamiento, aunque
comenzaron a aparecer las unidades de disquete de 5. Durante finales de los 70
aparecieron muchos otros ordenadores, fruto de la explosin inicial del microprocesador.
El IBM PC.
Y es que IBM tambin fabric su propio ordenador personal con vocacin profesional:
el 12 de agosto de 1981 present el IBM PC. Estaba basado en el microprocesador 8088,
de 16 bits, cuyas instrucciones sern las que usemos en este libro, ya que todos los
aos 90, desarrollaron con la norma VESA las placas con bus local (VESA Local Bus);
bsicamente es una prolongacin de las patillas de la CPU a las ranuras de expansin, lo
que permite tarjetas rpidas de 32 bits pero muy conflictivas entre s. Esta arquitectura de
bus se populariz mucho con los procesadores 486. Sin embargo, al final el estndar que
se ha impuesto ha sido el propuesto por el propio fabricante de las CPU: Intel, con su bus
PCI, que con el Pentium se ha convertido finalmente en el nico estndar de bus de 32
bits. Estas mquinas an admiten no obstante las viejas tarjetas ISA, suficientes para
algunas aplicaciones de baja velocidad (modems,... etc).
SP
CS
IP
BX
BP
DS
flags
CX
SI
SS
DX
DI
ES
Registros
Registros Registro puntero
Registros punteros de
de
de instrucciones
de datos
pila e
segmento
y flags
ndices
- Registros de datos:
AX, BX, CX, DX: pueden utilizarse bien como registros de 16 bits o como dos
registros separados de 8 bits (byte superior e inferior) cambiando la X por H o L segn
queramos referirnos a la parte alta o baja respectivamente. Por ejemplo, AX se
descompone en AH (parte alta) y AL (parte baja). Evidentemente, cualquier cambio
sobre AH o AL altera AX!: valga como ejemplo que al incrementar AH se le estn
aadiendo 256 unidades a AX.
AX = Acumulador.
Es el registro principal, es utilizado en las instrucciones de multiplicacin y
divisin y en algunas instrucciones aritmticas especializadas, as como en ciertas
operaciones de carcter especfico como entrada, salida y traduccin. Obsrvese que el
8086 es suficientemente potente para realizar las operaciones lgicas, la suma y la resta
sobre cualquier registro de datos, no necesariamente el acumulador.
BX = Base.
Se usa como registro base para referenciar direcciones de memoria con
direccionamiento indirecto, manteniendo la direccin de la base o comienzo de tablas o
matrices. De esta manera, no es preciso indicar una posicin de memoria fija, sino la
nmero BX (as, haciendo avanzar de unidad en unidad a BX, por ejemplo, se puede ir
accediendo a un gran bloque de memoria en un bucle).
CX = Contador.
Se utiliza comnmente como contador en bucles y operaciones repetitivas de
manejo de cadenas. En las instrucciones de desplazamiento y rotacin se utiliza como
contador de 8 bits.
DX = Datos.
Usado en conjuncin con AX en las operaciones de multiplicacin y divisin que
involucran o generan datos de 32 bits. En las de entrada y salida se emplea para
especificar la direccin del puerto E/S.
- Registros de segmento:
Definen reas de 64 Kb dentro del espacio de direcciones de 1 Mb del 8086. Estas
reas pueden solaparse total o parcialmente. No es posible acceder a una posicin de
memoria no definida por algn segmento: si es preciso, habr de moverse alguno.
CS = Registro de segmento de cdigo (code segment).
Contiene la direccin del segmento con las instrucciones del programa. Los
programas de ms de 64 Kb requieren cambiar CS peridicamente.
DS = Registro de segmento de datos (data segment).
Segmento del rea de datos del programa.
SS = Registro de segmento de pila (stack segment).
Segmento de pila.
ES = Registro de segmento extra (extra segment).
Segmento de ampliacin para zona de datos. Es extraordinariamente til actuando
en conjuncin con DS: con ambos se puede definir dos zonas de 64 Kb, tan alejadas
como se desee en el espacio de direcciones, entre las que se pueden intercambiar datos.
- Registros punteros de pila:
SP = Puntero de pila (stack pointer).
Apunta a la cabeza de la pila. Utilizado en las instrucciones de manejo de la pila.
BP = Puntero base (base pointer).
Es un puntero de base, que apunta a una zona dentro de la pila dedicada al
almacenamiento de datos (variables locales y parmetros de las funciones en los
programas compilados).
- Registros ndices:
SI = ndice fuente (source index).
Utilizado como registro de ndice en ciertos modos de direccionamiento indirecto,
tambin se emplea para guardar un valor de desplazamiento en operaciones de cadenas.
DI = ndice destino (destination index).
Se usa en determinados modos de direccionamiento indirecto y para almacenar un
desplazamiento en operaciones con cadenas.
- Puntero de instrucciones o contador de programa:
IP = Puntero de instruccin (instruction pointer).
Marca el desplazamiento de la instruccin en curso dentro del segmento de cdigo.
Es automticamente modificado con la lectura de una instruccin.
- Registro de estado o de indicadores (flags).
Es un registro de 16 bits de los cuales 9 son utilizados para indicar diversas
situaciones durante la ejecucin de un programa. Los bits 0, 2, 4, 6, 7 y 11 son
indicadores de condicin, que reflejan los resultados de operaciones del programa; los
bits del 8 al 10 son indicadores de control y el resto no se utilizan. Estos indicadores
pueden ser comprobados por las instrucciones de salto condicional, lo que permite variar
el flujo secuencial del programa segn el resultado de las operaciones.
15 14 13 12 11 10 9 8
6 5 4 3 2 1 0
OF DF IF TF SF ZF AF PF CF
CF (Carry Flag): Indicador de acarreo. Su valor ms habitual es lo que nos
llevamos en una suma o resta.
DESTINO, FUENTE
DESTINO
AX,0fffh
EQU
MOV
0fffh
AX,dato
; smbolo constante
DW
MO
0fffh
AX,OFFSET dato
Porque hay que tener en cuenta que cuando traduzcamos a nmeros el smbolo
podra quedar:
17F3:0A11
DW
MOV
FFF
AX,0A11
DX,AX
AH,AL
AX,[57D1h]
AX,ES:[429Ch]
Esta sintaxis (quitando la 'h' de hexadecimal) sera la que admite el programa DEBUG
(realmente habra que poner, en el segundo caso, ES: en una lnea y el MOV en otra). Al
trabajar con ensambladores, las variables en memoria se pueden referenciar con etiquetas
simblicas:
dato
MOV
MOV
AX,dato
AX,ES:dato
DW
1234h
AX,[BP]
ES:[DI],AX
; AX = [SS*16+BP]
; [ES*16+DI] = AX
AX,[DI+DESP]
[SI+DESP],BX
MOV
ADD
AX,desp[DI]
desp[SI],BX
AX,ES:[BX+DI+DESP]
CS:[BX+SI+DESP],CX
MOV
MOV
AX,ES:desp[BX][DI]
CS:desp[BX][SI],CX
CS
SS
DS
ES
IP
No
No
No
SP
No
No
No
con prefijo
con prefijo
con prefijo
o
o
o
o
o
o
o
Los vectores de interrupcin pueden ser desviados hacia un programa propio que,
adems, podra quedar residente en memoria. Si se reprograma por completo una
interrupcin y sta es de tipo hardware, hay que realizar una serie de tareas adicionales,
como enviar una seal fin de interrupcin hardware al chip controlador de interrupciones.
Si se trata adems de la interrupcin del teclado del PC o XT, hay que enviar una seal de
reconocimiento al mismo ... en resumen: conviene documentarse debidamente antes de
intentar hacer nada. Todos estos problemas se evitan si la nueva rutina que controla la
interrupcin llama al principio (o al final) al anterior gestor de la misma, que es lo ms
normal, como se ver ms adelante.
vector
gestin
6.
MOV
AH,25h
MOV
LEA
AL,vector
DX,rutina
; entre 0 y 255
; DS:DX nueva rutina de
INT
21h
; llamar al DOS
MOV
MOV
MOV
PUSH
MOV
14.
LEA
15.
CLI
16.
MOV
[BX],DX
; cambiar vector
17.
MOV
[BX+2],CS
; cambiar vector
18.
STI
19.
POP
0000
gestin
interrupcin
(offset)
(segmento)
interrupciones
BL,vector*4
BH,0
AX,0
DS
DS,AX
DX,rutina
; vector a cambiar en BL
; ahora en BX
; preservar DS
; apuntar al segmento
; CS:DX nueva rutina de
; evitar posible
; permitir
DS
; restaurar DS
sectores BIOS por pista y NUMCAB cabezas, los sectores lgicos se relacionan con la
estructura fsica por la siguiente frmula:
Sector lgico = (sector_BIOS - 1) + cara * SECTPISTA + cilindro * SECTPISTA * NUMCAB - X1
7.6.3. - LA FAT.
Despus del sector de arranque, aparecen en el disco una serie de sectores que
constituyen la Tabla de Localizacin de Ficheros (File Alocation Table o FAT). Consiste
en una especie de mapa que indica qu zonas del disco estn libres, cules ocupadas,
dnde estn los sectores defectuosos, etc. Normalmente hay dos copias consecutivas de la
FAT (vase el offset 16 del sector de arranque), ya que es el rea ms importante del disco
de la que dependen todos los dems datos almacenados en l. No deja de resultar extrao
que ambas copias de la FAT estn fsicamente consecutivas en el disco: si
accidentalmente se estropeara una de ellas (por ejemplo, rayando con un bolgrafo el
disco) lo ms normal es que la otra tambin resultara daada. En general, muchos
programas de chequeo de disco no se molestan en verificar si ambas FAT son idnticas
(empezando por algunas versiones de CHKDSK). Por otra parte, hubiera sido mejor
eleccin haberla colocado en el centro del disco: dada la frecuencia de los accesos a la
misma, de cara a localizar los diferentes fragmentos de los ficheros, ello mejorara
notablemente el tiempo de acceso medio. Aunque cierto es que los cachs de disco y los
buffers del config.sys pueden hacer casi milagros... a costa de memoria.
Estado de los motores. En esta variable se indica, adems del estado de los
Byte 40h:3Fh motores de las 4 posibles disqueteras (si estn encendidos o no), la ltima
unidad que fue seleccionada y la operacin en curso sobre la misma.
Cuenta para la detencin del motor. Este byte es decrementado por la
interrupcin peridica del temporizador; cuando llega a 0 todos los
motores de las disqueteras (realmente, el nico que estaba girando) son
Byte 40h:40h
detenidos. Dejar el motor girando unos segundos tras la ltima operacin
evita tener que esperar a que el motor acelere antes de la siguiente (si esta
llega poco despus).
Estado de la ltima operacin: se actualiza tras cada acceso al disco,
Byte 40h:41h
indicando los errores producidos (0 = ninguno).
A partir de esta direccin, 7 bytes almacenan el resultado de la ltima
Bytes 40h:42h operacin de disquete o disco duro. Se trata de los 7 bytes que devuelve el
NEC765 tras los principales comandos.
Control del soporte (AT). Esta variable almacena, entre otros, la ltima
Byte 40h:8Bh
velocidad de transferencia seleccionada.
Informacin del controlador de disquete (AT). Se indica si la unidad
Byte 40h:8Fh soporta 80 cilindros (pues s, la verdad) y si soporta varias velocidades de
transferencia.
Estado del soporte en la unidad A. Se indica la velocidad de transferencia a
emplear en el disquete introducido en esta unidad, si precisa o no saltos
Byte 40h:90h dobles del cabezal (caso de los disquetes de 40 cilindros en unidades de
80), y el resultado de los intentos de la BIOS (la velocidad puede ser
correcta o no, segn se haya logrado determinar el tipo de soporte).
Byte 40h:91h Lo mismo que el byte anterior, pero para la unidad B.
Byte 40h:92h Estado del soporte en la unidad A al inicio de la operacin.
Byte 40h:93h Estado del soporte en la unidad B al inicio de la operacin.
Byte 40h:94h Nmero de cilindro en curso en la unidad A.
Byte 40h:95h Nmero de cilindro en curso en la unidad B.
Adems de estas variables, la BIOS utiliza tambin una tabla de parmetros apuntada
por la INT 1Eh. Los valores para programar ciertas caractersticas del FDC segn el tipo
de disco pueden variar, aunque algunos son comunes. Esta tabla determina las principales
caractersticas de operacin del disco. Dicha tabla est inicialmente en la ROM, en la
posicin 0F000h:0EFC7h de todas las BIOS compatibles (prcticamente el 100%),
aunque el DOS suele desviarla a la RAM para poder actualizarla. El formato de la misma
es:
Se corresponde con el byte 1 del comando 'Specify' del 765, que indica el step
byte 0: rate (el tiempo de acceso cilindro-cilindro, a menudo es 0Dh = 3 6 ms) y el
head unload time (normalmente, 0Fh = 240 480 ms).
Es el byte 2 del comando 'Specify': los bits 7..1 indican el head load time
byte 1:
(normalmente 01h = 2 4 ms) y el bit 0 suele estar a 0 para indicar modo DMA.
Tics de reloj (pulsos de la interrupcin 8) que transcurren tras el acceso hasta que
byte 2:
se para el motor.
cero la lnea A20 de direcciones del microprocesador en los 286 y superiores. Ese
artificio de hardware lo protagoniza el chip controlador del teclado (8042) ya que la lnea
A20 pasa por sus manos. Si se le insta a que conecte los dos extremos (enviando un
simple comando al controlador del teclado) a partir de ese momento es el
microprocesador quien controla la lnea A20 y, por tanto, en el ejemplo anterior se
hubiera accedido efectivamente a la memoria extendida. Los nuevos sistemas operativos
DOS habilitan la lnea A20 y, gracias a ello, estn disponibles otros 64 Kb adicionales.
Para ser exactos, como el rango va desde FFFF:0010 hasta FFFF:FFFF se puede acceder
a un total de 65520 bytes (64 Kb menos 16 bytes) de memoria. Tngase en cuenta que las
direcciones FFFF:0000 a la FFFF:000F estn dentro del primer megabyte. En el HMA se
cargan actualmente el DR-DOS 5.0/6.0 y el MS-DOS 5.0 y posteriores; evidentemente
siempre que el equipo, adems de ser un AT, disponga como mnimo de 64 Kb de
memoria extendida. En ciertos equipos poco compatibles es difcil habilitar la lnea A20,
por lo que el HIMEM.SYS de Microsoft dispone de un parmetro que se puede variar
probando docenas de veces hasta conseguirlo, si hay suerte (adems, hay BIOS muy
intervencionistas que dificultan el control de A20).
Address Data Bus. Son lneas multiplexadas, que pueden actuar como bus de datos o de
direcciones, evidentemente en tiempos distintos.
A15..8:
Address Bus. En todo momento almacenan la parte media del bus de direcciones.
Address/Status. Parte alta del bus de direcciones, multiplexada: cuando no salen direcciones,
la lnea S5 indica el estado del bandern de interrupciones; las lneas S4:S3 informan del
A19..16/S6..3:
registro de segmento empleado para realizar el acceso a memoria: 00-ES, 01-SS, 10-CS, 11DS; S6 no se usa.
-RD:
Read. Indica una lectura de memoria o de un dispositivo de entrada/salida.
READY:
Ready. Lnea de entrada que indica el final de la operacin de memoria o E/S.
Interrupt Request. Lnea de peticin de interrupciones enmascarables; el 8088 la observa
INTR:
peridicamente.
Test. En respuesta a la instruccin mquina WAIT (no TEST!), el 8088 se para a comprobar
-TEST:
esta lnea hasta que se ponga a 0.
Non-maskable Interrupt. Lnea de peticin de la interrupcin de tipo 2, que no puede ser
NMI:
enmascarada.
RESET:
Provoca una inicializacin interna que culmina saltando a FFFF:0.
MN/-MX:
Esta lnea indica si se trata de un sistema mnimo o mximo.
-S2
-S1
-S0
Estado del bus
------- ------- ------- -----------------------------0
0
0
Reconocimiento de interrupcin
0
0
1
Lectura de puerto E/S
0
1
0
Escritura en puerto E/S
0
1
1
Estado Halt
1
0
0
Acceso a cdigo
1
0
1
Lectura de memoria
1
1
0
Escritura en memoria
1
1
1
Inactivo
-RQ/Request/Grant. Estas patillas bidireccionales permiten a los dems procesadores conectados al
GT0..1:
bus forzar al 8088 a que libere el bus al final del ciclo en curso.
Lock. Lnea que sirve al 8088 para prohibir el acceso al bus a otros procesadores (se activa tras
la instruccin mquina LOCK y dura mientras se ejecuta la siguiente instruccin -la que sigue a
-LOCK:
LOCK, que es realmente un prefijo-). Tambin se activa automticamente en los momentos
crticos de un ciclo de interrupcin.
QS1/QS0: Queue Status. Permite determinar el estado de la cola de instrucciones del 8088.
Aunque pueden parecer demasiadas, algunas son idnticas (caso de inp() e inport()) y
otras se diferencian slo ligeramente en el tipo de los datos devueltos, lo cual es
irrelevante si se tiene en cuenta que el dato devuelto es descartado (caso de outp() y
outport()). En general, lo normal es emplear inport() e inportb() para la entrada, as como
outport() y outportb() para la salida. Por ejemplo, para enviar el EOI al final de una
interrupcin hardware se puede ejecutar: outportb(0x20, 0x20);
13.1.2 - ACCESO A LA MEMORIA.
/* leer la
/* leer el byte
/* poner palabra
/* poner byte
/* obtener offset
/* obtener
/* convertir
Las funciones peek(), peekb(), poke() y pokeb() tienen una utilidad evidente de cara a
consultar y modificar las posiciones de memoria. Cuando se necesita saber el segmento
y/o el offset de una variable del programa, las macros FP_OFF y FP_SEG devuelven
dicha informacin. Por ltimo, con MK_FP es posible asignar una direccin de memoria
absoluta a un puntero far. Por ejemplo, si se declara una variable:
char far *pantalla_color;
se puede hacer que apunte a la memoria de vdeo del modo texto de los adaptadores de
color con:
pantalla_color = MK_FP (0xB800, 0);
y despus se podra limpiar la pantalla con un bucle:
*pantalla_color++=0;
struct BYTEREGS {
unsigned char
};
union
REGS
struct
struct
WORDREGS x;
BYTEREGS h;
};
struct SREGS
{
unsigned int es;
int ds;
};
unsigned
struct REGPACK {
unsigned
r_ax, r_bx, r_cx, r_dx;
unsigned
r_bp, r_si, r_di, r_ds, r_es, r_flags;
};
Las dos primeras funciones se basan en la declaracin de dos uniones: una para
entrada y otra para salida, que simbolizan los valores iniciales (antes de llamar a la
interrupcin) y finales (tras la llamada) en los registros. Si se desea que la misma unin
que indica los valores iniciales devuelva los finales, se puede indicar por duplicado:
union REGS regs;
regs.h.ah = 0;
regs.h.al = 0x13;
int86 (0x10, ®s, ®s);
La diferencia entre int86() e int86x() reside en que la ltima permite trabajar con los
registros de segmento (la estructura SREGS se puede inicializar con los valores que
tienen que tener los registros de segmento antes de llamar a la interrupcin; a la vuelta,
dicha estructura habr sido modificada para indicar el valor devuelto en los registros de
segmento tras la interrupcin).
Hay quien prefiere trabajar con REGPACK, que con una sola estructura permite
tambin operar con los registros de segmento y la emplea tanto para enviar como para
recibir los resultados. El inconveniente, poco relevante, es que slo admite registros de 16
bits, lo que suele obligar a hacer desplazamientos y forzar el empleo de mscaras para
trabajar con las mitades necesarias:
struct REGPACK bios;
bios.r_ax = 0x13;
intr (0x10, &bios);
/* obtener
/*
/* nuestra funcin de
/* variable para almacenar el
En los casos en que no lo sea, se le puede hacer que vuelva a serlo aumentando el
tamao del rea de seguridad (que en los programas menos conflictivos ser 0). Tanto
_psp como _SS y _SP estn definidas ya por el compilador, por lo que la lnea anterior es
perfectamente vlida (sin ms) al final de un programa.
De estas variables predefinidas, las ms tiles son quiz las que devuelven la versin
del DOS, lo que ahorra el esfuerzo que supone averiguarlo llamando al DOS o
empleando la funcin de librera correspondiente. Tambin es til _psp, que permite un
acceso a este rea del programa de manera inmediata.
13.1.8 - INSERCIN DE CDIGO EN LNEA.
void _ _emit_ _ (argumento,...);
void geninterrupt (int interrupcin);
Por medio de _ _emit_ _() se puede colocar cdigo mquina de manera directa dentro
del programa en C. No es conveniente hacerlo as porque as, ya que alterar directamente
los registros de la CPU acabar alterando el funcionamiento esperado del compilador y
haciendo fallar el programa. Sin embargo, en un procedimiento dedicado exclusivamente
a almacenar cdigo inline (en lnea), es seguro este mtodo, sobre todo si se tiene cuidado
de no alterar los registros SI y DI (empleados muy a menudo por el compilador como
variables de tipo register). Por medio de geninterrupt() se puede llamar directamente a
una interrupcin: geninterrupt (interr) es exactamente lo mismo que _ _emit_ _(0xCD,
interr) ya que 0xCD es el cdigo de operacin de INT. Por ejemplo, para volcar la
pantalla por impresora se puede ejecutar geninterrupt(5). Con los smbolos _AX, _AL,
_AH, _BX, _BL, _BH, _CX, _CL, _CH, _DX, _DL, _DH, _SI, _DI, _BP, _SP, _CS,
_DS, _ES, _SS y _FLAGS se puede acceder directamente a los registros de la CPU. Hay
que tomar tambin precauciones para evitar efectos laterales (una asignacin tipo
_DS=0x40 no afectar slo a DS).
13.1.9 - LAS PALABRAS CLAVE INTERRUPT Y ASM.
Con interrupt <declaracin_de_funcin>; se declara una determinada funcin como
de tipo interrupcin. En estas funciones, el compilador preserva y restaura todos los
registros al comienzo y final de las mismas; finalmente, retorna con IRET. Por tanto, es
til para funciones que controlan interrupciones. Para emplear esto, se debera compilar
el programa con la opcin test stack overflow y las variables tipo registro desactivadas.
Con asm se pueden insertar instrucciones en ensamblador, como se ver ms adelante.
Datos
Punteros
Pila
64 Kb
Cdigo Datos
near
near
64 Kb
64 Kb
near
near
Medium 1 Mb
64 Kb
far
near
Compact 64 Kb
1 Mb
near
far
Large
1 Mb
1 Mb
far
far
Huge
1 Mb
1 Mb
(Bloques > 64 Kb)
far
far
MEDIUM: Este modelo es ideal para programas largos que no manejan demasiados
datos. Se utilizan punteros largos para el cdigo (que puede extenderse hasta 1 Mb) y
cortos para los datos: la pila y los datos juntos no pueden exceder de 64 Kb.
COMPACT: Al contrario que el anterior, este modelo es el apropiado para los programas
pequeos que emplean muchos datos. Por ello, el programa no puede exceder de 64 Kb
aunque los datos que controla pueden alcanzar el Mb, ya que los punteros de datos son de
tipo far por defecto.
LARGE: Empleado en las aplicaciones grandes y tambin por los programadores de
sistemas que no tienen paciencia para andar forzando continuamente el tipo de los
punteros (para rebasar el lmite de 64 Kb). Tanto los datos como el cdigo pueden
alcanzar el Mb, aunque no se admite que los datos estticos ocupen ms de 64 Kb. Este
modo es el que menos problemas da para manejar la memoria, no siendo quiz tan lento y
pesado como indica el fabricante.
HUGE: Similar al anterior, pero con algunas ventajas: por un lado, todos los punteros
son normalizados automticamente y se admiten datos estticos de ms de 64 Kb. Por
otro, y gracias a esto ltimo, es factible manipular bloques de datos de ms de 64 Kb cada
uno, ya que los segmentos de los punteros se actualizan correctamente. Sin embargo, este
modelo es el ms costoso en tiempo de ejecucin de los programas.
13.2.2 - INTEGRACIN DE MDULOS EN ENSAMBLADOR.
LA SENTENCIA ASM
La sentencia asm permite incluir cdigo ensamblador dentro del programa C,
utilizando los mnemnicos normales del ensamblador. Sin embargo, el uso de esta
posibilidad est ms o menos limitado segn la versin del compilador. En Turbo C 2.0,
los programas que utilizan este mtodo es necesario salir a la lnea de comandos para
compilarlos con el tradicional compilador de lnea, lo cual resulta poco atractivo. En
Turbo C++ 1.0, se puede configurar adecuadamente el compilador para que localice el
Turbo Assembler y lo utilice automticamente para ensamblar, sin necesidad de salir del
entorno integrado. Sin embargo, es a partir del Borland C++ cuando se puede trabajar a
gusto: en concreto, la versin Borland C++ 2.0 permite ensamblar sin rodeos cdigo
ensamblador incluido dentro del listado C. El nico inconveniente es la limitacin del
hardware disponible: para un PC/XT, el Turbo C 2.0 es el nico compilador
aceptablemente rpido. Sin embargo, en un 286 es ms recomendable el Turbo C++,
mientras que en un 386 modesto (o incluso en un 286 potente) resulta ms interesante
emplear el Borland C++ 2.0: las versiones 3.X de este compilador son las ms adecuadas
para un 486 o superior (bajo DOS).
La sintaxis de asm se puede entender fcilmente con un ejemplo:
main()
{
int dato1, dato2, resultado;
printf("Dame dos nmeros: "); scanf("%d %d", &dato1, &dato2);
asm
asm
asm
mult:
asm
asm
asm
asm
}
ax,dato2
mult
resultado,ax
cx; pop ax;
SUBRUTINAS EN ENSAMBLADOR
Cuando las rutinas a incluir son excesivamente largas, resulta ms conveniente
escribirlas como ficheros independientes y ensamblarlas por separado, incluyndolas en
un fichero de proyecto (*.PRJ) seleccionable en los mens del compilador.
Para escribir este tipo de rutinas hay que respetar las mismas definiciones de
segmentos que realiza el compilador. Hoy en da existe algo ms de flexibilidad; sin
embargo, aqu se expone el mtodo general para mezclar cdigo de ensamblador con C.
Veamos el siguiente programa en C:
int variable;
extern dato;
extern funcion();
main()
{
int a=21930; char b='Z';
variable = funcion (a, b, 0x12345678);
}
La variable variable es una variable global del programa a la que no se asigna valor
alguno en el momento de definirla. Tanto a como b son variables locales del
procedimiento main() y son asignadas con un cierto valor inicial; funcion() no aparece
por ningn sitio, ya que ser codificada en ensamblador en un fichero independiente. A
dicha funcin se le pasan 3 parmetros. La manera de hacerlo es colocndolos en la pila
(empezando por el ltimo y acabando por el primero). Por ello, el compilador meter
primero en la pila el valor 1234h y luego el 5678h (necesita dos palabras de pila porque
es un dato de tipo long). Luego coloca en la pila el carcter almacenado en la variable b:
como los valores que se apilan son siempre de 16 bits, la parte alta est a 0. Finalmente,
deposita el dato entero a. Seguidamente, llama a la funcin funcion() con un CALL que
puede ser de dos tipos: corto (CALL/RET en el mismo segmento) o largo (CALL/RETF
entre distintos segmentos). Esta llamada a la funcin, por tanto, provoca un
almacenamiento adicional de 2 bytes (modelos TINY, SMALL y COMPACT) o 4 (en los
restantes modelos de memoria, que podramos llamar largos).
El esqueleto de la subrutina en ensamblador que ha de recibir esos datos y, tras
procesarlos, devolver un resultado de tipo int es el siguiente:
DGROUP
GROUP
_DATA
programa C
_dato
_DATA
_BSS
_info
_BSS
_TEXT
DW
ENDS
_DATA, _BSS
; valor inicial a 0
SEGMENT
WORD PUBLIC 'BSS'
EXTRN _variable:WORD
; variable externa
DW
?
; sin valor inicial
ENDS
SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT,DS:DGROUP,SS:DGROUP
PUBLIC _funcion
PROC
PUSH
MOV
MOV
MOV
MOV
MOV
; ...
; ...
ADD
ADD
SUB
; ...
; ...
MOV
MOV
POP
RET
ENDP
NEAR
BP
BP,SP
BX,[BP+4]
CX,[BP+6]
AX,[BP+8]
DX,[BP+10]
; funcion() del C
CX,BX
CX,AX
CX,DX
; cuerpo de la funcin
AX,CX
SP,BP
BP
el programa C
_funcion
_funcion
;
;
;
;
_TEXT
ENDS
END
INT 00:
INT 01:
INT 02:
INT 03:
INT 04:
INT 05:
INT 06:
INT 07:
INT 08:
INT 09:
INT 0A:
INT 0B:
INT 0C:
INT 0D:
INT 0E:
INT 0F:
INT 10:
INT 11:
INT 12:
INT 13:
INT 14:
INT 15:
INT 16:
INT 17:
INT 18:
INT 19:
INT 1A:
INT 1B:
INT 1C:
INT 1D:
INT 1E:
INT 1F:
INT 20:
INT 21:
INT 22:
INT 23:
INT 24:
INT 25:
INT 26:
INT 27:
INT 28:
INT 29:
INT 2A:
INT 2B-2D:
INT 2E:
INT 2F:
INT 30:
INT 31:
INT 32:
INT 33:
INT 34-3F:
INT 40:
INT 41:
INT 42:
INT 43:
INT 44-45:
INT 46:
INT 47-49:
INT 4A:
INT 4B-5F:
INT 60-66:
INT 67:
INT 68-6F:
INT 70:
INT 71:
INT 72:
INT 73:
INT 74:
INT 75:
INT 76:
INT 77:
INT 78-7F:
INT 80-85:
INT 86-F0:
INT F1-FF:
Volver al ndice
Tamao
WORD
Descripcin
WORD
instalado)
02h
instalado)
04h
WORD
06h
WORD
instalado)
instalado)
orden por
sistema, sin
BIOS pueden
08h
WORD
no instalado)
0Ah
WORD
0Ch
WORD
no instalado)
no instalado)
0Eh
WORD
si no instalado)
orden por
[Mquinas no PS]:
Direccin E/S base del cuarto puerto paralelo (0
[Mquinas PS]:
Segmento del rea de datos extendida de la BIOS
Nota: Los campos de arriba son rellenados en estricto
sistema, sin
la BIOS
10h
WORD
interno
apuntador
bit
bit
arrancar
12h
BYTE
fabricacin}
13h
15h
16h
WORD
BYTE
BYTE
17h
BYTE
18h
BYTE
19h
BYTE
1Ah
1Ch
WORD
WORD
numrico)
buffer
1Eh 16 WORDs
3Eh
BYTE
del disquete
3Fh
BYTE
formateo
verificacin
bit 6
reservado
bits 5-4 nmero de disquetera seleccionada (0-3)
bit 3 = 1 motor de la disquetera 3 en marcha
bit 2 = 1 motor de la disquetera 2 en marcha
bit 1 = 1 motor de la disquetera 1 en marcha
bit 0 = 1 motor de la disquetera 0 en marcha
40h
BYTE
Contador de tics de reloj que faltan para parar
motor de la disquetera
41h
BYTE
Estado de la ltima operacin de disco (0 =
correcta)
bit 7 = 1 unidad no preparada
bit 6 = 1 error de posicionamiento del cabezal
bit 5 = 1 fallo general del controlador
bits 4-0:
00h no hay error
01h solicitud incorrecta
02h no encontrada la marca de direcciones
03h error de proteccin contra escritura
04h sector no encontrado
06h lnea de disco cambiado activa
08h el DMA se ha desbordado
09h el DMA ha cruzado una frontera de 64k
0Ch medio fsico desconocido
10h fallo de CRC al leer
42h 7 BYTEs
Bytes de estado/comandos de la Disquetera/Disco fijo
49h
BYTE
Modo de vdeo activo
4Ah
WORD
Nmero de columnas en pantalla
4Ch
WORD
Tamao del buffer de vdeo de la pgina activa en
bytes
4Eh
WORD
Desplazamiento sobre la memoria de pantalla de la
pgina activa
50h 16 BYTEs
Posicin del cursor (columna, fila) para las 8
pginas
60h
WORD
Tipo de cursor, compatible 6845, byte alto=lnea
inicial, bajo=final
62h
BYTE
Pgina activa
63h
WORD
Direccin E/S base del controlador de vdeo:
color=03D4h, mono=03B4h
65h
BYTE
03D8h/03B8h
66h
BYTE
67h
DWORD
6Bh
6Ch
BYTE
DWORD
70h
BYTE
la CGA 03D9h
del POST
medianoche
23:59:59.99
71h
72h
BYTE
WORD
(arranque caliente)
al arrancar
74h
BYTE
unidades ESDI}
disco
formateo
75h
76h
00h
01h
02h
03h
04h
05h
07h
no hubo error
funcin solicitada incorrecta
no encontrada marca de direcciones
error de proteccin contra escritura
sector no encontrado
fallo en el reset
fallo en la actividad de los parmetros del
08h
09h
0Ah
0Bh
0Dh
el DMA se ha desbordado
alineamiento de datos incorrecto para el DMA
detectado bandern de sector errneo
detectada pista errnea
nmero incorrecto de sectores para el
BYTE
BYTE
BYTE
en el XT}
77h
slo en el XT}
78h
3 BYTEs
1-3
7Bh
no PS]
BYTE
84h
85h
BYTE
WORD
87h
BYTE
EGA/MCGA/VGA
90h
91h
BYTE
BYTE
A1h
7 BYTEs
A4h
DWORD
verdad?)
duro preservada
A8h
DWORD
Pointer Table
ACh-AFh
B0h
BYTE
LOOP cuando se pita
B0h
DWORD
B4h
WORD
B6h 3 BYTEs
B9h 7 BYTEs
C0h 14 BYTEs
CEh
WORD
D0h-EFh
D0h-DCh
F0h-FFh
100h
BYTE
10Eh
BYTE
Reservados
(Phoenix 386 BIOS 1.10 10a) contador para retardo
ante un buffer de teclado lleno
Puntero al controlador de disco ptico 3363.
Reservado
Reservado para el POST?
???
Reservado
Cuenta de das desde el ltimo arranque???
Reservado
Usado por Digiboard MV/4
Reservado para el usuario
Byte de estado de Print Screen
Estado de BREAK al inicio de la ejecucin de
BASICA.COM
10Fh
116h
11Ah
BYTE
DWORD
DWORD
Volver al ndice
PC/XT
8255)
PC/AT
tiempo real
000
020
040
060
00F
021
043
063
081 - 083
0A0 - 0AF
200 - 20F
210 - 217
2F8 - 2FF
300 - 31F
320 - 32F
378 - 37F
380 - 38C
3B0 - 3BF
3D0 - 3D7
3F0 - 3F7
3F8 - 3FF
790 - 793
B90 - B93
1390 - 1393
2390 - 2393
000
020
040
060
070
01F
021
05F
06F
07F
080
0A0
0C0
0F0
1F0
200
258
278
2E1
2E2
2F8
300
360
378
380
3A0
3B0
3C0
3D0
09F
0A1
0DF
0FF
1F8
207
25F
27F
2E3
2FF
31F
36F
37F
38C
3AF
3BF
3CF
3DF
3F0 - 3F7
3F8 - 3FF
6E2 - 6E3
790 - 793
AE2 - AE3
B90 - B93
EE2 - EE3
1390 - 1393
22E1
2390 - 2393
42E1
62E1
82E1
A2E1
C2E1
E2E1
Volver al ndice
Las teclas marcadas con 'Ex' son exclusivas de teclados expandidos; generan los
mismos cdigos de rastreo que sus correspondientes teclas no expandidas, aunque
precedidos de un cdigo de rastreo adicional 0E0h como mnimo, por lo general
(consultar el apartado 5.2 del captulo 7 para ms detalles).
Cdigos secundarios.
A continuacin se listan los cdigos secundarios. Estos se producen al pulsar ciertas
combinaciones especiales de teclas, a las que el controlador de INT 9 responde colocando
un cdigo ASCII 0 en el buffer, a menudo junto al cdigo de rastreo, para identificarlas;
las teclas expandidas provocan frecuentemente la insercin de un ASCII 0E0h o bien
0F0h. Estos cdigos secundarios son el valor devuelto en AH por las funciones 0, 1, 10h
y 11h de la BIOS, cuando stas devuelven un carcter ASCII 0 0E0h en AL.
Ha de tenerse en cuenta que la BIOS modifica en ocasiones el valor ledo del buffer
del teclado, aunque en la siguiente tabla hay pautas para detectar esta circunstancia si
fuera necesario. En primer lugar, cuando se invoca a la BIOS con las funciones 0 y 1, ste
se encarga de simular las teclas normales con las expandidas, as como de ocultar las
combinaciones exclusivamente expandidas. Aquellos cdigos precedidos de (*) en la
tabla son ocultados por la BIOS (como si no se hubiera pulsado las teclas) al emplear las
funciones 0 y 1, sacndolos del buffer e ignorndolos. En concreto, estos cdigos son
almacenados con un cdigo ASCII 0F0h en el buffer del teclado. Lgicamente, para las
funciones 10h y 11h s existen, aunque la BIOS devuelve un 0 en AL (y no un 0F0h). A
los cdigos precedidos por (#) les sucede lo mismo: slo existen para las funciones 10h y
11h, al emplear dichas funciones la BIOS devuelve en AL el valor 0 (el autntico
contenido del buffer en esta ocasin, sin necesidad de transformarlo). Por ltimo, los
cdigos precedidos por (@) existen tanto para las funciones 0 y 1 como para la 10h y la
11h: la ventaja de usar las dos ltimas es que devuelven en AL el autntico cdigo ASCII
del buffer (0E0h), permitiendo diferenciar entre la pulsacin de una tecla normal y su
correspondiente expandida.
En general, quien no desee complicarse la vida con este galimatas (debido a una
evidente falta de previsin en el diseo del primer teclado) puede limitarse a emplear las
combinaciones normales (las no marcadas con #, # ni *). Por otra parte, para emplear las
combinaciones sealadas con (#), (@) o (*) hay que asegurarse previamente de que la
BIOS soporta teclado expandido (vase captulo 7, apartado 5.3).
Para diferenciar las teclas repetidas, en la tabla siguiente, las teclas entrecomilladas se
suponen expandidas o, en su defecto, ubicadas en el teclado numrico. Por ejemplo: "5"
es el 5 del teclado numrico, "<-" es el cursor izquierdo expandido y <- a secas el normal
(esto es, la tecla 4 del teclado numrico con Num Lock inactivo). Se emplea la notacin
anglosajona: Ctrl (Control), Alt (Alt o AltGr), Shift (Mays), Ins (Insert), Del (Supr),
Home (Inicio), End (Fin), PgUp (RePg), PgDn (AvPg).
Excepciones:
Hay un par de teclas que sin tener un cdigo ASCII 0, 0E0h ni 0F0h reciben un
tratamiento especial por parte de la BIOS, que provoca que el cdigo secundario no sea el
de rastreo acostumbrado: el Intro del teclado numrico genera un cdigo ASCII 0Dh,
como cabra esperar, pero su cdigo secundario es 0E0h; lo mismo sucede con el '/' del
teclado numrico. Las funciones 0 y 1 de la BIOS traducen este 0E0h al valor
correspondiente a la tecla Intro principal y al '-' del teclado principal (tecla que ocupa la
posicin del '/' en los teclados norteamericanos), para compatibilizar con los teclados no
expandidos.
Volver al ndice
En la tabla de esta pgina se listan las instrucciones del ensamblador por orden
alfabtico, indicndose el nmero de bytes consumidos al ser ensambladas as como los
tiempos tericos de ejecucin en 8088, 286, 386 y 486. Estos tiempos son tericos y no
deberan ser utilizados para temporizaciones exactas. Por otra parte son diferentes de un
procesador a otro. Los tiempos se expresan en estados de mquina (1 MHz equivale a
1.000.000 de estados o ciclos de reloj) estando la capacidad de ejecucin de instrucciones
lgicamente en funcin de los MHz del equipo que se trate. Estos tiempos se aplican
suponiendo que se cumplen las siguientes hiptesis:
Evidentemente, es casi imposible que los tiempos tericos sean los reales, teniendo en
cuenta todos estos factores. Cuanto menos potente es la mquina, mucho ms lentos son
los tiempos reales; por el contrario, en ordenadores con cach y procesador avanzado los
tiempos efectivos pueden ser en ocasiones mejores que los tericos!. Por ejemplo, el 486
emplea ya la tecnologa pipeline, lo que le permite simultanear la ejecucin de una
instruccin con la decodificacin de la siguiente y la lectura de memoria de la posterior
as como almacenar el resultado de la anterior. Esto, con las lgicas limitaciones de un
procesador CISC, permite en la prctica ejecutar un alto nmero de instrucciones en un
solo ciclo (cada una de ellas, claro). Por tanto, para lo que s sirven las tablas es para
decidir qu instrucciones emplear en ciertos procesos en que el tiempo de ejecucin o la
memoria consumida son crticos, especialmente en las mquinas menos potentes. Como
muestra de lo sumamente tericos que son estos tiempos, a continuacin se listan dos
rutinas con las que he probado experimentalmente los tiempos de ejecucin en diversos
microprocesadores. Ambas rutinas constan de un bucle que se repite cierto nmero de
veces; mientras tanto las interrupciones estn inhibidas, por lo que se cronometran a
mano:
Ciclos tericos
8088
486
RutinaA:
CLI
286
386
MOV
XOR
bucle:
AX,1000h
CX,CX
repite:
LOOP repite
(m=2)
6 2
DEC AX
1
JNZ bucle
(m=2)
3 1
STI
RutinaB:
1
17 5
2
8+m 4 (m=2)
2
16 4
2
7+m 3 (m=2)
2
11+m
2
7+m 3
bucle1:
CLI
XOR
MOV
CX,CX
AX,BX
bucle2:
MOV
AX,BX
AX,BX
DEC
CX
JNZ
fin
16 4
1
.
...
bucle16384: MOV
.
1
(m=1)
3 1
(m=2)
fin:
JMP
bucle1
7+m 3
15
7+m
7+m 3
7+m
STI
Por ejemplo, la rutina B ejecuta 16384 instrucciones del tipo MOV AX,BX (2 ciclos
cada una) as como un decremento (2 ciclos) un salto que no se realiza -salvo al final del
todo- (4 ciclos en 8088) y otro salto absoluto (15 ciclos en 8088). Se emplea este rodeo
ya que los saltos condicionales, como conocer el lector, slo pueden desviar algo ms de
100 bytes el flujo del programa (y este bucle ocupa nada menos que 32 Kb). En total,
32787 ciclos que, repetidos 65536 veces, suponen 2.148.728.832 ciclos. Con un 8088
corriendo a 8 MHz (8 millones de ciclos) cabra esperar una demora de 268,59 segundos.
Sin embargo, mi reloj de pulsera dice que son nada menos que 1194!, unas 4,44 veces
ms de lo que los tiempos tericos de Intel sugieren. De hecho, esto implica que cada
MOV tarda casi 9 ciclos reales en un 8088, y no 2. Sin embargo, en el caso de la rutina A
apenas hay diferencia entre el tiempo terico y el real: el tiempo que emplea la
instruccin LOOP es bastante alto en comparacin con lo que se tarda en traer dicha
instruccin de la memoria, por lo que la diferencia porcentual se reduce notablemente.
RUTINA A
RUTINA B
286-12
85,93
93,50
486-25*
64,42
75,50
42,96
69,10
Operandos
valor EA
(b) Desplazamiento
desp
[BX+SI], [BX+DI]
[BP+SI], [BP+DI]
11
[BX+SI+desp], [BX+DI+desp]
Los datos entre parntesis en el 8088 indican el tiempo empleado por las palabras de
16 bits, fuera del parntesis hacen referencia a 8 bits (los 8086 y superiores no son ms
lentos con datos de 16 que con los de 8 bits, siempre lgicamente que stos estn en una
posicin de memoria par). Aunque el 286 y 386 no penalizan tanto los modos de
direccionamiento complejos, a los tiempos marcados con (#) hay que aadir un ciclo si en
el offset participan tres elementos (ej., BP+DI+desp). La letra {m} se refiere al nmero
de bytes totales de la siguiente instruccin que se va a ejecutar. Cuando aparecen dos
opciones en las instrucciones de salto condicional, el menor tiempo de ejecucin se
verifica cuando el salto no se realiza. Todas las instrucciones especficas de 386 ocupan,
bajo DOS, un byte ms de lo que indican las tablas debido a que se utiliza un prefijo para
forzar el modo 32 bit en segmentos de 16. En los tiempos del 386, los datos entre
parntesis se aplican cuando la CPU est en modo virtual 86; en general, los tiempos de
ejecucin corresponden al modo real (en modo protegido, podran variar).
Inst.
Operandos
Bytes
Ciclos 8088
Ciclos 286
Ciclos 386
Ciclos 486
------ ----------------------------------- ------- -------------------------- ------------ -----------AAA
1
8
3
4
3
AAD
14
AAM
16
AAS
ADC
ADC
7 #
ADC
7 #
ADC
ADC
7 #
ADC
ADD
ADD
7 #
ADD
7 #
ADD
ADD
7 #
ADD
AND
AND
7 #
AND
7 #
AND
AND
7 #
AND
BOUND
13 #
BOUND
(no existe)
BSF
(no existe)
BSF
(no existe)
BSF
(no existe)
BSF
(no existe)
BSR
(no existe)
19
14
17
15
4
3
registro, registro
2
1
registro, memoria
6
2
memoria, registro
7
3
registro, inmediato
2
1
memoria, inmediato
7
3
acumulador, inmediato
2
1
registro, registro
2
1
registro, memoria
6
2
memoria, registro
7
3
registro, inmediato
2
1
memoria, inmediato
7
3
acumulador, inmediato
2
1
registro, registro
2
1
registro, memoria
6
2
memoria, registro
7
3
registro, inmediato
2
1
memoria, inmediato
7
3
acumulador, inmediato
2
1
registro16, memoria16
10
7
registro32, memoria32
10
7
registro16, registro16
10+3*n
6-42
registro16, memoria16
10+3*n
7-43
registro32, registro32
10+3*n
6-42
registro32, memoria32
10+3*n
7-43
registro16, registro16
10+3*n
6-42
60
83
2-4
9(13)+EA
2-4
16(24)+EA
3-4
3-6
17(25)+EA
2-3
2-4
9(13)+EA
2-4
16(24)+EA
3-4
3-6
17(25)+EA
2-3
2-4
9(13)+EA
2-4
16(24)+EA
3-4
3-6
17(25)+EA
2-3
2-4
(no existe)
2-6
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
BSR
(no existe)
BSR
(no existe)
BSR
(no existe)
BT
(no existe)
BT
(no existe)
BT
(no existe)
BT
(no existe)
BT
(no existe)
BT
(no existe)
BT
(no existe)
BT
(no existe)
BTC
(no existe)
BTC
(no existe)
BTC
(no existe)
BTC
(no existe)
BTC
(no existe)
BTC
(no existe)
BTC
(no existe)
BTC
(no existe)
BTR
(no existe)
BTR
(no existe)
BTR
(no existe)
BTR
(no existe)
BTR
(no existe)
BTR
(no existe)
BTR
(no existe)
BTR
(no existe)
BTS
(no existe)
registro16, memoria16
10+3*n
7-43
registro32, registro32
10+3*n
6-42
registro32, memoria32
10+3*n
7-43
registro16, registro16
3
3
memoria16, registro16
12
8
registro32, registro32
3
3
memoria32, registro32
12
8
registro16, inmediato8
3
3
memoria16, inmediato8
6
3
registro32, inmediato8
3
3
memoria32, inmediato8
6
3
registro16, registro16
6
6
memoria16, registro16
13
13
registro32, registro32
6
6
memoria32, registro32
13
13
registro16, inmediato8
6
6
memoria16, inmediato8
8
8
registro32, inmediato8
6
6
memoria32, inmediato8
8
8
registro16, registro16
6
6
memoria16, registro16
13
13
registro32, registro32
6
6
memoria32, registro32
13
13
registro16, inmediato8
6
6
memoria16, inmediato8
8
8
registro32, inmediato8
6
6
memoria32, inmediato8
8
8
registro16, registro16
6
6
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
6-8
(no existe)
(no existe)
6-8
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
6-8
(no existe)
(no existe)
6-8
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
6-8
(no existe)
(no existe)
6-8
(no existe)
(no existe)
BTS
(no existe)
BTS
(no existe)
BTS
(no existe)
BTS
(no existe)
BTS
(no existe)
BTS
(no existe)
BTS
(no existe)
CALL
7+m
CALL
13+m
CALL
11+m
CALL
7+m
CALL
16+m
CBW
2
CDQ
(no existe)
CLC
2
CLD
2
CLI
3
CMC
2
CMP
2
CMP
6 #
CMP
7 #
CMP
3
CMP
6 #
CMP
3
CMPS
8
CMPS
5+9*n
CWD
2
CWDE
(no existe)
memoria16, registro16
13
13
registro32, registro32
6
6
memoria32, registro32
13
13
registro16, inmediato8
6
6
memoria16, inmediato8
8
8
registro32, inmediato8
6
6
memoria32, inmediato8
8
8
procedimiento near (intrasegmento)
7+m
3
procedimiento far (intersegmento)
17+m
18
intrasegmento indirecto a memoria
10+m
5
intrasegmento indirecto a registro
7+m
5
intersegmento indirecto a memoria
22+m
17
3
3
2
2
2
registro, registro
2
1
registro, memoria
6
2
memoria, registro
5
2
registro, inmediato
2
1
memoria, inmediato
5
2
acumulador, inmediato
2
1
10
(REP)
5+9*n
5 (CX=0) 7+7*n
3
3
(no existe)
(no existe)
5-7
(no existe)
(no existe)
6-8
(no existe)
(no existe)
6-8
(no existe)
23
36
2-4
29+EA
24
2-4
57+EA
(no existe)
2-4
9(13)+EA
2-4
9(13)+EA
3-4
3-6
5-7
10(14)+EA
2-3
22(30)
9+22(30)*n
(no existe)
3
3
DAA
DAS
4
2
DEC
registro byte
2
2
1
DEC
registro palabra
2
2
1
DEC
memoria
7 #
6
3
DIV
registro byte
14
14
16
DIV
registro palabra
22
22
24
DIV
registro32
(no existe)
38
40
DIV
byte de memoria
17 #
17
16
DIV
palabra de memoria
25 #
25
24
DIV
palabra32 de memoria
(no existe)
41
40
ENTER
constante16, 0
11
10
14
ENTER
constante16, 1
15
12
17
ENTER
constante16, nivel
12+4*(n-1)
15+4*(n-1)
17+3*n
ESC
inmediato, memoria
9-20 #
(ver coproc.) (ver coproc.)
ESC
inmediato, registro
2
(ver coproc.) (ver coproc.)
HLT
2
5
4
IDIV
registro byte
17
19
19
IDIV
registro palabra
25
27
27
IDIV
registro32
(no existe)
43
43
IDIV
byte de memoria
20 #
19
20
IDIV
palabra de memoria
28 #
27
28
IDIV
palabra32 de memoria
(no existe)
43
44
IMUL
registro byte
13
9-14
13-18
IMUL
registro palabra
21
9-22
13-26
IMUL
registro32
(no existe)
9-38
13-42
IMUL
byte de memoria
16
12-17
13-18
IMUL
palabra de memoria
24 #
12-25
13-26
2-4
15(23)+EA
80-90
144-162
(no existe)
2-4
86-96+EA
2-4
154-172+EA
2-6
(no existe)
(no existe)
(no existe)
(no existe)
2-4
8(12)+EA
101-112
165-185
(no existe)
2-4
107-118+EA
2-4
175-194+EA
2-6
(no existe)
80-98
128-154
(no existe)
2-4
86-104+EA
2-4
138-164+EA
IMUL
palabra32 de memoria
(no existe)
12-41
13-42
IMUL
registro16 destino, constante
21
9-22
13-26
IMUL
registro16 destino, memoria
(no existe)
12-25
13-26
IMUL
registro32 destino, memoria
(no existe)
12-41
13-42
IMUL
registro destino, registro, cte.
21
9-22
13-26
IMUL
registro destino, memoria, cte.
24 #
12-25
13-26
IN
acumulador, puerto fijo
5
12(26)
14(27)
IN
acumulador, DX
5
13(27)
14(27)
INC
registro byte
2
2
1
INC
registro palabra
2
2
1
INC
memoria
7 #
6
3
INS
5
15(29)
17(30)
INS
(REP)
5+4*n
13(27)+6*n
16(29)+8*n
INT
3
23+m
33
26
INT
inmediato
23+m
37
30
INTO
24+m 3
35 3
28 3
IRET
17+m
22
15
JCXZ
8+m 4
9+m 5
3 1
JECXZ
(no existe)
9+m 5
3 1
JMP
short
7+m
7+m
3
JMP
near (intrasegmento)
7+m
7+m
3
JMP
far
(intersegmento)
11+m
12+m
17
JMP
intrasegmento indirecto a memoria
11+m #
10+m
5
JMP
intrasegmento indirecto a registro
7+m
7+m
5
JMP
intersegmento indirecto a memoria
15+m
17+m
13
Jxxx
inmediato8
7+m 3
7+m 3
3 1
Jxxx
inmediato32
(no existe)
7+m 3
3 1
LAHF
2
2
3
2-6
(no existe)
3-4
(no existe)
5-7
(no existe)
5-7
(no existe)
2-4
(no existe)
3-4
(no existe)
10(14)
8(12)
2-4
15(23)+EA
(no existe)
(no existe)
52
51
1
1
2
53 4
32
18 6
(no existe)
15
15
15
2-4
18+EA
11
2-4
24+EA
16 4
(no existe)
7 #
3 #
5
7 #
LDS
LEA
LEAVE
LES
LFS
(no existe)
LGS
(no existe)
LSS
(no existe)
LOCK
0
LODS
5
LODS
5+4*n
LOOP
8+m 4
LOOPE
8+m 4
LOOPNE
8+m 4
LOOPZ
8+m 4
LOOPNZ
8+m 4
MOV
3
MOV
5
MOV
2
MOV
5 #
MOV
3 #
MOV
2
MOV
3 #
MOV
2
MOV
2
MOV
5 #
MOV
3 #
MOVS
5
MOVS
5+4*n
6
6
6
1
5
(REP)
5+6*n
5
5 (CX=0) 7+4*n
11+m
2 6
11+m
9 6
11+m
9 6
11+m
9 6
11+m
9 6
memoria, acumulador
2
1
acumulador, memoria
4
1
registro, registro
2
1
registro, memoria
4
1
memoria, registro
2
1
registro, inmediato
2
1
memoria, inmediato
2
1
registro de segmento, registro
2
3
registro, registro de segmento
2
3
registro de segmento, memoria
5
9
memoria, registro de segmento
2
3
7
(REP)
5+4*n
24+EA
2-4
2+EA
2-4
7
5 (CX=0) 12+3*n
(no
existe)
2-4
24+EA
2-4
(no existe)
2-4
(no existe)
2-4
(no existe)
12(16)
9+13(17)*n
17 5
18 6
19 5
18 6
19 5
10(14)
10(14)
2-4
8(12)+EA
2-4
9(13)+EA
2-3
3-6
10(14)+EA
2-4
8(12)+EA
2-4
9(13)+EA
1
1
18(26)
9+17(25)*n
MOVSX
(no existe)
MOVSX
(no existe)
MOVSX
(no existe)
MOVSX
(no existe)
MOVSX
(no existe)
MOVSX
(no existe)
MOVZX
(no existe)
MOVZX
(no existe)
MOVZX
(no existe)
MOVZX
(no existe)
MOVZX
(no existe)
MOVZX
(no existe)
MUL
13
MUL
21
MUL
(no existe)
MUL
16 #
MUL
24 #
MUL
(no existe)
NEG
2
NEG
7 #
NOP
3
NOT
2
NOT
7 #
OR
2
OR
7 #
OR
7 #
OR
3
OR
7 #
registro16, registro8
3
3
registro16, memoria8
6
3
registro32, registro8
3
3
registro32, memoria8
6
3
registro32, registro16
3
3
registro32, memoria16
6
3
registro16, registro8
3
3
registro16, memoria8
6
3
registro32, registro8
3
3
registro32, memoria8
6
3
registro32, registro16
3
3
registro32, memoria16
6
3
registro byte
9-14
13
registro palabra
9-22
13
registro32
9-38
13
byte de memoria
12-27
18
palabra de memoria
12-25
26
palabra32 de memoria
12-41
42
registro
2
1
memoria
6
3
3
1
registro
2
1
memoria
6
3
registro, registro
2
1
registro, memoria
6
3
memoria, registro
7
3
registro, inmediato
2
1
memoria, inmediato
7
3
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
70-77
118-133
(no existe)
2-4
76-83+EA
2-4
128-143+EA
2-6
(no existe)
2-4
16(24)+EA
2-4
16(24)+EA
2-4
9(13)+EA
2-4
16(24)+EA
3-4
3-6
17(25)+EA
3
3
3
5
OR
OUT
OUT
OUTS
OUTS
5+4*n
POP
5
POP
5
POP
5 #
POPA
19
POPAD
(no existe)
POPF
5
POPFD
(no existe)
PUSH
3
PUSH
5 #
PUSH
3
PUSHA
17
PUSHAD
(no existe)
PUSHF
3
PUSHFD
(no existe)
RCL
2
RCL
5
RCL
5
RCL
8 #
RCL
7 #
RCL
8 #
RCR
2
RCR
5
RCR
5
acumulador, inmediato
2
1
puerto fijo, acumulador
10(24)
16(29)
DX, acumulador
11(25)
16(29)
byte o palabra
14(28)
17(30)
(REP)
12(26)+5*n
17(31)+5*n
registro normal
4
4
registro de segmento
7
3
memoria
5
6
24
9
24
9
9
5
registro
2
memoria
5
inmediato
2
18
9
1
4
1
11
18
4
11
4
4
registro,1
9
3
registro,CL
9
8-30
registro, contador
9
8-30
memoria, contador
10
9-31
memoria,1
10
4
memoria,CL
10
9-31
registro,1
9
3
registro,CL
9
8-30
registro, contador
9
8-30
2-3
10(14)
8(12)
(no existe)
(no existe)
12
12
2-4
25+EA
(no existe)
(no existe)
12
(no existe)
14
2-4
24+EA
2-3
(no existe)
(no existe)
(no existe)
14
(no existe)
8+4*bits
(no existe)
3-6
(no existe)
2-4
15(23)+EA
2-4
20(28)+EA+4*bits
8+4*bits
(no existe)
RCR
8 #
RCR
7 #
RCR
8 #
REP
REPE
REPNE
REPZ
REPNZ
RET
11+m
RET
11+m
RET
15+m
RET
15+m
2
5
5
8 #
7 #
8 #
2
5
5
8 #
7 #
8 #
2
2
5
5
ROL
ROL
ROL
ROL
ROL
ROL
ROR
ROR
ROR
ROR
ROR
ROR
SAHF
SAL
SAL
SAL
memoria, contador
10
9-31
memoria,1
10
4
memoria,CL
10
9-31
0
0
0
intrasegmento
10+m
5
intrasegmento con SP+inmediato
10+m
5
intersegmento
18+m
13
intersegmento con SP+inmediato
18+m
14
registro,1
3
3
registro,CL
3
3
registro, contador
3
2
memoria, contador
7
4
memoria,1
7
4
memoria,CL
7
4
registro,1
3
3
registro,CL
3
3
registro, contador
3
2
memoria, contador
7
4
memoria,1
7
4
memoria,CL
7
4
3
2
registro,1
3
3
registro,CL
3
3
registro, contador
3
2
3-6
(no existe)
2-4
15(23)+EA
2-4
20(28)+EA+4*bits
20
24
32
31
8+4*bits
(no existe)
3-6
(no existe)
2-4
15(23)+EA
2-4
20(28)+EA+4*bits
8+4*bits
(no existe)
3-6
(no existe)
2-4
15(23)+EA
2-4
20(28)+EA+4*bits
8+4*bits
(no existe)
8 #
7 #
8 #
2
5
5
8 #
7 #
8 #
2
7 #
7 #
3
7 #
3
7
SAL
SAL
SAL
SAR
SAR
SAR
SAR
SAR
SAR
SBB
SBB
SBB
SBB
SBB
SBB
SCAS
SCAS
5+8*n
SETcc
(no existe)
SETcc
(no existe)
SHL
2
SHL
5
SHL
5
SHL
8 #
SHL
7 #
SHL
8 #
SHLD
(no existe)
SHLD
(no existe)
SHLD
(no existe)
memoria, contador
7
4
memoria,1
7
4
memoria,CL
7
4
registro,1
3
3
registro,CL
3
3
registro, contador
3
2
memoria, contador
7
4
memoria,1
7
4
memoria,CL
7
4
registro, registro
2
1
registro, memoria
6
2
memoria, registro
7
3
registro, inmediato
2
1
memoria, inmediato
7
3
acumulador, inmediato
2
1
7
6
(REP)
5+8*n 5 (CX=0) 7+5*n
registro8
4
4
memoria8
5
3
registro,1
3
3
registro,CL
3
3
registro, contador
3
2
memoria, contador
7
4
memoria,1
7
4
memoria,CL
7
4
registro16, registro16, inmediato8
3
2
memoria16, registro16, inmediato8
7
3
registro32, registro32, inmediato8
3
2
3-6
(no existe)
2-4
15(23)+EA
2-4
20(28)+EA+4*bits
8+4*bits
(no existe)
3-6
(no existe)
2-4
15(23)+EA
2-4
20(28)+EA+4*bits
2-4
9(13)+EA
2-4
16(24)+EA
3-4
3-6
4
17(25)+EA
2-3
15(19)
9+15(19)*n
(no existe)
4-6
(no existe)
8+4*bits
(no existe)
3-6
(no existe)
2-4
15(23)+EA
2-4
20(28)+EA+4*bits
(no existe)
6-8
(no existe)
(no existe)
SHLD
(no existe)
SHLD
(no existe)
SHLD
(no existe)
SHLD
(no existe)
SHLD
(no existe)
SHR
2
SHR
5
SHR
5
SHR
8 #
SHR
7 #
SHR
8 #
SHRD
(no existe)
SHRD
(no existe)
SHRD
(no existe)
SHRD
(no existe)
SHRD
(no existe)
SHRD
(no existe)
SHRD
(no existe)
SHRD
(no existe)
STC
2
STD
2
STI
2
STOS
3
STOS
4+3*n
SUB
2
SUB
7 #
SUB
7 #
SUB
3
4
5
(REP)
5+5*n 5 (CX=0) 7+4*n
registro, registro
2
1
registro, memoria
6
2
memoria, registro
7
3
registro, inmediato
2
1
6-8
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
8+4*bits
(no existe)
3-6
(no existe)
2-4
15(23)+EA
2-4
20(28)+EA+4*bits
(no existe)
6-8
(no existe)
(no existe)
6-8
(no existe)
(no existe)
5-7
(no existe)
(no existe)
5-7
(no existe)
11(15)
9+10(14)*n
2-4
9(13)+EA
2-4
16(24)+EA
3-4
7 #
3
2
6 #
6 #
3
6 #
3
3
3
3
5 #
5
2
7 #
7 #
3
7 #
3
SUB
SUB
TEST
TEST
TEST
TEST
TEST
TEST
WAIT
XCHG
XCHG
XCHG
XLAT
XOR
XOR
XOR
XOR
XOR
XOR
memoria, inmediato
7
3
acumulador, inmediato
2
1
registro, registro
2
1
registro, memoria
5
2
memoria, registro
5
2
registro, inmediato
2
1
memoria, inmediato
5
2
acumulador, inmediato
2
1
6
1-3
AX,registro16
3
3
registro, registro
3
3
memoria, registro
5
5
5
4
registro, registro
2
1
registro, memoria
6
2
memoria, registro
7
3
registro, inmediato
2
1
memoria, inmediato
7
3
acumulador, inmediato
2
1
Volver al ndice
3-6
17(25)+EA
2-3
2-4
9(13)+EA
2-4
16(24)+EA
3-4
3-6
17(25)+EA
2-3
2-4
17(25)+EA
11
2-4
9(13)+EA
2-4
16(24)+EA
3-4
3-6
17(25)+EA
2-3
El slot de expansin de los PC contiene bsicamente las principales seales del 8086
demultiplexadas, as como otras de interrupciones, DMA, control de E/S, etc. Las seales
presentes en el slot de expansin de 8 bits son:
OSC:
ALE:
TC:
DRQ1DRQ3:
DACK1DACK3:
IRQ2IRQ7:
(Oscilator) Seal de reloj de casi 70 ns (14,31818 MHz) que est la mitad del
perodo en estado alto y la otra mitad en estado bajo.
(Address Latch Enable) Indica en su flanco de bajada que el latch de
direcciones se ha cargado con una direccin vlida procedente del
microprocesador.
(Terminal Count) Indica el final de la cuenta en algn canal de DMA.
(DMA Request) Lneas asncronas de peticin de DMA (1 mayor prioridad, 3
menor). Esta lnea debe activarse hasta que DACK (activo a nivel bajo) suba.
(DMA Acknowledge) Indica que ha sido atendida la peticin de DMA y que
debe bajarse el correspondiente DRQ.
(Interrupt request) Indica una peticin de interrupcin (2 mayor prioridad, 7
menor). La seal debe mantenerse activa hasta que la interrupcin acabe de
ser procesada.
IOR:
IOW:
MEMR:
MEMW:
RESET
DRV:
A0-A19:
D0-D7:
AEN:
I/O CH
RDY:
I/O CH
CK:
En los AT, las lneas adicionales completan fundamentalmente la nueva longitud de los
buses de datos y direcciones, permitiendo acceder tambin al resto del nuevo hardware:
Nuevas lneas de peticin/reconocimiento de DMA para los canales 5, 6 y 7,
as como el 0 (realmente el 4) que en los XT no estaba disponible al ser
empleado por el refresco de memoria.
Nuevos niveles de interrupcin: 10, 11, 12, 13, 14 y 15. IRQ8 es interna a la
IRQ:
placa base y no est presente en el slot; IRQ9 se utiliza para emular IRQ2.
I/O CS 16: Indica un acceso de 16 bits en los puertos E/S.
MEM CS
Indica un acceso de 16 bits en la memoria.
16:
D8-D15: Parte alta del bus de datos.
A17-A23: Parte alta del bus de direcciones.
DRQ y
DACK:
Volver al ndice
Lgicamente, las funciones del DOS y la BIOS podran llenar varios libros de mayor
tamao que ste. Por ello, se listarn exclusivamente las funciones que se utilizan en los
programas ejemplo y en las explicaciones. Toda la informacin ha sido obtenida del
INTERRUPT.LST, en su mayora de la versin 39 del mismo (ver bibliografa), en este
libro se recoge menos de un 8% de las lneas de dicho fichero. Todas las funciones
recogidas en el INTERRUPT tienen el siguiente formato:
--------V-1000------------------------------INT 10 - VIDEO - SET VIDEO MODE
AH = 00h
AL = mode (see below)
Return: AL = video mode flag (Phoenix BIOS)
20h mode > 7
30h modes 0-5 and 7
3Fh mode 6
AL = CRT controller mode byte (Phoenix 386 BIOS
v1.10)
Al principio de la funcin, en la lnea de guiones, suele haber uno, dos o tres nmeros
hexadecimales de 8 bits (pegados unos a otros) que indican, por orden de aparicin:
nmero de la interrupcin, valor de llamada en AH, valor de llamada en AL. En el
ejemplo superior se trata de la INT 10h, a la que hay que llamar con AH=0. Si fueran
necesarios ms valores en otros registros normalmente se indicar de manera explcita en
la cabecera. Esta cabecera es til, ya que un fichero de varios megas no es operativo
consultarlo con TYPE (y muchos editores de texto no pueden cargarlo): lo normal es
emplear una de esas pequeas utilidades para ver ficheros de texto, que permiten moverse
arriba y abajo con las teclas de los cursores (como README.COM que acompaa a los
compiladores de Borland): esos programas suelen tener opciones de bsqueda de texto;
de esta manera, buscando la cadena "-210A" se podra encontrar rpidamente la funcin
0Ah del DOS (INT 21h).
Desc:
generated if the divisor of a DIV or IDIV instruction is
zero or the
quotient overflows the result register; DX and AX will
be unchanged.
Notes: on an 8086/8088, the return address points to the
following instruction
on an 80286+, the return address points to the divide
instruction
an 8086/8088 will generate this interrupt if the result of
a division
is 80h (byte) or 8000h (word)
SeeAlso: INT 04
Desc:
generated by BOUND instruction when the value to be tested
is less than
the indicated lower bound or greater than the indicated
upper bound.
Note:
returning from this interrupt re-executes the failing
BOUND instruction
Desc:
generated 18.2 times per second by channel 0 of the 8254
system timer,
this interrupt is used to keep the time-of-day clock
updated
Notes: programs which need to be invoked regularly should use INT
1C unless
they need to reprogram the timer while still keeping the
time-of-day
clock running at the proper rate
default handler is at F000h:FEA5h in IBM PC and 100%compatible BIOSes
may be masked by setting bit 0 on I/O port 21h
SeeAlso: INT 1C,INT 4A,INT 50"DESQview",INT 58"DoubleDOS",INT
70,INT 78"GO32"
next INT 09
31h
32h
33h
34h
35h
36h
37h
38h
39h
3Ah
3Bh
3Ch
3Dh
3Eh
3Fh
40h
41h
42h
43h
44h
45h
46h
47h
48h
49h
4Ah
4Bh
4Ch
4Dh
4Eh
4Fh
50h
N
M
, <
. >
/ ?
Right Shift
Grey*
Alt
SpaceBar
CapsLock
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
NumLock
ScrollLock
Home
UpArrow
PgUp
GreyLeftArrow
Keypad 5
RightArrow
Grey+
End
DownArrow
51h
52h
63h
64h
65h
66h
67h
68h
69h
6Ah
6Bh
6Ch
6Dh
F16
F17
F18
F19
F20
F21
F22
F23
F24
-EraseEOF
6Fh
Copy/Play
72h
CrSel
74h
75h
76h
ExSel
-Clear
E0h
prefix
PgDn
E1h
prefix
Ins
FAh
ACK
23h
H
53h
Del
FEh
RESEND
24h
J
54h
SysRq
FFh
kbd
error/buffer full
25h
K
26h
L
56h
left \| (102-key)
27h
; :
57h
F11
28h
' "
58h
F12
29h
` ~
2Ah
Left Shift
5Ah
PA1
2Bh
\ |
5Bh
F13
2Ch
Z
5Ch
F14
2Dh
X
5Dh
F15
2Eh
C
2Fh
V
30h
B
Note:
scan codes 56h-E1h are only available on the extended
(101/102-key)
keyboard and Host Connected (122-key) keyboard; scan
codes 5Ah-76h
are only available on the 122-key keyboard
handler's
process
many VGA boards do not implement the vertical retrace
interrupt,
including the IBM VGA Adapter where the traces are
either cut or
removed
SeeAlso: INT 52"DESQview",INT 5A"DoubleDOS",INT 71,INT 7A"GO32"
completion of an operation
Notes: default handler is at F000h:EF57h in IBM PC and 100%compatible BIOSes
may be masked by setting bit 6 on I/O port 21h
SeeAlso: INT 0D"IRQ5",INT 56"DESQview",INT 5E"DoubleDOS",INT
7E"GO32"
Notes: IBM standard modes do not clear the screen if the high bit
of AL is set
(EGA or higher only)
Values for video mode:
text/ text pixel
pixel colors disply scrn system
grph resol box
resoltn
pages
addr
00h = T
40x25 8x8
16gray
8
B800
CGA,PCjr,Tandy
= T
40x25 8x14
16gray
8
B800 EGA
= T
40x25 8x16
16
8
B800 MCGA
= T
40x25 9x16
16
8
B800 VGA
01h = T
40x25 8x8
16
8
B800
CGA,PCjr,Tandy
= T
40x25 8x14
16
8
B800 EGA
= T
40x25 8x16
16
8
B800 MCGA
= T
40x25 9x16
16
8
B800 VGA
02h = T
80x25 8x8
16gray
4
B800
CGA,PCjr,Tandy
= T
80x25 8x14
16gray
4
B800 EGA
= T
80x25 8x16
16
4
B800 MCGA
= T
80x25 9x16
16
4
B800 VGA
03h = T
80x25 8x8
16
4
B800
CGA,PCjr,Tandy
= T
80x25 8x14
16
4
B800 EGA
= T
80x25 8x16
16
4
B800 MCGA
= T
80x25 9x16
16
4
B800 VGA
04h = G
40x25 8x8
320x200
4
B800
CGA,PCjr,EGA,MCGA,VGA
05h = G
40x25 8x8
320x200 4gray
B800 CGA,PCjr,EGA
= G
40x25 8x8
320x200
4
B800 MCGA,VGA
06h = G
80x25 8x8
640x200
2
B800
CGA,PCjr,EGA,MCGA,VGA
07h = T
80x25 9x14
mono
var
B000
MDA,Hercules,EGA
= T
80x25 9x16
mono
B000 VGA
08h = T 132x25 8x8
16
B800 ATI EGA/VGA
Wonder [2]
= T 132x25 8x8
mono
B000 ATI EGA/VGA
Wonder [2]
= G
20x25 8x8
160x200
16
PCjr, Tandy
1000
= G
90x43 8x8
720x352 mono
B000 Hercules +
MSHERC.COM
= G
90x45 8x8
mono
B000 Hercules +
HERKULES [11]
09h = G
40x25 8x8
320x200
16
PCjr, Tandy
1000
0Ah = G
80x25 8x8
640x200
4
PCjr, Tandy
1000
0Bh =
reserved (used internally by EGA BIOS)
= G
80x25 8x8
640x200
16
Tandy 1000
SL/TL [13]
0Ch =
reserved (used internally by EGA BIOS)
0Dh = G
40x25 8x8
320x200
16
8
A000 EGA,VGA
0Eh = G
80x25 8x8
640x200
16
4
A000 EGA,VGA
0Fh = G
80x25 8x14 640x350 mono
2
A000 EGA,VGA
10h = G
80x25 8x14 640x350
4
2
A000 64k EGA
= G
640x350
16
11h = G
80x30 8x16 640x480 mono
EGA,ATI VIP
12h = G
80x30 8x16 640x480 16/256k
= G
80x30 8x16 640x480 16/64
Wonder
= G
640x480
16
UltraVision+256K EGA
13h = G
40x25 8x8
320x200 256/256k
VIP
Index: video modes
Index: installation check|HERKULES
A000 VGA,MCGA,ATI
AH=00h)
Desc:
specify which of possibly multiple display pages will be
visible
Note:
to determine whether the requested page actually exists,
use AH=0Fh
to query the current page after making this call
SeeAlso: AH=0Fh,AH=43h,AH=45h
0101 magenta
0110 brown
0111 light gray
=
=
=
=
09h
character to display
page number (00h to number of pages - 1) (see AH=00h)
attribute (text mode) or color (graphics mode)
if bit 7 set in graphics mode, character is xor'ed
onto screen
CX = number of times to write character
Notes: all characters are displayed, including CR, LF, and BS
replication count in CX may produce an unpredictable
result in graphics
modes if it is greater than the number of positions
remaining in the
current row
SeeAlso: AH=08h,AH=0Ah,AH=4Bh"GRAFIX",INT 17/AH=60h,INT 1F,INT
43,INT 44
screen)
Desc:
Notes:
AH = 0Ch
BH = page number
AL = pixel color (if bit 7 set, value is xor'ed onto
CX = column
DX = row
set a single pixel on the display in graphics modes
valid only in graphics modes
BH is ignored if the current video mode supports only one
page
SeeAlso: AH=0Dh,AH=46h
AH = 0Eh
AL = character to write
BH = page number
BL = foreground color (graphics modes only)
Desc:
display a character on the screen, advancing the cursor
and scrolling
the screen as necessary
Notes: characters 07h (BEL), 08h (BS), 0Ah (LF), and 0Dh (CR) are
interpreted
and do the expected things
IBM PC ROMs dated 4/24/81 and 10/19/81 require that BH be
the same as
#0063)
Return: AL = 4Fh if function supported
AH = status
00h successful
ES:DI buffer filled
01h failed
Desc:
determine whether VESA BIOS extensions are present and the
capabilities
supported by the display adapter
SeeAlso: AX=4E00h,AX=4F01h,AX=7F00h,AX=A00Ch
Index: installation check;VESA SuperVGA
Format of SuperVGA information:
Offset Size
Description
(Table 0063)
00h 4 BYTEs
signature ("VESA")
04h
WORD
VESA version number
06h
DWORD
pointer to OEM name
"761295520" for ATI
0Ah 4 BYTEs
capabilities
0Eh
DWORD
pointer to list of supported VESA and OEM video
modes
21h
BYTE
22h
BYTE
23h
BYTE
24h
BYTE
25h
BYTE
26h
BYTE
27h
BYTE
28h 216 BYTEs
106h
1280x1024x16
107h
1280x1024x256
108h
80x60 text
109h
132x25 text
10Ah
132x43 text
10Bh
132x50 text
10Ch
132x60 text
---VBE v1.2--10Dh
320x200x32K
10Eh
320x200x64K
10Fh
320x200x16M
110h
640x480x32K
111h
640x480x64K
112h
640x480x16M
113h
800x600x32K
114h
800x600x64K
115h
800x600x16M
116h
1024x768x32K
117h
1024x768x64K
118h
1024x768x16M
119h
1280x1024x32K
11Ah
1280x1024x64K
11Bh
1280x1024x16M
Index: video modes
(Table 0069)
Values for S3 OEM video mode:
201h
640x480x256
202h
800x600x16
203h
800x600x256
204h
1024x768x16
205h
1024x768x256
206h
1280x960x16
208h
1280x1024x16
211h
640x480x64K (Diamond Stealth 24)
212h
640x480x16M (Diamond Stealth 24)
301h
640x480x32K
Note:
these modes are only available on video cards using S3's
VESA driver
Index: video modes
are
=
=
=
=
02h
number of sectors to read (must be nonzero)
low eight bits of cylinder number
sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer
Return: CF set on error
=
=
=
=
03h
number of sectors to write (must be nonzero)
low eight bits of cylinder number
sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer
Return: CF set on error
CF clear if successful
AH = status (see AH=01h)
AL = number of sectors transferred
Notes: errors on a floppy may be due to the motor failing to spin
up quickly
enough; the write should be retried at least three
times, resetting
the disk with AH=00h between attempts
the IBM AT BIOS and many other BIOSes use only the low
four bits of
DH (head number) since the WD-1003 controller which is
the standard
AT controller (and the controller that IDE emulates)
only supports
16 heads
AWARD AT BIOS and AMI 386sx BIOS have been extended to
handle more
than 1024 cylinders by placing bits 10 and 11 of the
cylinder number
into bits 6 and 7 of DH
SeeAlso: AH=02h,AH=0Bh
=
=
=
=
04h
number of sectors to verify (must be nonzero)
low eight bits of cylinder number
sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer (PC,XT,AT with BIOS prior to
11/15/85)
Return: CF set on error
CF clear if successful
AH = status (see AH=01h)
AL = number of sectors verified
Notes: errors on a floppy may be due to the motor failing to spin
up quickly
enough; the write should be retried at least three
times, resetting
the disk with AH=00h between attempts
this function does not compare the disk with memory, it
merely
checks whether the sector's stored CRC matches the
data's actual CRC
the IBM AT BIOS and many other BIOSes use only the low
four bits of
DH (head number) since the WD-1003 controller which is
the standard
AT controller (and the controller that IDE emulates)
only supports
16 heads
AWARD AT BIOS and AMI 386sx BIOS have been extended to
handle more
than 1024 cylinders by placing bits 10 and 11 of the
cylinder number
into bits 6 and 7 of DH
SeeAlso: AH=02h
AH = 08h
DL = drive (bit 7 set for hard disk)
Return: CF set on error
AH = status (07h) (see AH=01h)
CF clear if successful
AH = 00h
BL = drive type (AT/PS2 floppies only) (see below)
CH = low eight bits of maximum cylinder number
CL = maximum sector number (bits 5-0)
high two bits of maximum cylinder number (bits 76)
DH = maximum head number
DL = number of drives
ES:DI -> drive parameter table (floppies only)
Notes: may return successful even though specified drive is
greater than the
number of attached drives of that type (floppy/hard);
check DL to
ensure validity
for systems predating the IBM AT, this call is only valid
for hard
disks, as it is implemented by the hard disk BIOS rather
than the
ROM BIOS
Toshiba laptops with HardRAM return DL=02h when called
with DL=80h,
but fail on DL=81h. The BIOS data at 40h:75h correctly
reports 01h.
SeeAlso: AH=06h"Adaptec",AH=15h,INT 1E,INT 41
Values for drive type:
01h
360K
02h
1.2M
03h
720K
04h
1.44M
05h
??? (reportedly an obscure drive type shipped on some IBM
machines)
2.88M on some machines (at least AMI 486 BIOS)
06h
2.88M
= 4Fh
= hardware scan code
set
set
AL = hardware scan code
CF clear
scan code should be ignored
Note:
called by INT 09 handler to translate scan codes; the INT
09 code does
not examine the scan code it reads from the keyboard
until after
this function returns. This permits software to
rearrange the
keyboard; for example, swapping the CapsLock and Control
keys, or
turning the right Shift key into Enter.
SeeAlso: INT 09,INT 15/AH=C0h
= 85h
= SysRq key action (00h pressed, 01h released)
clear
clear if successful
AH = 00h
CF set on error
AH = 90h
AL = device type (see below)
ES:BX -> request block for type codes 80h through BFh
CF clear
Return: CF set if wait time satisfied
CF clear if driver must perform wait
AH = 00h
Notes: type codes are allocated as follows:
00-7F non-reentrant devices; OS must arbitrate access
80-BF reentrant devices; ES:BX points to a unique
control block
C0-FF wait-only calls, no complementary INT 15/AH=91h
call
floppy and hard disk BIOS code uses this call to implement
a timeout;
for device types 00h and 01h, a return of CF set means
that the
timeout expired before the disk responded.
this function should be hooked by a multitasker to allow
other tasks
to execute while the BIOS is waiting for I/O completion;
the default
handler merely returns with AH=00h and CF clear
SeeAlso: AH=91h,INT 13/AH=00h,INT 17/AH=00h,INT 1A/AH=83h
Values for device type:
00h
disk
01h
diskette
02h
keyboard
03h
PS/2 pointing device
21h
80h
FBh
FCh
FDh
FEh
AH = C0h
Return: CF set if BIOS doesn't support call
CF clear on success
ES:BX -> ROM table (see below)
AH = status
00h successful
86h unsupported function
Notes: the 1/10/86 XT BIOS returns an incorrect value for the
feature byte
the configuration table is at F000h:E6F5h in 100%
compatible BIOSes
Dell machines contain the signature "DELL" or "Dell" at
absolute FE076h
and a model byte at absolute address FE845h
Hewlett-Packard machines contain the signature "HP" at
F000h:00F8h and
a product identifier at F000h:00FAh (see below)
Compaq machines can be identified by the signature string
"COMPAQ" at
F000h:FFEAh, and is preceded by additional information
(see below)
Tandy 1000 machines contain 21h in the byte at F000h:C000h
and FFh in
the byte at FFFFh:000Eh; Tandy 1000SL/TL machines only
provide the
first three data bytes (model/submodel/revision) in the
returned
table
byte 2:
(keyboard functionality) supported
(get POS data) supported
(return memory map info) supported
(en/disable CPU functions) supported
bit 2
bit 1
bit 0
FCh
05h
FCh
06h
FCh
06h
FCh
08h
FCh
08h
FCh
09h
FCh
09h
FCh
0Bh
286)
FCh
20h
FCh
30h
FCh
31h
FCh
33h
FCh
42h
FCh
45h
XP 5)
FCh
48h
FCh
4Fh
FCh
50h
FCh
51h
FCh
52h
FCh
81h
FCh
81h
FCh
82h
FCh
94h
FBh
00h
support
FBh
00h
FBh
4Ch
FAh
00h
FAh
00h
FAh
01h
8086)
FAh
30h
FAh
4Eh
FAh
FEh
F9h
00h
F9h
FFh
F8h
00h
F8h
01h
F8h
02h
F8h
04h
F8h
04h
2 system brd
F8h
04h
2 system brd
F8h
05h
F8h
06h
F8h
07h
F8h
07h
F8h
07h
F8h
07h
F8h
09h
1 system brd
F8h
09h
F8h
09h
00h
00h
01h
***
00h
00h
02h
00h
02/13/87
???
???
???
???
???
06/28/89
02/16/90
00h
***
***
***
***
***
02/18/93
???
???
???
???
???
Compaq ProLinea
Epson, unknown model
Epson, unknown model
Epson, unknown model
Olivetti M280
Olivetti M380 (XP 1, XP3,
***
***
***
***
***
00h
01h
01h
00h
01h
???
???
???
???
???
01/15/88
???
???
???
01/10/86
Olivetti M290
Olivetti M250
Olivetti M380 (XP 7)
Olivetti PCS286
Olivetti M300
Phoenix 386 BIOS v1.10 10a
"OEM machine"
"OEM machine"
Zenith 386
PC XT-089, Enh Keyb, 3.5"
02h
***
00h
01h
00h
05/09/86
???
09/02/86
12/12/86
???
PC XT
Olivetti M200
PS/2 Model 30 (8 MHz 8086)
PS/2 Model 30
PS/2 Model 25/25L (8 MHz
00h
***
00h
00h
00h
00h
00h
00h
00h
02h
???
???
???
09/13/85
???
03/30/87
10/07/87
???
???
04/11/88
03h
03/17/89
00h
00h
00h
01h
02h
03h
00h
???
???
???
???
???
???
???
IBM PC 7568
PS/2 Model 55-5571
IBM PC 7561/2
PS/2 Model 55-5551
IBM PC 7561/2
PS/2 Model 55-5551
PS/2 Model 70 16MHz, type
02h
03h
04/11/88
03/17/89
F8h
0Bh
typ 2 sys brd
F8h
0Bh
F8h
0Ch
386SX)
F8h
0Dh
3 system brd
F8h
0Eh
F8h
0Fh
F8h
10h
F8h
11h
486)
F8h
12h
F8h
13h
486)
F8h
14h
486), 95 XP
F8h
15h
F8h
16h
486)
F8h
17h
F8h
19h
(20 MHz 386SX)
F8h
1Ah
F8h
1Bh
486)
F8h
1Ch
386SX)
F8h
1Eh
386SX)
F8h
23h
F8h
23h
386SX)
F8h
25h
F8h
25h
386SLC)
F8h
26h
F8h
26h
386SX)
F8h
28h
F8h
29h
F8h
2Ah
486)
F8h
2Bh
F8h
2Ch
F8h
2Ch
486SX)
F8h
2Dh
486SX)
F8h
2Eh
F8h
2Eh
486SX + 487SX)
F8h
2Fh
486SX + 487SX)
F8h
30h
386SX)
F8h
33h
00h
01/18/89
02h
00h
12/16/89
11/02/88
00h
???
00h
00h
00h
00h
???
???
???
10/01/90
PS/1
PS/1
PS/2
PS/2
00h
00h
???
10/01/90
PS/2 Model 95 XP
PS/2 Model 90 XP (33 MHz
00h
10/01/90
00h
00h
???
10/01/90
PS/2 Model 90 XP
PS/2 Model 90-AKD (33 MHz
00h
05h
???
???
PS/2 Model 90 XP
PS/2 Model 35/35LS or 40
00h
00h
???
10/02/89
PS/2 Model 95 XP
PS/2 Model 70-486 (25 MHz
00h
02/08/90
00h
02/08/90
00h
01h
???
???
00h
06h
???
???
00h
01h
???
???
PS/2 Model 57 SX
PS/2 Model 57 (20 MHz
00h
00h
00h
???
???
???
PS/2 Model 95 XP
PS/2 Model 90 XP
PS/2 Model 95 XP (50 MHz
00h
00h
01h
???
???
???
00h
???
00h
01h
???
???
PS/2 Model 95 XP
PS/2 Model 95 (20 MHz
00h
???
00h
???
00h
???
F8h
34h
F8h
36h
F8h
37h
F8h
38h
F8h
39h
F8h
3Fh
F8h
40h
F8h
41h
F8h
45h
F8h
46h
F8h
47h
(Pentium)
F8h
48h
F8h
49h
F8h
4Ah
F8h
4Bh
F8h
4Eh
F8h
50h
MHz 386)
F8h
50h
F8h
52h
486)
F8h
56h
F8h
57h
F8h
58h
F8h
59h
F8h
5Ah
F8h
5Bh
F8h
5Ch
F8h
5Dh
F8h
5Eh
F8h
61h
F8h
62h
F8h
80h
F8h
80h
F8h
81h
F8h
87h
F8h
88h
F8h
97h
F8h
99h
F8h
F2h
F8h
F6h
F8h
FDh
(with VPD)
F8h
???
486SX)
F8h
???
486SX)
F8h
???
486SX + 487SX)
F8h
???
486SX + 487SX)
E1h
???
DOS4GW.EXE)
E1h
00h
9Ah
*
30h
???
00h
00h
00h
00h
00h
00h
00h
00h
00h
00h
00h
???
???
???
???
???
???
???
???
???
???
???
PS/2
PS/2
PS/2
PS/2
PS/2
PS/2
PS/2
PS/2
PS/2
PS/2
PS/2
Model
Model
Model
Model
Model
Model
Model
Model
Model
Model
Model
25-386
95 XP
90 XP
57
95 XP
90 XP
95 XP
77
90 XP (Pentium)
95 XP (Pentium)
90/95 E
00h
00h
00h
00h
00h
00h
???
???
???
???
???
???
PS/2 Model 85
PS/ValuePoint 325T
PS/ValuePoint 425SX
PS/ValuePoint 433DX
PS/2 Model 295
PS/2 Model P70 (8573) (16
01h
00h
12/16/89
???
00h
00h
00h
00h
00h
00h
00h
00h
00h
***
***
00h
01h
00h
00h
00h
00h
00h
30h
30h
00h
???
???
???
???
???
???
???
???
???
???
???
???
11/21/89
???
???
???
???
???
???
???
???
???
???
???
???
???
???
???
???
???
???
00h
*
???
???
???
???
2Dh
???
???
*
*
???
Compaq PC/Compaq Deskpro
56h
???
???
Olivetti, unknown model
74h
???
???
Olivetti, unknown model
* This BIOS call is not implemented in these early versions.
Read Model byte at F000h:FFFEh and BIOS date at F000h:FFF5h.
** These BIOS versions require the DASDDRVR.SYS patches.
*** These Olivetti and Epson machines store the submodel in the
byte at
F000h:FFFDh.
Values for Dell model byte:
02h
Dell 200
03h
Dell 300
05h
Dell 220
06h
Dell 310
07h
Dell 325
09h
Dell 310A
0Ah
Dell 316
0Bh
Dell 220E
0Ch
Dell 210
0Dh
Dell 316SX
0Eh
Dell 316LT
0Fh
Dell 320LX
11h
Dell 425E
Format of Compaq product information:
Address
Size
Description
F000h:FFE4h
BYTE
product family code (first byte)
F000h:FFE4h
BYTE
Point release number
F000h:FFE4h
BYTE
ROM version code
F000h:FFE4h
BYTE
product family code (second byte)
F000h:FFE8h
WORD
BIOS type code
Bitfields for Hewlett-Packard product identifier:
bits 4-0
machine code
0 original Vectra
1 ES/12
2 RS/20
3 Portable/CS
4 ES
5 CS
6 RS/16
other reserved
bits 7-5
CPU type
0 = 80286
1 = 8088
2 = 8086
3 = 80386
other reserved
CL = ASCII character
Return: AL = 00h if successful
01h if keyboard buffer full
Note:
under DESQview, the following "keystrokes" invoke the
following
actions when they are read from the keyboard buffer:
38FBh or FB00h switch to next window (only if
main menu
popped up)
38FCh or FC00h pop up DESQview main menu
38FEh or FE00h close the current window
38FFh or FF00h pop up DESQview learn menu
SeeAlso: AH=00h,AH=71h,AH=FFh,INT 15/AX=DE10h
AH = 10h
Return: AH = BIOS scan code
AL = ASCII character
Notes: if no keystroke is available, this function waits until
one is placed
in the keyboard buffer
the BIOS scan code is usually, but not always, the same as
the hardware
scan code processed by INT 09. It is the same for ASCII
keystrokes
and most unshifted special keys (F-keys, arrow keys,
etc.), but
differs for shifted special keys.
unlike AH=00h, this function does not discard extended
keystrokes
INT 16/AH=09h can be used to determine whether this
function is
supported, but only on later model PS/2s
SeeAlso: AH=00h,AH=09h,AH=11h,AH=20h
network cards with their own BIOS can hook this interrupt
to allow
is present
Desc:
This interrupt reboots the system without clearing memory
or restoring
interrupt vectors. Because interrupt vectors are
preserved, this
interrupt usually causes a system hang if any TSRs have
hooked
vectors from 00h through 1Ch, particularly INT 08.
Notes: Usually, the BIOS will try to read sector 1, head 0, track
0 from drive
A: to 0000h:7C00h. If this fails, and a hard disk is
installed, the
BIOS will read sector 1, head 0, track 0 of the first
hard disk.
This sector should contain a master bootstrap loader and
a partition
table. After loading the master boot sector at
0000h:7C00h, the
master bootstrap loader is given control. It will scan
the partition
table for an active partition, and will then load the
operating
system's bootstrap loader (contained in the first sector
of the
active partition) and give it control.
true IBM PCs and most clones issue an INT 18 if neither
floppy nor hard
disk have a valid boot sector
to accomplish a warm boot equivalent to Ctrl-Alt-Del,
store 1234h in
0040h:0072h and jump to FFFFh:0000h. For a cold boot
equivalent to
a reset, store 0000h at 0040h:0072h before jumping.
VDISK.SYS hooks this interrupt to allow applications to
find out how
much extended memory has been used by VDISKs (see
below). DOS 3.3+
PRINT hooks INT 19 but does not set up a correct VDISK
header block
at the beginning of its INT 19 handler segment, thus
causing some
programs to overwrite extended memory which is already
in use.
the default handler is at F000h:E6F2h for 100% compatible
BIOSes
0Ah
OS/2 Boot Manager
0Ah
OPUS
0Ah
Coherent swap partition
10h
OPUS
18h
AST special Windows swap file
24h
NEC MS-DOS 3.x
40h
VENIX 80286
50h
Disk Manager, read-only partition
51h
Disk Manager, read/write partition
51h
Novell???
52h
CP/M
52h
Microport System V/386
56h
GoldenBow VFeature
61h
SpeedStor
63h
Unix SysV/386, 386/ix
63h
Mach, MtXinu BSD 4.3 on Mach
63h
GNU HURD
64h
Novell NetWare
65h
Novell NetWare (3.11)
70h
DiskSecure Multi-Boot
75h
PC/IX
80h
Minix v1.1 - 1.4a
81h
Minix v1.4b+
81h
Linux
81h
Mitac Advanced Disk Manager
82h
Linux Swap partition (planned)
84h
OS/2-renumbered type 04h partition (related to hiding DOS
C: drive)
93h
Amoeba file system
94h
Amoeba bad block table
B7h
BSDI file system (secondarily swap)
B8h
BSDI swap partition (secondarily file system)
C1h
DR-DOS 6.0 LOGIN.EXE-secured 12-bit FAT partition
C4h
DR-DOS 6.0 LOGIN.EXE-secured 16-bit FAT partition
C6h
DR-DOS 6.0 LOGIN.EXE-secured Huge partition
DBh
CP/M, Concurrent CP/M, Concurrent DOS
DBh
CTOS (Convergent Technologies OS)
E1h
SpeedStor 12-bit FAT extended partition
E4h
SpeedStor 16-bit FAT extended partition
F2h
DOS 3.3+ secondary
FEh
LANstep
FFh
Xenix bad block table
Desc:
this vector points at 1024 bytes of graphics data, 8 bytes
for each
character 80h-FFh
Note:
graphics data for characters 00h-7Fh stored at F000h:FA6Eh
in 100%
compatible BIOSes
SeeAlso: INT 10/AX=5000h,INT 43
DOS 2+
buffer:
Description
maximum characters buffer can hold
(input) number of chars from last input which may
AH = 1Ah
DS:DX -> Disk Transfer Area (DTA)
the DTA is set to PSP:0080h when a program is started
under the FlashTek X-32 DOS extender, the pointer is in
DS:EDX
SeeAlso: AH=11h,AH=12h,AH=2Fh,AH=4Eh,AH=4Fh
Notes:
(10)
(20)
SETVER
AL = return code
DX = number of paragraphs to keep resident
Return: never
Notes: the value in DX only affects the memory block containing
the PSP;
additional memory allocated via AH=48h is not affected
the minimum number of paragraphs which will remain
resident is 11h
for DOS 2.x and 06h for DOS 3+
most TSRs can save some memory by releasing their
environment block
before terminating (see AH=26h,AH=49h)
SeeAlso: AH=00h,AH=4Ch,AH=4Dh,INT 20,INT 22,INT 27
AH = 34h
Return: ES:BX -> one-byte InDOS flag
Notes: the value of InDOS is incremented whenever an INT 21
function begins
and decremented whenever one completes
during an INT 28 call, it is safe to call some INT 21
functions even
though InDOS may be 01h instead of zero
InDOS alone is not sufficient for determining when it is
safe to
enter DOS, as the critical error handling decrements
InDOS and
increments the critical error flag for the duration of
the critical
error. Thus, it is possible for InDOS to be zero even
if DOS is
busy.
SMARTDRV 4.0 sets the InDOS flag while flushing its
buffers to disk,
then zeros it on completion
the critical error flag is the byte immediately following
InDOS in
DOS 2.x, and the byte BEFORE the InDOS flag in DOS 3+
and
DR-DOS 3.41+ (except COMPAQ DOS 3.0, where the critical
error flag
is located 1AAh bytes BEFORE the critical section flag)
for DOS 3.1+, an undocumented call exists to get the
address of the
critical error flag (see AX=5D06h)
this function was undocumented prior to the release of DOS
5.0.
SeeAlso: AX=5D06h,AX=5D0Bh,INT 15/AX=DE1Fh,INT 28
AL = interrupt number
Return: ES:BX -> current interrupt handler
Note:
under DR-DOS 5.0+, this function does not use any of the
DOS-internal
stacks and may thus be called at any time
SeeAlso: AH=25h,AX=2503h
AH = 38h
--DOS 2.x-AL = 00h get current-country info
DS:DX -> buffer for returned info (see below)
Return: CF set on error
AX = error code (02h)
CF clear if successful
AX = country code (MS-DOS 2.11 only)
buffer at DS:DX filled
--DOS 3+-AL = 00h for current country
AL = 01h thru 0FEh for specific country with code <255
AL = 0FFh for specific country with code >= 255
BX = 16-bit country code
DS:DX -> buffer for returned info (see below)
Return: CF set on error
AX = error code (02h)
CF clear if successful
BX = country code
DS:DX buffer filled
Note:
this function is not supported by the Borland DPMI host,
but no error
is returned; as a workaround, one should allocate a
buffer in
conventional memory with INT 31/AX=0100h and simulate an
INT 21 with
INT 31/AX=0300h
SeeAlso: AH=65h,INT 10/AX=5001h,INT 2F/AX=110Ch,INT 2F/AX=1404h
Format of DOS 2.00-2.10 country info:
Offset Size
Description
00h
WORD
date format 0 = USA
mm dd yy
1 = Europe dd mm yy
2 = Japan yy mm dd
02h
BYTE
currency symbol
03h
BYTE
00h
04h
BYTE
thousands separator char
05h
BYTE
00h
06h
BYTE
decimal separator char
07h
BYTE
00h
08h 24 BYTEs
reserved
Format of DOS 2.11+ country info:
Offset Size
Description
00h
WORD
date format (see above)
02h 5 BYTEs
ASCIZ currency symbol string
07h 2 BYTEs
ASCIZ thousands separator
09h 2 BYTEs
ASCIZ decimal separator
0Bh 2 BYTEs
ASCIZ date separator
0Dh 2 BYTEs
ASCIZ time separator
0Fh
BYTE
currency format
bit 2 = set if currency symbol replaces decimal
point
bit 1 = number of spaces between value and
currency symbol
bit 0 = 0 if currency symbol precedes value
1 if currency symbol follows value
10h
BYTE
number of digits after decimal in currency
11h
BYTE
time format
bit 0 = 0 if 12-hour clock
1 if 24-hour clock
12h
DWORD
address of case map routine
(FAR CALL, AL = character to map to upper case [>=
80h])
16h 2 BYTEs
ASCIZ data-list separator
18h 10 BYTEs
reserved
Values for country code:
001h
United States
002h
Canadian-French
003h
Latin America
01Fh
Netherlands
020h
Belgium
021h
France
022h
Spain
024h
Hungary (not supported by DR-DOS 5.0)
026h
Yugoslavia (not supported by DR-DOS 5.0)
027h
Italy
029h
Switzerland
02Ah
Czechoslovakia/Tjekia (not supported by DR-DOS 5.0)
02Bh
Austria (DR-DOS 5.0)
02Ch
United Kingdom
02Dh
Denmark
02Eh
02Fh
030h
031h
037h
03Dh
051h
052h
056h
058h
05Ah
15Fh
162h
166h
311h
3CCh
Sweden
Norway
Poland (not supported by DR-DOS 5.0)
Germany
Brazil (not supported by DR-DOS 5.0)
International English [Australia in DR-DOS 5.0]
Japan (DR-DOS 5.0, MS-DOS 5.0+)
Korea (DR-DOS 5.0)
China (MS-DOS 5.0+)
Taiwan (MS-DOS 5.0+)
Turkey (MS-DOS 5.0+)
Portugal
Iceland
Finland
Middle East/Saudi Arabia (DR-DOS 5.0,MS-DOS 5.0+)
Israel (DR-DOS 5.0,MS-DOS 5.0+)
RW|C C C
- - - - -|
Deny
R |2 C C
Write W |C C C
RW|C C C
- - - - -|
Deny
R |C C C
Read
W |C C C
RW|C C C
- - - - -|
Deny
R |2 C C
None
W |C C C
RW|C C C
Legend: Y = open
C = open
1 = open
code
2 = open
24
N N N
N N N
N N N
N N N
N N N
N N N
N N N
Y N N
N N N
N N N
N N N
Y N N
N N N
Y N N
Y N N
Y N N
N N N
N N N
N N N
N Y N
N N N
N N N
N N N
N Y N
N N N
N Y N
N Y N
N Y N
N N N Y Y Y N N N Y Y Y
N N N N N N Y Y Y Y Y Y
N N N N N N N N N Y Y Y
succeeds, N = open fails with error code 05h
fails, INT 24 generated
succeeds if file read-only, else fails with error
succeeds if file read-only, else fails with INT
AH = 3Fh
BX = file handle
CX = number of bytes to read
DS:DX -> buffer for data
Return: CF clear if successful
AX = number of bytes actually read (0 if at EOF before
call)
CF set on error
AX = error code (05h,06h) (see AH=59h)
Notes: data is read beginning at current file position, and the
file position
is updated after a successful read
the returned AX may be smaller than the request in CX if a
partial
read occurred
if reading from CON, read stops at first CR
multiuser
values
SeeAlso: AX=4412h,AX=4451h,AX=4459h
Values for operating system version ID:
60h
DOS Plus
63h
DR-DOS 3.41
64h
DR-DOS 3.42
65h
DR-DOS 5.00
67h
DR-DOS 6.00
70h
PalmDOS
71h
DR-DOS 6.0 March 1993 "business update"
72h
Novell DOS 7.0
Notes:
block to
allocate
.COM programs are initially allocated the largest
available memory
block, and should free some memory with AH=49h before
attempting any
allocations
under the FlashTek X-32 DOS extender, EBX contains a
protected-mode
near pointer to the allocated block on a successful
return
SeeAlso: AH=49h,AH=4Ah,AH=58h,AH=83h
= 49h
= segment of block to free
clear if successful
set on error
AX = error code (07h,09h) (see AH=59h)
Notes: apparently never returns an error 07h, despite official
docs; DOS 2.1+
code contains only an error 09h exit
DOS 2.1-6.0 does not coalesce adjacent free blocks when a
block is
freed, only when a block is allocated or resized
the code for this function is identical in DOS 2.1-6.0
except for
calls to start/end a critical section in DOS 3+
SeeAlso: AH=48h,AH=4Ah
= 4Ah
= new size in paragraphs
= segment of block to resize
clear if successful
set on error
AX = error code (07h,08h,09h) (see AH=59h)
BX = maximum paragraphs available for specified memory
block
Notes: under DOS 2.1-6.0, if there is insufficient memory to
expand the block
as much as requested, the block will be made as large as
possible
DOS 2.1-6.0 coalesces any free blocks immediately
following the block
to be resized
SeeAlso: AH=48h,AH=49h,AH=83h
AH = 4Bh
AL = type of load
00h load and execute
01h load but do not execute
03h load overlay
04h load and execute in background (European MS-DOS
4.0 only)
"Exec & Go" (see also AH=80h)
DS:DX -> ASCIZ program name (must include extension)
ES:BX -> parameter block (see below)
CX = mode (subfunction 04h only)
0000h child placed in zombie mode after
termination
0001h child's return code discarded on termination
Return: CF clear if successful
BX,DX destroyed
if subfunction 01h, process ID set to new program's
PSP; get with
INT 21/AH=62h
CF set on error
AX = error code (01h,02h,05h,08h,0Ah,0Bh) (see AH=59h)
Notes: DOS 2.x destroys all registers, including SS:SP
under ROM-based DOS, if no disk path characters (colons or
slashes)
are included in the program name, the name is searched
for in the
ROM module headers (see below) before searching on disk
for functions 00h and 01h, the calling process must ensure
that there
is enough unallocated memory available; if necessary, by
releasing
memory with AH=49h or AH=4Ah
for function 01h, the AX value to be passed to the child
program is put
on top of the child's stack
for function 03h, DOS assumes that the overlay is being
loaded into
memory allocated by the caller
function 01h was undocumented prior to the release of DOS
5.0
some versions (such as DR-DOS 6.0) check the parameters
and parameter
block and return an error if an invalid value (such as
an offset of
FFFFh) is found
background programs under European MS-DOS 4.0 must use the
new
executable format
new executables begin running with the following register
values
AX = environment segment
1Eh 6 BYTEs
signature "PKLITE" (followed by copyright message)
---LHarc 1.x self-extracting archive--1Ch 4 BYTEs
unused???
20h 3 BYTEs
jump to start of extraction code
23h 2 BYTEs
???
25h 12 BYTEs
signature "LHarc's SFX "
---LHA 2.x self-extracting archive--1Ch 8 BYTEs
???
24h 10 BYTEs
signature "LHa's SFX " (v2.10) or "LHA's SFX "
(v2.13)
---TopSpeed C 3.0 CRUNCH compressed file--1Ch
DWORD
018A0001h
20h
WORD
1565h
---PKARCK 3.5 self-extracting archive--1Ch
DWORD
00020001h
20h
WORD
0700h
---BSA (Soviet archiver) self-extracting archive--1Ch
WORD
000Fh
1Eh
BYTE
A7h
---LARC self-extracting archive--1Ch 4 BYTEs
???
20h 11 BYTEs
"SFX by LARC "
---LH self-extracting archive--1Ch 8 BYTEs
???
24h 8 BYTEs
"LH's SFX "
---other linkers--1Ch
var
optional information
--N
N DWORDs relocation items
Notes: if word at offset 02h is 4, it should be treated as 00h,
since pre-1.10
versions of the MS linker set it that way
if both minimum and maximum allocation (offset 0Ah/0Ch)
are zero, the
program is loaded as high in memory as possible
the maximum allocation is set to FFFFh by default
Format of ROM Module Header:
Offset Size
Description
00h 2 BYTEs
ROM signature 55h, AAh
02h
BYTE
size of ROM in 512-byte blocks
03h 3 BYTEs
POST initialization entry point (near JMP
instruction)
06h
ROM Program Name List [array]
Offset Size
Description
00h
BYTE
length of ROM program's name (00h if end
of name list)
01h N BYTEs
program name
N+1 3 BYTEs
program entry point (near JMP instruction)
Format of new executable header:
Offset Size
Description
00h 2 BYTEs
"NE" (4Eh 45h) signature
02h 2 BYTEs
linker version (major, then minor)
04h
WORD
offset from start of this header to entry table
(see below)
06h
WORD
length of entry table in bytes
08h
0Ch
DWORD
BYTE
0Dh
BYTE
API)
maintained)
init routine
returns AX=0000h
initialization)
0Eh
WORD
10h
WORD
12h
WORD
<> DS)
14h
DWORD
segment table
18h
DWORD
index
stack pointer is
local heap
segment count
module reference count
length of nonresident names table in bytes
offset from start of this header to segment table
1Ch
WORD
1Eh
WORD
20h
WORD
22h
WORD
(see below)
24h
WORD
26h
WORD
table
28h
WORD
reference table
2Ah
WORD
table
string of length
2Ch
table
30h
table
32h
DWORD
00h)
offset from start of file to nonresident names
WORD
WORD
34h
36h
WORD
BYTE
37h
BYTE
38h
WORD
3Ah
WORD
gangload area
3Ch
WORD
minimum code swap area size
3Eh 2 BYTEs
expected Windows version (minor version first)
Note:
this header is documented in detail in the Windows 3.1 SDK
Programmer's
Reference, Vol 4.
Format of Codeview trailer (at end of executable):
Offset Size
Description
00h
WORD
signature 4E42h ('NB')
02h
WORD
Microsoft debug info version number
04h
DWORD
Codeview header offset
Format of new executable segment table record:
00h
WORD
offset in file (shift left by alignment shift to
get byte offs)
02h
WORD
length of image in file (0000h = 64K)
04h
WORD
segment attributes (see below)
06h
WORD
number of bytes to allocate for segment (0000h =
64K)
Note:
the first segment table entry is entry number 1
Bitfields for segment attributes:
bit 0 data segment rather than code segment
bit 1 unused???
bit 2 real mode
bit 3 iterated
bit 4 movable
bit 5 sharable
bit 6 preloaded rather than demand-loaded
bit 7 execute-only (code) or read-only (data)
bit 8 relocations (directly following code for this segment)
bit 9 debug info present
bits 10,11
80286 DPL bits
bit 12
discardable
bits 13-15
discard priority
02h
04h
WORD
WORD
06h
WORD
resource string
08h
DWORD
reserved for runtime use
Notes: resource type and name strings are stored immediately
following the
resource table, and are not null-terminated
strings are counted strings, with a string of length 0
indicating the
end of the resource table
Format of new executable module reference table [one bundle of
entries]:
Offset Size
Description
00h
BYTE
number of records in this bundle (00h if end of
table)
01h
BYTE
segment indicator
00h unused
FFh movable segment, segment number is in entry
else segment number of fixed segment
02h N RECORDs
Format of segment record
Offset Size
Description
00h
BYTE
flags
bit 0: entry is exported
bit 1: entry uses global (shared) data
bits 7-3: number of parameter words
---fixed segment--01h
WORD
offset
---moveable segment--01h 2 BYTEs
INT 3F instruction (CDh 3Fh)
03h
BYTE
segment number
05h
WORD
offset
Note:
table entries are numbered starting from 1
Format of new executable resident/nonresident name table entry:
Offset Size
Description
00h
BYTE
length of string (00h if end of table)
01h N BYTEs
ASCII text of string
N+1
WORD
ordinal number (index into entry table)
Notes: the first string in the resident name table is the module
name; the
first entry in the nonresident name table is the module
description
the strings are case-sensitive; if the executable was
linked with
/IGNORECASE, all strings are in uppercase
Format of Linear Executable (enhanced mode executable) header:
Offset Size
Description
00h 2 BYTEs
"LE" (4Ch 45h) signature (Windows)
02h
endian)
03h
endian)
04h
08h
BYTE
BYTE
DWORD
WORD
0Ah
WORD
0Ch
10h
DWORD
DWORD
(only for
programs)
for .EXE)
14h
DWORD
18h
Initial
DWORD
DWORD
20h
Initial
DWORD
DWORD
28h
DWORD
2Ch
DWORD
30h
34h
DWORD
DWORD
38h
3Ch
40h
44h
48h
4Ch
50h
54h
58h
5Ch
60h
64h
68h
6Ch
70h
74h
78h
7Ch
80h
84h
88h
8Ch
90h
94h
98h
9Ch
A0h
A4h
A8h
ACh 20
C0h
C2h
Note:
drivers
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
DWORD
BYTEs
WORD
WORD
used by
1Ch
DWORD
20h
DWORD
24h
WORD
26h
DWORD
2Ah
DWORD
2Eh
DWORD
32h
DWORD
36h
DWORD
3Ah
DWORD
3Eh
DWORD
42h
DWORD
46h
DWORD
4Ah
DWORD
4Eh
DWORD
52h
DWORD
56h
DWORD
end of program
5Ah
DWORD
end of program
5Eh
62h
66h
68h
6Ch
6Eh
70h
72h
DWORD
DWORD
WORD
DWORD
WORD
WORD
WORD
WORD
74h
DWORD
78h
DWORD
7Ch
DWORD
80h 256 BYTEs
12h
14h
WORD
WORD
16h
WORD
2, or 3)
18h 104 BYTEs
Note:
additional information on the Borland debugging info may
be found in
Borland's Open Architecture Handbook
AH = 52h
Return: ES:BX -> DOS list of lists
Notes: partially supported by OS/2 v1.1 compatibility box
(however, most
pointers are FFFFh:FFFFh, LASTDRIVE is FFh, and the NUL
header "next"
pointer is FFFFh:FFFFh).
on return, ES points at the DOS data segment (see also INT
2F/AX=1203h)
SeeAlso: INT 2F/AX=1203h
Format of List of Lists:
Offset Size
Description
-24
WORD
(DOS 3.1+) contents of CX from INT 21/AX=5E01h
-22
WORD
(DOS ???+) LRU counter for FCB caching
-20
WORD
(DOS ???+) LRU counter for FCB opens
-18
DWORD
(DOS ???+) address of OEM function handler (see
INT 21/AH=F8h)
FFFFh:FFFFh if not installed or not
available
-14
WORD
(DOS ???+) offset in DOS CS of code to return from
INT 21 call
-12
WORD
(DOS 3.1+) sharing retry count (see AX=440Bh)
-10
WORD
(DOS 3.1+) sharing retry delay (see AX=440Bh)
-8
DWORD
(DOS 3+) pointer to current disk buffer
-4
WORD
(DOS 3+) pointer in DOS data segment of unread CON
input
line,
rest
input
-2
WORD
00h
DWORD
AH=32h)
04h
DWORD
08h
DWORD
recently loaded
list of device
34h
BYTE
---DOS 4.x--10h
WORD
12h
DWORD
16h
DWORD
(see below)
1Ah
DWORD
1Eh
WORD
FCBS=x,y)
20h
BYTE
21h
BYTE
installed
size of
22h 18 BYTEs
list of device
Also
01h
WORD
01h
WORD
belongs to DOS
03h
WORD
05h
BYTE
06h
WORD
(0000h if last)
08h
WORD
or 0000h
0Ah 6 BYTEs
DOS 3.2:
fairly early
DOS 3.3:
DOS data
segment
02h, 08h-0Eh,
-28h
DWORD
-24h
DWORD
-20h
DWORD
-1Ch
locked
DWORD
file
position in file
-18h
DWORD
AX=5D00h)
sharing rec
specified SFT
-14h
SFT???
DWORD
-10h
DWORD
file ???
offsets
-0Ch
DWORD
for process
mismatched
CF clear if successful
BX = starting cluster number from FCB
pointer to FAR routine to close file if duplicate
uses SFT
and sharing
owned by
mode and
-08h
sharing record
pointer to FAR routine for closing file
Note: closes various handles referring to file
DWORD
most-recently
opened
pointer to FAR routine to update directory info in
-04h
DWORD
related SFT
entries
call with ES:DI -> system file table entry for
file (see below)
SFT)
0Dh) and date
and starting
last-accessed
file if file
Sets
accessed fields
table entries
always changed
03h: do both functions 00h and 02h
Note: follows ptr at offset 2Bh in system file
Note: NOP if opened with no-inherit or via FCB
Notes: most of the above hooks (except -04h, -14h, -18h, and
-3Ch) assume
either that SS=DOS DS or SS=DS=DOS DS and directly
access
DOS-internal data
sharing hooks are not supported by DR-DOS 5-6; will
reportedly be
supported by Novell DOS 7
Format of sharing record:
Offset Size
Description
00h
BYTE
flag
00h free block
01h allocated block
FFh end marker
01h
WORD
size of block
03h
BYTE
checksum of pathname (including NUL)
if sum of ASCII values is N, checksum is (N/256 +
N%256)
04h
WORD
offset in SHARE's DS of first Record Lock Record
(see below)
06h
DWORD
pointer to start of system file table chain for
file
0Ah
WORD
unique sequence number
0Ch
var
ASCIZ full pathname
Note:
not supported by DR-DOS SHARE 1.1 and 2.0; will reportedly
be
supported by Novell DOS 7
Format of Record Lock Record (SHARE.EXE):
Offset Size
Description
00h
WORD
offset in SHARE's DS of next lock table in list or
0000h
02h
DWORD
offset in file of start of locked region
06h
DWORD
offset in file of end of locked region
0Ah
DWORD
pointer to System File Table entry for this file
0Eh
WORD
PSP segment of lock's owner
---DOS 5+ --10h
WORD
lock type: (00h lock all, 01h lock writes only)
Format of DOS 2.x system file tables:
Offset Size
Description
00h
DWORD
pointer to next file table (offset FFFFh if last)
04h
WORD
number of files in this table
06h 28h bytes per file
Offset Size
Description
00h
BYTE
number of file handles referring to this
file
01h
BYTE
file open mode (see AH=3Dh)
02h
BYTE
file attribute
03h
BYTE
drive (0 = character device, 1 = A, 2 = B,
etc)
04h 11 BYTEs
filename in FCB format (no path,no
period,blank-padded)
0Fh
WORD
???
11h
WORD
???
13h
DWORD
file size???
17h
WORD
file date in packed format (see AX=5700h)
19h
WORD
file time in packed format (see AX=5700h)
1Bh
BYTE
device attribute (see AX=4400h)
---character device--1Ch
DWORD
pointer to device driver
---block device--1Ch
WORD
starting cluster of file
1Eh
WORD
relative cluster in file of last cluster
accessed
-----20h
22h
24h
WORD
WORD
DWORD
07h
DWORD
character device
(see AH=32h)
0Bh
0Dh
WORD
WORD
size of
00h
WORD
02h
WORD
04h
05h
BYTE
WORD
file
on closing
if local)
07h
DWORD
character device
set
set
set
set
if
if
if
if
named pipe
no inherit
network spooler
device, clear if file (only
(see AH=32h)
only)
13
12
11
7
0Bh
WORD
0Dh
0Fh
11h
15h
WORD
WORD
DWORD
DWORD
or REDIR data
starting cluster of file (local files
file time in packed format (see AX=5700h)
file date in packed format (see AX=5700h)
file size
current offset in file (SFT)
LRU counters (FCB table, two WORDs)
---local file--19h
WORD
relative cluster within file of last
cluster accessed
1Bh
DWORD
number of sector containing directory
entry
1Fh
BYTE
number of dir entry within sector (byte
offset/32)
---network redirector--19h
DWORD
pointer to REDIRIFS record
1Dh 3 BYTEs
???
-----20h 11 BYTEs
filename in FCB format (no path/period,
blank-padded)
2Bh
DWORD
(SHARE.EXE) pointer to previous SFT
sharing same file
2Fh
WORD
(SHARE.EXE) network machine number which
opened file
(Windows Enhanced mode DOSMGR uses the
virtual machine
ID as the machine number; see INT
2F/AX=1683h)
31h
WORD
PSP segment of file's owner (see AH=26h)
(first three
entries for AUX/CON/PRN contain segment of
IO.SYS
startup code)
33h
WORD
offset within SHARE.EXE code segment of
sharing record (see above) 0000h = none
35h
WORD
clustr accessed
(redirector) ???
37h
DWORD
pointer to IFS driver for file, 0000000h
if native DOS
Note:
the OS/2 2.0 DOS Boot Session does not properly fill in
the filename
field due to incomplete support for SFTs; the OS/2 2.0
DOS Window
does not appear to support SFTs at all
Format of current directory structure (CDS) (array, LASTDRIVE
entries):
Offset Size
Description
00h 67 BYTEs
ASCIZ path in form X:\PATH (local) or \\MACH\PATH
(network)
43h
WORD
drive attributes (see also note below and
AX=5F07h)
bit 15: uses network redirector \ invalid if 00,
installable
bit 14: physical drive
/ file system if
11
bit 13: JOIN'ed
\ path above is true path that
would be
bit 12: SUBST'ed / needed if not under SUBST or
JOIN
bit 7: remote drive hidden from redirector's
assign-list and
exempt from network connection
make/break commands;
set for CD-ROM drives
45h
DWORD
pointer to Drive Parameter Block for drive (see
AH=32h)
---local drives--49h
WORD
starting cluster of current directory
0000h = root, FFFFh = never accessed
4Bh
WORD
??? seems to be FFFFh always
4Dh
WORD
??? seems to be FFFFh always
---network drives--49h
DWORD
pointer to redirector or REDIRIFS record, or
FFFFh:FFFFh
(DOS 4 only) available for use by IFS driver
4Dh
WORD
stored user data from INT 21/AX=5F03h
-----4Fh
WORD
offset in current directory path of backslash
corresponding to
root directory for drive
this value specifies how many characters to hide
from the
"CHDIR" and "GETDIR" calls; normally set to 2 to
hide the
drive letter and colon, SUBST, JOIN, and
networks change it
so that only the appropriate portion of the true
path is
visible to the user
---DOS 4+ ---
51h
BYTE
52h
DWORD
(DOS 5+) for
bit 6
bit 5
bit 4
(see AX=440Ch,AX=440Dh)
reserved
device is special (use INT 29 "fast
bit 3
(command 13h)
console output")
transfer
drives)
bit 10 reserved
bit 9 direct I/O not allowed???
(set by DOS 3.3 DRIVER.SYS for "new"
bit 8
bit 7
drives
supported (cmd 19h)
(command 13h)
and 18h
bit 6
(see AX=4410h,AX=4411h)
(DOS 3.2+) Generic IOCTL call supported
implies support for commands 17h
(see
AX=440Ch,AX=440Dh,AX=440Eh,AX=440Fh)
bits 5-2 reserved
bit 1
driver supports 32-bit sector
addressing (DOS 3.31+)
bit 0
reserved
Note: for European MS-DOS 4.0, bit 11 also
indicates that bits
8-6 contain a version code (000 = DOS
3.0,3.1;
001 = DOS 3.2, 010 = European DOS 4.0)
06h
WORD
device strategy entry point
call with ES:BX -> request header (see INT
2F/AX=0802h)
08h
WORD
device interrupt entry point
---character device--0Ah 8 BYTEs
blank-padded character device name
---block device--0Ah
BYTE
number of subunits (drives) supported by driver
0Bh 7 BYTEs
unused
--12h
WORD
(CD-ROM driver) reserved, must be 0000h
appears to be another device chain
14h
BYTE
(CD-ROM driver) drive letter (must initially be
00h)
15h
BYTE
16h 6 BYTEs
version
06h
DWORD
0Ah
WORD
BUFFERS=x,y)
0Ch
BYTE
0Dh
WORD
0Fh
WORD
255)
11h
WORD
13h
WORD
15h
WORD
17h 4 WORDs
Format of DOS 4.01 (from UR 25066 Corrctive Services Disk on) disk
buffer info:
Offset Size
Description
00h
DWORD
pointer to array of disk buffer hash chain heads
(see below)
04h
WORD
number of disk buffer hash chains (referred to as
NDBCH below)
06h
DWORD
pointer to lookahead buffer, zero if not present
0Ah
WORD
number of lookahead sectors, else zero (the y in
BUFFERS=x,y)
0Ch
BYTE
01h, possibly to distinguish from pre-UR 25066
format
0Dh
WORD
??? EMS segment for BUFFERS (only with /XD)
0Fh
WORD
??? EMS physical page number of EMS seg above
(only with /XD)
11h
WORD
??? EMS segment for ??? (only with /XD)
13h
WORD
??? EMS physical page number of above (only
with /XD)
15h
BYTE
??? number of EMS page frames present (only
with /XD)
16h
WORD
segment of one-sector workspace buffer allocated
in main memory
if BUFFERS/XS or /XD options in effect, possibly
to avoid DMA
into EMS
18h
WORD
EMS handle for buffers, zero if not in EMS
1Ah
WORD
EMS physical page number used for buffers (usually
255)
1Ch
WORD
??? appears always to be 0001h
1Eh
WORD
segment of EMS physical page frame
20h
WORD
??? appears always to be zero
22h
BYTE
00h if /XS, 01h if /XD, FFh if BUFFERS not in EMS
Format of DOS 4.x disk buffer hash chain head (array, one entry
per chain):
Offset Size
Description
00h
WORD
EMS logical page number in which chain is
resident, -1 if not
in EMS
02h
DWORD
pointer to least recently used buffer header. All
buffers on
this chain are in the same segment.
06h
BYTE
number of dirty buffers on this chain
07h
BYTE
reserved (00h)
06h
DWORD
0Ah
WORD
BUFFERS=x,y)
0Ch
BYTE
0Dh
DWORD
memory
11h 3 BYTEs
14h
WORD
16h
BYTE
17h
BYTE
during EXEC
18h
BYTE
off
19h
BYTE
load
1Ah
WORD
21/AX=4B05h)
1Ch
BYTE
chain
1Dh
WORD
being EXECed
1Fh
WORD
FFFFh if DOS
supported
02h
AH
AH
AH
AH
WORD
06h
08h
0Eh
WORD
6 BYTEs
WORD
vs \
26h
BYTE
???
27h
BYTE
???
---class 05h function 02h--17h 7 BYTEs
???
1Eh
DWORD
pointer to ???
22h 4 BYTEs
???
26h
WORD
returned total clusters
28h
WORD
returned sectors per cluster
2Ah
WORD
returned bytes per sector
2Ch
WORD
returned available clusters
2Eh
BYTE
returned ???
2Fh
BYTE
???
---class 05h functions 03h,04h,05h--17h 7 BYTEs
???
1Eh
DWORD
pointer to ???
22h 4 BYTEs
???
26h
DWORD
pointer to directory name
---class 05h function 06h--17h 7 BYTEs
???
1Eh
DWORD
pointer to ???
22h 4 BYTEs
???
26h
WORD
attribute mask
28h
DWORD
pointer to filename
---class 05h function 07h--17h 7 BYTEs
???
1Eh
DWORD
pointer to ???
22h 4 BYTEs
???
26h
WORD
attribute mask
28h
DWORD
pointer to source filespec
2Ch
DWORD
pointer to destination filespec
---class 05h function 08h--17h 7 BYTEs
???
1Eh
DWORD
pointer to ???
22h 4 BYTEs
???
26h
BYTE
00h FINDFIRST
01h FINDNEXT
28h
DWORD
pointer to FindFirst search data + 01h if
FINDNEXT
2Ch
WORD
search attribute if FINDFIRST
2Eh
DWORD
pointer to filespec if FINDFIRST
---class 05h function 09h--17h 7 BYTEs
???
1Eh
DWORD
pointer to ???
22h
DWORD
pointer to IFS open file structure (see
below)
26h
whether or
28h
2Ah
2Eh
32h
36h
WORD
WORD
4 BYTEs
DWORD
4 BYTEs
WORD
???
below)
below)
below)
22h
DWORD
26h
28h
BYTE
DWORD
28h
WORD
below)
below)
26h
BYTE
WORD
DWORD
WORD
BYTE
???
pointer to ???
???
???
2Fh
BYTE
subfunction
01h get printer setup
03h ???
04h ???
05h ???
06h ???
07h ???
21h set printer setup
---class 05h function 11h--17h 7 BYTEs
???
1Eh
DWORD
pointer to ???
22h
DWORD
pointer to IFS open file structure (see
below)
26h
BYTE
subfunction
27h
BYTE
unused???
28h
WORD
???
2Ah
WORD
???
2Ch
WORD
???
2Eh
BYTE
???
2Fh
BYTE
???
---class 05h function 12h--17h 15 BYTEs
unused???
26h
WORD
PSP segment
28h
BYTE
type of process termination
29h
BYTE
unused???
---class 05h function 13h--17h 15 BYTEs
unused???
26h
WORD
PSP segment
---request class 06h--16h
DWORD
returned pointer to string corresponding to error
code at 03h
1Ah
BYTE
returned ???
1Bh
BYTE
unused
---request class 07h--16h
DWORD
pointer to IFS open file structure (see below)
1Ah
BYTE
???
1Bh
BYTE
unused???
Format of IFS open file structure:
Offset Size
Description
00h
WORD
???
02h
WORD
device info word
04h
WORD
file open mode
06h
WORD
???
08h
WORD
file attributes
0Ah
WORD
owner's network machine number
0Ch
WORD
owner's PSP segment
0Eh
DWORD
file size
12h
DWORD
current offset in file
16h
WORD
file time
18h
WORD
file date
1Ah 11 BYTEs
filename in FCB format
25h
WORD
???
27h
WORD
hash value of SFT address
(low word of linear address + segment&F000h)
29h 3 WORDs
network info from SFT
2Fh
WORD
???
memory
AH = 58h
AL = subfunction
00h get allocation strategy
Return: AX = current strategy
00h low memory first fit
01h low memory best fit
02h low memory last fit
---DOS 5+ --40h high memory first fit
41h high memory best fit
42h high memory last fit
80h first fit, try high then low
4Ch
4Dh
4Eh
4Fh
50h
51h
52h
53h
54h
55h
56h
57h
58h
59h
5Ah
64h
65h
66h
67h
68h
(76)
(77)
(78)
(79)
(80)
(81)
(82)
(83)
(84)
(85)
(86)
(87)
(88)
(89)
(90)
(100)
(101)
(102)
(103)
(104)
AREA
AX = 5D06h
Return: CF set on error
AX = error code (see AH=59h)
CF clear if successful
DS:SI -> nonreentrant data area (includes all three
DOS stacks)
(critical error flag is first byte)
CX = size in bytes of area which must be swapped while
in DOS
DX = size in bytes of area which must always be
swapped
Notes: the Critical Error flag is used in conjunction with the
InDOS flag
(see AH=34h) to determine when it is safe to enter DOS
from a TSR
setting CritErr flag allows use of functions 50h/51h from
INT 28h under
DOS 2.x by forcing use of correct stack
swapping the data area allows reentering DOS unless DOS is
in a
critical section delimited by INT 2A/AH=80h and INT
2A/AH=81h,82h
under DOS 4.0, AX=5D0Bh should be used instead of this
function
SHARE and other DOS utilities consult the byte at offset
04h in the
DOS data segment (see INT 2F/AX=1203h) to determine the
SDA format
in use: 00h = DOS 3.x, 01h = DOS 4.0-6.0, other = error.
DR-DOS 3.41+ supports this function, but the SDA format
beyond the
first 18h bytes is completely different from MS-DOS
SeeAlso: AX=5D0Bh,INT 2A/AH=80h,INT 2A/AH=81h,INT 2A/AH=82h
Format of DOS 3.10-3.30 Swappable Data Area:
Offset Size
Description
-34
BYTE
(DOS 3.10+) printer echo flag (00h off, FFh
active)
-31
BYTE
(DOS 3.30) current switch character
-28
BYTE
(DOS 3.30) incremented on each INT 21/AX=5E01h
call
-27 16 BYTEs
(DOS 3.30) machine name set by INT 21/AX=5E01h
-11 5 WORDs
zero-terminated list of offsets which need to be
patched to
enable critical-section calls (see INT 2A/AH=80h)
-1
BYTE
unused padding
---start of actual SDA--00h
BYTE
critical error flag ("ErrorMode")
01h
BYTE
InDOS flag (count of active INT 21 calls)
02h
BYTE
drive on which current critical error occurred, or
FFh
(DR-DOS sets to drive number during INT 24, 00h
otherwise)
03h
BYTE
locus of last error
04h
WORD
extended error code of last error
06h
BYTE
07h
BYTE
08h
DWORD
0Ch
DWORD
10h
WORD
12h
WORD
14h
WORD
after reading
with AH=4Dh)
16h
BYTE
current drive
17h
BYTE
extended break flag
---remainder need only be swapped if in DOS--18h
WORD
value of AX on call to INT 21
1Ah
WORD
PSP segment for sharing/network
1Ch
WORD
network machine number for sharing/network (0000h
= us)
1Eh
WORD
first usable memory block found when allocating
memory
20h
WORD
best usable memory block found when allocating
memory
22h
WORD
last usable memory block found when allocating
memory
24h
WORD
memory size in paragraphs (used only during
initialization)
26h
WORD
last entry checked during directory search
28h
BYTE
flag: INT 24 returned Fail
29h
BYTE
flags: allowable INT 24 actions (passed to INT 24
in AH)
2Ah
BYTE
directory flag (00h directory, 01h file)
2Bh
BYTE
flag: FFh if Ctrl-Break termination, 00h otherwise
2Ch
BYTE
flag: allow embedded blanks in FCB
2Dh
BYTE
padding (unused)
2Eh
BYTE
day of month
2Fh
BYTE
month
30h
WORD
year - 1980
32h
WORD
number of days since 1-1-1980
34h
BYTE
day of week (0 = Sunday)
35h
BYTE
flag: console swapped during read from device
36h
BYTE
flag: safe to call INT 28 if nonzero
37h
BYTE
flag: if nonzero, INT 24 Abort turned into INT 24
Fail
(set only during process termination)
38h 26 BYTEs
device driver request header (see INT 2F/AX=0802h)
52h
DWORD
pointer to device driver entry point (used in
calling driver)
56h 22 BYTEs
device driver request header for I/O calls
6Ch 14 BYTEs
device driver request header for disk status check
7Ah
DWORD
pointer to device I/O buffer???
7Eh
WORD
???
80h
WORD
???
82h
BYTE
type of PSP copy (00h=simple for INT 21/AH=26h,
FFh=make child)
83h
BYTE
padding (unused)
84h 3 BYTEs
24-bit user number (see AH=30h)
87h
BYTE
OEM number (see AH=30h)
88h
WORD
offset to error code conversion table for INT
25/INT 26
8Ah 6 BYTEs
90h
BYTE
91h
BYTE
92h 128 BYTEs
112h 128 BYTEs
192h 21 BYTEs
1A7h 32 BYTEs
1C7h 81 BYTEs
being accessed
218h 11 BYTEs
223h
BYTE
224h 11 BYTEs
format)
22Fh
BYTE
230h
BYTE
231h
WORD
233h 5 BYTEs
238h
BYTE
239h
BYTE
23Ah
BYTE
23Bh
BYTE
23Ch
BYTE
23Dh
BYTE
found
23Eh
BYTE
together)
23Fh
BYTE
AX=5D00h)
240h
BYTE
241h
BYTE
242h
BYTE
243h
BYTE
244h
BYTE
245h
BYTE
246h
BYTE
247h
BYTE
file/dir if FFh
248h
BYTE
249h
BYTE
24Ah
BYTE
24Bh
BYTE
file's name
25Eh
WORD
referenced)
260h
WORD
262h
BYTE
263h
BYTE
264h
DWORD
268h
DWORD
26Ch
DWORD
being accessed
270h
DWORD
274h
WORD
refer
276h
WORD
278h
DWORD
(see AH=26h)
27Ch
WORD
27Eh
WORD
280h
WORD
282h
WORD
284h
WORD
286h
WORD
288h
WORD
28Ah
WORD
28Ch
WORD
28Eh
WORD
290h
WORD
292h
DWORD
296h
DWORD
29Ah
WORD
29Ch
WORD
29Eh
WORD
2A0h
WORD
2A2h
DWORD
2A6h
DWORD
2AAh
DWORD
2AEh
WORD
2B0h
WORD
2B2h
WORD
registers
2B4h
DWORD
reentered
73Bh
BYTE
???
AX = 5D0Ah
DS:DX -> 11-word DOS parameter list (see AX=5D00h)
Return: nothing. next call to AH=59h will return values from
fields AX,BX,CX,
DX,DI, and ES in corresponding registers
Notes: documented for DOS 5+, but undocumented in earlier
versions
the MS-DOS Programmer's Reference incorrectly states that
this call was
introduced in DOS 4, and fails to mention that the ERROR
structure
passed to this function is a DOS parameter list.
BUG:
DR-DOS 3.41 and 5.0 read the value for ES from the DS
field of the DPL;
fortunately, MS-DOS ignores the DS field, allowing a
generic routine
which sets both DS and ES fields to the same value
SeeAlso: AH=59h
AX = 5D0Bh
Return: CF set on error
AX = error code (see AH=59h)
CF clear if successful
DS:SI -> swappable data area list (see below)
Notes: copying and restoring the swappable data areas allows DOS
to be
reentered unless it is in a critical section delimited
by calls to
INT 2A/AH=80h and INT 2A/AH=81h,82h
SHARE and other DOS utilities consult the byte at offset
04h in the
DOS data segment (see INT 2F/AX=1203h) to determine the
SDA format
in use: 00h = DOS 3.x, 01h = DOS 4.0-6.0, other = error.
DOS 5+ use the SDA format listed below, but revert back to
the DOS 3.x
call for finding the SDA (see AX=5D06h)
SeeAlso: AX=5D06h,INT 2A/AH=80h,INT 2A/AH=81h,INT 2A/AH=82h,INT
2F/AX=1203h
Format of DOS 4.x swappable data area list:
Offset Size
Description
00h
WORD
count of data areas
02h N BYTEs
"count" copies of data area record
Offset Size
Description
00h
DWORD
address
04h
if swap in DOS
WORD
2Dh
BYTE
2Eh
BYTE
2Fh
BYTE
30h
BYTE
31h
BYTE
32h
WORD
34h
WORD
36h
BYTE
37h
BYTE
38h
BYTE
39h
BYTE
Abort into Fail
3Ah 30 BYTEs
for
58h
DWORD
calling driver)
5Ch 22 BYTEs
72h 14 BYTEs
80h
DWORD
84h
WORD
86h
WORD
88h
BYTE
FFh=make child)
89h
DWORD
8Dh
DWORD
91h
BYTE
92h 3 BYTEs
95h
BYTE
96h 6 BYTEs
9Ch
BYTE
9Dh
BYTE
9Eh 128 BYTEs
11Eh 128 BYTEs
19Eh 21 BYTEs
1B3h 32 BYTEs
1D3h 88 BYTEs
being accessed
22Bh 11 BYTEs
236h
BYTE
237h 11 BYTEs
format)
242h
BYTE
243h
BYTE
244h
WORD
246h 5 BYTEs
24Bh
BYTE
24Ch
BYTE
24Dh
BYTE
24Eh
BYTE
24Fh
BYTE
250h
BYTE
found
251h
BYTE
together)
252h
BYTE
2BEh
DWORD
2C2h
DWORD
2C6h
DWORD
2CAh
WORD
2CCh
WORD
2CEh
WORD
registers
2D0h
DWORD
reentered
2D4h
WORD
2D6h
BYTE
read is
SeeAlso: INT 1B
WORD
DI
WORD
BP
WORD
DS
WORD
ES
DWORD
return address for INT 21 call
WORD
flags pushed by INT 21
Handler must return:
AL = action code
00h ignore error and continue processing request
01h retry operation
02h terminate program through the equivalent of INT
21/AH=4Ch
(INT 20h for DOS 1.x)
03h fail system call in progress
SS,SP,DS,ES,BX,CX,DX preserved
Notes: the only DOS calls the handler may make are INT 21/AH=01h0Ch,30h,59h
if the handler returns to the application by popping the
stack, DOS
will be in an unstable state until the first call with
AH > 0Ch
for DOS 3.1+, IGNORE (AL=00h) is turned into FAIL (AL=03h)
on network
critical errors
if IGNORE specified but not allowed, it is turned into
FAIL
if RETRY specified but not allowed, it is turned into FAIL
if FAIL specified but not allowed, it is turned into ABORT
(DOS 3+) if a critical error occurs inside the critical
error handler,
the DOS call is automatically failed
Notes:
caller
01h unsuccessful
02h can not uninstall yet, will do so
when able
uninstaller
resident code
uninstaller
through memory
out to pop up
nonzero
user
dependent
Notes:
rather than
function.
If the
and will be
specification;
version 3.3,
any
Notes:
program
implementation
05h get hotkeys
Return: AL = status
00h not implemented
FFh supported
DX:BX -> hotkey list (see below)
06h-0Fh reserved for future enhancements
Return: AL = 00h (not implemented)
other application-dependent
programs should not use fixed multiplex numbers; rather, a
resident
TSRs that
must also
compliant
Note:
it is not necessary to reserve a full 64 bytes for the
description,
just enough to store the actual ASCIZ string
Format of interrupt hook list [array]:
Offset Size
Description
00h
BYTE
interrupt number (last entry in array is 2Dh)
01h
WORD
offset within hook list's segment of the interrupt
handler
this will point at the initial short jump of the
interrupt
sharing protocol header (see below)
Format of hotkey list:
Offset Size
Description
00h
BYTE
type of hotkey checking
bit 0: checks before chaining INT 09
bit 1: checks after chaining INT 09
bit 2: checks before chaining INT 15/AH=4Fh
bit 3: checks after chaining INT 15/AH=4Fh
bit 4: checks on INT 16/AH=00h,01h,02h
bit 5: checks on INT 16/AH=10h,11h,12h
bit 6: checks on INT 16/AH=20h,21h,22h
bit 7: reserved (0)
01h
BYTE
number of hotkeys (may be zero if TSR can disable
hotkeys)
02h 6N BYTEs
array of hotkey definitions
(one per hotkey, first should be primary hotkey)
Offset Size
Description
00h
BYTE
hotkey scan code (00h/80h if shift
states only)
hotkey triggers on release if bit
7 set
01h
WORD
required shift states (see below)
03h
WORD
disallowed shift states (see
below)
05h
BYTE
flags
bit 0: hotkey chained before
processing
bit 1: hotkey chained after
processing
bit 2: others should pass through
this hotkey
so that it can be
monitored
bit 3: hotkey will not activate if
other keys
pressed/released before
hotkey press is
completed
bit 4: this key is remapped into
some other key
bit 5-7: reserved (0)
Notes: except for bit 7, the shift states correspond exactly to
the return
values from INT 16/AH=12h. A set bit in the required
states word
RETF)
0Bh 7 BYTEs
and
handlers
signature
Index:
Index:
-16
WORD
in programs
Offset Size
Description
00h
BYTE
bit 0: TSR is relocatable (no absolute segment
references)
01h
WORD
offset to a variable which can activate/inhibit
the TSR
---And if bit 0 in offset 00h is off:
03h
DWORD
pointer to ASCIZ pathname for executable file
which supports
/SR parameter (silent installation & inhibit)
07h
DWORD
pointer to first variable to initialize on the
copy reloaded
from the previous TSR still resident
0Bh
DWORD
pointer to last variable (all variables packed in
one block)
AX = 4680h
Return: AX = 0000h MS Windows 3.0 running in real (/R) or standard
(/S) mode,
nonzero
in enhanced
mode
Note:
Windows 3.1 finally provides an installation check which
works in all
modes (see AX=160Ah)
SeeAlso: AX=1600h,AX=160Ah
1Eh 2 BYTEs
20h
WORD
22h
WORD
below)
24h 9 BYTEs
---DOS 4.01--1Ah 2 BYTEs
1Ch
WORD
tables???
1Eh
WORD
20h 2 BYTEs
22h
WORD
24h
WORD
below)
26h 9 BYTEs
???
pointer to key translation data
pointer to last item in code page table list (see
???
???
pointer to first item in list of code page
pointer to ??? item in list of code page tables
???
pointer to key translation data
pointer to last item in code page table list (see
???
Volver al ndice
AX = 4300h
Return: AL = 80h XMS driver installed
AL <> 80h no driver
Notes: XMS gives access to extended memory and
noncontiguous/nonEMS memory
above 640K
this installation check DOES NOT follow the format used by
other
software
SeeAlso: AX=4310h
Index: installation check;XMS version 2+
= 0000h failure
BL = error code (80h,81h,90h,93h) (see
below)
03h
04h
05h
below)
below)
memory
below)
07h
below)
08h
success)
KB
09h
below)
0Ah
0Bh
below)
offset is
address in
below)
0Ch
block
(see below)
below)
34h
44h
80h
81h
82h
code
with
chain
84h
88h
system)
memory
A0h)
status A0h)
89h
with AH=0Ah)
below)
8Eh
8Fh
below)
Notes:
B0h
B1h
B2h
90h
undefined attribute type
91h
feature not supported
92h
successful, but a portion of the source region has been
overwritten
93h
length of source or destination region exceeds length of
region
allocated to either source or destination handle
94h
conventional and expanded memory regions overlap
95h
offset within logical page exceeds size of logical page
96h
region length exceeds 1M
97h
source and destination EMS regions have same handle and
overlap
98h
memory source or destination type undefined
9Ah
specified alternate map register or DMA register set not
supported
9Bh
all alternate map register or DMA register sets currently
allocated
9Ch
alternate map register or DMA register sets not supported
9Dh
undefined or unallocated alternate map register or DMA
register set
9Eh
dedicated DMA channels not supported
9Fh
specified dedicated DMA channel not supported
A0h
no such handle name
A1h
a handle found had no name, or duplicate handle name
A2h
attempted to wrap around 1M conventional address space
A3h
source array corrupted
A4h
operating system denied access
--------m6743---------------------------------------------------
--------m6748---------------------------------------------------
AH = 49h
defined in EMS 3.0, but undocumented in EMS 3.2
AH = 4Ah
defined in EMS 3.0, but undocumented in EMS 3.2
SeeAlso: AH=4Ch
AH = 4Fh
AL = subfunction
00h get partial page map
DS:SI -> structure containing list of segments
whose mapping
contexts are to be saved
ES:DI -> array to receive page map
01h set partial page map
DS:SI -> structure containing saved partial page
map
02h get size of partial page map
BX = number of mappable segments in the partial map
to be saved
Return: AH = status
00h successful
80h internal error
81h hardware malfunction
84h undefined function requested
8Bh one of specified segments is not mappable
8Fh undefined subfunction parameter
A3h contents of partial page map corrupted or count of
mappable
=
=
=
=
=
51h
handle
number of pages to be allocated to handle
status (00h,80h,81h,83h,84h,87h,88h) (see below)
actual number of pages allocated to handle
00h
02h
WORD
8 BYTEs
handle
handle's name
address
address
Use a RETF
below)
AH = 59h
AL = subfunction
00h get hardware configuration array
ES:DI -> buffer to be filled with array (see
AH = 5Bh
AL = subfunction
00h get alternate map register set
Return: BL = current active alternate map register
set number
ES:DI -> map register context save area if
BL=00h
01h set alternate map register set
BL = new alternate map register set number
ES:DI -> map register context save area if BL=0
02h get alternate map save array size
Return: DX = array size in bytes
03h allocate alternate map register set
Return: BL = number of map register set; 00h = not
supported
04h deallocate alternate map register set
BL = number of alternate map register set
Return: AH = status (00h,80h,81h,84h,8Fh,9Ah-9Dh,A3h,A4h) (see
below)
Note:
this function is for use by operating systems only, and
can be
enabled or disabled at any time by the operating system
Values for status:
00h
successful
80h
internal error
81h
hardware malfunction
84h
undefined function requested
8Fh
undefined subfunction
9Ah
specified alternate map register or DMA register set not
supported
9Bh
all alternate map register or DMA register sets currently
allocated
9Ch
alternate map register or DMA register sets not supported
9Dh
undefined or unallocated alternate map register/DMA
register set
9Eh
dedicated DMA channels not supported
9Fh
specified dedicated DMA channel not supported
A3h
source array corrupted
A4h
operating system denied access
supported
Volver al ndice
Apndice XI - BIBLIOGRAFA
Ralf Brown.
Ralf Brown publica peridicamente un fichero (en ingls) con informacin muy
detallada sobre interrupciones (INTERRUP.LST), muy superior a la de cualquier libro.
Contiene todas las funciones de la BIOS, con informacin de mquinas y marcas
concretas, as como de casi todas las tarjetas (por ejemplo, de vdeo) del mercado.
Tambin estn todas las interrupciones y funciones del DOS, tanto las documentadas
como las secretas o indocumentadas. Aqu se pueden encontrar las funciones (va llamada
a interrupciones) de los controladores de memoria expandida y extendida, del ratn, de
las extensiones CD-ROM, de Desqview, de Windows,... en resumen: de casi todos los
programas importantes del mercado. Adems, se trata de un fichero de dominio pblico.
Peridicamente es actualizado con la informacin que altruistamente le envan personas
de todo el mundo. La versin 55 (mediados de 1997) ocupa unos 5 Mbytes, tras
descomprimir y juntar los diversos ficheros en que viene repartido. Se puede conseguir en
Internet y en las principales BBS.
Michael Tischer.
PC Interno. Programacin de sistema.
Editorial Marcombo - Data Becker, 1993. 1404 pginas + disco.
Este gigantesco libro rene en una sola obra un ingente volumen de informacin
til, relacionada con la programacin de sistemas de los PC. La primera parte constituye
una especie de introduccin a la programacin de sistemas (100 pginas). La segunda
parte (600 pginas) describe los grficos mejor que muchos otros libros especializados en
la materia, explica el teclado, los disquetes y discos duros, los puertos paralelo y serie, la
programacin del ratn y el joystick, el reloj de tiempo real, las memorias EMS y XMS,
la creacin de sonido, la deteccin del tipo de microprocesador... La tercera parte (250
pginas) comenta la estructura del sistema operativo DOS, las formatos COM y EXE, la
gestin de archivos, la gestin de memoria, los controladores de dispositivo,... La cuarta
parte (100 pginas) trata de la creacin de programas residente