beginner compile problem

Thread Solved

Join Date: Feb 2006
Posts: 24
Reputation: cozofdeath is an unknown quantity at this point 
Solved Threads: 0
cozofdeath cozofdeath is offline Offline
Newbie Poster

beginner compile problem

 
0
  #1
Jul 9th, 2006
Ok, I've been trying different tutorials/methods of learning asm and right now I'm reading Dr. Paul Carters tutorial and using NASM and DJGPP to compile. I just got into the conditional/jump section and I wanted to test how the jumps work and ran into a problem. The read_char macro seems to never run and when I look into the registers EAX always has an ascii 'A' (linefeed) in it after the read_char is suppost to run. I can't even enter anything a 'y' or 'n'. I warn you I'm a beginner, and this is a corny test program.

  1. %include "asm_io.inc"
  2.  
  3. segment .data
  4. label1 db "Enter your age: ", 0
  5. label2 db "Are your really ", 0
  6. label3 db " (y or n): ", 0
  7. label4 db "Wow, your old!", 0
  8. label5 db "Ok, sorry!", 0
  9.  
  10. segment .bss
  11. age resd 1
  12. yorn resd 1
  13.  
  14. segment .text
  15. global _asm_main
  16. _asm_main:
  17.  
  18. enter 0,0
  19. pusha
  20.  
  21. mov eax, label1
  22. call print_string
  23.  
  24. call read_int
  25.  
  26. mov dword [age], eax
  27.  
  28. mov eax, label2
  29. call print_string
  30.  
  31. mov eax, dword [age]
  32. call print_int
  33.  
  34. mov eax, label3
  35. call print_string
  36.  
  37. mov eax, 0
  38. call read_char ; <-- will not get input
  39.  
  40. mov dword [yorn], eax
  41.  
  42. cmp dword [yorn], 'y'
  43. jnz no
  44.  
  45. call print_nl
  46. mov eax, label4
  47. call print_string
  48.  
  49. popa
  50. mov eax, 0
  51. leave
  52. ret
  53.  
  54. no:
  55. call print_nl
  56. mov eax, label5
  57. call print_string
  58.  
  59.  
  60. popa
  61. mov eax, 0
  62. leave
  63. ret

Any comments or suggestions on how I can make things easier or avoid problems are very welcome. This has been driving me nutts:mad:

Also, I have tried commenting every line before the read_char untill the first call print_string and when I get to the read_int line and comment it also, then it works.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 24
Reputation: cozofdeath is an unknown quantity at this point 
Solved Threads: 0
cozofdeath cozofdeath is offline Offline
Newbie Poster

Re: beginner compile problem

 
0
  #2
Jul 9th, 2006
Nevermind, this is solved. Dr. Carter and some very nice people on the alt.lang.asm group helped me out.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 24
Reputation: cozofdeath is an unknown quantity at this point 
Solved Threads: 0
cozofdeath cozofdeath is offline Offline
Newbie Poster

Re: beginner compile problem

 
0
  #3
Jul 10th, 2006
K, nevermind the problem is still there. Any ideas:?????
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 24
Reputation: cozofdeath is an unknown quantity at this point 
Solved Threads: 0
cozofdeath cozofdeath is offline Offline
Newbie Poster

Re: beginner compile problem

 
0
  #4
Jul 10th, 2006
Solved!!! Finally!!!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC