English Amiga Board


Go Back   English Amiga Board > News

 
 
Thread Tools
Old 14 November 2008, 13:54   #41
TCD
HOL/FTP busy bee
 
TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,518
Quote:
Originally Posted by jasonver2.0 View Post
hmph
Don't worry jason, yours is still different (and has a nice GUI ). Does your app also check if the disk checksum is correct?
TCD is offline  
Old 15 November 2008, 15:10   #42
jasonver2.0
ABR Creator
 
Join Date: Mar 2006
Location: Australia
Age: 44
Posts: 178
I cant decypher the checksum routine shown in the adflib documentation.
- I understand that byte 04 - 08 is a 'long', but i dont know how to correctly read and display them eg. byte values 255 37 45 82, how are they correctly translated? I have no reference to check if im right or wrong

checksum+=long(buf+i*4) - i dont know whats happening here

I cant check whether a checksum is correct without the correct checksum to check it against
jasonver2.0 is offline  
Old 15 November 2008, 15:49   #43
bLAZER
Awesome to the max
 
bLAZER's Avatar
 
Join Date: Mar 2007
Location: Gothenburg / Sweden
Age: 47
Posts: 1,006
Don't know how the code looks, but if you have a long on 4 bytes you calculate the value either with
255^1*255+*255^2*37+255^3*45+255^4*82
or
255^4*255+*255^3*37+255^2*45+255^1*82
bLAZER is offline  
Old 15 November 2008, 18:14   #44
mr_0rga5m
Tik Gora :D
 
mr_0rga5m's Avatar
 
Join Date: Oct 2001
Location: Round yo momma's
Posts: 1,273
Quote:
Originally Posted by jasonver2.0 View Post
checksum+=long(buf+i*4) - i dont know whats happening here
Say 'i' contains 3 .. then you would get the value from location of 'buf' + 12 (cast to long) and add it to 'checksum' (also defined as long).

Code:
buf :       444F5300 'D' 'O' 'S' 
            00000000  *checksum*
            00000370
            43FA003E
            70254EAE
            FDD84A80

so checksum would be checksum plus 43FA003E.
mr_0rga5m is offline  
Old 15 November 2008, 19:54   #45
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Quote:
Originally Posted by jasonver2.0 View Post
I cant decypher the checksum routine shown in the adflib documentation.
And you think you are stupid? NO!
I really do think that Laurent Clevy sometimes only explains for die-hard coders in tech drivel, but misses to explain important parts.

If his explanations were perfect, I would not have felt the need to ask on here about the algorithm.
andreas is offline  
Old 16 November 2008, 07:41   #46
OddbOd
Registered User
 
Join Date: Jul 2005
Location: Australia
Age: 46
Posts: 666
Quote:
Originally Posted by bLAZER View Post
Don't know how the code looks, but if you have a long on 4 bytes you calculate the value either with
255^1*255+*255^2*37+255^3*45+255^4*82
or
255^4*255+*255^3*37+255^2*45+255^1*82
Is this some sort of crazy Euro-math?

The real way to do it in decimal is 16^6*255+16^4*37+16^2*45+16^0*82 which I think is expressed in VB notation as &HFF252D52. At a guess I would say you are currently holding the bootblock in a byte array and trying to convert to an array of ULongs so you can proceed with checksum calculation.

VB.Net confuses the hell out of me with it's mess of datatype aliases and .Net intrinsics, I can only wish the best of luck with getting this to work.
Quote:
Originally Posted by andreas View Post
I really do think that Laurent Clevy sometimes only explains for die-hard coders in tech drivel, but misses to explain important parts.
You mean like how the bitmap flag is a supposedly a ULONG but with a note next to it that says -1 means VALID
OddbOd is offline  
Old 16 November 2008, 12:24   #47
Testaware
 
Posts: n/a
Amiga ADF BootBlock CheckSum

Quote:
Originally Posted by jasonver2.0 View Post
- I dont know how to calculate checksum in vb 2005 - if you know how to then please tell me
(ADFLib sources and andreas efforts in C doesnt help - i dont know C that well)
I like this tool very much and it's helpful as well

I'd read the problems to calculate a correct checksum for a BootBlock,
I can't give you a VB example coz I've never coded in VB but perhaps this
code will help you? It's coded in Amiga Assembler and converted to PureBasic:

Code:
;*******************************************************
;* Amiga ASM source to calculate checksum of BootBlock *
;*******************************************************
;* Calculate checksum of BootBlock
;* In:  A0 => Ptr to BootBlock
;* Out: D0 => CheckSum
;
;CalcBBCkSum
;      clr.l    4(a0)      ;clear old checksum
;      moveq    #0,d0      ;clear new checkSum
;      move.w   #255,d1    ;255 x DWORD
;1$    add.l    (a0)+,d0   ;add DWORD
;      bcc.s    2$         ;Caryflag?
;      addq.l   #1,d0      ;correct checksum
;2$    dbf      d1,1$      ;loop until D0 = FALSE
;      not.l    d0         ;negate checksum
;      rts


;*******************************************************
;* PureBasic source to calculate checksum of BootBlock *
;*******************************************************

;Macro to correct handling of DWORD 
Macro AmigaLong(LONG)
    ((LONG>>24)&$FF)|((LONG>>8)&$FF00)|((LONG<<8)&$FF0000)|((LONG<<24)&$FF000000)
EndMacro

;Name of ADF discimage
adf.s = "C:\Amiga\ASM\DevPac3.adf"

;Open ADF for read
If  ReadFile(0, adf)

    ;Allocate memory for BootBlock (=1024 bytes)
    *bb_Mem = AllocateMemory(1024)
    ReadData(0, *bb_Mem, 1024)
    CloseFile(0)

    ;Get old checksum for test only
    ;LONG  = PeekL(*bb_Mem + 4)
    ;LONG  = AmigaLong(LONG)
    ;Debug "Old Checksum: " + Hex(LONG)

    ;Clear old checksum (must!) 
    PokeL(*bb_Mem + 4, 0)

    ;Calculate new checksum (see ASM 1$ to 2$)
    For i = 0 To 255
        LONG  = PeekL(*bb_Mem + i * 4)
        bb_Sum+ AmigaLong(LONG)
        If  bb_Sum < 0
            bb_Sum + 1
        EndIf
    Next
    bb_Sum = AmigaLong(bb_Sum)
    bb_Sum = bb_Sum!-1
    bb_Sum = AmigaLong(bb_Sum)

    ;New calculated checksum in bb_Sum
    Debug  "New Checksum: " + Hex(bb_Sum)

EndIf
 
Old 16 November 2008, 14:02   #48
mr_0rga5m
Tik Gora :D
 
mr_0rga5m's Avatar
 
Join Date: Oct 2001
Location: Round yo momma's
Posts: 1,273
Quote:
Originally Posted by OddbOd View Post
At a guess I would say you are currently holding the bootblock in a byte array and trying to convert to an array of ULongs so you can proceed with checksum calculation.
(u)long is 64bit .. he would be better with (u)int.

Here is my go...

Code:
C# .net:

            uint checksum = 0;
            uint precsum = 0;

            for (int i = 0; i < 0x100; i++)   // 0x100 = 1024 byte bootblock / 4
            {
                precsum = checksum;
                if ((checksum += (uint)(((byteArray[i * 4]) << 24) | ((byteArray[(i * 4) + 1]) << 16) | ((byteArray[(i * 4) + 2]) << 8) | byteArray[(i * 4) + 3])) < precsum)
                    ++checksum;
            }
            checksum = ~checksum;

Last edited by mr_0rga5m; 16 November 2008 at 14:20.
mr_0rga5m is offline  
Old 19 November 2008, 13:25   #49
jasonver2.0
ABR Creator
 
Join Date: Mar 2006
Location: Australia
Age: 44
Posts: 178
New version of my program - 1st post

Feedback welcome - If you dont like something tell me and ill change it

Last edited by jasonver2.0; 20 November 2008 at 03:03.
jasonver2.0 is offline  
Old 09 December 2008, 22:49   #50
Big-Byte
Long time member
 
Big-Byte's Avatar
 
Join Date: Jul 2001
Location: UK
Posts: 754
Ive dug up my old code from few years back when I was writing stuff like this.
Source code is in Delphi 6 so you may not be able to compile it.

However, the code is quite well commented and may interest you

All usefull code is in *.pas files. Read with notepad or similar.
Attached Files
File Type: zip Amiga ADF Utilities.zip (868.5 KB, 319 views)
Big-Byte is offline  
Old 09 December 2008, 22:53   #51
DamienD
Banned
 
DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
Your program came up recently in discussions Big-Byte: TOSEC dat for files to delete

Nice work
DamienD is offline  
Old 09 December 2008, 23:49   #52
exoticaga
Registered User
 
