43 lines
500 B
NASM
43 lines
500 B
NASM
|
|
DOS .equ 0x5
|
|
_CONOUT .equ 0x02
|
|
|
|
.area _CODE
|
|
JP START
|
|
|
|
.db 0x0D ; type hello.com
|
|
.db 0x0D,0x0A
|
|
.str "Example hello world executable."
|
|
.db 0x0D,0x0A
|
|
.db 0x1A ; end txt
|
|
|
|
START:
|
|
LD HL,#TXT_HELLO
|
|
CALL PUT_TXT
|
|
LD HL,#TXT_HELLO_SRC
|
|
CALL PUT_TXT
|
|
RET
|
|
|
|
PUT_TXT:
|
|
LD A,(HL)
|
|
CP #0x1D
|
|
RET Z
|
|
LD E,A
|
|
LD C,#2
|
|
PUSH HL
|
|
CALL DOS
|
|
POP HL
|
|
INC HL
|
|
JR PUT_TXT
|
|
|
|
TXT_HELLO:
|
|
.str "SDCC: Hello2world..."
|
|
.db 0x1D
|
|
|
|
TXT_HELLO_SRC:
|
|
.str "from asm."
|
|
.db 0x0D,0x0A
|
|
.db 0x1D
|
|
|
|
.area _DATA
|