Assemblers won't assemble!!

Thread Solved

Join Date: Mar 2007
Posts: 13
Reputation: Queatrix is an unknown quantity at this point 
Solved Threads: 1
Queatrix Queatrix is offline Offline
Newbie Poster

Assemblers won't assemble!!

 
0
  #1
Dec 18th, 2007
I have tried to assemble the following code in TASM and Flat Assembler, but they both give an error for every line of code. What is going on? How can I get the assemblers to assemble the * code?? Thanks for any help you can provide.
  1. [BITS 16]
  2. [ORG 0]
  3.  
  4. jmp start
  5.  
  6. bootdrv db 0
  7. bootmsg db 'Boot Sector Example',13,10,0
  8.  
  9. rebootmsg db 'Press any key to reboot',13,10,0
  10.  
  11. processormsg db 'Checking for 386+ processor: ',0
  12. need386 db 'Sorry... 386+ required!',13,10,0
  13. found386 db 'Found!',13,10,0
  14.  
  15. whatever db 'Now we insert our code here to do something, and we have an OS!',13,10,0
  16.  
  17. detect_cpu:
  18. mov si, processormsg
  19. call message
  20.  
  21. pushf
  22.  
  23. xor ah,ah
  24. push ax
  25. popf
  26.  
  27. pushf
  28. pop ax
  29. and ah,0f0h
  30. cmp ah,0f0h
  31. je no386
  32.  
  33. ; check for a 286 (bits 12-15 are clear)
  34. mov ah,0f0h
  35. push ax
  36. popf
  37.  
  38. pushf
  39. pop ax
  40. and ah,0f0h
  41. jz no386
  42. popf
  43.  
  44. mov si, found386
  45. call message
  46.  
  47. ret
  48. no386:
  49. mov si,need386
  50. call message
  51. jmp reboot
  52.  
  53. message:
  54. lodsb
  55. or al,al
  56. jz done
  57. mov ah,0eh
  58. mov bx,0007
  59. int 0x10
  60. jmp message
  61. done:
  62. ret
  63.  
  64. getkey:
  65. mov ah, 0
  66. int 016h
  67. ret
  68.  
  69. reboot:
  70. mov si, rebootmsg
  71. call message
  72. call getkey
  73.  
  74. db 0EAh
  75.  
  76. dw 0000h
  77. dw 0FFFFh
  78.  
  79. start:
  80. mov ax,0x7c0
  81. mov ds,ax
  82. data
  83.  
  84. mov [bootdrv], dl
  85.  
  86. cli
  87. mov ax,0x9000
  88. mov ss,ax
  89. mov sp,0xffff
  90. sti
  91.  
  92. mov si,bootmsg
  93. call message
  94.  
  95. call detect_cpu
  96.  
  97. .386
  98.  
  99. mov si,whatever
  100. call message
  101. call getkey
  102.  
  103. call reboot
  104.  
  105. times 510-($-$$) db 0
  106. dw 0xAA55
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Assemblers won't assemble!!

 
0
  #2
Dec 18th, 2007
You have failed to use the proper directives to organize your code and data. Please read TASM's documentation.

I should note also that you've got some pretty egregious errors there, particularly when calling and not returning.

Hope this helps.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 13
Reputation: Queatrix is an unknown quantity at this point 
Solved Threads: 1
Queatrix Queatrix is offline Offline
Newbie Poster

Re: Assemblers won't assemble!!

 
0
  #3
Dec 18th, 2007
I see, after really looking through it, I got rid of some errors, and it took care of the rest.
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