68080 asm: Print message on console

Open this code in devpac, ctrl+a to assemble it.

Open a shell, go to the drawer where this source file is stored.

Execute. It should display a message.

* print message on console
* credits pisklak for the code

    include exec/types.i
    include exec/libraries.i
    include exec/exec_lib.i
    include dos/dos_lib.i

LF  EQU 10  

*   CALLSYS  MACRO
*   LINKLIB  _LVO\1,\2
*   ENDM
    
    move.l   $4,_ExecBase
    lea      _DosName,A1
    move.l   #0,d0
    CALLEXEC OpenLibrary
    move.l   d0,_DOSBase
    
    CALLDOS  Output
    move.l   d0,_stdout
    
    move.l   _stdout,d1
    move.l   #PiskMessage,d2
    move.l   #PiskMessage_SIZEOF,d3
       	  
    CALLDOS  Write

Close_Dos
    move.l   _DOSBase,A1
    CALLEXEC CloseLibrary
    
ENDPRG  RTS

_ExecBase    dc.l    0   
_DOSBase     dc.l    0
_DosName     dc.b    "dos.library",0
_stdout      dc.l    0

PiskMessage  dc.b    "Vampire Rulez ! 68k ASM rulez !!!",LF,LF,LF,0
PiskMessage_SIZEOF   EQU *-PiskMessage

You are here: start » apollo_core » code_samples » print_message_on_console

Last modified: le 2019/11/23 09:12