Skip to content

Commit

Permalink
Merge pull request #123 from TG9541/ucsim-workaround
Browse files Browse the repository at this point in the history
fixes #122 uCsim workaround
  • Loading branch information
TG9541 authored Nov 26, 2017
2 parents ec994c3 + 5e9d9b0 commit 014fcae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 10 additions & 8 deletions forth.asm
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ _TIM2_UO_IRQHandler:
POPW X
LDW USREMIT,X

POP USRBASE+1
POP USRBASE+1 ; this may not work in uCsim

POPW X
LDW YTEMP,X
Expand Down Expand Up @@ -2324,8 +2324,8 @@ BASEAT:

HEADER NUMBQ "NUMBER?"
NUMBQ:
PUSH USRBASE+1
PUSH #0 ; sign flag
LDW Y,USRBASE
PUSHW Y ; note: (1,SP) used as sign flag

CALL ZERO
CALL OVER
Expand Down Expand Up @@ -2406,8 +2406,9 @@ NUMQ5: ; THEN
CALL DUPP
; fall through
NUMQ6:
POP A ; sign flag
POP USRBASE+1 ; restore BASE
POP A ; discard sign flag
POP A ; restore BASE
LD USRBASE+1,A
NUMDROP:
JP DROP

Expand Down Expand Up @@ -3407,8 +3408,8 @@ NEXT:

.ifne HAS_DOLOOP
.ifeq BOOTSTRAP
; DO ( -- a )
; Start a DO LOOP loop
; DO ( n1 n2 -- )
; Start a DO LOOP loop from n1 to n2
; structure in a colon definition.

HEADFLG DOO "DO" IMEDD
Expand Down Expand Up @@ -3959,7 +3960,8 @@ DUMP1: CALL CR
CALL DONXT
.dw DUMP1 ; loop till done
DUMP3:
POP USRBASE+1 ; restore radix
POP A
LD USRBASE+1,A ; restore radix
JP DROP
.endif

Expand Down
3 changes: 1 addition & 2 deletions lib/utils/tester.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ CREATE RESULTS 12 2* ALLOT
#RESULTS @ ?DUP IF
1- DUP FOR DUP I - 2* RESULTS + ? NEXT DROP
THEN 1 ;
: T{ ( -- )
DECIMAL ;
: T{ ( -- ) ;
: -> ( ... -- )
\ save stack depth and result values
DEPTH DUP #RESULTS !
Expand Down

0 comments on commit 014fcae

Please sign in to comment.