File tree Expand file tree Collapse file tree 3 files changed +61
-3
lines changed Expand file tree Collapse file tree 3 files changed +61
-3
lines changed Original file line number Diff line number Diff line change 11from contextlib import contextmanager
2- from unittest import mock
3-
42
53from src .arch .z80 import optimizer
64from src .arch .z80 .peephole import engine
@@ -41,4 +39,4 @@ def test_unrequired_or_a(self):
4139
4240 with mock_options_level (4 ):
4341 optimized_code = optimizer .optimize (code )
44- pass
42+ assert optimized_code . split ( " \n " )[: 2 ] == [ "call .core.__LTI8" , "ld bc, 0" ]
Original file line number Diff line number Diff line change 1+ org 32768
2+ .core.__START_PROGRAM:
3+ di
4+ push ix
5+ push iy
6+ exx
7+ push hl
8+ exx
9+ ld hl , 0
10+ add hl , sp
11+ ld (.core.__CALL_BACK__) , hl
12+ ei
13+ jp .core.__MAIN_PROGRAM__
14+ .core.__CALL_BACK__:
15+ DEFW 0
16+ .core.ZXBASIC_USER_DATA:
17+ ; Defines USER DATA Length in bytes
18+ .core.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_END - .core.ZXBASIC_USER_DATA
19+ .core.__LABEL__.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_LEN
20+ .core.__LABEL__.ZXBASIC_USER_DATA EQU .core.ZXBASIC_USER_DATA
21+ _dir:
22+ DEFB 00 , 00
23+ _n:
24+ DEFB 00
25+ .core.ZXBASIC_USER_DATA_END:
26+ .core.__MAIN_PROGRAM__:
27+ ld hl , 22528
28+ ld (_dir) , hl
29+ .LABEL.__LABEL0:
30+ ld a , (_n)
31+ ld hl , (_dir)
32+ ld (hl) , a
33+ ld hl , _n
34+ inc (hl)
35+ jp .LABEL.__LABEL0
36+ .core.__END_PROGRAM:
37+ di
38+ ld hl , (.core.__CALL_BACK__)
39+ ld sp , hl
40+ exx
41+ pop hl
42+ pop iy
43+ pop ix
44+ exx
45+ ei
46+ ret
47+ ;; --- end of user code ---
48+ END
Original file line number Diff line number Diff line change 1+ DIM dir as UInteger
2+ DIM n as UByte
3+ ' Imprmimos una X
4+ ' Obtenemos la dirección del atributo
5+ dir = 16384 + 6144
6+ ' Bucle infinito
7+ DO
8+ ' Cambiamos el atributo con un poke (no borra la X)
9+ poke dir,n
10+ ' Incrementamos el atributo
11+ n =n +1
12+ LOOP
You can’t perform that action at this time.
0 commit comments