944,030 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Marked Solved
  • Views: 2438
  • Assembly RSS
Jul 9th, 2006
0

beginner compile problem

Expand Post »
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.

Assembly Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cozofdeath is offline Offline
24 posts
since Feb 2006
Jul 9th, 2006
0

Re: beginner compile problem

Nevermind, this is solved. Dr. Carter and some very nice people on the alt.lang.asm group helped me out.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cozofdeath is offline Offline
24 posts
since Feb 2006
Jul 10th, 2006
0

Re: beginner compile problem

K, nevermind the problem is still there. Any ideas:?????
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cozofdeath is offline Offline
24 posts
since Feb 2006
Jul 10th, 2006
0

Re: beginner compile problem

Solved!!! Finally!!!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cozofdeath is offline Offline
24 posts
since Feb 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Procedures
Next Thread in Assembly Forum Timeline: hardware interrupt hangs





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC