Ignore:
Timestamp:
Apr 8, 2017, 12:28:05 AM (8 years ago)
Author:
Ben Rietbroek
Message:

Added the new disk-info stuff on the pre-MENU screen ! [v1.1.1-testing]

While many parts of the underlying engine have been enhanced,
this will probably be the most visible change for AiR-BOOT users... ;)

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bootcode/regular/videoio.asm

    r164 r166  
    740740
    741741
    742    ; Rousseau:
    743 ;   mov al, [NewPartitions]
    744    ;call  VideoIO_PrintByteDynamicNumber
    745 ;   mov al, [CFG_Partitions]
    746    ;call  VideoIO_PrintByteDynamicNumber
    747 ;   ret
    748 ;VideoIO_DBG_WriteString         EndP
    749 
    750 
    751 ; Dump the disk-info.
    752 ; Disk number is in DL.
    753 VideoIO_DumpDiskInfo    Proc Near uses ax bx cx dx
    754 
     742;------------------------------------------------------------------------------
     743; [TextColorFore], 01h    ; blue
     744; [TextColorFore], 02h    ; green
     745; [TextColorFore], 03h    ; cyan
     746; [TextColorFore], 04h    ; red
     747; [TextColorFore], 05h    ; magenta
     748; [TextColorFore], 06h    ; brown
     749; [TextColorFore], 07h    ; white
     750; [TextColorFore], 08h    ; grey
     751; [TextColorFore], 09h    ; marine
     752; [TextColorFore], 0ah    ; bright green
     753; [TextColorFore], 0bh    ; bright cyan
     754; [TextColorFore], 0ch    ; bright red
     755; [TextColorFore], 0dh    ; bright magenta
     756; [TextColorFore], 0eh    ; bright yellow
     757; [TextColorFore], 0fh    ; bright white
     758; [TextColorFore], 10h    ; black on blue.
     759; more...
     760;------------------------------------------------------------------------------
     761; Show disk and other information on the pre-MENU screen
     762;------------------------------------------------------------------------------
     763; IN    : None
     764; OUT   : None
     765; NOTE  : Assumes VIDEO and DISK stuff has been done already
     766; TODO  : Optimize for space (use seperate function to display geo)
     767;------------------------------------------------------------------------------
     768VideoIO_DisplayDiskInfo     Proc Near
     769
     770        ; Push the whole shebang
     771        pusha
     772
     773        ; Push these too for safety
     774        push    ds
     775        push    es
     776
     777        ; Save current video state
     778        mov     al, [TextColorFore]
     779        mov     ah, [TextColorBack]
     780        mov     dl, [TextPosX]
     781        mov     dh, [TextPosY]
     782        push    ax
     783        push    dx
     784
     785        ; Jmp over the strings
     786        jmp     @F
     787
     788        ; We like to have these local for now
     789    VideoIO_DumpDiskInfo_labels     db  'DISK '
     790                                    db  'SECTORS_LBA '
     791                                    db  'SECSIZE  '
     792                                    db  'I13_GEO   '
     793                                    db  'I13X_GEO  '
     794                                    db  'LVM_GEO   '
     795                                    db  'BUS  '
     796                                    db  'INTERFACE '
     797                                    db  'REMOVABLE'
     798                                    db  0
     799
     800    ; Display disk information on the pre-MENU screen
     801    @@:
     802
     803        ; Start postition -- allow for AuxIO message when debugging
     804IFNDEF  AUX_DEBUG
     805        mov     [TextPosY], 7
     806ELSE
     807        mov     [TextPosY], 8
     808ENDIF
     809        mov     [TextPosX], 0
     810
     811        ; Normal colors
     812        mov     [TextColorFore], 07h    ; white
     813        mov     [TextColorBack], 00h    ; black
     814
     815        ; Show the labels
     816        mov     si, offset [VideoIO_DumpDiskInfo_labels]
     817        call    VideoIO_Print
     818
     819        ; Zero based index of first drive to scan
     820        xor     cl, cl
     821
     822        ; Reduced brightness
     823        mov     [TextColorFore], 08h
     824
     825        ; Loop over all disks found
    755826    VideoIO_DumpDiskInfo_next_disk:
    756         push    dx
    757         xor     ax,ax
    758         mov     al,[TextPosY]
    759         push    ax
    760 
    761         mov     ax,21
    762         mov     dh,dl
    763         and     dh,01111111b
    764         mul     dh
    765         mov     dh,al
    766 
    767         mov     [TextPosX],dh
    768 
    769         mov     si, offset [Disk]
     827
     828        ; Compose BIOS disk number (80h, 81h, etc)
     829        mov     dl, cl
     830        add     dl, 80h
     831
     832        ; Position on start of next line
     833        inc     [TextPosY]
     834        mov     [TextPosX], 0
     835
     836        ; Show a bright star if this is the BIOS boot-disk
     837        ;~ mov     [TextColorBack], 08h
     838        mov     al, ' '
     839        cmp     dl, [BIOS_BootDisk]
     840        jne     @F
     841        mov     [TextColorFore], 0fh
     842        mov     al, '*'
     843    @@:
     844        call    VideoIO_PrintSingleChar
     845
     846        ; Show BIOS disk number in normal white ----------------- [ BIOS DISK ]
     847        mov     [TextColorFore], 07h
     848        mov     al, dl
     849        call    VideoIO_PrintHexByte
     850        mov     al, 'h'
     851        call    VideoIO_PrintSingleChar
     852        mov     [TextColorFore], 08h
     853
     854        ; Get pointer to DISKINFO structure in BX
     855        call    DriveIO_CalcDiskInfoPointer
     856
     857        ; Show disk size in LBA sectors (hex) -------------------- [ LBA SECS ]
     858        mov     [TextPosX], 5
     859        mov     [TextColorFore], 06h            ; brown for >2TiB
     860        mov     al, [bx+LocDISKINFO_I13X_SecsLBA+04h]
     861        test    al, al
     862        jnz     @F
     863        mov     ch, 08h                         ; reduced brightness
     864        cmp     dl, [BIOS_BootDisk]
     865        lahf                                    ; load flags
     866        rcl     ah, 2                           ; move ZF to CF
     867        sbb     ch, 0                           ; change color to white
     868        mov     [TextColorFore], ch             ; white when boot-disk
     869    @@:
     870        call    VideoIO_PrintHexByte
     871        mov     ax, [bx+LocDISKINFO_I13X_SecsLBA+00h]
     872        mov     dx, [bx+LocDISKINFO_I13X_SecsLBA+02h]
     873        call    VideoIO_PrintHexDWord
     874        mov     al, 'h'
     875        call    VideoIO_PrintSingleChar
     876        mov     [TextColorFore], 08h            ; reduced brightness
     877
     878        ; Show sector size (hex) ------------------------------ [ SECTOR SIZE ]
     879        mov     [TextPosX], 17
     880        mov     [TextColorFore], 06h            ; brown for != 512
     881        mov     ax, [bx+LocDISKINFO_I13X_SecSize]
     882        cmp     ax, 0200h
     883        jne     @F
     884        mov     [TextColorFore], ch             ; white when boot-disk
     885    @@:
     886        call    VideoIO_PrintHexWord
     887        mov     al, 'h'
     888        call    VideoIO_PrintSingleChar
     889        mov     [TextColorFore], 08h            ; reduced brightness
     890
     891        ; Show INT13 geometry (dec) ----------------------------- [ INT13 GEO ]
     892        mov     [TextPosX], 26
     893        mov     [TextColorFore], 04h            ; red for (0,0)
     894        mov     dl, [bx+LocDISKINFO_I13_Secs]
     895        mov     dh, [bx+LocDISKINFO_I13_Heads]
     896        test    dl, dl
     897        jz      @F                              ; no spt !
     898        test    dh, dh
     899        jz      @F                              ; no heads !
     900        mov     [TextColorFore], 08h            ; reduced brightness
     901    @@:
     902        mov     al, '('
     903        call    VideoIO_PrintSingleChar
     904        mov     al, dh                          ; int13 heads
     905        call    VideoIO_PrintByteDynamicNumber
     906        mov     al, ','
     907        call    VideoIO_PrintSingleChar
     908        mov     al, dl                          ; int13 secs
     909        call    VideoIO_PrintByteDynamicNumber
     910        mov     al, ')'
     911        call    VideoIO_PrintSingleChar
     912        mov     [TextColorFore], 08h            ; reduced brightness
     913
     914        ; Show INT13X geometry (dec) --------------------------- [ INT13X GEO ]
     915        mov     [TextPosX], 36
     916        mov     [TextColorFore], 04h            ; red for (0,0)
     917        mov     dl, [bx+LocDISKINFO_I13X_Secs]
     918        mov     dh, [bx+LocDISKINFO_I13X_Heads]
     919        test    dl, dl
     920        jz      @F                              ; no spt !
     921        test    dh, dh
     922        jz      @F                              ; no heads !
     923        mov     [TextColorFore], 08h            ; reduced brightness
     924    @@:
     925        mov     al, '('
     926        call    VideoIO_PrintSingleChar
     927        mov     al, dh                          ; int13x heads
     928        call    VideoIO_PrintByteDynamicNumber
     929        mov     al, ','
     930        call    VideoIO_PrintSingleChar
     931        mov     al, dl                          ; int13x secs
     932        call    VideoIO_PrintByteDynamicNumber
     933        mov     al, ')'
     934        call    VideoIO_PrintSingleChar
     935        mov     [TextColorFore], 08h            ; reduced brightness
     936
     937        ; Show LVM geometery (dec)  ------------------------------- [ LVM GEO ]
     938        mov     [TextPosX], 46
     939        mov     [TextColorFore], 04h            ; red for (0,0)
     940        mov     dl, [bx+LocDISKINFO_LVM_Secs]
     941        mov     dh, [bx+LocDISKINFO_LVM_Heads]
     942        test    dl, dl
     943        jz      @F                              ; no spt, thus no lvm !
     944        test    dh, dh
     945        jz      @F                              ; no heads, thus no lvm !
     946        mov     [TextColorFore], 09h            ; marine for LVM_SPT>127
     947        cmp     dl, 127
     948        ja      @F                              ; IBMS506 or DANI on >1TiB
     949        mov     [TextColorFore], 03h            ; cyan for 63>LVM_SPT<=127
     950        cmp     dl, 63
     951        ja      @F                              ; DANI on >502MiB
     952        mov     [TextColorFore], 07h            ; white for normal LVM_SPT
     953    @@:
     954        mov     al, '('
     955        call    VideoIO_PrintSingleChar
     956        mov     al, dh                          ; lvm heads
     957        call    VideoIO_PrintByteDynamicNumber
     958        mov     al, ','
     959        call    VideoIO_PrintSingleChar
     960        mov     al, dl                          ; lvm secs
     961        call    VideoIO_PrintByteDynamicNumber
     962        mov     al, ')'
     963        call    VideoIO_PrintSingleChar
     964        mov     [TextColorFore], 08h            ; reduced brightness
     965
     966        ; Show host bus (4 chars) -------------------------------- [ HOST BUS ]
     967        mov     [TextPosX], 56
     968        mov     ax, [bx+LocDISKINFO_I13X_HostBus+00h]
     969        mov     dx, [bx+LocDISKINFO_I13X_HostBus+02h]
     970        call    VideoIO_PrintSingleChar
     971        mov     al, ah
     972        call    VideoIO_PrintSingleChar
     973        mov     al, dl
     974        call    VideoIO_PrintSingleChar
     975        mov     al, dh
     976        call    VideoIO_PrintSingleChar
     977
     978        ; Show interface (8 chars) ------------------------------ [ INTERFACE ]
     979        mov     [TextPosX], 61
     980        mov     ax, [bx+LocDISKINFO_I13X_Interface+00h]
     981        mov     dx, [bx+LocDISKINFO_I13X_Interface+02h]
     982        call    VideoIO_PrintSingleChar
     983        mov     al, ah
     984        call    VideoIO_PrintSingleChar
     985        mov     al, dl
     986        call    VideoIO_PrintSingleChar
     987        mov     al, dh
     988        call    VideoIO_PrintSingleChar
     989        mov     ax, [bx+LocDISKINFO_I13X_Interface+04h]
     990        mov     dx, [bx+LocDISKINFO_I13X_Interface+06h]
     991        call    VideoIO_PrintSingleChar
     992        mov     al, ah
     993        call    VideoIO_PrintSingleChar
     994        mov     al, dl
     995        call    VideoIO_PrintSingleChar
     996        mov     al, dh
     997        call    VideoIO_PrintSingleChar
     998
     999        ; Show if disk is removable (YES/NO) -------------------- [ REMOVABLE ]
     1000        mov     [TextPosX], 71
     1001        mov     si, offset [No]
     1002        mov     ax, [bx+LocDISKINFO_I13X_Flags]
     1003        test    ax, 0004h
     1004        jz      @F
     1005        mov     si, offset [Yes]
     1006        mov     [TextColorFore], 06h            ; brown
     1007    @@:
    7701008        call    VideoIO_Print
    771         mov     al,dl
    772 
    773         ; NIET GOED, GAAT FOUT > 9, HEX PRINT GEBRUIKEN !!
    774         shr     al,4
    775         add     al,'0'
    776         call    VideoIO_PrintSingleChar
    777         mov     al,dl
    778         and     al,01111111b
    779         add     al,'0'
    780         call    VideoIO_PrintSingleChar
    781         mov     al,'h'
    782         call    VideoIO_PrintSingleChar
    783 
    784         inc     [TextPosY]
    785         mov     [TextPosX],dh
    786 
    787         mov     al,'-'
    788         mov     cl,17
    789         call    VideoIO_PrintSingleMultiChar
    790 
    791         ;~ inc     [TextPosY]
    792         ;~ mov     [TextPosX],dh
    793         ;~ mov     si, offset BiosCyls
    794         ;~ call    VideoIO_Print
    795 
    796         ;~ push    dx
    797         ;~ mov     bx,offset BIOS_Cyls
    798         ;~ xor     dh,dh
    799         ;~ and     dl,01111111b
    800         ;~ shl     dx,1
    801         ;~ shl     dx,1
    802         ;~ add     bx,dx
    803         ;~ mov     ax,[bx]
    804         ;~ mov     dx,[bx+02]
    805         ;~ call    VideoIO_PrintHexDWord
    806         ;~ pop     dx
    807 
    808         inc     [TextPosY]
    809         mov     [TextPosX],dh
    810         mov     si, offset BiosHeads
    811         call    VideoIO_Print
    812 
    813         push    dx
    814         mov     bx,offset BIOS_Heads
    815         xor     dh,dh
    816         and     dl,01111111b
    817         shl     dx,1
    818         shl     dx,1
    819         add     bx,dx
    820         mov     ax,[bx]
    821         mov     dx,[bx+02]
    822         call    VideoIO_PrintHexDWord
     1009        mov     [TextColorFore], 08h            ; reduced brightness
     1010
     1011        ; Increment disk index
     1012        inc     cl
     1013
     1014        ; Process next disk if still in range
     1015        cmp     cl, [TotalHarddiscs]
     1016        jb      VideoIO_DumpDiskInfo_next_disk
     1017
     1018    ; We're done
     1019    VideoIO_DumpDiskInfo_end:
     1020
     1021        ; Restore video state
    8231022        pop     dx
    824 
    825         inc     [TextPosY]
    826         mov     [TextPosX],dh
    827         mov     si, offset BiosSecs
    828         call    VideoIO_Print
    829 
    830         push    dx
    831         mov     bx,offset BIOS_Secs
    832         xor     dh,dh
    833         and     dl,01111111b
    834         shl     dx,1
    835         shl     dx,1
    836         add     bx,dx
    837         mov     ax,[bx]
    838         mov     dx,[bx+02]
    839         call    VideoIO_PrintHexDWord
    840         pop     dx
    841 
    842         inc     [TextPosY]
    843         mov     [TextPosX],dh
    844         mov     si, offset LvmSecs
    845         call    VideoIO_Print
    846 
    847         push    dx
    848         ; Offset of array containing LVM SPT values for each disk found
    849         mov     bx,offset [TrueSecs]
    850         ; DX to index
    851         xor     dh,dh
    852         and     dl,01111111b
    853         shl     dx,1
    854         shl     dx,1
    855         add     bx,dx
    856         ; Get LVM SPT
    857         mov     ax,[bx]
    858         mov     dx,[bx+02]
    859         call    VideoIO_PrintHexDWord
    860         pop     dx
    861 
    862         inc     [TextPosY]
    863         mov     [TextPosX],dh
    864         mov     si, offset BiosLBA
    865         call    VideoIO_Print
    866 
    867         push    dx
    868         mov     bx,offset BIOS_TotalSecs
    869         xor     dh,dh
    870         and     dl,01111111b
    871         shl     dx,1
    872         shl     dx,1
    873         shl     dx,1
    874         add     bx,dx
    875         mov     ax,[bx]
    876         mov     dx,[bx+02]
    877         call    VideoIO_PrintHexDWord
    878         pop     dx
    879 
    880         inc     [TextPosY]
    881         mov     [TextPosX],dh
    882 
    8831023        pop     ax
    884         mov     [TextPosY],al
    885         pop     dx
    886 
    887         inc     dl
    888         mov     al,dl
    889         and     al,01111111b
    890         cmp     al,[TotalHarddiscs]
    891         jae     VideoIO_DumpDiskInfo_end
    892         jmp     VideoIO_DumpDiskInfo_next_disk
    893 
    894     VideoIO_DumpDiskInfo_end:
    895         mov     [TextPosX],0
    896         add     [TextPosY],6
     1024        mov     [TextPosY], dh
     1025        mov     [TextPosX], dl
     1026        mov     [TextColorBack], ah
     1027        mov     [TextColorFore], al
     1028
     1029        ; Restore segment registers
     1030        pop     es
     1031        pop     ds
     1032
     1033        ; Restore work registers
     1034        popa
     1035
    8971036        ret
    898 VideoIO_DumpDiskInfo    EndP
     1037VideoIO_DisplayDiskInfo     EndP
    8991038
    9001039
     
    9281067
    9291068
    930 ; Disk Info to Dump to AB LogScreen
    931 Disk              db "DISK ",0
    932 ;BiosCyls          db "Cyls    :",0
    933 BiosHeads         db "Heads   :",0
    934 BiosSecs          db "Secs    :",0
    935 LvmSecs           db "SecsLVM :",0
    936 BiosLBA           db "LBA Secs:",0
    937 
    938 
    939 HugeBootDisk      db "Boot Disk is Huge    : ",0
    940 DisksFound        db "Disks Found          : ",0
    941 PartitionsFound   db "Partitions Found     : ",0
    942 ;AutoStartPart     db "Auto Start Partition : ",0
    943 
    944 Phase1            db "OS/2 Install Phase 1 : ",0
    945 
    946 
    947 ShowMenu          db "Press TAB to return to the AiR-BOOT Menu",0
    948 ;ShowBootLog       db "Press TAB to see the Boot Log...",0
    949 
    950 Yes               db "YES",0
    951 No                db "NO",0
    952 ;~ On                db "ON",0
    953 ;~ Off               db "OFF",0
    954 ;~ None              db "NONE",0
    955 ;~ Active            db "ACTIVE",0
    956 NotActive         db "NOT ACTIVE",0
    957 
    958 ; New Line for use by MBR_Teletype
    959 NL          db 0dh, 0ah, 0
     1069;
     1070; Strings used in the pre-MENU screen
     1071;
     1072NL                  db 0dh, 0ah, 0
     1073DisksFound          db "Disks Found          : ",0
     1074PartitionsFound     db "Partitions Found     : ",0
     1075Phase1              db "OS/2 Install Phase 1 : ",0
     1076TABMessage          db "Press TAB to return to the AiR-BOOT Menu",0
     1077PREPMessage         db "Preparing BOOT Menu...",0
     1078Yes                 db "YES",0
     1079No                  db "NO",0
     1080;~ On                  db "ON",0
     1081;~ Off                 db "OFF",0
     1082;~ None                db "NONE",0
     1083;~ Active              db "ACTIVE",0
     1084;~ NotActive           db "NOT ACTIVE",0
     1085;~ AutoStartPart       db "Auto Start Partition : ",0
Note: See TracChangeset for help on using the changeset viewer.