The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
July 24, 2014, 07:18:14 PM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  Project Support Forums
| |-+  HLA Forum
| | |-+  How to generate the MASM source code from HLA source code?
« previous next »
Pages: [1] Print
Author Topic: How to generate the MASM source code from HLA source code?  (Read 1990 times)
bolzano_1989
Member
**
Posts: 35


How to generate the MASM source code from HLA source code?
« on: November 11, 2011, 08:44:20 AM »

From the following topic:
http://www.masm32.com/board/index.php?topic=15040.msg132014#msg132014
I tried
Code:
hla -masm myprog.hla
but it didn't work.
Coud someone give me a hand  BigGrin ?
Logged
TmX
Member
*****
Gender: Male
Posts: 317



Re: How to generate the MASM source code from HLA source code?
« Reply #1 on: November 11, 2011, 09:31:28 AM »

Could you tell what error message you got?

Maybe like this?
Quote
'ml' is not recognized as an internal or external command,
operable program or batch file.
Error returned by Assembler = 1

If yes then it means that you need to put \masm32\bin in the %PATH%.
However, the HLA compiler already generated the asm file for you.
Let's say you just called hla -masm test1.hla. test1.asm should appear.
Logged
bolzano_1989
Member
**
Posts: 35


Re: How to generate the MASM source code from HLA source code?
« Reply #2 on: November 11, 2011, 04:48:51 PM »

Could you tell what error message you got?

Maybe like this?
Quote
'ml' is not recognized as an internal or external command,
operable program or batch file.
Error returned by Assembler = 1

If yes then it means that you need to put \masm32\bin in the %PATH%.
However, the HLA compiler already generated the asm file for you.
Let's say you just called hla -masm test1.hla. test1.asm should appear.

Thank you, for
Code:
hla -masm 1_01HelloWorld.hla
I received:
Quote
Illegal command line option '-masm'
Usage: hla options filename(s)

My HLA version:
Quote
HLA (High Level Assembler - FASM back end, POLINK linker)
Version 1.99 build 12920 (prototype)
Logged
bolzano_1989
Member
**
Posts: 35


Re: How to generate the MASM source code from HLA source code?
« Reply #3 on: November 11, 2011, 05:22:18 PM »

After I updated HLA to version 2.16 build 4413, I tried
Code:
hla -masm 1_01HelloWorld.hla
And it works but when I opened the 1_01HelloWorld.asm with Quick Editor of MASM32 package and tried "Console Assemble & Link" but received the errors:
Quote
1_01HelloWorld.obj : error LNK2001: unresolved external symbol STDOUT_NEWLN
1_01HelloWorld.obj : error LNK2001: unresolved external symbol DefaultExceptionH
andler__hla_
1_01HelloWorld.obj : error LNK2001: unresolved external symbol HardwareException
__hla_
1_01HelloWorld.obj : error LNK2001: unresolved external symbol BuildExcepts__hla
_
1_01HelloWorld.obj : error LNK2001: unresolved external symbol STDOUT_PUTS
1_01HelloWorld.obj : error LNK2001: unresolved external symbol __imp__ExitProces
s@4
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1_01HelloWorld.exe : fatal error LNK1120: 7 unresolved externals
_
Link error

How could I fix this so that it will work with qeditor of MASM32 package?
Here are the contents of 1_01HelloWorld.hla and 1_01HelloWorld.asm generated:

1_01HelloWorld.hla
Code:
program helloWorld;
#include( "stdlib.hhf" );

begin helloWorld;

    stdout.put( "Hello, World of Assembly Language", nl );

end helloWorld;

1_01HelloWorld.asm
Code:
; Assembly code emitted by HLA compiler
; Version 2.16 build 4413 (prototype)
; HLA compiler written by Randall Hyde
; MASM compatible output

  if @Version lt 612
  .586p
  else
  .686p
  .mmx
  .xmm
  endif
  .model flat, syscall
  option noscoped
  option casemap:none


offset32 equ <offset flat:>

  assume fs:nothing
