Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Kirk to Enterprise -- beam down yeoman Rand and a six-pack.


devel / comp.lang.asm.x86 / Nasm error undefined reference to printf

SubjectAuthor
* Nasm error undefined reference to printfMohammad Fayad
+- Re: Nasm error undefined reference to printfFrank Kotler
`* Re: Nasm error undefined reference to printfwolfgang kern
 `- Re: Nasm error undefined reference to printfwolfgang kern

1
Nasm error undefined reference to printf

<32b6607c-6e98-40d2-8889-87af52aa02f3n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=276&group=comp.lang.asm.x86#276

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 11910171@nospicedham.students.liu.edu.lb (Mohammad Fayad)
Newsgroups: comp.lang.asm.x86
Subject: Nasm error undefined reference to printf
Date: Sun, 19 Dec 2021 17:04:09 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 74
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <32b6607c-6e98-40d2-8889-87af52aa02f3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Mon, 20 Dec 2021 01:04:09 +0000
Injection-Info: reader02.eternal-september.org; posting-host="d1bde99e6fd078d33b134caceb416225";
logging-data="30057"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qN4sTk2PN8YQ0dV89DzD5l8LoAQN+JXQ="
User-Agent: G2/1.0
Cancel-Lock: sha1:0vyQ7QTC4LA7uuOkDSyEREHkDtw=
 by: Mohammad Fayad - Mon, 20 Dec 2021 01:04 UTC

Hello this is my code im trying to do a program that checks if a number is divisble by 2 and 8 and im getting an error undefined printf
This is the code:

global _start

extern _printf

SECTION .data
message1: db "Enter a number: ", 0
number1: db "%d", 0
integer1: times 10 db 0 ; 32-bits integer = 10 bytes
msg db 'Divisible by 2 and 8', 0xa,0xd
len equ $ - msg
SYS_EXIT equ 1
STDOUT EQU 1
SYS_WRITE EQU 4
SECTION .bss
val2 resb 2

SECTION .text

_start:

push message1
call _printf
pop rbx
mov eax, 3
mov ebx, 1
mov ebx, val2
mov edx, 2
int 0x80
push val2
mov al, [val2]

l1:
..divisble_by_2:
mov ax, [number1]
xor dx, dx
mov bx, 2
div bx
cmp dx, 0
jnz .not_divisible

..divisble_by_8:
mov ax, [number1]
xor dx, dx
mov bx, 8
div bx
cmp dx, 0
jnz .not_divisible

..print_number:
mov edx, [number1]
add edx, 48
mov [number1], edx

mov eax, 4
mov ebx, 1
mov ecx, [number1]
mov edx, len
int 0x80
mov eax, .divisble_by_2
int 0x80

..not_divisible:
xor eax, eax
mov edx, [eax+len]
mov al, 1
mov esi, .divisble_by_2
mov edi, eax
mov eax, 1
int 0x80
jmp _start

Re: Nasm error undefined reference to printf

<spp3mk$17hm$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=278&group=comp.lang.asm.x86#278

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: fbkotler@nospicedham.myfairpoint.net (Frank Kotler)
Newsgroups: comp.lang.asm.x86
Subject: Re: Nasm error undefined reference to printf
Date: Mon, 20 Dec 2021 00:20:55 -0500
Organization: Aioe.org NNTP Server
Lines: 16
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <spp3mk$17hm$1@gioia.aioe.org>
References: <32b6607c-6e98-40d2-8889-87af52aa02f3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="d1bde99e6fd078d33b134caceb416225";
logging-data="16286"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wXbmRBPt5paHYvAnk/NJW4IdHYdVB6Qc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2
Cancel-Lock: sha1:BLjUD3OHnBCpUo1+3xCWT1FQLaw=
 by: Frank Kotler - Mon, 20 Dec 2021 05:20 UTC

On 12/19/2021 08:04 PM, Mohammad Fayad wrote:
> Hello this is my code im trying to do a program that checks if a number is divisble by 2 and 8 and im getting an error undefined printf

Hi Mohammad,

> This is the code:
>
> global _start
>
> extern _printf

No underscore in GNU C?

Best.
Frank

Re: Nasm error undefined reference to printf

<sppid8$ngp$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=279&group=comp.lang.asm.x86#279

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: nowhere@nospicedham.nevernet.at (wolfgang kern)
Newsgroups: comp.lang.asm.x86
Subject: Re: Nasm error undefined reference to printf
Date: Mon, 20 Dec 2021 10:29:11 +0100
Organization: Aioe.org NNTP Server
Lines: 23
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <sppid8$ngp$1@gioia.aioe.org>
References: <32b6607c-6e98-40d2-8889-87af52aa02f3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="d1bde99e6fd078d33b134caceb416225";
logging-data="9892"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BnYrSl/CsU+0y6Gjf++xHIFlN5rC4g3c="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:OnnHpse171x6EUB5I5fCAvfZR2w=
 by: wolfgang kern - Mon, 20 Dec 2021 09:29 UTC

On 20/12/2021 02:04, Mohammad Fayad wrote:
> Hello this is my code im trying to do a program that checks if a number is divisble by 2 and 8 and im getting an error undefined printf
> This is the code:

cant help with the error but:
dividable by two:
test[variable],01
jnz not_by_2
dividable by eight:
test[variable],07
jnz by_2_but_not_by8
by2and8:
....

or much easier:
test[variable],15
;dividable by 2 and 8 if four least significant bits are zero
jnz failed
by2and8:
....
__
wolfgang

Re: Nasm error undefined reference to printf

<sppjv0$1et9$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=280&group=comp.lang.asm.x86#280

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: nowhere@nospicedham.nevernet.at (wolfgang kern)
Newsgroups: comp.lang.asm.x86
Subject: Re: Nasm error undefined reference to printf
Date: Mon, 20 Dec 2021 10:55:42 +0100
Organization: Aioe.org NNTP Server
Lines: 30
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <sppjv0$1et9$1@gioia.aioe.org>
References: <32b6607c-6e98-40d2-8889-87af52aa02f3n@googlegroups.com>
<sppid8$ngp$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="d1bde99e6fd078d33b134caceb416225";
logging-data="27845"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OdoLzCVwLNyjA8D1ADrUhKm8rg+J6ke4="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:9NHbYIPuHUN6EJGvv+lDf+QXDWM=
 by: wolfgang kern - Mon, 20 Dec 2021 09:55 UTC

On 20/12/2021 10:29, wolfgang kern wrote:
> On 20/12/2021 02:04, Mohammad Fayad wrote:
>> Hello this is my code im trying to do a program that checks if a
>> number is divisble by 2 and 8 and im getting an error undefined printf
>> This is the code:
>
> cant help with the error but:
> dividable by two:
>   test[variable],01
>   jnz not_by_2
> dividable by eight:
>   test[variable],07
>   jnz by_2_but_not_by8
> by2and8:
> ...
>
> or much easier:
>  test[variable],15
>  ;dividable by 2 and 8 if four least significant bits are zero
>  jnz failed
> by2and8:
> ...

oops :):)
if a number is dividable by 8 then it's dividable by 2 as well

__
wolfgang

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor