From 67d25d837ac55f28a366c0a3b262e439a6e75fc3 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 19 Aug 2017 12:15:28 +0200 Subject: Add AmForth --- amforth-6.5/avr8/amforth-eeprom.inc | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 amforth-6.5/avr8/amforth-eeprom.inc (limited to 'amforth-6.5/avr8/amforth-eeprom.inc') diff --git a/amforth-6.5/avr8/amforth-eeprom.inc b/amforth-6.5/avr8/amforth-eeprom.inc new file mode 100644 index 0000000..d71eeb0 --- /dev/null +++ b/amforth-6.5/avr8/amforth-eeprom.inc @@ -0,0 +1,64 @@ + .dw -1 ; EEPROM Address 0 should not be used +; some configs +CFG_DP: .dw DPSTART ; Dictionary Pointer +EE_HERE: .dw HERESTART ; Memory Allocation +EE_EHERE: .dw EHERESTART ; EEProm Memory Allocation +CFG_WLSCOPE: .dw XT_GET_CURRENT ; default wordlist scope +CFG_FORTHRECOGNIZER: .dw CFG_RECOGNIZERLISTLEN ; Recognizer word set +; LEAVE stack is between data stack and return stack. +CFG_LP0: .dw stackstart+1 +CFG_TURNKEY: .dw XT_APPLTURNKEY ; TURNKEY +CFG_ENVIRONMENT:.dw VE_ENVHEAD ; environmental queries +CFG_CURRENT: .dw CFG_FORTHWORDLIST ; forth-wordlist +CFG_FORTHWORDLIST:.dw VE_HEAD ; pre-defined (compiled in) wordlist +CFG_ORDERLISTLEN: + .dw 1 +CFG_ORDERLIST: ; list of wordlist id, exactly numwordlist entries + .dw CFG_FORTHWORDLIST ; get/set-order + .byte (NUMWORDLISTS-1)*CELLSIZE ; one slot is already used +CFG_RECOGNIZERLISTLEN: + .dw 2 +CFG_RECOGNIZERLIST: + .dw XT_REC_FIND + .dw XT_REC_NUM + .byte (NUMRECOGNIZERS-2)*CELLSIZE ; two slots are already used + +EE_STOREI: + .dw XT_DO_STOREI ; Store a cell into flash + +; MARKER saves everything up to here. Nothing beyond gets saved +EE_MARKER: + .dw EE_MARKER + +; default user area +EE_INITUSER: + .dw 0 ; USER_STATE + .dw 0 ; USER_FOLLOWER + .dw rstackstart ; USER_RP + .dw stackstart ; USER_SP0 + .dw stackstart ; USER_SP + + .dw 0 ; USER_HANDLER + .dw 10 ; USER_BASE + + .dw XT_TX ; USER_EMIT + .dw XT_TXQ ; USER_EMITQ + .dw XT_RX ; USER_KEY + .dw XT_RXQ ; USER_KEYQ + .dw XT_SOURCETIB ; USER_SOURCE + .dw 0 ; USER_G_IN + .dw XT_REFILLTIB ; USER_REFILL + .dw XT_DEFAULT_PROMPTOK + .dw XT_DEFAULT_PROMPTERROR + .dw XT_DEFAULT_PROMPTREADY + +; calculate baud rate error +.equ UBRR_VAL = ((F_CPU+BAUD*8)/(BAUD*16)-1) ; smart round +.equ BAUD_REAL = (F_CPU/(16*(UBRR_VAL+1))) ; effective baud rate +.equ BAUD_ERROR = ((BAUD_REAL*1000)/BAUD-1000) ; error in pro mille + +.if ((BAUD_ERROR>BAUD_MAXERROR) || (BAUD_ERROR<-BAUD_MAXERROR)) + .error "Serial line cannot be set up properly (systematic baud error too high)" +.endif +EE_UBRRVAL: + .dw UBRR_VAL ; BAUDRATE -- cgit v1.2.3