flat assembler
Message board for the users of flat assembler.

Index > OS Construction > rep outsw

Author
Thread Post new topic Reply to topic
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 06:15
Code:
mov edi,buffer
add edi,[Base]
cld
rep insw
    


The problem is here:
Code:
mov esi,buffer
cld
rep outsw
    

When I run the outsw without the base it almost works fine..
It causes an unhanled exception but writes the data correctly..
or if I add the base I get junk for the output and no exception..

the insw runs fine - reads and no exceptions with the base..
Is there something I am missing with the rep outsw that would
cause this?
I know there is something being overlooked by me...

Thanks in advance for any help!
Post 14 May 2009, 06:15
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 14 May 2009, 06:27
DS and ES the same?
Post 14 May 2009, 06:27
View user's profile Send private message Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 06:29
yes - I though it may be something with es,ds
so I tried setting them the same before calling..
still same results//
Post 14 May 2009, 06:29
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 14 May 2009, 06:33
With 'rep' you are using ecx - that's ok?

Some output to ports doesn't like 'rep outs' because it's too fast.
Post 14 May 2009, 06:33
View user's profile Send private message Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 06:35
yes - mov ecx,256

I have gone over it a million times..
but still running across this prob..

Quote:
Some output to ports doesn't like 'rep outs' because it's too fast


but that would cause it not to work with or with out the base..
with the base no crash.. just junk out
Post 14 May 2009, 06:35
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20292
Location: In your JS exploiting you and your system
revolution 14 May 2009, 06:38
And DX=?
Post 14 May 2009, 06:38
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 06:41
mov edx,[hdbase]
Post 14 May 2009, 06:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20292
Location: In your JS exploiting you and your system
revolution 14 May 2009, 06:42
I think you need to show ALL your code. We can't keep guessing like this!
Post 14 May 2009, 06:42
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 06:48
deleted!


Last edited by dosin on 14 May 2009, 08:15; edited 1 time in total
Post 14 May 2009, 06:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20292
Location: In your JS exploiting you and your system
revolution 14 May 2009, 06:55
Code:
      mov   edx,[hdbase] 
      
hddwait3: 
        mov    dx,0x1f7 ;<------- Hmm?
        in    al,dx 
        test  al,128 
        jnz   hddwait3 
 
      
      rep   outsw  ;DX=0x1F7, is that what you want?    
Post 14 May 2009, 06:55
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 06:59
sorry it has a

Code:
 mov   edx,[hdbase]  
 pushad
  
       
 hddwait3:  
        mov    dx,0x1f7 
        in    al,dx  
        test  al,128  
        jnz   hddwait3  
  
       
      

popad
rep   outsw  
 
    
Post 14 May 2009, 06:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20292
Location: In your JS exploiting you and your system
revolution 14 May 2009, 07:03
Why do you have the fixed value 0x1F7? Are you using a different hdbase or is that fixed to 0x1F0? Or what? Why have the fixed value 0x1F7 at all, it is going to cause you problems if you try to change to a different base.
Post 14 May 2009, 07:03
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 07:10
value 0x1F7
Code:
mov    dx,0x1f7  
in    al,dx   
test  al,128   
jnz   hddwait3   

    

this is a function to test the hd before writing..

This is the HD Base:
mov edx,[hdbase]
pushad
;hd test function
popad

rep outsw

;;;;;;;;;;;;;;;;;;;;;;
mov esi,buffer
add esi,base ; this gives me junk when I read it back
mov ecx,256
mov edx,[hdbase]

but if its not in it causes an unhand exception..

mov esi,buffer
;removed base add on ; this gives me junk when I read it back
mov ecx,256
mov edx,[hdbase]

this write correct but causes an excption
;;;;;;;;;;;;;;;;;;;;;;;;;;
Post 14 May 2009, 07:10
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20292
Location: In your JS exploiting you and your system
revolution 14 May 2009, 07:17
Why not use this instead:
Code:
...
mov edx,[hdbase]
add edx,7
...    
It would make your function work for all HDD bases. Then "All you HDD bases are belong to your function". Wink


What is the value of hdbase? Is it 0x1F0?

Since you haven't shown all your code I have to guess what you have done. Sad
Post 14 May 2009, 07:17
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20292
Location: In your JS exploiting you and your system
revolution 14 May 2009, 07:20
dosin wrote:
mov esi,buffer
add esi,base ; this gives me junk when I read it back
But what is buffer? What is base? Should that be "add esi,[base]"? Question
Post 14 May 2009, 07:20
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 07:25
mov esi,buffer ;<- this gives me junk when I read it back
add esi,[base]
yes! typo sorry.. getting a little sleepy...

but thats what I have been trying..
the read function works fine..
with the add edi,[base]
write funtion: add esi,[base]...

just not the write function..

Thanks rev.. and sinsi

I will post more tomorrow after getting some rest..


Last edited by dosin on 14 May 2009, 07:46; edited 1 time in total
Post 14 May 2009, 07:25
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 14 May 2009, 07:43
Quote:
It causes an unhanled exception but writes the data correctly..
What?
Post 14 May 2009, 07:43
View user's profile Send private message Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin 14 May 2009, 07:50
I wonder if there an int that needs cleard that maybe I have as an unhand exception.. for the HD

yep that was it... I have been writing a real mode program for the last few weeks.. and when I when back to PM.. I did everthing but add the int handler for the Disk Drive..

Works fine now...

Thanks again..
Post 14 May 2009, 07:50
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.