-
Notifications
You must be signed in to change notification settings - Fork 85
/
transx
125 lines (125 loc) · 2.7 KB
/
transx
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
.PAG 'TRANSX 5/02/83'
; TXJMP - TRANSFER-OF-EXECUTION JUMPER
; ENTRY - .A=SEG # .X=LOW .Y=HIGH
; CALLER MUST BE A JSR TXJMP
; ALL REGISTERS AND I6509 DESTROYED
; RETURNS DIRECTLY TO CALLER...
;
TXJMP ;BP ROUTINE
STA I6509
TXA
CLC
ADC #2
BCC TXJMP1
INY
TXJMP1 TAX
TYA
PHA
TXA
PHA
JSR IPINIT ;GO INITILIZE IPOINT
LDA #$FE
STA (IPOINT)Y
;
; 04/14/83 BP
; TRANSFER EXEC ROUTINES FOR CBM2
;
EXSUB PHP ;SAVE STATUS
SEI
PHA ;.A
TXA
PHA ;.X
TYA
PHA ;.Y
JSR IPINIT ;INIT IPOINT AND LOAD STACK FROM XFER SEG
TAY ;.Y IS XFER SEG STACK POINTER
LDA E6509 ;PUSH RETURN SEGMENT TO USER STACK
JSR PUTAS ;PUSH .A TO OTHER STACK
LDA #<EXCRT2 ;XFER SEG RTS ROUTN
LDX #>EXCRT2 ;XFER SEG RTS ROUTN
JSR PUTAXS ;PUT .A.X TO XFER SEG STACK
TSX
LDA $0105,X ;.SP +5 IS ACTUAL ROUTN ADDR LO
SEC
SBC #03 ;-3 FOR JSR TO THIS ROUTN
PHA ;SAVE .A
LDA $0106,X ;HI ADDR
SBC #00
TAX ;.X HI
PLA ;RESTORE .A LO
JSR PUTAXS ;SAVE .A.X ONTO XFER SEG STACK
TYA ;XFER SEG STACK POINTER
EXCOMM SEC
SBC #04 ;4 BYTES .Y.X.A.P
STA STACKP ;XFER SEG NEW STACK POINTER TEMP STORAGE
TAY ;USE THIS AS NEW POINTER ALSO
LDX #04 ;4 BYTES .Y.X.A.P
EXSU10 PLA
INY
STA (IPOINT),Y ;PUSH REGS FROM THIS STACK TO XFER SEG STACK
DEX
BNE EXSU10
LDY STACKP ;RESTORE .Y AS STACK POINTER FOR XFER SEG
LDA #<EXPUL2 ;PULL REGS AND RTS ROUTN
LDX #>EXPUL2 ;.HI PRENDN ROUTN IN XFER SEG
JSR PUTAXS ;PUT .A.X ON XFER SEG STACK
PLA ;FIX STACK
PLA ;FIX STACK
EXGBYE TSX
STX STACKP ;SAVE CURRENT STACK POINTER THIS SEG
TYA ;.Y IS STACK POINTER FOR XFER SEG
TAX
TXS ;NEW STACK FOR XFER SEG
LDA I6509 ;XFER SEG #
JMP GBYE ;GOOD BYE
;
NOP ;RETURNS HERE IF RTI
EXCRTS PHP ;.P
PHP ;.P
SEI ;DIS INTS
PHA ;.A
TXA
PHA ;.X
TYA
PHA ;.Y
TSX
LDA $0106,X ;.SP +7 IS RETURN SEG
STA I6509 ;RESTORE I6509 TO RETURN SEG
JSR IPINIT ;INIT IPOINT AND LOAD STACK FROM XFER SEG
JMP EXCOMM
;
IPINIT LDY #01
STY IPOINT+1
DEY
STY IPOINT ;IPOINT=$0100
DEY ;.Y =$FF
LDA (IPOINT),Y ;LOAD STACK POINTER FROM $001FF
RTS
PUTAXS PHA ;SAVE .A
TXA
STA (IPOINT),Y ;.X HI
DEY
PLA
PUTAS STA (IPOINT),Y ;.A LO
DEY
RTS
;
EXPULL PLA
TAY ;.Y
PLA
TAX ;.X
PLA ;.A
PLP ;.P
RTS ;.P
EXNMI PHP ;.P
JMP ($FFFA) ;DO NMI PROC
EXBRK BRK
NOP
RTS
EXIRQ CLI
RTS
EXEND
;
EXCRT2=EXCRTS-1
EXPUL2=EXPULL-1
.END