aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/msp430/amforth-interpreter.asm
blob: 1862e84dbec8d5d581dc97ca8b067da5c860a89d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
DOCOLON: 
        PUSH IP         ; 3 save old IP on return stack
        MOV W,IP        ; 1 set new IP to PFA

.if WANT_INTERRUPTS==1
DO_NEXT:
	TST ISR
        JNZ DO_INTERRUPT
        MOV @IP+,W      ; fetch word address into W
DO_REALLY_NEXT:
        MOV @W+,PC      ; fetch code address into PC, W=PFA

DO_INTERRUPT:
	SUB    #2,PSP          ; save tos
        MOV    TOS,0(PSP)
	MOV    ISR,TOS         ; move to tos
	CLR ISR                ; clear flag register
        MOV #XT_ISREXEC, W
	JMP DO_REALLY_NEXT

irq1_handler:
	MOV #1, R15
	RETI
irq2_handler:
	MOV #2, R15
	RETI
irq3_handler:
	MOV #3, R15
	RETI
irq4_handler:
	MOV #4, R15
	RETI
irq5_handler:
	MOV #5, R15
	RETI
irq6_handler:
	MOV #6, R15
	RETI
irq7_handler:
	MOV #7, R15
	RETI
irq8_handler:
	MOV #8, R15
	RETI
irq9_handler:
	MOV #9, R15
	RETI
irq10_handler:
	MOV #10, R15
null_handler:
	RETI
.else
	NEXT
.endif