@@ -720,9 +720,15 @@ fn main() {
720720 }
721721
722722 // Process args
723- info ! ( "Loading OS from {}" , args. os. display( ) ) ;
724- let lib = unsafe { libloading:: Library :: new ( args. os ) . expect ( "library to load" ) } ;
725- println ! ( "Loaded!" ) ;
723+ let mut lib = None ;
724+ for arg in std:: env:: args ( ) {
725+ if let Some ( os_path) = arg. strip_prefix ( "--os=" ) {
726+ info ! ( "Loading OS from {:?}" , os_path) ;
727+ lib = unsafe { Some ( libloading:: Library :: new ( os_path) . expect ( "library to load" ) ) } ;
728+ println ! ( "Loaded!" ) ;
729+ }
730+ }
731+ let lib = lib. expect ( "Fetching --os=filename from args" ) ;
726732
727733 // Make a window
728734 let mut engine = PixEngine :: builder ( )
@@ -751,7 +757,7 @@ fn main() {
751757 drop ( queue) ;
752758 info ! ( "Video init complete. OS starting..." ) ;
753759 let main_func: libloading:: Symbol < unsafe extern "C" fn ( api : & ' static common:: Api ) -> !> =
754- lib. get ( b"main " ) . expect ( "main() found" ) ;
760+ lib. get ( b"os_main " ) . expect ( "os_main() not found" ) ;
755761 main_func ( & BIOS_API ) ;
756762 } ) ;
757763
@@ -798,7 +804,7 @@ extern "C" fn serial_get_info(_device: u8) -> common::Option<common::serial::Dev
798804/// options are invalid for that serial device.
799805extern "C" fn serial_configure ( _device : u8 , _config : common:: serial:: Config ) -> common:: Result < ( ) > {
800806 debug ! ( "serial_configure()" ) ;
801- common :: Result :: Err ( common:: Error :: Unimplemented )
807+ Err ( common:: Error :: Unimplemented ) . into ( )
802808}
803809
804810/// Write bytes to a serial port. There is no sense of 'opening' or
@@ -812,7 +818,7 @@ extern "C" fn serial_write(
812818 _timeout : common:: Option < common:: Timeout > ,
813819) -> common:: Result < usize > {
814820 debug ! ( "serial_write()" ) ;
815- common :: Result :: Err ( common:: Error :: Unimplemented )
821+ Err ( common:: Error :: Unimplemented ) . into ( )
816822}
817823
818824/// Read bytes from a serial port. There is no sense of 'opening' or
@@ -826,7 +832,7 @@ extern "C" fn serial_read(
826832 _timeout : common:: Option < common:: Timeout > ,
827833) -> common:: Result < usize > {
828834 debug ! ( "serial_read()" ) ;
829- common :: Result :: Err ( common:: Error :: Unimplemented )
835+ Err ( common:: Error :: Unimplemented ) . into ( )
830836}
831837
832838/// Get the current wall time.
@@ -874,15 +880,15 @@ extern "C" fn time_clock_set(time: common::Time) {
874880/// battery-backed SRAM.
875881extern "C" fn configuration_get ( _buffer : common:: ApiBuffer ) -> common:: Result < usize > {
876882 debug ! ( "configuration_get()" ) ;
877- common :: Result :: Err ( common:: Error :: Unimplemented )
883+ Err ( common:: Error :: Unimplemented ) . into ( )
878884}
879885
880886/// Set the configuration data block.
881887///
882888/// See `configuration_get`.
883889extern "C" fn configuration_set ( _buffer : common:: ApiByteSlice ) -> common:: Result < ( ) > {
884890 debug ! ( "configuration_set()" ) ;
885- common :: Result :: Err ( common:: Error :: Unimplemented )
891+ Err ( common:: Error :: Unimplemented ) . into ( )
886892}
887893
888894/// Does this Neotron BIOS support this video mode?
@@ -981,7 +987,7 @@ extern "C" fn video_get_framebuffer() -> *mut u8 {
981987/// The pointer must point to enough video memory to handle the current video
982988/// mode, and any future video mode you set.
983989unsafe extern "C" fn video_set_framebuffer ( _buffer : * const u8 ) -> common:: Result < ( ) > {
984- common :: Result :: Err ( common:: Error :: Unimplemented )
990+ Err ( common:: Error :: Unimplemented ) . into ( )
985991}
986992
987993/// Find out whether the given video mode needs more VRAM than we currently have.
@@ -1185,7 +1191,7 @@ fn convert_keycode(key: Key) -> common::hid::KeyCode {
11851191/// Control the keyboard LEDs.
11861192extern "C" fn hid_set_leds ( _leds : common:: hid:: KeyboardLeds ) -> common:: Result < ( ) > {
11871193 debug ! ( "hid_set_leds()" ) ;
1188- common :: Result :: Err ( common:: Error :: Unimplemented )
1194+ Err ( common:: Error :: Unimplemented ) . into ( )
11891195}
11901196
11911197/// Wait for the next occurence of the specified video scan-line.
@@ -1523,6 +1529,7 @@ impl MyApp {
15231529 for glyph in 0 ..=255 {
15241530 for palette_entry in PALETTE . iter ( ) . take ( Self :: NUM_FG ) {
15251531 let fg = RGBColour :: from_packed ( palette_entry. load ( Ordering :: Relaxed ) ) ;
1532+ info ! ( "Drawing {glyph} in {:06x}" , fg. as_packed( ) ) ;
15261533 let texture_id = if texture_buffer. len ( ) > slot {
15271534 texture_buffer[ slot]
15281535 } else {
@@ -1631,6 +1638,7 @@ impl AppState for MyApp {
16311638 let num_rows = self . mode . text_height ( ) . unwrap ( ) ;
16321639 // FRAMEBUFFER is an num_cols x num_rows size array of (u8_glyph, u8_attr).
16331640 for row in 0 ..num_rows {
1641+ let y = row * font_height;
16341642 for col in 0 ..num_cols {
16351643 let cell_no = ( row * num_cols) + col;
16361644 let byte_offset = usize:: from ( cell_no) * 2 ;
0 commit comments