Line 421... |
Line 421... |
dec bx
|
dec bx
|
ret
|
ret
|
|
|
ASM_END
|
ASM_END
|
|
|
|
// for access to RAM area which is used by interrupt vectors
|
|
// and BIOS Data Area
|
|
|
|
typedef struct {
|
|
unsigned char filler1[0x400];
|
|
unsigned char filler2[0x6c];
|
|
Bit16u ticks_low;
|
|
Bit16u ticks_high;
|
|
Bit8u midnight_flag;
|
|
} bios_data_t;
|
|
|
|
#define BiosData ((bios_data_t *) 0)
|
|
|
|
typedef struct {
|
|
union {
|
|
struct {
|
|
Bit16u di, si, bp, sp;
|
|
Bit16u bx, dx, cx, ax;
|
|
} r16;
|
|
struct {
|
|
Bit16u filler[4];
|
|
Bit8u bl, bh, dl, dh, cl, ch, al, ah;
|
|
} r8;
|
|
} u;
|
|
} pusha_regs_t;
|
|
|
|
typedef struct {
|
|
union {
|
|
struct {
|
|
Bit16u flags;
|
|
} r16;
|
|
struct {
|
|
Bit8u flagsl;
|
|
Bit8u flagsh;
|
|
} r8;
|
|
} u;
|
|
} flags_t;
|
|
|
|
#define SetCF(x) x.u.r8.flagsl |= 0x01
|
|
#define SetZF(x) x.u.r8.flagsl |= 0x40
|
|
#define ClearCF(x) x.u.r8.flagsl &= 0xfe
|
|
#define ClearZF(x) x.u.r8.flagsl &= 0xbf
|
|
#define GetCF(x) (x.u.r8.flagsl & 0x01)
|
|
|
|
typedef struct {
|
|
Bit16u ip;
|
|
Bit16u cs;
|
|
flags_t flags;
|
|
} iret_addr_t;
|
|
|
typedef struct {
|
typedef struct {
|
Bit16u type;
|
Bit16u type;
|
Bit16u flags;
|
Bit16u flags;
|
Bit32u vector;
|
Bit32u vector;
|
Bit32u description;
|
Bit32u description;
|
Line 444... |
Line 494... |
static void int13_harddisk();
|
static void int13_harddisk();
|
static void transf_sect();
|
static void transf_sect();
|
static void int13_diskette_function();
|
static void int13_diskette_function();
|
static void int16_function();
|
static void int16_function();
|
static void int19_function();
|
static void int19_function();
|
|
static void int1a_function();
|
static Bit16u get_CS();
|
static Bit16u get_CS();
|
static Bit16u get_SS();
|
static Bit16u get_SS();
|
static unsigned int enqueue_key();
|
static unsigned int enqueue_key();
|
static unsigned int dequeue_key();
|
static unsigned int dequeue_key();
|
static void set_diskette_ret_status();
|
static void set_diskette_ret_status();
|
Line 961... |
Line 1012... |
jmp halt2_loop
|
jmp halt2_loop
|
ASM_END
|
ASM_END
|
}
|
}
|
}
|
}
|
|
|
static char bios_svn_version_string[] = "$Revision: 1.12 $ $Date: 2009-03-03 16:52:58 $";
|
static char bios_svn_version_string[] = "$Revision: 1.13 $ $Date: 2009-03-05 00:26:53 $";
|
|
|
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
// print_bios_banner
|
// print_bios_banner
|
// displays a the bios version
|
// displays a the bios version
|
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
Line 1774... |
Line 1825... |
;; Go!
|
;; Go!
|
iret
|
iret
|
ASM_END
|
ASM_END
|
}
|
}
|
|
|
|
void
|
|
int1a_function(regs, ds, iret_addr)
|
|
pusha_regs_t regs; // regs pushed from PUSHA instruction
|
|
Bit16u ds; // previous DS:, DS set to 0x0000 by asm wrapper
|
|
iret_addr_t iret_addr; // CS,IP,Flags pushed from original INT call
|
|
{
|
|
Bit8u val8;
|
|
|
|
ASM_START
|
|
sti
|
|
ASM_END
|
|
|
|
switch (regs.u.r8.ah) {
|
|
case 0: // get current clock count
|
|
ASM_START
|
|
cli
|
|
ASM_END
|
|
regs.u.r16.cx = BiosData->ticks_high;
|
|
regs.u.r16.dx = BiosData->ticks_low;
|
|
regs.u.r8.al = BiosData->midnight_flag;
|
|
BiosData->midnight_flag = 0; // reset flag
|
|
ASM_START
|
|
sti
|
|
ASM_END
|
|
// AH already 0
|
|
ClearCF(iret_addr.flags); // OK
|
|
break;
|
|
|
|
default:
|
|
SetCF(iret_addr.flags); // Unsupported
|
|
}
|
|
}
|
|
|
ASM_START
|
ASM_START
|
;----------------------
|
;----------------------
|
;- INT13h (relocated) -
|
;- INT13h (relocated) -
|
;----------------------
|
;----------------------
|
;
|
;
|
Line 2141... |
Line 2225... |
;; EBDA setup
|
;; EBDA setup
|
call ebda_post
|
call ebda_post
|
|
|
;; Keyboard
|
;; Keyboard
|
SET_INT_VECTOR(0x09, #0xF000, #int09_handler)
|
SET_INT_VECTOR(0x09, #0xF000, #int09_handler)
|
;SET_INT_VECTOR(0x16, #0xF000, #int16_handler)
|
SET_INT_VECTOR(0x16, #0xF000, #int16_handler)
|
|
|
xor ax, ax
|
xor ax, ax
|
mov ds, ax
|
mov ds, ax
|
mov 0x0417, al /* keyboard shift flags, set 1 */
|
mov 0x0417, al /* keyboard shift flags, set 1 */
|
mov 0x0418, al /* keyboard shift flags, set 2 */
|
mov 0x0418, al /* keyboard shift flags, set 2 */
|
Line 2168... |
Line 2252... |
|
|
/* keyboard pointer to end of buffer */
|
/* keyboard pointer to end of buffer */
|
mov bx, #0x003E
|
mov bx, #0x003E
|
mov 0x0482, bx
|
mov 0x0482, bx
|
|
|
|
;; CMOS RTC
|
|
SET_INT_VECTOR(0x1A, #0xF000, #int1a_handler)
|
|
|
;; Video setup
|
;; Video setup
|
SET_INT_VECTOR(0x10, #0xF000, #int10_handler)
|
SET_INT_VECTOR(0x10, #0xF000, #int10_handler)
|
|
|
mov cx, #0xc000 ;; init vga bios
|
mov cx, #0xc000 ;; init vga bios
|
mov ax, #0xc780
|
mov ax, #0xc780
|
Line 2421... |
Line 2508... |
mov ds, ax
|
mov ds, ax
|
mov ax, 0x0010
|
mov ax, 0x0010
|
pop ds
|
pop ds
|
iret
|
iret
|
|
|
|
;----------
|
|
;- INT1Ah -
|
|
;----------
|
|
.org 0xfe6e ; INT 1Ah Time-of-day Service Entry Point
|
|
int1a_handler:
|
|
push ds
|
|
;pusha ; we do this instead:
|
|
push ax
|
|
push cx
|
|
push dx
|
|
push bx
|
|
push sp
|
|
mov bx, sp
|
|
sseg
|
|
add [bx], #10
|
|
sseg
|
|
mov bx, [bx+2]
|
|
push bp
|
|
push si
|
|
push di
|
|
|
|
xor ax, ax
|
|
mov ds, ax
|
|
int1a_callfunction:
|
|
call _int1a_function
|
|
; popa ; we do this instead:
|
|
pop di
|
|
pop si
|
|
pop bp
|
|
add sp, #2
|
|
pop bx
|
|
pop dx
|
|
pop cx
|
|
pop ax
|
|
|
|
pop ds
|
|
iret
|
|
|
;------------------------------------------------
|
;------------------------------------------------
|
;- IRET Instruction for Dummy Interrupt Handler -
|
;- IRET Instruction for Dummy Interrupt Handler -
|
;------------------------------------------------
|
;------------------------------------------------
|
.org 0xff53 ; IRET Instruction for Dummy Interrupt Handler
|
.org 0xff53 ; IRET Instruction for Dummy Interrupt Handler
|
dummy_iret_handler:
|
dummy_iret_handler:
|