* jmp is x86...

* make the checksumer build under linux and fix it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23484 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol
2008-01-13 11:57:11 +00:00
parent 551d3012d8
commit 2504405008
2 changed files with 13 additions and 11 deletions
@@ -1,27 +1,29 @@
#include <stdio.h> #include <stdio.h>
#include <OS.h> #include <stdint.h>
#include <ByteOrder.h> #include <fcntl.h>
uint8_t sector[512];
uint8 sector[512];
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int fd, i; int fd, i;
uint16 sum; uint16_t sum;
uint16 *p = (uint16 *)sector; uint8_t *p = sector;
fd = open(argv[1], O_RDWR); fd = open(argv[1], O_RDWR);
if (fd < 0) { if (fd < 0) {
return 1; return 1;
} }
if (read(fd, sector, 512-2) < 512) { if (read(fd, sector, 512-2) < 512-2) {
perror("read"); perror("read");
return 1; return 1;
} }
for (sum = 0, i = 0; i < (512-2)/2; i++) { for (sum = 0, i = 0; i < (512-2); i++) {
sum += B_LENDIAN_TO_HOST_INT16(p[i]); sum += p[i];
} }
p[(512-2)/2] = B_HOST_TO_BENDIAN_INT16(0x1234 - sum); sum = 0x1234 - sum;
// big endian
p[512-2] = (uint8_t)(sum >> 8);
p[512-1] = (uint8_t)sum;
//lseek(fd, 0LL, SEEK_SET); //lseek(fd, 0LL, SEEK_SET);
write(fd, &sector[512-2], 2); write(fd, &sector[512-2], 2);
return 0; return 0;
+1 -1
View File
@@ -75,7 +75,7 @@ floppy_start:
jsr puts jsr puts
bra spin bra spin
flopy_done: flopy_done:
jmp #ATARI_ZBEOS_BASE+512 bra #ATARI_ZBEOS_BASE+512
/** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx. /** Loads %d2 sectors from floppy disk, starting at head XXX %dh, sector %cx.
* The data is loaded to %a2. * The data is loaded to %a2.