15 December 2014, 18:57 | #1 |
Posts: n/a
|
ADF Utilities on Windows to read/write tracks/bootloader
I have set up my amiga dev environment in order to use VASM to assemble on PC and to output the test executable to a shared directory in winuae.
The demo that I will be working on will be a trackloader and wanted to find out whether or not there are any windows tools to inject data to an ADF file into the relevant track/sector and to write/checksum the bootblock I am aware of amiga tools that allow this (DD was the one I was using previously) and I can put together a quick ADF writer myself, (and I have looked at many other places) but could not find any? Any thing like this released as a windows binary? |
16 December 2014, 10:34 | #2 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Quote:
For example makeimage.c from SolidGold: Code:
/* * Makes a disk image of 901120 (0xdc000) bytes. * Calculates boot block checksum. * * Written by Frank Wille in 2013. * * I, the copyright holder of this work, hereby release it into the * public domain. This applies worldwide. */ #include <stdio.h> #include <string.h> #include <stdint.h> #define DISKSIZE (0xdc000) uint8_t image[DISKSIZE]; static void boot_chksum(uint8_t *p) { uint32_t oldchk,chk=0; int i; memset(p+4,0,4); for (i=0; i<1024; i+=4) { oldchk = chk; chk += ((uint32_t)p[i+0] << 24) | ((uint32_t)p[i+1] << 16) | ((uint32_t)p[i+2] << 8) | p[i+3]; if (chk < oldchk) ++chk; /* carry */ } chk = ~chk; p[4] = (uint8_t)((chk >> 24) & 0xff); p[5] = (uint8_t)((chk >> 16) & 0xff); p[6] = (uint8_t)((chk >> 8) & 0xff); p[7] = (uint8_t)(chk & 0xff); } int main(int argc,char *argv[]) { FILE *f; int rc = 1; size_t len; if (argc == 2) { if (f = fopen(argv[1],"rb")) { len = fread(image,1,DISKSIZE,f); if (len > 0) { if (len < DISKSIZE) memset(image+len,0,DISKSIZE-len); boot_chksum(image); fwrite(image,1,DISKSIZE,stdout); rc = 0; } else fprintf(stderr,"Image read error!\n"); } else fprintf(stderr,"Cannot open '%s'!\n",argv[0]); } else fprintf(stderr,"Usage: %s <image data>\n",argv[0]); return rc; } BTW, I just realized that under Windows you should better open the image file with fwrite(name,"wb") instead of writing to stdout, because of that stupid CR/LF translation. Additionally you can easily define the layout of your disk image in an assembler source: Code:
org 0 ; AmigaDOS boot blocks (1024 bytes) boot: dc.b "DOS",0 dc.l 0 ; checksum will be inserted here dc.l 880 ;--------------------------------------------------------------------------- boot_code: ; a6 = SysBase ; a1 = trackdisk IOStdReq ... rorg 11*512 ; start of track 1 demo1: incbin "demo1.bin" cnop 0,512 ; align to next block demo2: incbin "demo2.bin" ... |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how write back .adf files on floppy from inside windows | se8820726 | support.Apps | 9 | 25 September 2014 06:06 |
ADF Utilities | FlashFF | Amiga scene | 3 | 22 February 2012 04:46 |
read but wont write | Dave_wb | support.Hardware | 0 | 09 December 2006 14:04 |
Read\Write Errors..... | THX1138 | support.Apps | 10 | 13 October 2004 15:24 |
Read/Write error? | one1 | support.Games | 8 | 04 June 2003 23:23 |
|
|