Skip to content

Commit

Permalink
simplify some code
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotlinski committed Nov 29, 2019
1 parent 06af063 commit ccdd0d3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
10 changes: 0 additions & 10 deletions acmeforth
Original file line number Diff line number Diff line change
Expand Up @@ -834,15 +834,6 @@ def UM_MOD(): # ( lsw msw divisor -- rem quot )
stack[-2] = ctypes.c_short(n // d).value
stack.pop()

def M_PLUS(): # ( d1 u -- d2 )
lsw = stack[-3]
msw = stack[-2]
n = (msw << 16) | ctypes.c_ushort(lsw).value
n += stack[-1]
stack[-3] = ctypes.c_short(n).value
stack[-2] = ctypes.c_short(n >> 16).value
stack.pop()

def POSTPONE():
name = read_word().lower()
words = dictionary.words
Expand Down Expand Up @@ -1382,7 +1373,6 @@ add_word("code", CODE)
add_word("compile,", COMPILE_COMMA)
add_word("compile", COMPILE)
add_word("d+", D_PLUS)
add_word("m+", M_PLUS)
add_word("page", PAGE)
add_word("0", lambda : stack.append(0))

Expand Down
23 changes: 1 addition & 22 deletions src/words.fs
Original file line number Diff line number Diff line change
Expand Up @@ -100,28 +100,7 @@ create pad 84 allot
R> DROP 2DROP FALSE \ LENGTHS MISMATCH
THEN ;

code m+
ldy #0
lda MSB,x
bpl +
dey
+ clc
lda LSB,x
adc LSB+2,x
sta LSB+2,x
lda MSB,x
adc MSB+2,x
sta MSB+2,x
tya
adc LSB+1,x
sta LSB+1,x
tya
adc MSB+1,x
sta MSB+1,x
inx
rts
;code

: m+ s>d d+ ;
: dnegate invert >r invert r> 1 m+ ;

: fm/mod \ from Gforth
Expand Down

0 comments on commit ccdd0d3

Please sign in to comment.