English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 27 December 2017, 21:07   #1
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 46
Posts: 2,372
assembly code to test for assign (2.0+)

I have this code to test for an assign. Ex: pass a pointer on "T:" in D0 and it returns 0 if not found

Code:
    move.l    _DosBase,A6
   move.l	D0,D5
   move.l    #LDF_READ|LDF_WRITE|LDF_ALL,D1
    JSRLIB    LockDosList
    move.l    D0,D6        ; head of dos list

    ; search in the list
    
    move.l    D5,D2
    move.l    #LDF_READ|LDF_WRITE,D3    ; flags
    move.l    D6,D1
    JSRLIB    FindDosEntry

    move.l    D0,D4            ; return

    ; unlock dos list

    move.l    #LDF_READ|LDF_WRITE,D1    ; flags
    JSRLIB    UnLockDosList

    move.l    D4,D0            ; NULL: not found
The issue with that code (took me a while to narrow it down) is that using it randomly locks my application on system calls like Read or Lock...

Someone knows why? I'd like to keep that code, but if I have to get rid of it and replace by a "Lock" I'll do it (since my app switches the requesters off, I suppose it won't be an issue)

Edit: replacing the flags by just
Code:
move.l    #LDF_READ,D1
fixes the lock but not sure if the test works in that case

Last edited by jotd; 27 December 2017 at 21:17.
jotd is offline  
AdSense AdSense  
Old 27 December 2017, 22:38   #2
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 940
Hi jotd, have You tried
move.l #LDF_READ|LDF_ALL,D1
?

From Autodocs there is a possible deadlock using LDF_WRITE without
AttemptLockDosList() before.
ross is offline  
Old 27 December 2017, 23:16   #3
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 46
Posts: 2,372
tried that and it didn't lock, but didn't find the assign either. Anyway, used a good old "doslib.Lock" with requesters off, and it does exactly the same thing (I don't need assign, I need to see if the T: directory exists). Moreover, my code needs to be 1.3 compatible, so the Lock solution works. thanks
jotd is offline  
AdSense AdSense  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to test time for piece of code Powergoo Coders. Asm / Hardware 16 17 October 2015 23:08
ALWAYS test your code on real hardware!! h0ffman Coders. General 32 16 July 2015 21:02
CD32 Frog Feast test available. Test out the final! cdoty News 42 01 April 2008 16:20
Assign command fc.studio support.Apps 2 28 December 2005 18:36
Multi-Assign Shoonay support.Apps 17 12 April 2005 15:16

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 02:38.


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