40 likes | 191 Vues
This document presents a simple "Hello, World!" program implemented in three different assembly languages: MS-DOS, Linux, and RISC OS. Each code segment demonstrates how to output the message "Hello, World!" using system calls specific to each operating system. The MS-DOS version utilizes the DOS interrupt for output, while the Linux implementation employs system calls for writing to standard output. The RISC OS version showcases the use of software interrupts to achieve the same goal. This comprehensive comparison aids in understanding assembly programming across different platforms.
E N D
PC / MS-DOS code segment para assume cs:code,ds:code org 0100h start: movdx,offset message ;point to message mov ah,09h ;func# to printstring int 21h ;call DOS mov ax,4c00h ;exit int 21h Message db 'Hello World!',13,10,'$' end start
PC / Linux section .data ;data section declaration msg db 'Hello World!',0AH lenequ $-msg ;string length section .text ;code section declaration global _start ;entry point _start: movedx,len ;string length movecx,msg ;string start mov ebx,1 ;file handle: stdout mov eax,4 ;sys_write int 80h ;kernel system call mov ebx,0 ;return value mov eax,1 ;sys_exit int 80h ;kernel system call
ARM / RISC-OS .start STMFD (sp!), {R0-R12, lr} ADR R0, message SWI OS_Write0 LDMFD (sp!), {R0-R12, pc} .message EQUS "Hello, world!" EQUB 0