Added M80 example

This commit is contained in:
Willem Cazander 2021-07-06 03:52:02 +02:00
parent 656c3436da
commit 6cec28f1bc
13 changed files with 110 additions and 77 deletions

View file

@ -0,0 +1,27 @@
TEST_AHELLO_SDCC := $(PATH_BIN)/test/ahello-sdcc
BUILD_HELP += \\n\\t* $(TEST_AHELLO_SDCC)/ahello.com\\n\\t* test-ahello-sdcc-run\\n\\t* test-ahello-sdcc-assert
$(TEST_AHELLO_SDCC):
$(call mb_mkdir,$(TEST_AHELLO_SDCC))
$(TEST_AHELLO_SDCC)/%.rel: test/ahello-sdcc/%.asm | $(TEST_AHELLO_SDCC)
$(call mb_compile_asm,$@,$<)
$(TEST_AHELLO_SDCC)/ahello.hex: $(TEST_AHELLO_SDCC)/ahello.rel
$(call mb_link_asm_dos,$(TEST_AHELLO_SDCC)/ahello.hex,$(TEST_AHELLO_SDCC)/ahello.rel)
$(TEST_AHELLO_SDCC)/ahello.com: $(TEST_AHELLO_SDCC)/ahello.hex
$(call mb_hex2com,$(TEST_AHELLO_SDCC)/ahello.hex,$(TEST_AHELLO_SDCC)/ahello.com)
.PHONY: test-ahello-sdcc-run
test-ahello-sdcc-run: $(TEST_AHELLO_SDCC)/ahello.com
$(call mb_autoexec_open_gui,$(TEST_AHELLO_SDCC))
$(call mb_openmsx_dos2,$(TEST_AHELLO_SDCC))
.PHONY: test-ahello-sdcc-assert
test-ahello-sdcc-assert: $(TEST_AHELLO_SDCC)/ahello.com
$(call mb_delete,$(TEST_AHELLO_SDCC)/test.out)
$(call mb_autoexec_cmd_test,$(TEST_AHELLO_SDCC),ahello > test.out)
$(call mb_openmsx_dos2,$(TEST_AHELLO_SDCC))
grep "SDCC: Hello world..." $(TEST_AHELLO_SDCC)/test.out

View file

@ -0,0 +1,42 @@
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: Hello world..."
.db 0x1D
TXT_HELLO_SRC:
.str "from asm."
.db 0x0D,0x0A
.db 0x1D
.area _DATA