Skip to content

Commit

Permalink
Move FILL to assembler
Browse files Browse the repository at this point in the history
  • Loading branch information
davazp committed Apr 15, 2012
1 parent bea598a commit 595dcc8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 0 additions & 3 deletions core.fs
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,6 @@
: min
2dup > if nip else drop then ;

: fill ( c-addr u c -- )
-rot 0 ?do 2dup c! 1+ loop 2drop ;

: pick ( xn ... x0 u -- xn ... x0 xu )
1+ cells sp + @ ;

Expand Down
22 changes: 22 additions & 0 deletions forth.S
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,18 @@ BUILTIN_WORD_NAME(cmove_to, "cmove>")
END_WORD(cmove_to)


BUILTIN_WORD(fill)
pushl %edi
movl (%esi), %eax
movl 4(%esi), %ecx
movl 8(%esi), %edi
rep stosb
popl %edi
addl $12, %esi
ret
END_WORD(fill)


/* port -- n */
BUILTIN_WORD(inputb)
xorl %eax, %eax
Expand Down Expand Up @@ -577,6 +589,16 @@ BUILTIN_WORD_NAME(divide, "/")
END_WORD(divide)


BUILTIN_WORD_NAME(udivide, "u/")
xorl %edx, %edx
movl 4(%esi), %eax
divl (%esi)
addl $4, %esi
movl %eax, (%esi)
ret
END_WORD(udivide)


BUILTIN_WORD(mod)
movl 4(%esi), %eax
cdq
Expand Down

0 comments on commit 595dcc8

Please sign in to comment.