rouaix@inria.UUCP (03/13/87)
I would like to know what the amiga does when booting on a system disk. The code lies in blocks 0 and 1 of bootable disks. Has anyone a commented disassembly listing ? It would be great. Thanks .
billk@pnet01.CTS.COM (Bill Kelly) (03/16/87)
Wait. Let me take of my polarized glasses... There. Now the screen flickers but I can see the papers on my desk! fouaix@inria.UUCP (Francois Rouaix) writes: >I would like to know what the amiga does when booting on a system disk. Ouch -- I'm gonna put my glasses back on. Let's see: Here's what the Amiga does when it boots: It reads in the first two sectors from the disk. It looks at the first longword. To boot, that has to equal 'DOS',0. Then it does a checksum on the bootblock (if you are going to write your own routine to make the checksum check, (I did because I wrote my own bootblock and had to make the checksum correct) be sure to use ADDX.L rather than just ADD.L so that you get the carry included.) which must add up to zero. If the checksum on the bootblock is ok, it jumps to byte-location twelve in the bootblock with an opened trackdisk.device IO request in register A1. The bootcode can trash any registers it wants to but do not close the trackdisk.device it has opened for you. Just use it if you want to. When your bootcode is through it has to do an RTS. When you do the RTS you have to set D0 and/or A0. If you set D0 it ignores A0 and just puts up a GURU. If you clear D0, then it expects to be able to jump to the address it finds in A0. I don't have a commented disassembley of the normal DOS bootcode, but it is EXTREMELY simple. It gets a pointer to the Exec library from location four. Then it calls FindResident(dos.library) (It calls the Exec routine caled FindResident, and "dos.library" is the name it supplies) I believe it then does a TST.L with the result of the FindResident. If the result is zero it puts #$FFFFFFFF into D0. Otherwise, it clears D0 and puts the result of FindResident into A0 so that when it does an RTS the bootcode loader will do a JSR (a0) instead of calling the Exec Alert. (alias GURU) NOTE: This was all typed-in from memory, but it was only a couple of weeks ago that I was messing around with my own bootcode, so I believe it's all fairly accurate information. 'Hope it helped, Bill Kelly {akgua, hplabs!hp-sdd, sdcsvax}!crash!pnet01!billk
hamilton@uxc.cso.uiuc.edu (03/16/87)
/* Written 10:34 am Mar 13, 1987 by rouaix@inria.UUCP in uxc.cso.uiuc.edu:comp.sys.amiga */ /* ---------- "Boot code. Help Needed" ---------- */ I would like to know what the amiga does when booting on a system disk. The code lies in blocks 0 and 1 of bootable disks. Has anyone a commented disassembly listing ? It would be great. Thanks . /* End of text from uxc.cso.uiuc.edu:comp.sys.amiga */ not much there. slightly paraphrased, it's: lea DosName(pc),a1 jsr LVOFindResident(a6) tst.l d0 beq fail fail, return nonzero move.l d0,a0 move.l 22(a0),a0 a0 = a0->rt_Init moveq #0,d0 succeed, return 0 return rts fail moveq #$FF,d0 bra return DosName dc.b "dos.library" wayne hamilton U of Il and US Army Corps of Engineers CERL UUCP: ihnp4!uiucuxc!hamilton ARPA: hamilton%uiucuxc@a.cs.uiuc.edu USMail: Box 476, Urbana, IL 61801 CSNET: hamilton%uiucuxc@uiuc.csnet Phone: (217)333-8703 CIS: [73047,544] PLink: w hamilton