Bootstrap and boot blocks

Everything about programming, including VDP and Sound programming.
Bill B
Posts: 590
Joined: 26 Jan 2014 16:31

Re: Bootstrap and boot blocks

Post by Bill B »

Yes, the bug is in the VDP code, but not related to Fuzex. It happens even when emulating an MTX 512.

The symptoms:
  • Start memu-cfg.
  • Tap the "Menu" key to open the configuration window.
  • Select "Exit" from the bottom line of the window.
  • The configuration window closes.
  • What should then happen is the remaining windows close and the program exit.
  • Instead the remaining windows are marked "Not Responding".
Under the hood:
  • win_delete () is called, and closes the configuration window.
  • terminate () is called, and begins to shut down the emulator.
  • terminate () calls mon_term () or vid_term (), to close another of the windows.
  • Either of these routines call win_delete () to close their corresponding window.
  • win_delete () posts the WM_DELETEWINDOW message (a private message) and then blocks waiting for win->heventDeleted to be signalled.
  • However the UI thread never receives the message. It appears that the event loop has stopped running.
  • So the program is deadlocked, waiting for an event which is never signalled.
I will try and do some more work on this today. If I don't get anywhere I will post more details in a separate thread.
Bill B
Posts: 590
Joined: 26 Jan 2014 16:31

Re: Bootstrap and boot blocks

Post by Bill B »

Rather off-topic for this thread, but to finish up the discussion of the memu-cfg issue, the causes were:
  • A mis-understanding on my part :? I thought that there was only one UI thread, whereas there is actually one per window.
  • I also hadn't appreciated the consequences of the keypress () and keyrelease () routines being called by the UI threads, not the main thread. As a result, the configuration dialog was running on a UI thread.
  • The win_delete () routine was written on the assumption that it is only called from the main thread. Because terminate () had been called from the configure dialog, which was running from a UI thread, when it came to close that window, win_delete () blocked the thread that needed to process the close event.
Possible solutions:
  • Serialise the keyboard events, so that keypress () and keyrelease () are called by the main thread. This may have performance issues.
  • Have the keypress () routine just set a global flag when the menu key is pressed, then poll for that flag somewhere from the main thread to start the configuration dialog. This requires changes affecting all versions of MEMU, not just the Windows version.
  • Modify win_delete () to detect being called from a UI thread. Difficult to clean up the thread afterwards, and Andy notes that terminate () should only be run from the main thread.
All the above just illustrates how tricky multi-threaded programs are.

For now I have adopted the first solution.
Bill B
Posts: 590
Joined: 26 Jan 2014 16:31

Re: Bootstrap and boot blocks

Post by Bill B »

Alan, a request from Dave. As you know, the MTX keyboard matrix potentially supports 80 keys, only 77 of which are implemented in hardware. The three unused locations are used by the PC keyboard interface, MTX+ and my version of MEMU to implement virtual keys with characters having the same shift state as on the PC keyboard. These virtual keys are:

Code: Select all

Drive Line     Sense Line     Unshifted Character     Shifted Character
     4             8                  =                       ^
     5             8                  ' (Quote)               @
     6             8                  #                       :
Would you be able to add support for these virtual keys to the Fuzex keyboard driver? It will not make any difference to operation on a normal MTX which will never generate these key strokes.
EtchedPixels
Posts: 31
Joined: 07 Feb 2019 01:12

Re: Bootstrap and boot blocks

Post by EtchedPixels »

Tivial enough

Added.

Alan
User avatar
Dave
Posts: 1278
Joined: 11 Aug 2012 18:16
Contact:

Re: Bootstrap and boot blocks

Post by Dave »

Hi Alan,

thanks a lot, it does not seem to work for me though.

Did you upload it to the same link as last time?

Can you change the time using the ":" key? That doesn't work on my PC (laptop). The Scroll Lock mode should enable the ":" key, but doesn't work for me.

Of course, I could have made a mess of replacing the Fuzix image at my end :-)

Bill, is there anything more required other than copying the updated Fuzix image to the Fuzix.img file in the disks directory?

regards
Dave
EtchedPixels
Posts: 31
Joined: 07 Feb 2019 01:12

Re: Bootstrap and boot blocks

Post by EtchedPixels »

I've not uploaded a new one yet :D

I will do when I get a bit of time.

Alan
User avatar
Dave
Posts: 1278
Joined: 11 Aug 2012 18:16
Contact:

Re: Bootstrap and boot blocks

Post by Dave »

Hi Alan,

OK, thanks - sorry, there's no rush

regards
Dave
User avatar
Dave
Posts: 1278
Joined: 11 Aug 2012 18:16
Contact:

Re: Bootstrap and boot blocks

Post by Dave »

Newbie question on Unix/Linux/Fuzix please . . . .

I see that there is a games directory in Fuzix, with stuff in there, how can I run the programs?

regards
Dave
EtchedPixels
Posts: 31
Joined: 07 Feb 2019 01:12

Re: Bootstrap and boot blocks

Post by EtchedPixels »

Easiest way

type

/usr/games/whatever
User avatar
Dave
Posts: 1278
Joined: 11 Aug 2012 18:16
Contact:

Re: Bootstrap and boot blocks

Post by Dave »

Ah, thanks a lot.

I need to do some more reading, I thought that I would be able to run the programs when logged into the /usr/games directory, but it seems that I ned to run them from my home directory with the path specified

regards
Dave
Post Reply