-
Notifications
You must be signed in to change notification settings - Fork 0
/
speedcodeasm.s
96 lines (83 loc) · 1.26 KB
/
speedcodeasm.s
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
.macpack longbranch
.autoimport on
.FEATURE labels_without_colons
.IMPORTZP ptr1,ptr2
.PUSHSEG
.BSS
.EXPORT _spdcdef_loc = *
.RES 10
.EXPORT _speedcodecounters=*
.RES 10
.POPSEG
.EXPORT _DELTA = _speedcodecounters - _spdcdef_loc
.EXPORT _setCallbackJmpAddr
.PROC _setCallbackJmpAddr
.IMPORT _jmpdest
.EXPORT rtscode
tay
bne setaddr
cpx #0
bne setaddr
lda #<rtscode
ldx #>rtscode
setaddr
sta _jmpdest
stx _jmpdest+1
rtscode
rts
.ENDPROC
.EXPORT _fastCallback
.PROC _fastCallback
.EXPORT _jmpdest
.IMPORT rtscode
; tay
; bne pushparams
; cpx #0
; beq nopush
;pushparams
; jsr pushax
;nopush
_jmpdest = *+1
jmp rtscode
.ENDPROC
.EXPORT _fastmemcpy256
.PROC _fastmemcpy256
sta ptr2
stx ptr2+1
jsr popax
sta ptr1
stx ptr1+1
jsr popa
tax ;x is not used else for copying
tay
copyagain
cpy #16
bcs jd0
tya
and #15
asl
sta jmpdest
jmpdest = *+1
bcc :+
:
.repeat 16,i
bcc .ident(.sprintf("jd%d",16-i))
.endrep
.REPEAT 16,i
.ident(.sprintf("jd%d",i))
dey
lda (ptr1),y
sta (ptr2),y
.ENDREPEAT
jd16
cpy #0
jne copyagain
txa
clc
adc ptr2
ldx ptr2+1
bcc :+
inx
:
rts
.ENDPROC