Skip to content

Commit b25d4b0

Browse files
this probably works
more magic to fix crashes!
1 parent f1bab7f commit b25d4b0

File tree

2 files changed

+74
-124
lines changed

2 files changed

+74
-124
lines changed

src/cesium.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
; POSSIBILITY OF SUCH DAMAGE.
2828

2929
cesium_name := 'Cesium'
30-
cesium_version := '3.5.1'
30+
cesium_version := '3.6.0'
3131
cesium_copyright := '(C) 2015-2021 Matt Waltz'
3232

3333
include 'include/macros.inc'

src/ports.asm

Lines changed: 73 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -26,89 +26,65 @@
2626
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2727
; POSSIBILITY OF SUCH DAMAGE.
2828

29-
os_num = 0
30-
31-
macro ports? v, lock, unlock
32-
match major.mid.minor.build, v
33-
db major, mid, minor
34-
dl build
35-
end match
36-
dl lock
37-
dl unlock
38-
os_num = os_num + 1
39-
end macro
40-
41-
os_table:
42-
ports 5.6.1.0012, port_os560.lock, port_os561.unlock
43-
ports 5.6.0.0020, port_os560.lock, port_os560.unlock
44-
ports 5.5.5.0011, port_os560.lock, port_os555.unlock
45-
ports 5.5.2.0044, port_os560.lock, port_os552.unlock
46-
ports 5.5.1.0038, port_os560.lock, port_os551.unlock
47-
4829
port_setup:
4930
di
50-
call $21ED4
31+
ld b,1
32+
or a,a
33+
sbc hl,hl
34+
.find:
35+
ld a,(hl)
36+
inc hl
37+
cp a,$80
38+
jq z,.found_80
39+
cp a,$ed
40+
jq nz,.find
41+
ld a,(hl)
42+
sub a,$41
43+
jq z,.found_ed41
44+
cp a,$73
45+
jq nz,.find
46+
dec b
47+
dec hl
48+
ld (port_new.target),hl
49+
inc hl
50+
jq .find
51+
.found_80:
52+
ld a,(hl)
53+
cp a,$0f
54+
jq nz,.find
55+
and a,b
56+
ret nz
57+
ld hl,port_new.unlock
58+
jq .store_smc
59+
.found_ed41:
60+
dec hl
61+
ld (port_old.target),hl
62+
inc hl
5163
push hl
5264
pop ix
53-
lea de,ix + 6
54-
ld a,(de)
55-
cp a,5
56-
jq nz,.invalid_os
57-
inc de
58-
ld a,(de)
59-
cp a,5
60-
jq c,.ospre55
61-
dec de
62-
ld b,os_num
63-
ld ix,os_table
64-
.find:
65-
lea hl,ix
66-
push de,bc
67-
ld b,6
68-
call ti.StrCmpre
69-
pop bc,de
70-
jq z,.found
71-
lea ix,ix + 12
72-
djnz .find
73-
.invalid_os:
74-
inc a
75-
ret
76-
.found:
77-
ld de,(ix + 6)
78-
ld hl,(ix + 9)
65+
bit 0,(ix+4)
66+
jq nz,.find
67+
ld hl,port_old.unlock
7968
.store_smc:
8069
ld (port_unlock.code),hl
81-
ld (port_lock.code),de
82-
xor a,a
8370
ret
84-
.ospre55:
85-
ld hl,port_ospre55.unlock
86-
ld de,port_ospre55.lock
87-
jq .store_smc
8871

89-
port_ospre55:
72+
port_old:
9073
.unlock:
91-
ld bc,$24
74+
call .unlockhelper
75+
.unlockfinish:
9276
ld a,$8c
93-
call .write
94-
ld bc,$06
95-
call .read
77+
out0 ($24),a
78+
in0 a,($06)
9679
or a,4
97-
call .write
98-
ld bc,$28
99-
ld a,$4
100-
jq .write
101-
.lock:
102-
ld bc,$28
103-
xor a,a
104-
call .write
105-
ld bc,$06
106-
call .read
107-
res 2,a
108-
call .write
109-
ld bc,$24
110-
ld a,$88
111-
jq .write
80+
out0 ($06),a
81+
ret
82+
.unlockhelper:
83+
call ti._frameset0
84+
push de
85+
ld bc,$0022
86+
jp 0
87+
.target := $-3
11288
.write:
11389
ld de,$c979ed
11490
ld hl,ti.heapBot - 3
@@ -120,59 +96,34 @@ port_ospre55:
12096
ld (hl),de
12197
jp (hl)
12298

123-
port_os555:
99+
port_new:
124100
.unlock:
125-
ld ix,$b96df
126-
jq port_os560.unlock0
127-
128-
port_os552:
129-
.unlock:
130-
ld ix,$bd573
131-
jq port_os560.unlock0
132-
133-
port_os551:
134-
.unlock:
135-
ld ix,$bd55f
136-
jq port_os560.unlock0
137-
138-
port_os561:
139-
.unlock:
140-
ld ix,$4a5ac
141-
ld hl,port_os560.unlockhelper
142-
push hl
101+
ld de,$d19881
102+
push de
103+
or a,a
104+
sbc hl,hl
143105
push hl
144-
ld de,ti.flags
106+
ld de,$03d1
145107
push de
146-
ld bc,$22
147-
ld a,(ix)
148-
cp a,$ed
149-
jr z,.84
150-
.83:
151-
ld ixl,$8f
152-
.84:
153-
xor a,a
154-
jp (ix)
155-
156-
port_os560:
157-
.unlock:
158-
ld ix,$b99bb
159-
.unlock0:
160-
ld hl,.unlockhelper
161108
push hl
162-
ld hl,$d09466
109+
call .unlockhelper
110+
ld hl,12
111+
add hl,sp
112+
ld sp,hl
113+
jq port_old.unlockfinish
114+
.unlockhelper:
115+
push hl
116+
ex (sp),ix
117+
add ix,sp
163118
push hl
164119
push de
165-
xor a,a
166-
jp (ix)
167-
.unlockhelper:
168-
ld a,$8c
169-
out0 ($24),a
170-
in0 a,($06)
171-
or a,$04
172-
out0 ($06),a
173-
ld a,$04
174-
out0 ($28),a
175-
ret
120+
ld de,$887c00
121+
push de
122+
ld bc,$10de
123+
ld de,$0f22
124+
add hl,sp
125+
jp 0
126+
.target := $-3
176127
.lock:
177128
xor a,a
178129
out0 ($28),a
@@ -187,12 +138,12 @@ port_os560:
187138

188139
port_read:
189140
push de,bc,hl
190-
call port_ospre55.read
141+
call port_old.read
191142
jq port_lock.pop
192143

193144
port_write:
194145
push de,bc,hl
195-
call port_ospre55.write
146+
call port_old.write
196147
jq port_lock.pop
197148

198149
port_unlock:
@@ -203,8 +154,7 @@ port_unlock:
203154

204155
port_lock:
205156
push de,bc,hl
206-
call 0
207-
.code := $-3
157+
call port_new.lock
208158
.pop:
209159
pop hl,bc,de
210160
ret

0 commit comments

Comments
 (0)