Mix C and assembly, minor modifications to print routines.

This commit is contained in:
giomba 2023-10-13 09:08:22 +02:00
parent 640314be8a
commit 06f240dd6d
5 changed files with 32 additions and 3 deletions

View File

@ -1,7 +1,8 @@
PROJECT := demo
SRC = \
src/ceda_print.c \
src/ceda_print_a.asm \
src/ceda_print_c.c \
src/main.c \
\

View File

@ -1,7 +1,8 @@
#ifndef CEDA_PRINT_H
#define CEDA_PRINT_H
void ceda_print(const char* s);
void ceda_cls(void);
void ceda_print(const char *s);
#endif // CEDA_PRINT_H

26
src/ceda_print_a.asm Normal file
View File

@ -0,0 +1,26 @@
SECTION code
PUBLIC _ceda_cls
_ceda_cls:
push af
push bc
push de
push hl
ld hl,$d000
ld de,2000
ld c,$20
_ceda_cls_loop:
ld (hl),c
inc hl
dec de
ld a,d
or e
jp nz,_ceda_cls_loop
pop hl
pop de
pop bc
pop af
ret

View File

@ -4,6 +4,7 @@ int globalvar = 0x7777;
int main(void) {
ceda_print("Hello world!");
ceda_cls();
return 0;
}