Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. help!!!!!!!!!!!!!!! about inline assemble

help!!!!!!!!!!!!!!! about inline assemble

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestiontutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jfk_lili
    wrote on last edited by
    #1

    i hv used inline assemble which hv been showed below: do{ for(int test=0;test<5000;test++);// reach the high output to send a read data properly __asm{//the normal case which used to transfer the data ///* mov dx,portaddress mov bx,data mov cx,i //need to shift it to the large register bt bx,cl jc Current_Bit2_Is_1 Current_Bit2_Is_0: /* mov al,00000010b mov cx,10h loop_label7: out dx,al loop loop_label7*/ mov al,11111101b mov cx,25h loop_label8: out dx,al loop loop_label8 mov al,11111111b mov cx,35h loop_label9: out dx,al loop loop_label9 mov al,11111101b mov cx,25h loop_label7: out dx,al loop loop_label7 jmp END2 //jump without any condition Current_Bit2_Is_1: mov al,11111101b mov cx,25h loop_label1: out dx,al loop loop_label1 mov al,11111001b mov cx,35h loop_label2: out dx,al loop loop_label2 mov al,11111011b mov cx,35h loop_label3: out dx,al loop loop_label3 mov al,11111001b mov cx,25h loop_label4: out dx,al loop loop_label4 mov al,11111101b mov cx,25h loop_label5: out dx,al loop loop_label5 END2: } for(test=0;test<7000;test++); __asm{ mov dx,portaddress mov al,11111101b out dx,al } i--; }while(i>=0); if i just use like this then no problem. but when i use inline assemble in another part of my program, it always make the program hang. if(i==-1){ __asm{ mov dx,portaddress mov bx,data mov al,00000010b mov cx,10h loop_labelA: out dx,al loop loop_labelA mov al,00000000b mov cx,15h loop_labelB: out dx,al loop loop_labelB mov al,00000010b mov cx,10h loop_labelC: out dx,al loop loop_labelC } } this one is just under the while statement.....but it always make the program hang. i really dont know what is the problem in here. is there anyone know how to solve it?:doh: thank u in advance!!!!!:)

    P 1 Reply Last reply
    0
    • J jfk_lili

      i hv used inline assemble which hv been showed below: do{ for(int test=0;test<5000;test++);// reach the high output to send a read data properly __asm{//the normal case which used to transfer the data ///* mov dx,portaddress mov bx,data mov cx,i //need to shift it to the large register bt bx,cl jc Current_Bit2_Is_1 Current_Bit2_Is_0: /* mov al,00000010b mov cx,10h loop_label7: out dx,al loop loop_label7*/ mov al,11111101b mov cx,25h loop_label8: out dx,al loop loop_label8 mov al,11111111b mov cx,35h loop_label9: out dx,al loop loop_label9 mov al,11111101b mov cx,25h loop_label7: out dx,al loop loop_label7 jmp END2 //jump without any condition Current_Bit2_Is_1: mov al,11111101b mov cx,25h loop_label1: out dx,al loop loop_label1 mov al,11111001b mov cx,35h loop_label2: out dx,al loop loop_label2 mov al,11111011b mov cx,35h loop_label3: out dx,al loop loop_label3 mov al,11111001b mov cx,25h loop_label4: out dx,al loop loop_label4 mov al,11111101b mov cx,25h loop_label5: out dx,al loop loop_label5 END2: } for(test=0;test<7000;test++); __asm{ mov dx,portaddress mov al,11111101b out dx,al } i--; }while(i>=0); if i just use like this then no problem. but when i use inline assemble in another part of my program, it always make the program hang. if(i==-1){ __asm{ mov dx,portaddress mov bx,data mov al,00000010b mov cx,10h loop_labelA: out dx,al loop loop_labelA mov al,00000000b mov cx,15h loop_labelB: out dx,al loop loop_labelB mov al,00000010b mov cx,10h loop_labelC: out dx,al loop loop_labelC } } this one is just under the while statement.....but it always make the program hang. i really dont know what is the problem in here. is there anyone know how to solve it?:doh: thank u in advance!!!!!:)

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      Did you consider that the loop variable test may be optimised to register variable and your inline code is currupting it.


      MSN Messenger. prakashnadar@msn.com

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups