Assembly language > Assembly discussions

I am begginer

(1/3) > >>

zellJunior:
Please someone help me adapt this code to POASM
/------------------------------------------------------------------/
               TITLE salut1_exe
               .MODEL    SMALL
               .STACK    100h
               .DATA
     mesaj     DB   "Salut!",13,10
     lmesaj    EQU  $ mesaj
               .CODE
     start:    mov  ax,@data
               mov  ds,ax
               mov  bx,1
               mov  cx,lmesaj
               mov  dx,OFFSET mesaj
               mov  ah,40h
               int  21h
               mov  ax,4C00h
               int  21h
               END  start

jj2007:
Your code is 16-bit, that won't work with PoAsm. Here is an example that compiles fine but requires some libraries from Masm32:
.486         ; create 32 bit code
.model flat, stdcall   ; 32 bit memory model
option casemap :none   ; case sensitive

include \masm32\include\windows.inc   ; main windows include file
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

.code
AppTitle   db "PoAsm is great:", 0
AppName   db "Hi, I am a MessageBox", 0

start:
   invoke MessageBox, 0, addr AppName, addr AppTitle, MB_OK
   invoke ExitProcess, 0

end start

Bitbeisser:
PoAsm (just like Pelle's C in general) is geared towards development for (32/64bit) Windows programming.
Your assembler code is for a 16bit .COM style DOS code, which PoAsm therefor doesn't understand...

Instead of using JJ's cryptic code to force a Windows executable with a different assembler, I think a better option to get you going with your x86 assembly language studies is to use JWasm, which is likely to compile your source code just fine.

However, as this will (when linked) produce a 16bit .COM executable file, you can't run this on any 64bit flavor of Windows, as in those, the backwards compatibility that would enable you to run 16bit code has been removed. Any 32bit version of Windows however should be fine...

Ralf

TimoVJL:
For POAsm without any extra stuff:

--- Code: ---.486         ; create 32 bit code
.model flat, stdcall   ; 32 bit memory model
option casemap :none   ; case sensitive

MB_OK EQU 0h
MessageBoxA proto :DWORD, :DWORD, :DWORD, :DWORD
ExitProcess proto : DWORD

includelib kernel32.lib
includelib user32.lib

.code
AppTitle   db "PoAsm is great:", 0
AppName   db "Hi, I am a MessageBox", 0

start:
   invoke MessageBoxA, 0, addr AppName, addr AppTitle, MB_OK
   invoke ExitProcess, 0

end start

--- End code ---

jj2007:

--- Quote from: Bitbeisser on February 05, 2014, 10:33:14 PM ---However, as this will (when linked) produce a 16bit .COM executable file..
--- End quote ---

Beisser, fyi this will produce a 16-bit .exe, not .com
The example above was assembled with PoAsm, not with "a different assembler"; besides, I find your attempt to push the OP to continue with JWasm and 16-bit code utterly anachronistic.

@Timo: Thanks for simplifying the example.

Navigation

[0] Message Index

[#] Next page

Go to full version