1

I was trying to implement Hello world program in Assembly, but there is some

warning:

cpuid.s: Assembler messages: cpuid.s: Warning: end of file not at end of a line; newline inserted

There is code below

.section .data
 output:
.ascii "The processor Vender Id is 'xxxxxxxxxxxx'"
.section .text
.globl _start
_start:
mov $0,%eax
cpuid
movl $output ,%edi
movl %ebx,28(%edi)
movl %edx,32(%edi)
movl %ecx,36(%edi)
movl $4,eax
movl $1,ebx
movl $output,%ecx
movl $43,%edx
int $0x80
movl $1,%eax
movl $0,%ebx
int $0x80
Raul Cacacho
  • 267
  • 1
  • 4
  • 15
  • 2
    Seems like you need to add a new line character to the end of the file. (Open the file, go to the end, push enter...) – Jacob H Jan 30 '18 at 17:06
  • what do you mean by push enter – Bhupender Sharma Jan 30 '18 at 17:44
  • The Enter button on your keyboard. Push it. https://en.wikipedia.org/wiki/Newline – Jacob H Jan 30 '18 at 17:58
  • seem like linux, so then newline character is byte of value 10, if you would view your text file as binary data, you would see the last line ends with some characters, but not byte with value 10. And if you would hit "ctrl+end" to move cursor to the very end of the source code, some of the editors will make it stop after the last character on last line, not being able to go to the line below. By putting another enter there you will create "empty line" at bottom of source. – Ped7g Jan 30 '18 at 19:40
  • Related: on Unix.SE: [What's the point in adding a new line to the end of a file?](https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file): to avoid breakage with `#include`, so this warning makes sense for the GNU assembler. See also [Why should text files end with a newline?](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). Also [Should I end my text/script files with a newline?](https://unix.stackexchange.com/questions/23903/should-i-end-my-text-script-files-with-a-newline) – Peter Cordes Jan 31 '18 at 05:05
  • i know that value 10 is for newline but it show again warning. i solve the problem in entering a '\n' in string i used – Bhupender Sharma Jan 31 '18 at 17:34
  • Hello anyone can write a assembly code for newline for me in AT&T syntax – Bhupender Sharma Jan 31 '18 at 18:04

0 Answers0