File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ import z80
4
+
5
+
6
+ def main ():
7
+ INC_A = 0x3c
8
+ HALT = 0x76
9
+
10
+ code = bytes ([INC_A , HALT , INC_A ])
11
+
12
+ m = z80 .Z80Machine ()
13
+ m .set_memory_block (0x0000 , code )
14
+
15
+ def step ():
16
+ m .ticks_to_stop = 1
17
+ m .run ()
18
+
19
+ print (f'pc={ m .pc :04x} a={ m .a :02x} halted={ m .halted } ' )
20
+
21
+ # Execute the first 'inc a'.
22
+ step ()
23
+
24
+ # Execute the halt.
25
+ # From now on, stepping will not progress until we exit the halted mode.
26
+ step ()
27
+ step ()
28
+ step ()
29
+
30
+ # Exit the halted mode and execute the second 'inc a'.
31
+ m .halted = False
32
+ step ()
33
+
34
+
35
+ if __name__ == "__main__" :
36
+ main ()
Original file line number Diff line number Diff line change @@ -298,7 +298,11 @@ def int_disabled(self):
298
298
299
299
@property
300
300
def halted (self ):
301
- return self .__halted [0 ]
301
+ return bool (self .__halted [0 ])
302
+
303
+ @halted .setter
304
+ def halted (self , value ):
305
+ self .__halted [0 ] = int (value )
302
306
303
307
@property
304
308
def index_rp_kind (self ):
You can’t perform that action at this time.
0 commit comments