Перейти к содержанию

Стандарты

В разработке...

На данный момент существует сырой файл Standards.txt

 ========================================
  BIOS STANDARD
 ========================================

 Calls and interupts
 -------------------
 IRQ:
    0x00      - #DE (Divide by zero)
    0x01      - #DB (Debug)
    0x02      - #BP (Breakpoint)
    0x03      - #OF (Overflow)
    0x04      - #UO (Unknown opcode)
    0x05-0x1F - Reserved
    ---------
    0x20      - Timer
    0x21      - Disk
    0x22      - GPU
    0x23      - Keyboard
    0x24      - Mouse
    0x25      - Audio
    0x26      - Network
    0x27      - XPB-IRQ

 Interupts:
 -# EX1 - func; EX2 - arg1; EX3 - arg2; EX4 - arg3

    0x49      - KBD-INT

    0x50      - Video services
         0x00 - Set video mode
         0x01 - Set cursor shape

    0x51      - Disk services
         0x00 - Get disk parameters
         0x01 - Read sector
         0x02 - Write sector

    !!! Not done yet !!!


 Calls:
 -# Example (read sector):
 -#     LDI.dw IX, 0x00060400   ; dest
 -#     LDI.dw EX2, 1   ; #1 sector
 -#     LDI.dw EX3, 8   ; 8 sectors
 -#     LOD.dw A1, [0x000300104] ; rd_disk
 -#     CALLR A1

    0x00030104 - Read disk (IX - dest; EX2 - LBA ptr; EX3 - LBA ctr)
    0x00030108 - Write disk (IX - src; EX2 - LBA ptr; EX3 - LBA ctr)
    0x0004FC00 - Video service (EX1 - func; EX2 - arg1; EX3 - arg2; EX4 - arg3)
    0x0004FC04 - Disk services (EX1 - func; IX - dest/src; EX2 - LBA ptr; EX3 - LBA ctr)
    0x0004FC08 - Serial port services
    0x0004FC0C - Parallel port services
    0x0004FC10 - Kbd services
    0x0004FC14 - XPB services
    0x0004FC18-0x0004FDFC - Reserved
    0x0004FE00-0x0004FFFC - System calls

 BOOTLOAD
 --------
 BIOS load 1 sector (1024b) in memory (0x00060000) and jumps to 0x00060008, because 0x00060000-0x00060007 means signature

 SCROLL=OFF
 CURSOR=OFF
 VC_MODE=0x00 (80x25; 16 colors)
 TERM_ATTR=0x07

CASM148:
    CLI
    LDI.dw BP, 0xB007AB1E
    PUSH EX1
    PUSH A7
    LDI.dw A7, 0x00020019
    LDI.b XL1, 0x01
    STR.b XL1, [A7]
    STR.b R0, [A7+1]
    LDI.b XL1, 0x07
    STR.b XL1, [A7+2]
    LDI.b XL1, 0x03
    STR.b XL1, [A7]
    LDI.b XL1, 0x05
    STR.b XL1, [A7]
    POP A7
    POP EX1

 CMOS
 ----
 0x00010000-0x000103FF (1024b; 4 bytes per vector; 256 vectors) - IDT (Interupt descriptor table)
 0x00010400-0x000107FF (1024b; 4 bytes per vector; 256 vectors) - DLT (Device list table)
 0x00010800-0x00010DFF (1024b; 8 bytes per vector; 128 vectors) - DDL (Disk Drive list)
 0x00010C00-0x0001FFFF (62464b) - BIOS settings


 IDT vector: bytes 3-0 = service address
 DLT vector: byte #0 = Flags, byte #1 = Device class (Did), byte #2 = Vendor ID (Vid), byte #3 = ?
 DDL vector: bytes 3-0 = disk capacity (in sectors), byte #4 = Flags, bytes 5-7 = Reserved

 BIOS Settings (Example: FBIOS):
    -# Addr = Base:Offset
    -# Base = 0x00010C00

    Offset - Ending - Length - Type   - Name

    0x0000 - 0x001F - 32b    - string - BIOS Password
    0x0020 - 0x0023 - 4b     - bitmap - BIOS Parameters
    0x0024 - 0x0033 - 16b    - uint8  - Boot sequence

 Loading & Saving CMOS
 ---------------------
 When you enter in setup: Copy memory block from 0x00010C00 to <dest>
    (Number of bytes = Size of your CMOS settings; For example, it's 44 bytes for FBIOS: 32 bytes = password; 4 bytes = parameters; 16 bytes = boot sequence)
    (While you change parameters, they save in <dest> area, and it flush to 0x00010C00 only when you save changes and exit from setup)

 When you exit setup with saving: Copy memory block from <dest> to 0x00010C00
    (Number of bytes = Size of your CMOS settings; For example, it's 36 bytes for FBIOS: 32 bytes = password; 4 bytes = parameters; 8 bytes = boot sequence)


 BIOS BOOT SIGNATYRE
 -------------------
    B0 07 AB 1E XX XX XX XX

 Insert these 8 bytes at the very beginning (sector 0) of the disk to designate it as bootable.
 The first 4 bytes (B0 07 AB 1E) represent a magic constant used by the BIOS to determine 
 whether the disk is bootable.

 The next 4 bytes (XX XX XX XX) are reserved for disk signatures, like FS, OS or bootloader

 BIOS must jump to 0x00060008!

 .p.s. 0xB007AB1E in hexspeak means "BOOTABLE"