diff options
Diffstat (limited to 'Source/Applications/SampleApps')
-rw-r--r-- | Source/Applications/SampleApps/Makefile | 29 | ||||
-rwxr-xr-x | Source/Applications/SampleApps/asmdemo | bin | 0 -> 4725 bytes | |||
-rw-r--r-- | Source/Applications/SampleApps/asmdemo.asm | 30 | ||||
-rw-r--r-- | Source/Applications/SampleApps/lib-melonasm.asm | 24 |
4 files changed, 83 insertions, 0 deletions
diff --git a/Source/Applications/SampleApps/Makefile b/Source/Applications/SampleApps/Makefile new file mode 100644 index 0000000..28dad49 --- /dev/null +++ b/Source/Applications/SampleApps/Makefile @@ -0,0 +1,29 @@ +.PHONY: clean, mrproper + +ASM = nasm +ASMFLAGS = -f elf +LD = ld +LDFLAGS = --entry=start -Ttext=40000000 + +Applications = asmdemo + +all: $(Applications) + echo "* Done with applications : $(Applications)" + +rebuild: mrproper all + +%: %.o + echo "* Linking $<..." + $(LD) $(LDFLAGS) $< -o $@ + +%.o: %.asm + echo "* Compiling $<..." + $(ASM) $(ASMFLAGS) -o $@ $< + +clean: + echo "* Removing object files..." + rm -rf *.o + +mrproper: clean + echo "* Removing applications..." + rm -rf $(Applications) diff --git a/Source/Applications/SampleApps/asmdemo b/Source/Applications/SampleApps/asmdemo Binary files differnew file mode 100755 index 0000000..9e6822d --- /dev/null +++ b/Source/Applications/SampleApps/asmdemo diff --git a/Source/Applications/SampleApps/asmdemo.asm b/Source/Applications/SampleApps/asmdemo.asm new file mode 100644 index 0000000..3037897 --- /dev/null +++ b/Source/Applications/SampleApps/asmdemo.asm @@ -0,0 +1,30 @@ +%include "lib-melonasm.asm" + +start: ; label used for calculating app size + mov ecx, [data] + mov ebx, ecx + mov eax, SC_WHEX + int 64 + mov eax, SC_PUTCH + mov ebx, 10 + int 64 + loop: + inc ecx + mov eax, SC_PUTCH ;temporarily defined for writing one char to screen + mov ebx, ecx + int 64 + mov eax, SC_SLEEP ;temporary syscall for sleeping + mov ebx, 30 ;20ms + int 64 + cmp ecx, 127 + jnz loop + mov eax, 0 + mov eax, SC_PUTCH + mov ebx, 10 ;newline + int 64 + int 66 ;finish task + +data: +dd 0x00000020 + +end: ; label used for calculating app size diff --git a/Source/Applications/SampleApps/lib-melonasm.asm b/Source/Applications/SampleApps/lib-melonasm.asm new file mode 100644 index 0000000..0845770 --- /dev/null +++ b/Source/Applications/SampleApps/lib-melonasm.asm @@ -0,0 +1,24 @@ +[bits 32] + +%ifidn __OUTPUT_FORMAT__, bin +; create a MelonBinary output + +%define MEM_ORIGIN 0x10000000 + +dd 0xFEEDBEEF ; magic number ^^ +dd end - start +dd MEM_ORIGIN + +; the ($-$$) permits not taking into account the header above +[org MEM_ORIGIN - ($-$$)] + +%elifidn __OUTPUT_FORMAT__, elf +; create an elf object + +[global start] + +%endif + +%define SC_PUTCH 0xFFFFFF01 +%define SC_SLEEP 0xFFFFFF02 +%define SC_WHEX 0xFFFFFF03 |