[mbr] use 80x25:16 text mode rather than 640x480:16 VGA mode

* This should produce the same output while improving compatibility with systems that have a broken VGA implementation.
* Also fix an LD error with newer gcc toolchains.
This commit is contained in:
Pete Batard 2022-07-04 15:08:55 +01:00
parent 3cf41abf2e
commit 8fb602b8ee
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
5 changed files with 20 additions and 26 deletions

View File

@ -1,7 +1,7 @@
#
# This file is part of the Rufus project.
#
# Copyright (c) 2012 Pete Batard <pete@akeo.ie>
# Copyright (c) 2012-2022 Pete Batard <pete@akeo.ie>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@ -24,8 +24,7 @@ CC = gcc
LD = ld
OBJDUMP = objdump
OBJCOPY = objcopy
CFLAGS = -m32
LDFLAGS = -nostartfile
CFLAGS = -m32 -nostartfiles -nodefaultlibs
BOCHS = "C:/Program Files/Bochs/bochsdbg.exe"
.PHONY: all clean

View File

@ -2,7 +2,7 @@
/* MSG - A protective MBR that displays an ASCII message located in the */
/* subsequent sectors. */
/* */
/* Copyright (c) 2019-2020 Pete Batard <pete@akeo.ie> */
/* Copyright (c) 2019-2022 Pete Batard <pete@akeo.ie> */
/* */
/* This program is free software; you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the Free */
@ -31,7 +31,7 @@
/********************************************************************************/
MBR_ADDR = 0x7c00
MBR_RESERVED = 0x1b8 # Start of the reserved section (partition table, etc.)
MSG_SECTOR = 0x22 # First sector of the message (must be after the GPT)
MSG_SECTOR = 0x22 # First sector of the message (must be after the GPT)
NB_SECTORS = 0x08 # Number of sectors to read
PT_MAX = 0x04 # Number of partition entries in the partition table
PT_ENTRY_SIZE = 0x10 # Size of a partition entry in the partition table
@ -85,21 +85,16 @@ mbr:
mov es, ax # Keep allocated RAM segment in ES
clear_display:
mov bh, 0x07
mov ax, 0x007f
int 0x10 # Set Video Mode to 640x480 16 color graphics (VGA)
xor bx, bx
xor cx, cx
mov dx, 0x184f
mov ax, 0x0600
int 0x10 # Clear screen
xor dx, dx
mov ax, 0x0003
int 0x10 # Set Text Mode to 80x25, 16 color (setting mode also clears the screen)
mov ah, 0x02
int 0x10 # Set cursor pos to top left
read_sectors: # Copy the next sectors into RAM
mov ah, 0x41
mov bx, 0x55aa
xor cx, cx
xor dx, dx
int 0x13
jb no_ext # failure to get ext
cmp bx, 0xaa55

Binary file not shown.

View File

@ -2,23 +2,22 @@
* Rufus message MBR - Displays an ASCII text message contained in the
* 4 KB of sectors starting at LBA 34 (i.e. after the primary GPT if any).
* See https://github.com/pbatard/rufus/tree/master/res/mbr
* Copyright © 2019-2020 Pete Batard <pete@akeo.ie>
* Copyright © 2019-2022 Pete Batard <pete@akeo.ie>
*/
unsigned char mbr_msg_rufus_0x0[] = {
0x41, 0x4B, 0x45, 0x4F, 0xFC, 0x31, 0xC0, 0xFA, 0x8E, 0xD0, 0xBC, 0x00,
0x7C, 0xFB, 0x8E, 0xD8, 0xBB, 0x13, 0x04, 0x8B, 0x07, 0x83, 0xE8, 0x04,
0x89, 0x07, 0xC1, 0xE0, 0x06, 0x8E, 0xC0, 0xB7, 0x07, 0xB8, 0x7F, 0x00,
0xCD, 0x10, 0x31, 0xDB, 0x31, 0xC9, 0xBA, 0x4F, 0x18, 0xB8, 0x00, 0x06,
0xCD, 0x10, 0x31, 0xD2, 0xB4, 0x02, 0xCD, 0x10, 0xB4, 0x41, 0xBB, 0xAA,
0x55, 0xCD, 0x13, 0x72, 0x27, 0x81, 0xFB, 0x55, 0xAA, 0x75, 0x21, 0xF7,
0x89, 0x07, 0xC1, 0xE0, 0x06, 0x8E, 0xC0, 0xB8, 0x03, 0x00, 0xCD, 0x10,
0xB4, 0x02, 0xCD, 0x10, 0xB4, 0x41, 0xBB, 0xAA, 0x55, 0x31, 0xC9, 0x31,
0xD2, 0xCD, 0x13, 0x72, 0x27, 0x81, 0xFB, 0x55, 0xAA, 0x75, 0x21, 0xF7,
0xC1, 0x01, 0x00, 0x74, 0x1B, 0x66, 0x31, 0xC0, 0x66, 0x50, 0x6A, 0x22,
0x06, 0x66, 0x50, 0x6A, 0x08, 0x6A, 0x10, 0x89, 0xE6, 0xB4, 0x42, 0xCD,
0x13, 0x9F, 0x83, 0xC4, 0x10, 0x9E, 0xEB, 0x0D, 0xB8, 0x08, 0x02, 0xB9,
0x23, 0x00, 0xBA, 0x80, 0x00, 0x31, 0xDB, 0xCD, 0x13, 0xBB, 0x07, 0x00,
0x72, 0x0B, 0x31, 0xF6, 0x8C, 0xC0, 0x8E, 0xD8, 0xE8, 0x3F, 0x00, 0xEB,
0x06, 0xBE, 0x17, 0x7D, 0xE8, 0x37, 0x00, 0x31, 0xC0, 0x8E, 0xD8, 0xBE,
0x63, 0x7D, 0xE8, 0x2D, 0x00, 0xE8, 0x1D, 0x00, 0xB4, 0x01, 0xCD, 0x16,
0x06, 0xBE, 0x0B, 0x7D, 0xE8, 0x37, 0x00, 0x31, 0xC0, 0x8E, 0xD8, 0xBE,
0x57, 0x7D, 0xE8, 0x2D, 0x00, 0xE8, 0x1D, 0x00, 0xB4, 0x01, 0xCD, 0x16,
0x75, 0x08, 0xB4, 0x02, 0xCD, 0x16, 0x24, 0x04, 0x74, 0xF2, 0x31, 0xC0,
0x8E, 0xD8, 0xB8, 0x34, 0x12, 0xA3, 0x73, 0x04, 0xEA, 0x00, 0x00, 0xFF,
0xFF, 0xB4, 0x01, 0xCD, 0x16, 0x74, 0x06, 0xB4, 0x00, 0xCD, 0x16, 0xE2,
@ -42,4 +41,5 @@ unsigned char mbr_msg_rufus_0x0[] = {
0x64, 0x69, 0x61, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x70, 0x72, 0x65, 0x73,
0x73, 0x20, 0x61, 0x6E, 0x79, 0x20, 0x6B, 0x65, 0x79, 0x20, 0x74, 0x6F,
0x20, 0x72, 0x65, 0x62, 0x6F, 0x6F, 0x74, 0x5C, 0x30, 0x37, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.19.1911"
CAPTION "Rufus 3.19.1912"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,19,1911,0
PRODUCTVERSION 3,19,1911,0
FILEVERSION 3,19,1912,0
PRODUCTVERSION 3,19,1912,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.19.1911"
VALUE "FileVersion", "3.19.1912"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.19.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.19.1911"
VALUE "ProductVersion", "3.19.1912"
END
END
BLOCK "VarFileInfo"