DGivney / assemblytutorials

This project was put together to teach myself NASM x86 assembly language on linux.
https://asmtutor.com/
654 stars 117 forks source link

Lesson 16 - not discarding non-numbers #20

Closed bobcyc closed 4 years ago

bobcyc commented 4 years ago

From asmtutor.com, lesson 16, the asm code which should be discarding non-number arguments seems to fail.

cmp bl, 48 jl finished cmp bl, 57 jg finished

For example:

~$ ./exe/lesson16 1 2 3 4 e Floating point exception ~$ ./exe/lesson16 1 2 3 e 2576980383 ~$ ./exe/lesson16 1 2 3 4 10 ~$ ./exe/lesson16 e 1 2 3 6 ~$ ./exe/lesson16 e 2 e 3 858993464

DGivney commented 4 years ago

Hi bobcyc

Thank you for creating this issue - you are correct.

I've updated the atoi function to skip the division by 10 when a non-integer value is passed to this function; https://github.com/DGivney/assemblytutorials/commit/c58bffb7e8c7290e32c3680b525da7c616d1979c#diff-1128b2227978f400f05023dc2b7eb023

Thanks again,

Daniel