08 November 2018, 09:10 | #1 |
Registered User
Join Date: Nov 2017
Location: france
Posts: 109
|
FileLoader without operatingsystem
Hi !
I try many code to do the job but not one work. Exemple with GoodFile code. Like always, I word under MKIII Of course I have a floopy in DF0 with a filename called 'Call' which contains some data (a little file for information) But like we see in the picture, Don't work. I don't have data on A1 (30000 for me) And After return of the code, D0 is set to FFFFFFFF (D0 is for error message, return, 0=No error, -1=Error) I don't know why, If someone has an idea, I keep it The code : Code:
TrackBuffer = $7b240 ;must be $32c0 Bytes big SekBuffer = $7b000 ;must be 512 bytes ($200) big Sync = $4489 StepWait = $0e00 ;normal $0a00 ;------------------------------------------------- ; LoadFile (Fileloadroutine for df0: (without operatingsystem)) ;Input: ; A0 -> Pointer to Filename ; A1 -> Pointer to Loadadress ; filename length is in d0, and is calculated automatically ; by the routine in START. be sure filename is followed by a null ($00) ;Output: ; Errormessage -> D0 (0 = no error / -1 = error) ; Filelenght (actual) -> D1 ;------------------------------------------------- org $7f044 load $7f044 ; below routine only for testing !!!!!!!!!!!!!!!!!!!!! ; this is the start of the loader ... run: START: move.l a0,-(a7) clr.l d0 START2: cmpi.b #$00,(a0)+ beq ENDLOOP addi.l #$1,d0 bra START2 ENDLOOP: move.l (a7)+,a0 LoadFile: movem.l d2/d3/a0/a1,-(a7) move.w d0,FilenameLength move.l d0,d3 move.l a0,FilenamePtr move.l a1,FileBufferPtr clr.l FileLength lea SekBuffer,a0 move.l #$370,d0 bsr TrackRead move.l FilenamePtr(pc),a0 moveq #0,d0 move.w d3,d1 subq.w #1,d1 lfl0: mulu #13,d3 move.b (a0)+,d0 bsr UpCase add.l d0,d3 and.l #$7ff,d3 dbf d1,lfl0 divu #72,d3 clr.w d3 swap d3 addq.w #6,d3 lsl.w #2,d3 lfl1: lea SekBuffer,a0 move.l (a0,d3.w),d0 tst.l d0 beq loadE bsr TrackRead cmp.l #2,(a0) bne loadE move.w FilenameLength(pc),d1 move.l FilenamePtr(pc),a1 add.w #432,a0 cmp.b (a0)+,d1 bne.s lfl3 subq.w #1,d1 lfl2: move.b (a0)+,d0 bsr UpCase move.b d0,d2 move.b (a1)+,d0 bsr UpCase cmp.b d0,d2 bne.s lfl3 dbf d1,lfl2 bra.s lfl4 lfl3: move.w #496,d3 bra.s lfl1 lfl4: lea SekBuffer,a0 cmp.l #-3,508(a0) bne.s loadE move.l FileBufferPtr(pc),a1 lfl5: move.l 16(a0),d0 beq.s lfl7 bsr TrackRead cmp.l #8,(a0) bne.s loadE move.l 12(a0),d0 add.l d0,FileLength add.w #24,a0 subq.l #1,d0 lfl6: move.b (a0)+,(a1)+ dbf d0,lfl6 lea SekBuffer,a0 bra.s lfl5 lfl7: moveq #0,d0 lfl8: move.b #$ff,$bfd100 move.b #$f5,$bfd100 move.b #$ff,$bfd100 move.l FileLength(pc),d1 movem.l (a7)+,d2/d3/a0/a1 rts loadE: moveq #-1,d0 move.b d0,Trackposition bra.s lfl8 ;--------------------------------------------------------------------- UpCase: cmp.b #'a',d0 blo.s upcl1 cmp.b #'z',d0 bhi.s upcl1 sub.w #$20,d0 upcl1: rts ;----------------------------------- ; TrackRead (zum lesen eines Blocks) ;Eingabe: ; D0 -> Startblocknummer ; A0 -> Zieladresse im Speicher ;Ausgabe: ; Fehlernummer -> D0 ;----------------------------------- TrackRead: movem.l d0-d7/a0-a6,-(a7) lea BlockPointer(pc),a2 lea Trackposition(pc),a1 divu #11,d0 cmp.b (a1),d0 beq trkrl16 lea $dff024,a6 move.w #Sync,$7e-$24(a6) move.w #$7f00,$9e-$24(a6) move.w #$9500,$9e-$24(a6) move.l #$55555555,d2 lea $bfd100,a5 lea $0f01(a5),a4 trkrl1: move.b #$7d,(a5) move.b #$75,(a5) trkrl2: cmp.b #$ff,(a1) bne.s trkrl5 trkrl3: btst #4,(a4) beq.s trkrl4 bsr hto00 bra.s trkrl3 trkrl4: clr.b (a1) trkrl5: move.l d0,d1 bclr #0,d1 bclr #0,(a1) cmp.b (a1),d1 beq.s trkrl7 bcs.s trkrl6 bsr hto80 addq.b #2,(a1) bra.s trkrl5 trkrl6: bsr hto00 subq.b #2,(a1) bra.s trkrl5 trkrl7: btst #0,d0 beq.s trkrl8 addq.b #1,(a1) bclr #2,(a5) trkrl8: moveq #11,d3 resp: btst #5,(a4) bne.s resp move.w #$4000,(a6) move.w #$8210,$96-$24(a6) lea TrackBuffer,a3 move.l a3,$20-$24(a6) clr.l $440(a3) move.w #$1002,$9c-$24(a6) move.w #$9960,(a6) move.w #$9960,(a6) trkrl9: tst.l $440(a3) beq.s trkrl9 trkrl10:cmp.w #Sync,(a3) bne.s trkrl11 addq.l #2,a3 bra.s trkrl10 trkrl11:bsr DecodeLword move.l d5,d4 swap d4 cmp.b (a1),d4 beq.s trkrl12 st (a1) bra trkrl1 trkrl12:lsr.w #8,d5 lsl.w #2,d5 move.w d5,d6 cmp.w #44,d6 bcc.s trkrl12-4 add.w #$28,a3 bsr.s DecodeLword move.l d5,d1 move.l a3,(a2,d6.w) moveq #0,d7 moveq #$7f,d4 trkrl13:move.l (a3),d5 move.l 512(a3),d6 eor.l d5,d7 eor.l d6,d7 and.l d2,d5 and.l d2,d6 lsl.l #1,d5 or.l d5,d6 move.l d6,(a3)+ dbf d4,trkrl13 and.l d2,d7 cmp.l d7,d1 bne.s trkrl12-4 add.w #$0200,a3 trkrl14:btst #1,$1f-$24(a6) beq.s trkrl14 subq.b #1,d3 beq.s trkrl16 trkrl15:cmp.w #Sync,(a3)+ bne.s trkrl15 bra trkrl10 trkrl16:swap d0 lsl.w #2,d0 move.l (a2,d0.w),a2 moveq #$7f,d0 trkrl17:move.l (a2)+,(a0)+ dbf d0,trkrl17 movem.l (a7)+,d0-d7/a0-a6 rts ;--------------------------------------------------------------------- DecodeLword: move.l (a3)+,d4 move.l (a3)+,d5 and.l d2,d4 and.l d2,d5 lsl.l #1,d4 or.l d4,d5 rts ;--------------------------------------------------------------------- hto00: bset #1,(a5) bra.s hbr0 hto80: bclr #1,(a5) hbr0: bclr #0,(a5) bset #0,(a5) move.w #StepWait,d3 hbr1: dbf d3,hbr1 rts ********************************************************************** BlockPointer: blk.l 11,0 Trackposition: dc.b -1,0 FilenamePtr: dc.l 0 FileBufferPtr: dc.l 0 FilenameLength: dc.w 0 FileLength: dc.l 0 Name: dc.w 00 dc.w 00 END: ********************************************************************** Last edited by Giants; 08 November 2018 at 09:16. |
08 November 2018, 10:26 | #2 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
Are you using a disk formatted for FFS by any chance? Briefly looking at the code, I don't think it supports FFS.
|
08 November 2018, 10:40 | #3 |
Registered User
Join Date: Nov 2017
Location: france
Posts: 109
|
Hi !
With 'Create Standard disk' on WinUAE without FFS set, Don't work. With FORMAT mkIII command, don't work. So my Floppy Disk used for this test is not formated in FFS mode. But I'm not stuck to use this code. If I find other code THAT WORK without operatingsystem, no problem. I already test : GoodFiles.s (don't work) AgileFileLoader.s (crash with guru medidation) |
08 November 2018, 12:19 | #4 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
|
|
08 November 2018, 12:50 | #5 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Just one question: when you already have working low-level disk routines without using the OS, why do you have to read files in AmigaDOS filesystem format? You can do you own format, which would be easier to handle.
|
08 November 2018, 16:06 | #6 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
|
Actually it's not so rare.
Many games from the past used the standard file system and then a non-system loader. Much simpler not worry about where the "files" locate tracks/blocks, or to reconstruct fixed tables: you simply copy with your prefered files manager And explore/edit/install to WB with no effort (on a greater machine). Also the need to patch those that worked on KS1.x (or slow machines) that no longer work on the new kickstarts because in fact they used a quasi-compatible mode... You put code like mine and you no longer worry anymore about which machine you are loading, and you can easily avoid activating/deactivating the system when it would have been necessary. Yes, it's not the best, but a solution. You can also have only some academic curiosity about file system inner working |
08 November 2018, 17:10 | #7 |
Registered User
Join Date: Nov 2017
Location: france
Posts: 109
|
Hi !
Phx : Because, the code that you talk is not mine. It's not a 'dev' question, to create a code from scrath but, the idea it's to use code which already exist. Why waste time to try create a new code while it already exists a lot of source of FileLoader. ross : Thks Ross, I will try you'r code Last time : Hummm Set A1 as 'ascii' is problematic under Action Replay, I can't... I try with A0=20000 (which is the adress of already load, ocean_loader.68k in memory) A2=30000 (with Lea like A0) D0=0 (with moveq) I don't look again you'r, I juste try to use directly an adress for A1 Like A1=50000 (with Lea) and in $50000 I try to put in ascii the name of my file but, don't work (normal) Amiga Crash and reboot (no guru mediation) Last edited by Giants; 08 November 2018 at 17:45. |
11 November 2018, 07:15 | #8 |
Registered User
Join Date: Feb 2017
Location: fastmem
Posts: 53
|
|
11 November 2018, 16:41 | #9 |
Registered User
Join Date: Nov 2017
Location: france
Posts: 109
|
You say that all the existing FileLoader on Amiga work with 23% of reliability ...???
Since all these years, they are no source-code of FileLoader Amigados working good on amiga ? I can not believe that. |
11 November 2018, 16:51 | #10 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,417
|
I'm guessing pants's point was that the following code:
Code:
move.w #StepWait,d3 hbr1: dbf d3,hbr1 That kind of waiting will only work on slow CPU's. Never use a CPU busy wait like this to time anything - use methods that wait the same amount of time on any system (such as waiting a certain number of raster lines, or using the CIA timers). |
11 November 2018, 21:05 | #11 |
Registered User
Join Date: Nov 2017
Location: france
Posts: 109
|
It's not my code, no problem
Just find It on the net. Maybe it's just a sync problem, maybe we just need to change that loop (and maybe other) in this code. I have no problem whith that. I you have a little code who uses 'CIA timers', I keep it ! I my side, I going to find how to di a CIA timers. Thks |
11 November 2018, 21:19 | #12 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Seeing that you can't get any loader to work (regardless of the CPU dependent delay loops and other problems the old loaders have), are you trying these loaders with the OS still intact? If so that's the reason for your problems as these loaders need the OS killed.
|
11 November 2018, 21:29 | #13 |
Registered User
Join Date: Nov 2017
Location: france
Posts: 109
|
Nop, I already tested that (with OS killed).
Maybe it's just a timers problem as you say. I thought about that, change the software delay in the original code by something like that : Code:
MOVE.W #StepWait,D3 StepWait: DBF D3,StepWait WaitForMe: BTST #5,BFE001 BNE WaitForMe Last edited by Giants; 11 November 2018 at 21:44. |
11 November 2018, 21:47 | #14 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
That's still the same CPU dependent delay loop. It is not your problem though if you're trying that code in an A500 environment.
|
11 November 2018, 22:04 | #15 |
Registered User
Join Date: Nov 2017
Location: france
Posts: 109
|
I keep the 'old' software delay but I add a test on BFE001.
You think use /RDY (Bit 5 of BFE001) is not enough ? I actually in test this on WinUae with 'Cycle-Exact' option set Last edited by Giants; 11 November 2018 at 22:10. |
11 November 2018, 22:26 | #16 |
Registered User
Join Date: Feb 2017
Location: fastmem
Posts: 53
|
- you've assembled non-relocatable code (with absolute buffers) and then loaded/executed it at a different address.
- the code you found on the web has issues, not limited to simple timing. Most loaders are like that, that was my poor joke. - this one is wasting your time. find and study a decent one. ross linked his. I haven't checked it, but he's smart, so it's likely perfect or close to. - alternatively,if you can stomach the bloat, then use the (full) rnc loader until you are more familiar with them - and their issues. Timing is not your issue *yet*, it's just the first thing people check when determining whether a loader is even worth reading. Anything like the above falls into the 'replace immediately' category. |
11 November 2018, 22:51 | #17 |
Registered User
Join Date: Nov 2017
Location: france
Posts: 109
|
I trying with this :
Code:
hbr1: dbf d3,hbr1 move.w #$2000,$dff09a move.b $BFEE01,d3 andi.b #$c0,d3 ori.b #8,d3 move.b d0,$BFEE01 move.b #$28,$bfe401 move.b #$21,$bfe501 wait: btst.b #0,$bfed01 beq.s wait bset.b #0,$bfed01 Always don't work. Yes you'r right, I will give up this code and study the ross code. thks |
12 November 2018, 02:09 | #18 | |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,979
|
Quote:
Maybe this code can works, but im not sure. Code:
WaitForMe MOVE.W #StepWait,D3 StepWait: DBF D3,StepWait BTST #5,$BFE001 BNE WaitForMe |
|
12 November 2018, 14:20 | #19 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Yes, Ross' loader will be fine. Just had a look at it again. It's PC-relative, well-commented and doesn't do busy-loops. Try it!
But make sure to OFS-format your disk. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|