This commit is contained in:
Koichi Nakamura 2020-12-29 14:41:03 +09:00
parent 41a39200c7
commit 7674970c2d
2 changed files with 21 additions and 14 deletions

View file

@ -6,13 +6,14 @@ $ make
# Builtin Words # Builtin Words
| char | semantics | | code | name | semantics |
|:----:|:-----------------------------------------:| |:----:|:--------:|:-----------------------------------------:|
| Q | ( -- ) Exit the process | | Q | quit | ( -- ) Exit the process |
| C | ( -- n ) The size of Cells | | C | cell | ( -- n ) The size of Cells |
| h | ( -- addr ) The address of 'here' cell | | h | here | ( -- addr ) The address of 'here' cell |
| l | ( -- addr ) The address of 'latest' cell | | l | latest | ( -- addr ) The address of 'latest' cell |
| k | ( -- n ) Read character | | k | key | ( -- n ) Read character |
| t | ( n -- ) Print character | | t | type | ( n -- ) Print character |
| j | ( -- ) Unconditional branch. | | j | jump | ( -- ) Unconditional branch. |
| J | ( a -- ) Jump if a == 0. | | J | 0jump | ( a -- ) Jump if a == 0. |
| f | find | ( c -- ) Find CFA of word 'c' |

View file

@ -6,12 +6,12 @@
00000028: 3400 2000 0100 0000 e_ehsize,e_phentsize,e_phnum,e_shentsize 00000028: 3400 2000 0100 0000 e_ehsize,e_phentsize,e_phnum,e_shentsize
00000030: 0000 0000 0100 0000 e_shnum,e_shstrndx,<phdr> PT_LOAD 00000030: 0000 0000 0100 0000 e_shnum,e_shstrndx,<phdr> PT_LOAD
00000038: 0000 0000 0080 0408 p_offset,p_vaddr=0x08048000 00000038: 0000 0000 0080 0408 p_offset,p_vaddr=0x08048000
00000040: 0000 0000 bd01 0000 p_paddr,p_filesz 00000040: 0000 0000 f001 0000 p_paddr,p_filesz
00000048: 0000 0008 0700 0000 p_memsz(128MB),PF_X|PF_W|PF_R 00000048: 0000 0008 0700 0000 p_memsz(128MB),PF_X|PF_W|PF_R
00000050: 0010 0000 0200 0000 p_align, <here> 00000050: 0010 0000 0200 0000 p_align, <here>
00000058: 0300 0000 4881 0408 <latest>, <interpreter>(5c: key) 00000058: c081 0408 4881 0408 <latest:init="f">, <interpreter>(5c: key)
00000060: b081 0408 f8ff ffff (60: jump if zero) (64: -8) 00000060: c881 0408 8880 0408 (60: find) (64: quit)
00000068: 8880 0408 0000 0000 (68: quit) (6c: 0) 00000068: 8880 0408 0000 0000 (68: 0) (6c: 0)
00000070: be5c 8004 08bd 0080 (70: movl $interpreter,%esi) (75: movl $0x10048000,%ebp) 00000070: be5c 8004 08bd 0080 (70: movl $interpreter,%esi) (75: movl $0x10048000,%ebp)
00000078: 0410 adff 2000 0000 (7a: next) 00000078: 0410 adff 2000 0000 (7a: next)
00000080: 0000 0000 0151 0000 "Q" quit 00000080: 0000 0000 0151 0000 "Q" quit
@ -42,3 +42,9 @@
000001a8: 9081 0408 014a 0000 "J" jump if zero 000001a8: 9081 0408 014a 0000 "J" jump if zero
000001b0: b481 0408 5885 c074 popl %eax; test %eax,%eax;je 19c(-29) 000001b0: b481 0408 5885 c074 popl %eax; test %eax,%eax;je 19c(-29)
000001b8: e3ad adff 2000 0000 lodsl; next; 000001b8: e3ad adff 2000 0000 lodsl; next;
000001c0: a881 0408 0166 0000 "f" find
000001c8: cc81 0408 8a24 24b0 movb (%esp),%ah;movb $1,%al;
000001d0: 018b 0d58 8004 088b movl latest,%ecx;<1>movl 4(%ecx),%ebx;
000001d8: 5904 6639 c374 048b cmpw %ax,%bx;je 2f;movl (%ecx),%ecx
000001e0: 09eb f483 c108 890c jmp 1b(-12);<2>addl $8,%ecx;movl %ecx,(%esp)
000001e8: 24ad ff20 0000 0000 next;