Skip to content

Commit aed39bd

Browse files
committed
Add 83 ASM detection
1 parent 24e5ff6 commit aed39bd

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

tests/data/var/ZLOAD.83P

507 Bytes
Binary file not shown.

tests/tivars.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,17 @@ def test_protection(self):
206206
file.seek(55)
207207
self.assertEqual(test_program.bytes(), file.read()[:-2])
208208

209-
def test_doors(self):
209+
def test_assembly(self):
210210
test_program = TIProgram.open("tests/data/var/COLORZ.8xp")
211211
self.assertEqual(type(test_program), TIProtectedAsmProgram)
212212

213213
self.assertEqual(test_program.decode(test_program.data[:26]), "Disp \"Needs Doors CSE\"")
214214

215+
test_program = TIProgram.open("tests/data/var/ZLOAD.83P")
216+
self.assertEqual(type(test_program), TIAsmProgram)
217+
218+
self.assertEqual(test_program.string()[-12:], "End\n0000\nEnd")
219+
215220
def test_modes(self):
216221
interpolation = "A and B:Disp \"A and B\":Send(\"SET SOUND eval(A and B) TIME 2"
217222
names = "Disp \"WHITE,ʟWHITE,prgmWHITE\",WHITE,ʟWHITE:prgmWHITE:prgmABCDEF"

tivars/types/tokenized.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,16 @@ def coerce(self):
418418
simplefilter("error")
419419

420420
try:
421-
self.string()
421+
asm_83 = self.string().endswith("End\n0000\nEnd")
422422
doors = False
423423

424424
except BytesWarning:
425+
asm_83 = False
425426
doors = True
426427

427428
doors &= b"\xEF\x68" in self.data and self.data.index(b"\xEF\x68") > 0
428429

429-
match self.type_id, any(token in self.data for token in self.asm_tokens) | doors:
430+
match self.type_id, any(token in self.data for token in self.asm_tokens) | asm_83 | doors:
430431
case TIProgram.type_id, False:
431432
self.__class__ = TIProgram
432433
case TIProgram.type_id, True:

0 commit comments

Comments
 (0)