Add "j" and "J"

This commit is contained in:
Koichi Nakamura 2020-12-29 10:56:48 +09:00
parent 2aa9397d98
commit 7629eaf000
2 changed files with 11 additions and 3 deletions

View file

@ -14,3 +14,5 @@ $ make
| l | ( -- addr ) The address of 'latest' cell |
| k | ( -- n ) Read character |
| t | ( n -- ) Print character |
| j | ( -- ) Unconditional branch. |
| J | ( a -- ) Jump if a == 0. |

View file

@ -6,12 +6,12 @@
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
00000038: 0000 0000 0080 0408 p_offset,p_vaddr=0x08048000
00000040: 0000 0000 9001 0000 p_paddr,p_filesz
00000040: 0000 0000 bd01 0000 p_paddr,p_filesz
00000048: 0000 0008 0700 0000 p_memsz(128MB),PF_X|PF_W|PF_R
00000050: 0010 0000 0200 0000 p_align, <here>
00000058: 0300 0000 4881 0408 <latest>, <interpreter>(5c: key)
00000060: 7081 0408 8880 0408 (60: find) (64: execute)
00000068: 0000 0000 f0ff ffff (68: jump) (6c: -16)
00000060: b081 0408 f8ff ffff (60: jump if zero) (64: -8)
00000068: 8880 0408 0000 0000 (68: quit) (6c: 0)
00000070: be5c 8004 08bd 0080 (70: movl $interpreter,%esi) (75: movl $0x10048000,%ebp)
00000078: 0410 adff 2000 0000 (7a: next)
00000080: 0000 0000 0151 0000 "Q" quit
@ -36,3 +36,9 @@
00000178: 0089 e1bb 0100 0000 movl %esp,%ecx; movl $1,%ebx (STDOUT)
00000180: b804 0000 00cd 8083 movl $SYS_WRITE,%eax; int $0x80
00000188: c404 adff 2000 0000 addl $4,%esp; next
00000190: 6881 0408 016a 0000 "j" jump
00000198: 9c81 0408 0336 adff addl (%esi),%esi; next;
000001a0: 2000 0000 0000 0000
000001a8: 9081 0408 014a 0000 "J" jump if zero
000001b0: b481 0408 5885 c074 popl %eax; test %eax,%eax;je 19c(-29)
000001b8: e3ad adff 20 lodsl; next;