aboutsummaryrefslogtreecommitdiff
path: root/ia32
diff options
context:
space:
mode:
Diffstat (limited to 'ia32')
-rw-r--r--ia32/bitwise.sts27
-rw-r--r--ia32/branch.sts11
-rw-r--r--ia32/const.sts3
-rw-r--r--ia32/core.sts17
-rw-r--r--ia32/elf/begin.sts129
-rw-r--r--ia32/elf/end.sts21
-rw-r--r--ia32/elf/syscall.sts41
-rw-r--r--ia32/float/control.sts19
-rw-r--r--ia32/float/float.sts3
-rw-r--r--ia32/float/math.sts32
-rw-r--r--ia32/float/stack.sts25
-rw-r--r--ia32/ia32.sts8
-rw-r--r--ia32/macro.sts86
-rw-r--r--ia32/math.sts68
-rw-r--r--ia32/memory.sts10
-rw-r--r--ia32/stack.sts41
16 files changed, 0 insertions, 541 deletions
diff --git a/ia32/bitwise.sts b/ia32/bitwise.sts
deleted file mode 100644
index 205e618..0000000
--- a/ia32/bitwise.sts
+++ /dev/null
@@ -1,27 +0,0 @@
-defasm xor
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 31 ?' # d8 ?' ; xor eax, ebx
- # 50 ?' ; push eax
-next
-
-defasm and
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 21 ?' # d8 ?' ; and eax, ebx
- # 50 ?' ; push eax
-next
-
-defasm shr
- # 59 ?' ; pop ecx
- # 58 ?' ; pop eax
- # d3 ?' # e8 ?' ; shr eax, cl
- # 50 ?' ; push eax
-next
-
-defasm shl
- # 59 ?' ; pop ecx
- # 58 ?' ; pop eax
- # d3 ?' # e0 ?' ; shl eax, cl
- # 50 ?' ; push eax
-next
diff --git a/ia32/branch.sts b/ia32/branch.sts
deleted file mode 100644
index 35177f6..0000000
--- a/ia32/branch.sts
+++ /dev/null
@@ -1,11 +0,0 @@
-defasm branch
- # 8b ?' # 36 ?' ; mov esi, [esi]
-next
-
-defasm 0branch
- # 58 ?' ; pop eax
- # 83 ?' # c6 ?' # 4 ?' ; add esi, 4
- # 83 ?' # f8 ?' # 0 ?' ; cmp eax, 0
- # 75 ?' # 3 ?' ; jne +3
- # 8b ?' # 76 ?' # fc ?' ; mov esi, [esi - 4]
-next
diff --git a/ia32/const.sts b/ia32/const.sts
deleted file mode 100644
index 31f8041..0000000
--- a/ia32/const.sts
+++ /dev/null
@@ -1,3 +0,0 @@
-defconst word_size 4
-defconst word_max ffffffff
-defconst word_endianness 0
diff --git a/ia32/core.sts b/ia32/core.sts
deleted file mode 100644
index 4a5e692..0000000
--- a/ia32/core.sts
+++ /dev/null
@@ -1,17 +0,0 @@
-defasm docol
- # 83 ?' # ed ?' # 4 ?' ; sub ebp, 4
- # 89 ?' # 75 ?' # 0 ?' ; mov [ebp], esi
- # 83 ?' # c0 ?' # 4 ?' ; add eax, 4
- # 89 ?' # c6 ?' ; mov esi, eax
- # ad ?' # ff ?' # 20 ?' ; go next
-next
-
-defasm exit
- # 8b ?' # 75 ?' # 0 ?' ; mov esi, [ebp]
- # 83 ?' # c5 ?' # 4 ?' ; add ebp, 4
-next
-
-defasm lit
- # ad ?' ; lodsd
- # 50 ?' ; push eax
-next
diff --git a/ia32/elf/begin.sts b/ia32/elf/begin.sts
deleted file mode 100644
index 8dab930..0000000
--- a/ia32/elf/begin.sts
+++ /dev/null
@@ -1,129 +0,0 @@
-?create ?? _code_segment
-_code_segment ?choose
-
-# 08048000 ?org
-# 4 ?size
-# 0 ?endianness
-
-?create ?? _data_segment
-_data_segment ?choose
-
-# 09048000 ?org
-# 4 ?size
-# 0 ?endianness
-
-_code_segment ?choose
-
-; ELF header
-; EI_MAG - ELF magic number
-# 7f ?' # 45 ?' # 4c ?' # 46 ?'
-; EI_CLASS - 32-bit format
-# 1 ?'
-; EI_DATA - little-endiann
-# 1 ?'
-; EI_VERSION - current ELF header version
-# 1 ?'
-; EI_OSABI - Linux ABI
-# 3 ?'
-; EI_ABIVERSION - none
-# 0 ?'
-; EI_PAD - padding
-# 7 ?res
-; Executable file type
-# 2 ?2.
-; IA-32 architecture
-# 3 ?2.
-; ELF version
-# 1 ?4.
-; Entry point
-?$ ?? _elf_entry
-# 0 ?4.
-; Program headers offset
-# 34 ?4.
-; Section headers offset
-# 0 ?4.
-; Extra flags
-# 0 ?4.
-; ELF header size
-# 34 ?2.
-; Program header size
-# 20 ?2.
-; Number of program headers
-# 2 ?2.
-; Section header size
-# 28 ?2.
-; Number of section headers
-# 0 ?2.
-; Section name section index
-# 0 ?2.
-
-; ELF CODE PROGRAM HEADER
-; Segment type
-# 1 ?4.
-; Segment offset
-# 0 ?4.
-; Segment virtual address
-?$$ ?4.
-; Segment physical address
-?$$ ?4.
-; Segment file size
-?$ ?? _code_segment_file_size
-# 0 ?4.
-; Segment memory size
-?$ ?? _code_segment_memory_size
-# 0 ?4.
-; Segment flags
-# 5 ?4.
-; Segment alignment
-# 1000 ?4.
-
-; ELF DATA PROGRAM HEADER
-; Segment type
-# 1 ?4.
-; Segment offset
-?$ ?? _data_segment_offset
-# 0 ?4.
-; Segment virtual address
-_data_segment ?choose
-?$$
-_code_segment ?choose
-?4.
-; Segment physical address
-_data_segment ?choose
-?$$
-_code_segment ?choose
-?4.
-; Segment file size
-?$ ?? _data_segment_file_size
-# 0 ?4.
-; Segment memory size
-?$ ?? _data_segment_memory_size
-# 0 ?4.
-; Segment flags
-# 6 ?4.
-; Segment alignment
-# 1000 ?4.
-
-; Return stack
-_data_segment ?choose
-1000 ?res
-?$ ?dup ?? _return_stack
-_code_segment ?choose
-
-; PROGRAM ENTRY CODE
-?$ _elf_entry ?!
-; mov ebp, _return_stack
-# bd ?'
-_return_stack ?.
-; mov esi, _threaded_code_entry
-# be ?'
-?$ ?? _threaded_code_entry
-# 0 ?.
-; lodsd
-# ad ?'
-; jmp dword [eax]
-# ff ?' # 20 ?'
-
-module ia32/ia32.sts
-module ia32/elf/syscall.sts
-module common/common.sts
diff --git a/ia32/elf/end.sts b/ia32/elf/end.sts
deleted file mode 100644
index 7c80eec..0000000
--- a/ia32/elf/end.sts
+++ /dev/null
@@ -1,21 +0,0 @@
-; Code segment alignment
-# 1000 ?$ # 1000 ?mod ?- ?dup ?res
-
-; Code segment ELF sizes
-?$ ?$$ ?- _code_segment_file_size ?!
-?$ ?$$ ?- _code_segment_memory_size ?!
-
-; Data segment ELF offset
-?$ ?$$ ?-
-_code_segment ?choose
-_data_segment_offset ?!
-
-; Data segment ELF sizes
-_data_segment ?choose
-?$ ?$$ ?-
-_code_segment ?choose
-_data_segment_file_size ?!
-_data_segment ?choose
-?$ ?$$ ?-
-_code_segment ?choose
-_data_segment_memory_size ?!
diff --git a/ia32/elf/syscall.sts b/ia32/elf/syscall.sts
deleted file mode 100644
index 3acfef2..0000000
--- a/ia32/elf/syscall.sts
+++ /dev/null
@@ -1,41 +0,0 @@
-defasm sys_exit
- # b8 ?' # 1 ?. ; mov eax, 1
- # 31 ?' # db ?' ; xor ebx, ebx
- # cd ?' # 80 ?' ; int 0x80
-; no need in next since this is the last instruction
-
-_data_segment ?choose
- ?$ ?? _iobuf # 0 ?.
-_code_segment ?choose
-
-defasm sys_read
- # b8 ?' # 3 ?. ; mov eax, 3
- # 31 ?' # db ?' ; xor ebx, ebx
- # b9 ?' _iobuf ?. ; mov ecx, _iobuf
- # ba ?' # 1 ?. ; mov edx, 1
- # cd ?' # 80 ?' ; int 0x80
- # 31 ?' # db ?' ; xor ebx, ebx
- # 8a ?' # 1d ?' _iobuf ?. ; mov bl, [_iobuf]
- # 53 ?' ; push ebx
- # 50 ?' ; push eax
-next
-
-defasm sys_write
- # 58 ?' ; pop eax
- # a2 ?' _iobuf ?. ; mov [_iobuf], al
- # b8 ?' # 4 ?. ; mov eax, 4
- # bb ?' # 1 ?. ; mov ebx, 1
- # b9 ?' _iobuf ?. ; mov ecx, _iobuf
- # ba ?' # 1 ?. ; mov edx, 1
- # cd ?' # 80 ?' ; int 0x80
-next
-
-defasm sys_write_err
- # 58 ?' ; pop eax
- # a2 ?' _iobuf ?. ; mov [_iobuf], al
- # b8 ?' # 4 ?. ; mov eax, 4
- # bb ?' # 2 ?. ; mov ebx, 2
- # b9 ?' _iobuf ?. ; mov ecx, _iobuf
- # ba ?' # 1 ?. ; mov edx, 1
- # cd ?' # 80 ?' ; int 0x80
-next
diff --git a/ia32/float/control.sts b/ia32/float/control.sts
deleted file mode 100644
index 3863f5f..0000000
--- a/ia32/float/control.sts
+++ /dev/null
@@ -1,19 +0,0 @@
-defasm float_init
- # 9b ?' ; wait
- # db ?' # e3 ?' ; fninit
-next
-
-defasm float_cload
- # d9 ?' # 2c ?' # 24 ?' ; fldcw [esp]
- # 58 ?' ; pop eax
-next
-
-defasm float_sstore
- # 9b ?' # df ?' # e0 ?' ; fstsw ax
- # 50 ?' ; push eax
-next
-
-defasm float_cstore
- # 50 ?' ; push eax
- # d9 ?' # 3c ?' # 24 ?' ; fstcw [esp]
-next
diff --git a/ia32/float/float.sts b/ia32/float/float.sts
deleted file mode 100644
index d6907ca..0000000
--- a/ia32/float/float.sts
+++ /dev/null
@@ -1,3 +0,0 @@
-module ia32/float/control.sts
-module ia32/float/stack.sts
-module ia32/float/math.sts
diff --git a/ia32/float/math.sts b/ia32/float/math.sts
deleted file mode 100644
index d02b491..0000000
--- a/ia32/float/math.sts
+++ /dev/null
@@ -1,32 +0,0 @@
-defasm float_add
- # de ?' # c1 ?' ; faddp st1, st0
-next
-
-defasm float_sub
- # de ?' # e9 ?' ; fsubp st1, st0
-next
-
-defasm float_mul
- # de ?' # c9 ?' ; fmullp st1, st0
-next
-
-defasm float_div
- # de ?' # f9 ?' ; fdivp st1, st0
-next
-
-defasm float_sqrt
- # d9 ?' # fa ?' ; fsqrt
-next
-
-defasm float_more
- # de ?' # d9 ?' ; fcompp
- # 9b ?' # df ?' # e0 ?' ; fstsw ax
- # 25 ?' # 100 ?. ; and eax, 0x100
- # c1 ?' # e8 ?' # 8 ?' ; shr eax, 8
- # 50 ?' ; push eax
-next
-
-defword float_less
- float_more
- 0 =
-exit
diff --git a/ia32/float/stack.sts b/ia32/float/stack.sts
deleted file mode 100644
index 8c16fef..0000000
--- a/ia32/float/stack.sts
+++ /dev/null
@@ -1,25 +0,0 @@
-defasm float_fload
- # d9 ?' # 04 ?' # 24 ?' ; fld dword [esp]
- # 58 ?' ; pop eax
-next
-
-defasm float_iload
- # db ?' # 04 ?' # 24 ?' ; fild dword [esp]
- # 58 ?' ; pop eax
-next
-
-defasm float_dload
- # df ?' # 2c ?' # 24 ?' ; fild qword [esp]
- # 58 ?' ; pop eax
- # 58 ?' ; pop eax
-next
-
-defasm float_fstore
- # 50 ?' ; push eax
- # d9 ?' # 1c ?' # 24 ?' ; fstp dword [esp]
-next
-
-defasm float_istore
- # 50 ?' ; push eax
- # db ?' # 1c ?' # 24 ?' ; fistp dword [esp]
-next
diff --git a/ia32/ia32.sts b/ia32/ia32.sts
deleted file mode 100644
index 38b5919..0000000
--- a/ia32/ia32.sts
+++ /dev/null
@@ -1,8 +0,0 @@
-module ia32/macro.sts
-module ia32/const.sts
-module ia32/core.sts
-module ia32/stack.sts
-module ia32/branch.sts
-module ia32/memory.sts
-module ia32/math.sts
-module ia32/bitwise.sts
diff --git a/ia32/macro.sts b/ia32/macro.sts
deleted file mode 100644
index fa9510b..0000000
--- a/ia32/macro.sts
+++ /dev/null
@@ -1,86 +0,0 @@
-[ next 0
- # ad ?' # ff ?' # 20 ?'
-]
-
-[ defasm 1
- [ %1% 0
- _%0% ?.
- \]
- ?$ ?? _%1%
- ?$ # 4 ?+ ?.
-]
-
-[ defword 1
- [ %1% 0
- _%0% ?.
- \]
- ?$ ?? _%1%
- _docol # 4 ?+ ?.
-]
-
-[ defconst 2
- defasm %1%
- # 68 ?' # %2% ?. ; push %2%
- next
-]
-
-[ defarr 2
- _data_segment ?choose
- ?$ ?? _%1%_arr
- # %2% # 4 ?* ?res
- _code_segment ?choose
- defasm %1%
- # 68 ?' _%1%_arr ?. ; push _%1%_arr
- next
-]
-
-[ defvar 1
- defarr %1% 1
-]
-
-[ as 1
- _data_segment ?choose
- defword %1%
- lit ?$ # 0 ?.
- exit
- _code_segment ?choose
- lit ?. !
-]
-
-[ literal 0
- lit # %1% ?.
-]
-
-[ set_entry 0
- ?$ _threaded_code_entry ?!
-]
-
-[ if 0
- 0branch ?$ # 0 ?.
-]
-
-[ fi 0
- ?$ ?swap ?!
-]
-
-[ else 0
- branch ?$ # 0 ?.
- ?swap ?$ ?swap ?!
-]
-
-[ do 0
- ?$
-]
-
-[ untilod 0
- 0branch ?.
-]
-
-[ until 0
- 0 = 0branch ?$ # 0 ?.
-]
-
-[ od 0
- branch ?swap ?.
- ?$ ?swap ?!
-]
diff --git a/ia32/math.sts b/ia32/math.sts
deleted file mode 100644
index 609a21a..0000000
--- a/ia32/math.sts
+++ /dev/null
@@ -1,68 +0,0 @@
-defasm +
- # 58 ?' ; pop eax
- # 01 ?' # 04 ?' # 24 ?' ; add [esp], eax
-next
-
-defasm -
- # 58 ?' ; pop eax
- # 29 ?' # 04 ?' # 24 ?' ; sub [esp], eax
-next
-
-defasm mul
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # f7 ?' # e3 ?' ; mul ebx
- # 50 ?' ; push eax
-next
-
-defasm mod
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 31 ?' # d2 ?' ; xor edx, edx
- # f7 ?' # f3 ?' ; div ebx
- # 52 ?' ; push edx
-next
-
-defasm div
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 31 ?' # d2 ?' ; xor edx, edx
- # f7 ?' # f3 ?' ; div ebx
- # 50 ?' ; push eax
-next
-
-defasm =
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 39 ?' # d8 ?' ; cmp eax, ebx
- # 0f ?' # 94 ?' # c0 ?' ; sete al
- # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al
- # 50 ?' ; push eax
-next
-
-defasm !=
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 39 ?' # d8 ?' ; cmp eax, ebx
- # 0f ?' # 95 ?' # c0 ?' ; setne al
- # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al
- # 50 ?' ; push eax
-next
-
-defasm <
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 39 ?' # d8 ?' ; cmp eax, ebx
- # 0f ?' # 92 ?' # c0 ?' ; setb al
- # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al
- # 50 ?' ; push eax
-next
-
-defasm >
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 39 ?' # d8 ?' ; cmp eax, ebx
- # 0f ?' # 97 ?' # c0 ?' ; seta al
- # 0f ?' # b6 ?' # c0 ?' ; movzx eax, al
- # 50 ?' ; push eax
-next
diff --git a/ia32/memory.sts b/ia32/memory.sts
deleted file mode 100644
index 240c598..0000000
--- a/ia32/memory.sts
+++ /dev/null
@@ -1,10 +0,0 @@
-defasm @
- # 58 ?' ; pop eax
- # ff ?' # 30 ?' ; push dword [eax]
-next
-
-defasm !
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 89 ?' # 03 ?' ; mov [ebx], eax
-next
diff --git a/ia32/stack.sts b/ia32/stack.sts
deleted file mode 100644
index e884098..0000000
--- a/ia32/stack.sts
+++ /dev/null
@@ -1,41 +0,0 @@
-defasm top
- # 54 ?' ; push esp
-next
-
-defasm ref
- # 58 ?' ; pop eax
- # c1 ?' # e0 ?' # 2 ?' ; shl eax, 2
- # 01 ?' # e0 ?' ; add eax, esp
- # 50 ?' ; push eax
-next
-
-defasm get
- # 58 ?' ; pop eax
- # 8b ?' # 4 ?' # 84 ?' ; mov eax, [esp + 4 * eax]
- # 50 ?' ; push eax
-next
-
-defasm set
- # 5b ?' ; pop ebx
- # 58 ?' ; pop eax
- # 89 ?' # 04 ?' # 9c ?' ; mov [esp + 4 * ebx], eax
-next
-
-defasm drop
- # 58 ?' ; pop eax
-next
-
-defasm dup
- # ff ?' # 34 ?' # 24 ?' ; push dword [esp]
-next
-
-defasm over
- # ff ?' # 74 ?' # 24 ?' # 4 ?' ; push dword [esp + 4]
-next
-
-defasm swap
- # 58 ?' ; pop eax
- # 5b ?' ; pop ebx
- # 50 ?' ; push eax
- # 53 ?' ; push ebx
-next