projects
/
rrq
/
rrqforth.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add DEPTH
[rrq/rrqforth.git]
/
compile.asm
diff --git
a/compile.asm
b/compile.asm
index 3d5433ef5ff133ae51dfd033492fbe7336ce4f17..71393bb31596e6d0e64c22be8316d192da238260 100644
(file)
--- a/
compile.asm
+++ b/
compile.asm
@@
-139,42
+139,56
@@
p_create_COPY:
pushr rsi
pop rcx ; ( -- chars* )
pop rsi ; ( -- )
pushr rsi
pop rcx ; ( -- chars* )
pop rsi ; ( -- )
- xor rdi,rdi
+ xor rdi,rdi ; value
+ mov rbx,1 ; sign (byte 0=0 means negative)
+ cmp qword [p_base_DFA],10
+ jne p_number_LOOP
+ cmp byte [rsi],'-'
+ jne p_number_LOOP
+ mov rbx,0
+ inc rsi
+ dec rcx
+ jle p_number_BAD
p_number_LOOP:
dec rcx
jl p_number_DONE
p_number_LOOP:
dec rcx
jl p_number_DONE
+ xor rax,rax ; clearing
lodsb
lodsb
- mov bl,al ; into bl
- cmp bl,'0'
+ cmp al,'0'
jl p_number_BAD
jl p_number_BAD
- cmp
b
l,'9'
+ cmp
a
l,'9'
jg p_number_ALPHA
jg p_number_ALPHA
- sub
b
l,'0'
+ sub
a
l,'0'
p_number_CONSUME:
p_number_CONSUME:
+ mov r8,rax
mov rax,rdi
mov rax,rdi
- mul qword [p_base_DFA]
- add rax,r
bx
+ mul qword [p_base_DFA]
; uses rdx:rax
+ add rax,r
8
mov rdi,rax
jmp p_number_LOOP
p_number_ALPHA:
mov rdi,rax
jmp p_number_LOOP
p_number_ALPHA:
- cmp
b
l,'A'
+ cmp
a
l,'A'
jl p_number_BAD
jl p_number_BAD
- cmp
b
l,'Z'
+ cmp
a
l,'Z'
jg p_number_alpha
jg p_number_alpha
- sub
b
l,'A'-10
+ sub
a
l,'A'-10
jmp p_number_CONSUME
p_number_alpha:
jmp p_number_CONSUME
p_number_alpha:
- cmp
b
l,'a'
+ cmp
a
l,'a'
jl p_number_BAD
jl p_number_BAD
- cmp
b
l,'z'
+ cmp
a
l,'z'
jg p_number_BAD
jg p_number_BAD
- sub
b
l,'a'-10
+ sub
a
l,'a'-10
jmp p_number_CONSUME
p_number_BAD:
push qword 0
popr rsi
next
p_number_DONE:
jmp p_number_CONSUME
p_number_BAD:
push qword 0
popr rsi
next
p_number_DONE:
+ cmp rbx,0
+ jne p_numper_POSITIVE
+ neg rdi
+p_numper_POSITIVE:
push rdi
push qword 1
popr rsi
push rdi
push qword 1
popr rsi
@@
-205,7
+219,7
@@
p_evaluate_stream_NOTWORD:
dq p_drop ; ( -- chars* n )
dq p_number ; ( -- [ 0 ]/[ v 1 ] )
dq p_dup
dq p_drop ; ( -- chars* n )
dq p_number ; ( -- [ 0 ]/[ v 1 ] )
dq p_dup
- BRANCH 0,p_evaluate_stream_BAD ; branch if 0
on TOP
+ BRANCH 0,p_evaluate_stream_BAD ; branch if 0
dq p_drop
BRANCH ,p_evaluate_stream_LOOP
p_evaluate_stream_END:
dq p_drop
BRANCH ,p_evaluate_stream_LOOP
p_evaluate_stream_END: