?? bios.asm
字號:
Date: Wed, 13 Jan 88 04:26 PST
From: <MULTI%TRIUMFCL.BITNET@CUNYVM.CUNY.EDU>
Subject: BIOS.ASM update INFO-IBMPC librarys
To: hicks@walker-emh.arpa
Page 80,132
Title BIOS - For Intel 8088 or NEC "V20" turbo motherboards. Use MASM 4.0
;
; This bios will work on IBM-PC/xt and many other compatibles that share a
; similar design concept. You do not need to have a turbo motherboard to
; use this bios, but if you do, then use the following key sequence
; CTRL ALT -
; to toggle the computer speed between fast and slow (=IBM compatible)
;
; This BIOS can produce the following error messages at IPL time
;
ER_BIOS equ 01h ; Bad ROM bios checksum, patch last byte
ER_RAM equ 02h ; Bad RAM in main memory, replace
ER_CRT equ 04h ; Bad RAM in video card, replace
ER_MEM equ 10h ; Bad RAM in vector area, replace
ER_ROM equ 20h ; Bad ROM in expansion area, bad checksum
;
; The last two bytes have to be patched with DEBUG as follows
;
; FFFF 00.xx ( avoid ER_BIOS on bootstrap ) --------------------
; FFFE 00.FE ( leaves IBM-PC/xt signature ) ----------------- |
; | |
; where "xx" results in a zero checksum for the whole BIOS rom, for ex | |
; | |
; masm BIOS; ( Assemble BIOS source code) | |
; link BIOS; ( Link the BIOS object code) | |
; debug BIOS.EXE ( Exe2bin BIOS binary code) | |
; -nBIOS.BIN ( Name of the output binary) | |
; -eCS:FFFE ( Opens BIOS signature byte) | |
; .FE ( Leave IBM-PC/xt signature) <-- |
; -eCS:FFFF ( Opens BIOS checksum byte) |
;; -------> .DC ( Force ROM checksum = zero) <-----
;; -rBX ( Opens hi order byte count)
;; :0 ( ... must be 0 bytes long)
;; -rCX ( Opens lo order byte count)
;; :2000 ( ... BIOS 2000 bytes long)
;; -wCS:E000 ( Output to BIOS.BIN file)
;; -q
;;
;; You must correct the checksum by manually patching the last byte so as the
;; the entire 2764-2 eprom sums to zero. I wish DEBUG could checksum blocks.
;
; ************************Miscellaneous definitions************************
; *
MAX_MEMORY =704 ; Maximum kilobytes of memory allowed *
;SLOW_FLOPPY =1 ; Define to run floppy always at 4.77 mHz *
; *
; ************************Miscellaneous definitions************************
;
entry macro x
pad =BANNER - $ + x - 0E000h
if pad LT 0
.err
%out 'No room for ENTRY point'
endif
if pad GT 0
db pad DUP(0FFh)
endif
endm
;
jmpf macro x,y
db 0EAh;
dw y,x
endm
;
retf macro x
ifb <x>
db 0CBh
else
db 0CAh
dw x
endif
endm
;
LF equ 0Ah
CR equ 0Dh
;
.SALL ; Suppress Macro Expansions
.LFCOND ; List False Conditionals
;
ASSUME DS:code, SS:code, CS:code, ES:code
data SEGMENT at 40h ; IBM compatible data structure
dw 4 dup(?) ; 40:00 ; RS232 com. ports - up to four
dw 4 dup(?) ; 40:08 ; Printer ports - up to four
dw ? ; 40:10 ; Equipment present word
; + (1 iff floppies) * 1.
; + (# 64K sys ram ) * 4.
; + (init crt mode ) * 16.
; + (# of floppies ) * 64.
; + (# serial ports) * 512.
; + (1 iff toy port) * 4096.
; + (# parallel LPT) * 16384.
db ? ; 40:12 ; MFG test flags, unused by us
dw ? ; 40:13 ; Memory size, kilobytes
db ? ; 40:15 ; IPL errors<-table/scratchpad
db ? ; ...unused
;---------------[Keyboard data area]------------;
db ?,? ; 40:17 ; Shift/Alt/etc. keyboard flags
db ? ; 40:19 ; Alt-KEYPAD char. goes here
dw ? ; 40:1A ; --> keyboard buffer head
dw ? ; 40:1C ; --> keyboard buffer tail
dw 16 dup(?) ; 40:1E ; Keyboard Buffer (Scan,Value)
;---------------[Diskette data area]------------;
db ? ; 40:3E ; Drive Calibration bits 0 - 3
db ? ; 40:3F ; Drive Motor(s) on 0-3,7=write
db ? ; 40:40 ; Ticks (18/sec) til motor off
db ? ; 40:41 ; Floppy return code stat byte
; 1 = bad ic 765 command req.
; 2 = address mark not found
; 3 = write to protected disk
; 4 = sector not found
; 8 = data late (DMA overrun)
; 9 = DMA failed 64K page end
; 16 = bad CRC on floppy read
; 32 = bad NEC 765 controller
; 64 = seek operation failed
;128 = disk drive timed out
db 7 dup(?) ; 40:42 ; Status bytes from NEC 765
;---------------[Video display area]------------;
db ? ; 40:49 ; Current CRT mode (software)
; 0 = 40 x 25 text (no color)
; 1 = 40 x 25 text (16 color)
; 2 = 80 x 25 text (no color)
; 3 = 80 x 25 text (16 color)
; 4 = 320 x 200 grafix 4 color
; 5 = 320 x 200 grafix 0 color
; 6 = 640 x 200 grafix 0 color
; 7 = 80 x 25 text (mono card)
dw ? ; 40:4A ; Columns on CRT screen
dw ? ; 40:4C ; Bytes in the regen region
dw ? ; 40:4E ; Byte offset in regen region
dw 8 dup(?) ; 40:50 ; Cursor pos for up to 8 pages
dw ? ; 40:60 ; Current cursor mode setting
db ? ; 40:62 ; Current page on display
dw ? ; 40:63 ; Base addres (B000h or B800h)
db ? ; 40:65 ; ic 6845 mode reg. (hardware)
db ? ; 40:66 ; Current CGA palette
;---------------[Used to setup ROM]-------------;
dw ?,? ; 40:67 ; Eprom base Offset,Segment
db ? ; 40:6B ; Last spurious interrupt IRQ
;---------------[Timer data area]---------------;
dw ? ; 40:6C ; Ticks since midnite (lo)
dw ? ; 40:6E ; Ticks since midnite (hi)
db ? ; 40:70 ; Non-zero if new day
;---------------[System data area]--------------;
db ? ; 40:71 ; Sign bit set iff break
dw ? ; 40:72 ; Warm boot iff 1234h value
;---------------[Hard disk scratchpad]----------;
dw ?,? ; 40:74 ;
;---------------[Timout areas/PRT/LPT]----------;
db 4 dup(?) ; 40:78 ; Ticks for LPT 1-4 timeouts
db 4 dup(?) ; 40:7C ; Ticks for COM 1-4 timeouts
;---------------[Keyboard buf start/nd]---------;
dw ? ; 40:80 ; Contains 1Eh, buffer start
dw ? ; 40:82 ; Contains 3Eh, buffer end
data ENDS
dosdir SEGMENT at 50h ; Boot disk directory from IPL
xerox label byte ; 0 if Print Screen idle
; 1 if PrtSc xeroxing screen
;255 if PrtSc error in xerox
; ...non-grafix PrtSc in bios
db 200h dup(?) ; PC-DOS bootstrap procedure
; ...IBMBIO.COM buffers the
; ...directory of the boot
; ...device here at IPL time
; ...when locating the guts
; ...of the operating system
; ...filename "IBMDOS.COM"
dosdir ends
dosseg SEGMENT at 70h ; "Kernel" of PC-DOS op sys
;IBMBIO.COM file loaded by boot block. Device Drivers/Bootstrap. CONTIGUOUS<---
;IBMDOS.COM operating system nucleus immediately follows IBMBIO.COM and |
; doesn`t have to be contiguous. The IBMDOS operating system nucleus |
; binary image is loaded by transient code in IBMBIO binary image |
dosseg ends ; |
iplseg SEGMENT at 0h ; Segment for boot block |
;The following boot block is loaded with 512. bytes on the first sector of |
;the bootable device by code resident in the ROM-resident bios. Control is |
;then transferred to the first word 0000:7C00 of the disk-resident bootstrap |
ORG 07C00h ; ..offset for boot block |
boot db 200h dup(?) ; ..start disk resident boot--
iplseg ends
code SEGMENT
ORG 0E000h
BANNER db ' Generic Turbo XT Bios 1987',CR,LF
db ' for 8088 or V20 cpu',CR,LF
db ' (c)Anonymous',CR,LF
db LF,0
LPTRS dw 03BCh,0378h,0278h ; Possible line printer ports
ENTRY 0E05Bh ; IBM restart entry point
COLD: MOV AX,40h ; Entered by POWER_ON/RESET
MOV DS,AX
MOV Word ptr DS:72h,0 ; Show data areas not init
WARM: CLI ; Begin FLAG test of CPU
XOR AX,AX
JB HALT
JO HALT
JS HALT
JNZ HALT
JPO HALT
ADD AX,1
JZ HALT
JPE HALT
SUB AX,8002h
JS HALT
INC AX
JNO HALT
SHL AX,1
JNB HALT
JNZ HALT
SHL AX,1
JB HALT
MOV BX,0101010101010101b ; Begin REGISTER test of CPU
CPUTST: MOV BP,BX
MOV CX,BP
MOV SP,CX
MOV DX,SP
MOV SS,DX
MOV SI,SS
MOV ES,SI
MOV DI,ES
MOV DS,DI
MOV AX,DS
CMP AX,0101010101010101b
JNZ CPU1
NOT AX
MOV BX,AX
JMP CPUTST
CPU1: XOR AX,1010101010101010b
JZ CPU_OK
HALT: HLT
CPU_OK: CLD
MOV AL,0 ; Prepare to initialize
OUT 0A0h,AL ; ...no NMI interrupts
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -