User:Johnburger/Demo/Pad/ISO/ISO

From OSDev Wiki
Jump to navigation Jump to search

Where can this be used?

This module can be %included into any other binary project that has two properties:

  1. It defines a boot sector in the first 512 bytes:
    1. The entry is at 0000h;
    2. Location 1FEh is 55h;
    3. Location 1FFh is AAh.
  2. It is no more than 32 kiB in size.

What do I need to do?

To successfully assemble, you will need to define the following symbols:

  • ISO.Start.Size
    This is the total number of bytes that this module will be appending onto. As noted above, this needs to be less than 32 kiB.
  • Version.Program
    A short, one-word name for the program;
  • Version.Author
    The author's name - also used as ISO.Primary.Preparer;
  • Version.Name
    A longer name for the program;
  • Version.Copyright
    A short copyright string;
  • Version.String
    A short string representing the Program's version number.

Note that to be truly ISO 9660 compliant, Version.Program should be ALLCAPITALS with no spaces, and the other strings should not contain lower case. Over time these restrictions have been reduced, and just about any characters are acceptable now.

If you want, you can go into Demo/Pad/ISO/Primary and change their usage there - or perhaps change ISO.Primary.Application.

You would also probably want to modify ISO.Timezone in this file.

Example from Demo/Demo

%define         Version.Program   "Demonstrator"
%define         Version.Author    "John Burger"
%define         Version.Name      Version.Author, "'s 80386 ", Version.Program
%define         Version.Copyright "(c)2014"

%define         Version.Major   1
%define         Version.Minor   0
%define         Version.Build   1000

%defstr         Version.String  %[Version.Major].%[Version.Minor].%[Version.Build]

Demo/Pad/ISO/ISO.inc

;
; Pad/ISO/ISO.inc
;

; This file performs the necessary binary padding to generate a .iso file.
;
; To make an ISO bootable, there needs to be some sectors in defined locations:
; Primary Volume; Boot Volume; Terminator Volume; Boot Catalog; Little-endian
; Path Table; Big-endian Path Table, and finally the Root directory.
; They've been included below in the correct order.
;
; Note that the Boot Catalog can advise the BIOS that it wants to emulate a
; HardDisk, a Floppy, or nothing: quite frankly, this image doesn't care.
;
; Note that according to the original standard, certain strings are VERY
; constrained. These constraints have been relaxed over the years: I'm taking
; advantage. To become more compliant, you will need to restrict your strings.
;
; The biggest limitation to the technique used here is that it will only work if
; the previous image that this module is padding onto is no more than 32 kiB in
; size. This value is defined in ISO.Start.Size

                SEGMENT         ISO

ISO.Timezone    EQU                     40      ; GMT+10:00 (AEST)

%include        "Pad/ISO/Defn.inc"

%assign         ISO.Sectors     16

ISO.Padding     EQU             ISO.Sectors*ISO.Sector.Size - ISO.Start.Size

TIMES           ISO.Padding     DB 00h

%include        "Pad/ISO/Primary.inc"

%include        "Pad/ISO/Boot.inc"

%include        "Pad/ISO/Terminator.inc"

%include        "Pad/ISO/Catalog.inc"

%define         ISO.Endian      Little
%include        "Pad/ISO/PathTable.inc"
%undef          ISO.Endian

%define         ISO.Endian      Big
%include        "Pad/ISO/PathTable.inc"
%undef          ISO.Endian

%include        "Pad/ISO/RootDir.inc"

ISO.Sector.Last      EQU        ISO.Sectors

ISO.Size        EQU             $ - $$