English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 14 May 2010, 08:09   #1
Yesideez
(2b)||!(2b)
Yesideez's Avatar
 
Join Date: Mar 2007
Location: Devon, UK
Age: 45
Posts: 216
Coding a bootblock

Last night I disassembled the bootblock from one of my prods and kinda got the coding bug back.

I've forgotten so much!

Just modified an XCopy bootblock (more text, slightly larger copperlist) and now it's ready to test on a bootblock but I'm having a bit of a problem.

I've assembled to disk with all debug info off.

Using TrackDOS to write the bootblock to disk (it calculates the checksum) skipping the first 32 bytes it seems to write the bootblock OK but it doesn't boot.

I can't remember if I have to assemble as position dependent or absolute?

Tried hunting in Google for a decent tutorial to revive the grey matter but I can't find anything!
Yesideez is offline  
Old 14 May 2010, 08:37   #2
hitchhikr
Registered User

 
Join Date: Jun 2008
Location: somewhere
Posts: 390
The ROM just does an AllocMem in public memory, loads, checks and runs the bootblock directly if it's valid, so it have to be relocatable or you'll have to copy it manually at a suitable address (probably in chipmem if you've got a copperlist etc), a4 contains the address of the first byte of the code, a1 the trackdisk device and a6 contains execbase.
hitchhikr is offline  
Old 14 May 2010, 09:43   #3
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Hey there Yesideez

You should definitely get back to coding.

There's lots of stuff about a bootblocks in relation to a bootblock trackloader I made here:

http://eab.abime.net/showthread.php?t=45654

there's some source codes in that thread I think...

I use AsmOne to write code to bootblocks as required.

Hope that helps.
pmc is offline  
Old 14 May 2010, 09:51   #4
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,228
Quote:
Originally Posted by Yesideez View Post
Using TrackDOS to write the bootblock to disk (it calculates the checksum) skipping the first 32 bytes it seems to write the bootblock OK but it doesn't boot.
If you use ASM-One you can easily write the bootblock code to disk without any other tools (why did you skip the first 32 bytes btw?).
Just use ASM-One's "WS" (W.rite S.ector) command to write the bootblock followed by CC (C.alculate C.hecksum) which will calculate the bootblock checksum (which is required as otherwise the disk won't boot).

Example:

BOOT:
dc.l "DOS"<<8
dc.l 0
dc.l 0

START:
moveq #0,d0
...

To write this code to disk with ASM-One you'd use:
WS

RAM PTR>BOOT
DISK PTR>0
LENGTH>2

ASM-One will now write the bootblock and then you'd just use CC to calculate the checksum and the disk will boot.


Quote:
Originally Posted by Yesideez View Post
I can't remember if I have to assemble as position dependent or absolute?
Your code should be position independent as that's shorter.
StingRay is offline  
Old 14 May 2010, 09:57   #5
Yesideez
(2b)||!(2b)
Yesideez's Avatar
 
Join Date: Mar 2007
Location: Devon, UK
Age: 45
Posts: 216
Thanks for the replies.

I've found a bootblock writing tool I coded years and years ago so I've been using that.

The reason for skipping the first 32 bytes is...
Code:
dc.b 'dos',0
dc.l 0,$370
...that doesn't immediately start at the beginning when assembled to disk as there's an EXE header which needs to be removed.

I'm using DevPac to write the code and my little tool bwrite to write to disk calculating the checksum as it goes.

It assembles fine. If I comment out the first three longwords and add "move.l 4.w,a6" at the start and run my copperlist views perfectly fine but it doesn't work when applied as a bootblock.

All I'm using is a ReSourced X-Copy bootblock which has been modified very slightly.

Starting to pull hair out...
Yesideez is offline  
Old 14 May 2010, 10:03   #6
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,228
Quote:
Originally Posted by Yesideez View Post
The reason for skipping the first 32 bytes is...
Code:
dc.b 'dos',0
dc.l 0,$370
...that doesn't immediately start at the beginning when assembled to disk as there's an EXE header which needs to be removed.
I don't use Devpac but check if it can write a binary then you won't have to skip/remove the exe header.

Also:

Code:
dc.b 'dos',0
dc.l 0,$370
is wrong! It needs to be 'DOS' (upper case).

