From 7dc8c19f7d6220c9e3dac43796faf77c4f11974f Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sat, 17 Oct 2009 23:22:41 +0200 Subject: Melon now loads a simple ASM application out of the ramfs The format is very simple, but an ELF loader is planned. --- Source/Applications/ASMApps/Makefile | 20 ++++++++++++++++++++ Source/Applications/ASMApps/syscalls.asm | 7 +++++++ Source/Applications/ASMApps/test | Bin 0 -> 62 bytes Source/Applications/ASMApps/test.asm | 20 ++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 Source/Applications/ASMApps/Makefile create mode 100644 Source/Applications/ASMApps/syscalls.asm create mode 100644 Source/Applications/ASMApps/test create mode 100644 Source/Applications/ASMApps/test.asm (limited to 'Source/Applications') diff --git a/Source/Applications/ASMApps/Makefile b/Source/Applications/ASMApps/Makefile new file mode 100644 index 0000000..8cc8bfd --- /dev/null +++ b/Source/Applications/ASMApps/Makefile @@ -0,0 +1,20 @@ +.PHONY: clean, mrproper + +ASM = nasm + +Applications = test + +all: $(Applications) + echo "* Done with ASM applications : $(Applications)" + +rebuild: mrproper all + +%: %.asm + echo "* Compiling $<..." + $(ASM) -o $@ $< + +clean: + echo "* Removing files..." + rm -rf $(Applications) + +mrproper: clean diff --git a/Source/Applications/ASMApps/syscalls.asm b/Source/Applications/ASMApps/syscalls.asm new file mode 100644 index 0000000..cdd5cc6 --- /dev/null +++ b/Source/Applications/ASMApps/syscalls.asm @@ -0,0 +1,7 @@ +[bits 32] + +dd 0xFEEDBEEF ; magic number ^^ +dd end - start + +%define SC_PUTCH 0xFFFFFF01 +%define SC_SLEEP 0xFFFFFF02 diff --git a/Source/Applications/ASMApps/test b/Source/Applications/ASMApps/test new file mode 100644 index 0000000..397abf1 Binary files /dev/null and b/Source/Applications/ASMApps/test differ diff --git a/Source/Applications/ASMApps/test.asm b/Source/Applications/ASMApps/test.asm new file mode 100644 index 0000000..80965b4 --- /dev/null +++ b/Source/Applications/ASMApps/test.asm @@ -0,0 +1,20 @@ +%include "syscalls.asm" + +start: + mov ecx, ' ' + 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 +end: -- cgit v1.2.3