Add "?" and "$"

This commit is contained in:
Koichi Nakamura 2020-12-29 15:46:19 +09:00
parent 3c88577b47
commit 6b0eeceaab
2 changed files with 13 additions and 3 deletions

View file

@ -24,4 +24,6 @@ $ cat helloworld.fs | ./plank
| f | find | ( c -- xt ) Get execution token of c | | f | find | ( c -- xt ) Get execution token of c |
| x | execute | ( xt -- ... ) Run the execution token | | x | execute | ( xt -- ... ) Run the execution token |
| @ | fetch | ( addr -- a ) Load value from addr | | @ | fetch | ( addr -- a ) Load value from addr |
| ! | store | ( a addr -- ) Store a to addr | | ! | store | ( a addr -- ) Store value to addr |
| ? | cfetch | ( addr -- c ) Load byte from addr |
| $ | cstore | ( c addr -- ) Store byte to addr |

View file

@ -6,10 +6,10 @@
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 3002 0000 p_paddr,p_filesz 00000040: 0000 0000 6002 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: 1882 0408 4881 0408 <latest:init="!">, <interpreter>(5c: key) 00000058: 4882 0408 4881 0408 <latest:init="$">, <interpreter>(5c: key)
00000060: c881 0408 f881 0408 (60: find) (64: execute) 00000060: c881 0408 f881 0408 (60: find) (64: execute)
00000068: 9881 0408 f0ff ffff (68: jump) (6c: -16) 00000068: 9881 0408 f0ff ffff (68: jump) (6c: -16)
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)
@ -68,3 +68,11 @@
00000218: 0082 0408 0121 0000 !: store 00000218: 0082 0408 0121 0000 !: store
00000220: 2482 0408 585b 8918 popl %eax; popl %ebx; movl %ebx,(%eax) 00000220: 2482 0408 585b 8918 popl %eax; popl %ebx; movl %ebx,(%eax)
00000228: adff 2000 0000 0000 next; 00000228: adff 2000 0000 0000 next;
00000230: 1882 0408 013f 0000 ?: cfetch
00000238: 3c82 0408 580f b600 popl %eax; movzbl (%eax),%eax;
00000240: 50ad ff20 0000 0000 pushl %eax; next;
00000248: 3082 0408 0124 0000 $: cstore
00000250: 5482 0408 585b 8818 popl %eax; popl %ebx; movb %bl,(%eax)
00000258: adff 2000 0000 0000 next;