Code Monkey home page Code Monkey logo

Comments (7)

Dman95 avatar Dman95 commented on July 23, 2024 1

It is not a bug, it is a feature. To perform input in a program you should enter a text before running a program.

from sasm.

Dman95 avatar Dman95 commented on July 23, 2024

You can find a description of the library on the site http://dman95.github.io/SASM/english.html
In brief, macros determine a type of the arguments and call an according code, in which C library functions are used.

from sasm.

insolor avatar insolor commented on July 23, 2024

I've already seen the docs from the link you given.
I need something else: at least I need info on how to make basic IO functions work.
Eg. I've written the following code:

format ELF

extrn _printf

section '.text' executable
public _main
_main:
    push message
    call _printf
    xor eax, eax
    ret

message db 'Hello!', 0

It is compiled successfully with fasm from sasm, but when I try to run it, it prints nothing.

from sasm.

insolor avatar insolor commented on July 23, 2024

I've finally found helloworld for fasm in the directory of sasm, it works fine, so I will try to use it as a reference.

from sasm.

insolor avatar insolor commented on July 23, 2024

printf, puts are working, but I failed to make work scanf - it just passes through it without waiting of input.
P.S. It actually works, but it doesn't wait for input (as I expected), and just reads from the input window. Here's an example of working code:

format ELF

section '.data' writeable
    num dd 0
    format_str db "%d", 0

section '.text' executable
public _main
extrn _printf
extrn _scanf
_main:
    mov ebp, esp; for correct debugging

    push num
    push format_str
    call _scanf
    add esp, 8

    push [num]
    push format_str
    call _printf
    add esp, 8

    xor eax, eax
    ret

from sasm.

ThomasThelen avatar ThomasThelen commented on July 23, 2024

There are many libraries that have already been made for other assemblers. Look up FreshLib for a fasm macro library.

from sasm.

insolor avatar insolor commented on July 23, 2024

@ThomasThelen, the request was not about libraries for fasm in general. It was limited to rewriting existing io.inc file, which works with nasm, to the syntax of fasm.
Personally I don't need such include file for using in my projects, but I think it would be useful for some people for educational purposes.

from sasm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.