Search code examples
assemblyopenvmsitanium

"Hello World" in Openvms/Itanium assembly example?


I've been searching the web for an example "Hello World" program written for the intel ia64 assembler on OpenVMS/Itanium. Has anybody done this?

Thanks


Solution

  • For a start, using printf from the crtl, leaving out unwind information directives:

    .vms_module_name "HELLO"
    .vms_module_version "V1.0"
    
    .section .rdata, "a", "progbits"
    .align 8
    .STRING:
    stringz "Hello World!\n"
    
    .global DECC$TXPRINTF
    .type DECC$TXPRINTF, @function
    
    .text
    .global HELLO
    .proc HELLO
    
    HELLO:
    
    PROLOGUE:
    alloc loc2 = ar.pfs, 0, 4, 1, 0
    mov loc3 = sp
    mov loc1 = b0
    
    CODE:
    addl out0 = @ltoff(.STRING), gp
    ;;
    ld8 out0 = [out0]
    mov loc0 = gp
    br.call.sptk.many b0 = DECC$TXPRINTF
    ;;
    
    EPILOGUE:
    mov gp = loc0
    mov ar.pfs = loc2
    mov b0 = loc1
    mov sp = loc3
    br.ret.sptk.many b0
    .endp HELLO