CompuServe Thread

Forum unknown · Programming

#DOS in ASM

5 messages in this thread
#34777From: Mike BerroSep 30, 1986 4:33 PM
Yet another DOS problem. The following fragment bombs at (I think) the Examine statement. Why? FileInfo is a block of memory fib_SIZEOF large. Does it need to be intialized somehow? Thanx! —Mike movea.l DOSLibrary,a6 move.l dir,d1 ;pointer to 'df1:',0 move.l #ACCESS_READ,d2 jsr _LVOLock(a6) tst.l d0 beq forget_it move.l d0,my_lock move.l my_lock,d1 move.l #FileInfo,d2 ;FileInfoBlock movea.l DOSLibrary,a6 jsr _LVOExamine(a6) ;If I leave this out, no bomb * normally do some ExNext and stuff…then move.l my_lock,d1 movea.l DOSLibrary,a6 jsr _LVOUnLock(a6) ;bombs
#34844From: Darrel SchneiderOct 1, 1986 12:49 AM
I'm not sure this will help but the address of FileInfo must be longWord alligned. This is probably because it is turned into a BPTR somewhere internal to the Examine code. You can allign it yourself using 'CNOP 0,4' or you can allocate the block with AllocMem. Just make sure that the two msbits are '00'. On the efficency side ( I realize that you may have just been trying to make your code 'extra' safe to try to fix the bug and thus apoligize in advance! ) you only need the first 'movea.l DOSLibrary,A6' the others are redundant. Also the first 'move.l my_lock,d1' should be 'move.l d0,d1'. Also I don't like the look of 'move.l #FileInfo,D2' even though I think it will work. I guess I'm always getting my addresses from Ax reg. or with d(PC) addressing. But in this case I think the way you are doing it is the most efficent it just looks funny!
#34853From: Mike BerroOct 1, 1986 1:35 AM
Darrel, I had assumed that by specifying "dc.l", that the data area would be long-word aligned. Besides, the FileInfo works on Examine, but not ExNext. However, I will try AllocMem. My code was strange because there were a few things going on between some of the lines. I am also in a stage where I still re-arrange a lot of the code (I'm a dis-organized programmer), so I keep the "movea.l nnnLibrary" statements in there until I'm ready to clean it up (which is usually never). Thanx for the help! — Mike
#34853From: Mike BerroOct 1, 1986 1:35 AM
Darrel, I had assumed that by specifying "dc.l", that the data area would be long-word aligned. Besides, the FileInfo works on Examine, but not ExNext. However, I will try AllocMem. My code was strange because there were a few things going on between some of the lines. I am also in a stage where I still re-arrange a lot of the code (I'm a dis-organized programmer), so I keep the "movea.l nnnLibrary" statements in there until I'm ready to clean it up (which is usually never). Thanx for the help! — Mike
#34844From: Darrel SchneiderOct 1, 1986 12:49 AM
I'm not sure this will help but the address of FileInfo must be longWord alligned. This is probably because it is turned into a BPTR somewhere internal to the Examine code. You can allign it yourself using 'CNOP 0,4' or you can allocate the block with AllocMem. Just make sure that the two msbits are '00'. On the efficency side ( I realize that you may have just been trying to make your code 'extra' safe to try to fix the bug and thus apoligize in advance! ) you only need the first 'movea.l DOSLibrary,A6' the others are redundant. Also the first 'move.l my_lock,d1' should be 'move.l d0,d1'. Also I don't like the look of 'move.l #FileInfo,D2' even though I think it will work. I guess I'm always getting my addresses from Ax reg. or with d(PC) addressing. But in this case I think the way you are doing it is the most efficent it just looks funny!