NO

Author Topic: ChatGPT examples  (Read 880 times)

Offline Vortex

  • Member
  • *
  • Posts: 601
    • http://www.vortex.masmcode.com
Re: ChatGPT examples
« Reply #15 on: April 23, 2023, 01:11:23 PM »
Question : Create a Windows based hello world example with Pelle's macro assembler Poasm.

ChatGPT's output :

Code: [Select]
; Program to print "Hello, World!" to the console in Windows

format PE console
entry start

section '.data' data readable writeable

message db 'Hello, World!', 0

section '.text' code readable executable

start:
    ; Print the message to the console
    push dword -11
    call [GetStdHandle]
    mov dword [handle], eax
    push dword 0
    push dword message
    push dword 13
    push dword [handle]
    call [WriteConsoleA]

    ; Exit the program
    push dword 0
    call [ExitProcess]

section '.idata' import data readable

library kernel32, 'kernel32.dll',\
        user32, 'user32.dll'

import kernel32,\
       ExitProcess, 'ExitProcess',\
       GetStdHandle, 'GetStdHandle',\
       WriteConsoleA, 'WriteConsoleA'

section '.data' data readable writeable

handle dd ?

Naturally, this is the syntax of the Flat Assembler and not Poasm.
Code it... That's all...

Offline John Z

  • Member
  • *
  • Posts: 594
Re: ChatGPT examples
« Reply #16 on: April 26, 2023, 10:44:57 PM »
Google BARD released a pseudo-coder too now .... "Coders can choose from 20+ different coding languages too...."

https://www.tomsguide.com/news/googles-bard-ai-can-now-write-code-heres-how-to-use-it

John Z


Offline Vortex

  • Member
  • *
  • Posts: 601
    • http://www.vortex.masmcode.com
Re: ChatGPT examples
« Reply #17 on: April 27, 2023, 09:19:34 PM »
Quote
Question : What are differences between the macro engines of Masm and Poasm?

Quote
Masm (Microsoft Macro Assembler) and Poasm (Pelle's Macro Assembler) are both macro assemblers that support the x86 architecture. While they are similar in many respects, there are some differences between their macro engines:

Syntax: Masm and Poasm use slightly different syntax for defining and invoking macros. Masm uses the MACRO and ENDM directives to define a macro and the INVOKE directive to invoke it, while Poasm uses the macro and endm directives to define a macro and the invoke directive to invoke it.

Parameter passing: Masm and Poasm handle parameter passing differently. Masm passes parameters using the stack, while Poasm uses registers.

Macro expansion: Masm and Poasm expand macros differently. Masm expands macros recursively, which can lead to excessive code duplication if macros are not written carefully. Poasm expands macros non-recursively, which can result in more efficient code generation.

Error checking: Masm and Poasm perform error checking differently. Masm checks for errors during the expansion phase, while Poasm checks for errors during the assembly phase.

Overall, both Masm and Poasm are powerful macro assemblers that are widely used in the industry. The choice between the two largely depends on personal preference and specific project requirements.

ChatGPT is serioulsy confused here.
Code it... That's all...