A complete 8088 source code (by bitnet@cunyvm.cuny.edu)
A MASM commented source code of an 8088/NEC V20 BIOS. At that time 2764 EPROMS were in use. You can see how the different devices are initialized, how memory check, checksum and POST work. Very interesting code...
This article is online from 2333 days and has been seen 9691 times
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/scratchpa d 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
(*** download for full text ***)
Similar Articles
BIOS Boot Specification Version 1.01 A 46 page PDF BIOS specification (by Compaq - Phoenix - Intel)
BIOS Information Leakage A nice doc about cmos programming in asm (by Endrazine)
Bootable CD-ROM Format Specification Bootable CD and int 13 BIOS extensions (by Phoenix Technologies / IBM)
IBM AT 80286 BIOS SOURCE CODE Very detailed BIOS commented code from IBM (by IBM)
Simple BIOS save A CPP source to save BIOS in a file (by unknown)
TinyBios (tm) 1.3 An open source x86 assembly bios code (by PC Engines GmbH)
Tags: bios
|