@@ -25,12 +25,22 @@ impl TextBuffer {
25
25
26
26
TextBuffer { data, handle}
27
27
}
28
+
29
+ pub fn get ( & self , addr : u16 ) -> u8 {
30
+ self . data [ addr as usize ]
31
+ }
32
+
33
+ pub fn set ( & mut self , addr : u16 , data : u8 ) {
34
+ self . data [ addr as usize ] = data;
35
+ println ! ( "{}" , self . data[ addr as usize ] ) ;
36
+ }
28
37
}
29
38
30
39
async fn run_handle ( buffer : BufferPtr ) {
31
40
let mut opts = WindowOptions :: default ( ) ;
32
41
opts. scale = Scale :: FitScreen ;
33
- opts. scale_mode = ScaleMode :: Center ;
42
+ opts. scale_mode = ScaleMode :: AspectRatioStretch ;
43
+ opts. resize = true ;
34
44
35
45
let mut window = minifb:: Window :: new ( "f8ful" , WIDTH , HEIGHT , opts) . expect ( "should be able to create window" ) ;
36
46
let mut fb = [ 0x00000000 ; WIDTH * HEIGHT ] ;
@@ -48,14 +58,16 @@ async fn run_handle(buffer: BufferPtr) {
48
58
( * buffer. 0 ) [ char_idx]
49
59
} ;
50
60
51
- let font_addr = ( character as usize ) << 4 + font_y;
52
- let lit = FONT [ font_addr] & !( 1 << font_x) > 0 ;
61
+ let font_addr = ( ( character as usize ) << 4 ) + font_y;
62
+ let lit = FONT [ font_addr] & ( 1 << ( 7 - font_x) ) > 0 ;
63
+
53
64
54
65
// This part isn't part of the actual CPU,
55
66
// the real value will be transmitted via wire instead of stored.
56
67
fb[ x + y* WIDTH ] = if lit { 0x00FFFFFF } else { 0x00000000 } ;
57
- window. update_with_buffer ( & fb, WIDTH , HEIGHT ) . expect ( "should be able to update window" ) ;
58
68
}
59
69
}
70
+
71
+ window. update_with_buffer ( & fb, WIDTH , HEIGHT ) . expect ( "should be able to update window" ) ;
60
72
}
61
73
}
0 commit comments