ExceptionPtr__hla_ equ <(dword ptr fs:[0])>



        public     QuitMain__hla_
        public     DfltExHndlr__hla_
        public     _HLAMain
        public     HWexcept__hla_
        public     start


  .code


        externdef  STDOUT_NEWLN:near32
        externdef  DefaultExceptionHandler__hla_:near32
        externdef  abstract__hla_:near32
        externdef  HardwareException__hla_:near32
        externdef  BuildExcepts__hla_:near32
        externdef  STDOUT_PUTS:near32
        externdef  Raise__hla_:near32
        externdef  shortDfltExcept__hla_:near32






  .code




;/* HWexcept__hla_ gets called when Windows raises the exception. */

HWexcept__hla_ proc near32
        jmp        HardwareException__hla_
HWexcept__hla_ endp

DfltExHndlr__hla_ proc near32
        jmp        DefaultExceptionHandler__hla_
DfltExHndlr__hla_ endp



_HLAMain proc near32

start   proc near32
start   endp

        call       BuildExcepts__hla_
        db         06ah
        db         00h
        db         055h
        db         055h
        db         08dh
        db         06ch
        db         024h
        db         04h


        db         068h
        dd         offset32 str__hla_1888
        call       STDOUT_PUTS
        call       STDOUT_NEWLN
QuitMain__hla_::
        db         06ah
        db         00h
        db         0ffh
        db         015h
        dd         offset32 __imp__ExitProcess@4
_HLAMain endp









  .code


        align      (4)
len__hla_1888 dd         021h
        dd         021h
str__hla_1888 label byte
db "Hello, World of Assembly Language"
db 0

db 0
db 0




  .data

        externdef  MainPgmCoroutine__hla_:byte
        externdef  __imp__MessageBoxA@16:dword
        externdef  __imp__ExitProcess@4:dword
        align      (4)




end

Logged
TmX
Member
*****
Gender: Male
Posts: 317



Re: How to generate the MASM source code from HLA source code?
« Reply #4 on: November 11, 2011, 07:21:31 PM »

This error:
Quote
1_01HelloWorld.obj : error LNK2001: unresolved external symbol STDOUT_NEWLN
1_01HelloWorld.obj : error LNK2001: unresolved external symbol DefaultExceptionH
andler__hla_
1_01HelloWorld.obj : error LNK2001: unresolved external symbol HardwareException
__hla_
1_01HelloWorld.obj : error LNK2001: unresolved external symbol BuildExcepts__hla
_
1_01HelloWorld.obj : error LNK2001: unresolved external symbol STDOUT_PUTS
1_01HelloWorld.obj : error LNK2001: unresolved external symbol __imp__ExitProces
s@4
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1_01HelloWorld.exe : fatal error LNK1120: 7 unresolved externals
_
Link error

happened because the linker couldn't found the required lib. It's hlalib.lib (in my system, it's could be found in C:\hla\hlalib.lib).

After some trial and errors, I could build the code correctly using this command.
Quote
link /subsystem:console /entry:HLAMain /libpath:C:\hla\hlalib hlalib.lib /libpath:C:\masm32\lib kernel32.lib user32.lib 1_01HelloWorld.obj

I don't know how to do that from Qeditor, though.
Logged
bolzano_1989
Member
**
Posts: 35


Re: How to generate the MASM source code from HLA source code?
« Reply #5 on: November 12, 2011, 03:41:24 PM »

Is there anyway to generate MASM source code (from HLA source code) independent from those lib files from HLA BigGrin ?
Logged
TmX
Member
*****
Gender: Male
Posts: 317



Re: How to generate the MASM source code from HLA source code?
« Reply #6 on: November 12, 2011, 05:03:25 PM »

Well honestly I don't know.
Maybe you'd better ask Mr Hyde wink
Logged
Sevag.K
Member
*****
Posts: 469



Re: How to generate the MASM source code from HLA source code?
« Reply #7 on: November 15, 2011, 04:12:57 AM »

Is there anyway to generate MASM source code (from HLA source code) independent from those lib files from HLA BigGrin ?

yeah, don't use the lib files.
Logged

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!