Join Date: Aug 2007
Location: UK
Posts: 446
Quote:
Originally Posted by andreas View Post
LOL. I'm shortly before the release candidate of MY tool in ANSI-C (which does not require NET, but would probably run perfectly on Windows 95! ) and this tool really seems very similar to mine!

Yours truly should've been a LOT faster
Congrats on not needing .NET

Windows '95 whats that!! Available for use with xp would be of more use.
exoticaga is offline  
Old 10 December 2008, 03:14   #53
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
ehm, have you checked out my tool at all? This would be that way along, please *points finger*
This is jason's tool ... someone must have illegally given the wooden signpost a spin then

Quote:
Windows '95 whats that!!
An OS that people STILL use to this day to give their old machines some employment. Positive: less junk on the electronic waste dumps just "because they can".

Last edited by andreas; 10 December 2008 at 06:02.
andreas is offline  
Old 10 December 2008, 03:30   #54
jasonver2.0
ABR Creator
 
Join Date: Mar 2006
Location: Australia
Age: 44
Posts: 178
@andreas - hehe

Your program checks disk integrity and mine is all about the bootblocks - if we stay in our own respective camps we'll all be hunky dory

@bigbyte - thank you, ill have a look

btw - new version coming soon

Last edited by jasonver2.0; 10 December 2008 at 03:43.
jasonver2.0 is offline  
Old 10 December 2008, 16:10   #55
Big-Byte
Long time member
 
Big-Byte's Avatar
 
Join Date: Jul 2001
Location: UK
Posts: 754
blimey! reading that old thread really brought back some memories.. I cannot believe I wrote those utils that long ago!

Unfortunately I lost 99% of all my Amiga related stuff due to a hard drive crash a few years ago.. and kind of gave up and just lurked around this board like an old ghost never really posting much.

Last thing I remember doing was that I was able to extract files from the adf image and save them in windows then add files back into the adf but can never remember if it worked correctly (the disk still appeared valid in my program but I never tried using any of the disks I modified with Winuae)
Big-Byte is offline  
Old 10 December 2008, 16:17   #56
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Big-Byte I found your altfinder on my HD
BippyM is offline  
Old 10 December 2008, 22:29   #57
exoticaga
Registered User
 
Join Date: Aug 2007
Location: UK
Posts: 446
NP i had a mind fluck for a moment i was thinking of win3.1 as win'95 as you can see if was win3.1 for me asking the question why.!

I'll have a look at the url you linked Andreas. It's very easy to miss new progs on this site.
exoticaga is offline  
Old 10 December 2008, 22:37   #58
Big-Byte
Long time member
 
Big-Byte's Avatar
 
Join Date: Jul 2001
Location: UK
Posts: 754
Quote:
Originally Posted by bippym View Post
Big-Byte I found your altfinder on my HD
Really glad you still find it useful. Amazingly Ive now got to do some changes to an old Delphi app at work (last time app was worked on was in 2000 !)

What Im really after is my 'Singing Skulls' demo.. If anyone who has it could either upload it to the zone or better still make an avi of it and stick it on youtube that would be great
Big-Byte is offline  
Old 09 January 2009, 02:40   #59
jasonver2.0
ABR Creator
 
Join Date: Mar 2006
Location: Australia
Age: 44
Posts: 178
Program updated again...see 1st post

Maybe I should create a new thread, I dont want people to think it doesnt have a HEX View!

May have bugs still intact, sorry in advance
jasonver2.0 is offline  
Old 01 May 2010, 21:05   #60
trackah123
Amiga User
 
trackah123's Avatar
 
Join Date: Dec 2006
Location: Delft / The Netherlands
Posts: 327
Hi.

Nice work, since i'm not a programmer can i add multiple files (append) in NDOS mode with this?

In the past for example you had "Multiboot v1.0 by SPY from Sensor" which was able to do this.
trackah123 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
Amiga Bootblock Reader v2 jasonver2.0 News 40 29 April 2021 20:57
SCSI Card reader amiga?? jimbobrocks92 support.Hardware 15 26 August 2018 15:21
Replace Amiga's Floppy Drive with USB Reader? xaind support.Hardware 6 29 April 2010 18:29
Super Low Cost Amiga CF Card Reader AmigaMAD75 support.Hardware 5 26 January 2010 18:41
Amiga pdf reader RickyD-II request.Other 6 16 May 2007 19:14

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 09:34.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.27627 seconds with 16 queries