Skip to content

ADFTools

Paul Raingeard edited this page Dec 17, 2021 · 8 revisions

Create an ADF disk file

The task amigaassembly: create ADF is used to create a bootable ADF file from a directory where your produced binaries are stored. To learn more on tasks in Visual Studio Code please read the documentation https://code.visualstudio.com/Docs/editor/tasks.

Create ADF file task

Task definitions

File : .vscode/tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "amigaassembly",
			"adfgenerator": {
				"ADFToolsParentDir": "${config:amiga-assembly.binDir}",
				"sourceRootDir": "uae/dh0",
				"outputADFFile": "./build/disk.adf",
				"includes": "**/*",
				"excludes": "**/.*",
				"adfCreateOptions": [
					"--label=MYDISK"
				]
			},
			"problemMatcher": [],
			"label": "amigaassembly: create ADF"
		}
	]
}
option description
ADFToolsParentDir Parent dir of the ADFTools binaries (adfcreate, adfinst, adfcopy, etc.)
sourceRootDir Root dir of the files and directories to copy on the ADF disk image. If it is set to "", no files will be added
outputADFFile Name and path to the output ADF file
includes Filter for the filenames to include in the copy
excludes Filter for the filenames to exclude from the copy
adfCreateOptions
Options for the adf creation

-f, --file-system=INT file-system for the disk
0 - OFS (default)
1 - FFS
2 - I-OFS
3 - I-FFS
4 - DC-OFS
5 - DC-FFS


-H --hd format with high density
-l, --label=NAME use NAME as disk label
bootBlockSourceFile Will build this assembly source file and add it as a boot block

Task definition to create an empty ADF file with a boot block

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "amigaassembly",
			"adfgenerator": {
				"ADFToolsParentDir": "${config:amiga-assembly.binDir}",
				"sourceRootDir": "uae/dh0",
				"outputADFFile": "./build/disk.adf",
				"includes": "**/*",
				"excludes": "**/.*",
				"adfCreateOptions": [
					"--label=MYDISK"
				],
				"bootBlockSourceFile": "bblock.s"
			},
			"problemMatcher": [],
			"label": "bootable ADF"
		}
	]
}

Example of boot code

; Boot definition
boot:
;OxOO
  dc.l      "DOS"<<8         ; DiskType
;OxO4
  dc.l      0                ; Checksum will be added by the build 
;OxO8
  dc.l      880              ; Rootblock

;OxOc
  lea       dos(pc),a1       ;name
  jsr       -96(a6)          ;FindResident()
  tst.l     d0
  beq.b     error2           ;not found
  move.l    d0,a0
  move.l    22(a0),a0        ;DosInit sub
  moveq     #0,d0
  rts
error2:
  moveq     #-1,d0
  rts

dos:  
  dc.b      "dos.library"

Generated files

You will find in the build dir :

  • bblock.o: the bootblock code binary file
  • bblock.dd: the bootblock complete 1kb binary file
  • disk.adf: the generated adf file

The bootblock is built with the vasm options :

  • "-m68000"
  • "-Fbin"

Boot block structure

From http://lclevy.free.fr/adflib/adf_info.html

offset size number name meaning
0/0x00 char 4 DiskType 'D''O''S' + flags
4/0x04 ulong 1 Chksum special block checksum
8/0x08 ulong 1 Rootblock Value is 880 for DD and HD
(yes, the 880 value is strange for HD)
12/0x0c char * Bootblock code The size for a floppy disk is 1012,
for a harddisk it is
(DosEnvVec->Bootblocks * BSIZE) - 12

Disk type flag values (3 least significant bits) :

set clr
0 FFS OFS
1 INTL ONLY NO_INTL ONLY
2 DIRC & INTL NO_DIRC & INTL

The DiskType flag informs of the disk format :

  • OFS = Old/Original File System, the first one. (AmigaDOS 1.2)
  • FFS = Fast File System (AmigaDOS 2.04)
  • INTL = International characters Mode (see section 5.4).
  • DIRC = stands for Directory Cache Mode. This mode speeds up directory listing, but uses more disk space (see section 4.7).

Chaining the build

You can chain the run < ADF creation < build process.

In the .vscode/launch.json configuration add :

	{
		"type": "winuae",
		...
		"preLaunchTask": "amigaassembly: create ADF"
	}

In .vscode/tasks.json :

	{
		"type": "amigaassembly",
		...
		"label": "amigaassembly: create ADF",
		"dependsOn": [
			"amigaassembly: build"
		]
	}