Quote:
Originally Posted by Yesideez View Post
It assembles fine. If I comment out the first three longwords and add "move.l 4.w,a6" at the start and run my copperlist views perfectly fine but it doesn't work when applied as a bootblock.
What does "doesn't work" mean here? Disk doesn't even boot or just no display/black screen?
StingRay is offline  
Old 14 May 2010, 10:36   #7
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
You're right Sting - Devpac won't write binary... Again Yesideez, AsmOne is your friend for that.
pmc is offline  
Old 14 May 2010, 10:40   #8
BippyM
Registered User

BippyM's Avatar
 
Join Date: Nov 2001
Location: Nottingham, UK
Age: 43
Posts: 8,765
devpac should be able to output binary.

I'm sure it's in the options!
BippyM is offline  
Old 14 May 2010, 11:17   #9
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
@ bippym - if you find it, let me know cos I never have but would be happy if I could.
pmc is offline  
Old 14 May 2010, 12:00   #10
BippyM
Registered User

BippyM's Avatar
 
Join Date: Nov 2001
Location: Nottingham, UK
Age: 43
Posts: 8,765
i'll look when my pc is back up and running. It's dead atm and i am stuck on a laptop.. Oh i'll reply to your email soon too bloody work has been hectic
BippyM is offline  
Old 14 May 2010, 13:02   #11
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Sorry to hear about your PC...

Quote:
Originally Posted by bippym
Oh i'll reply to your email soon too bloody work has been hectic
No worries man, replies never expected - people have lives and other stuff to do.
pmc is offline  
Old 14 May 2010, 17:46   #12
musashi5150
move.w #$4489,$dff07e
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 37
Posts: 2,297
Quote:
Originally Posted by pmc View Post
@ bippym - if you find it, let me know cos I never have but would be happy if I could.
Neither have I... don't hold your breath The number of times I stripped off the first 32 bytes in a hex editor!
musashi5150 is offline  
Old 14 May 2010, 17:55   #13
Yesideez
(2b)||!(2b)
Yesideez's Avatar
 
Join Date: Mar 2007
Location: Devon, UK
Age: 45
Posts: 216
Topic matter seems to have changed somewhat.

No need for me to relocate to another assembler, DevPac does me just fine. Doesn't matter if it doesn't create binary files because I have a little tool I wrote a long time ago to write the files to disk for me that takes care of everything. I assemble to disk, write the file and job done.

I've got to the bottom of the problem - slightly mistake on my part.

I set the bootpri of the hard drive too high as it was set to 5 instead of 0 so the floppy driver never got a look in.

Turns out my bootblock works perfectly fine!

@StingRay: The 'dos' thing was me typing when tired - I always use 'DOS'
Yesideez is offline  
Old 14 May 2010, 18:06   #14
Yesideez
(2b)||!(2b)
Yesideez's Avatar
 
Join Date: Mar 2007
Location: Devon, UK
Age: 45
Posts: 216
Quote:
Originally Posted by musashi5150 View Post
Neither have I... don't hold your breath The number of times I stripped off the first 32 bytes in a hex editor!
Have you never used TrackDOS? When writing exe files to trackdisk you can specify an offset therefore cutting the 32 byte header off.

I would attach it here or upload to The Zone but I can't figure out how to copy it to PC without it corrupting but you can download it from Aminet.

http://aminet.net/search?query=ztls

In that download you'll also find NewZAP - both tools were "fixed" by me to look right on Workbench 2+. I believe my BWrite tool is there (CLI & GUI versions as well as a BootKit for managing bootblocks)
Yesideez is offline  
Old 15 May 2010, 10:27   #15
musashi5150
move.w #$4489,$dff07e
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 37
Posts: 2,297
Thanks man I'm something of a dinosaur and always do everything long hand - including the longword at the end of the exe Devpac does me just fine too
musashi5150 is offline  
Old 23 May 2010, 00:13   #16
Ray Norrish
Registered User
Ray Norrish's Avatar
 
Join Date: May 2005
Location: Cheshire, UK
Age: 51
Posts: 300
Send a message via ICQ to Ray Norrish
I used to just load the exe (no matter what the assembler was) into Rossi Mon (either use relative code or fix it) and Rossi Mon can calc the checksum and write out the memory to disk blocks. Easy as that.
Ray Norrish is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
bootblock mai support.Apps 7 25 September 2012 11:28
Anyone like to help understanding this bootblock ??? Joe Maroni Coders. Tutorials 2 15 February 2007 17:33
XCopy2 No virus Bootblock. redblade Coders. General 3 08 May 2006 02:09
Bootblock checksum -Rob- Coders. General 5 17 April 2006 15:49
ADF Bootblock installer jjsmith Coders. General 6 30 November 2005 01:36

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:23.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.10269 seconds with 12 queries