Welcome, Guest. Please login or register.


Author Topic: SymbOS (Read 447291 times)

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: SymbOS
« Reply #420 on: 2014.November.29. 14:49:44 »
I don't know if you have some kind of label or map file after compiling SymbOS for EP (files contain addresses for labels) but then after a freeze maybe pressing button Z80 helps to know the EP segment and PC to find out where the execution is being done during the freeze.

Offline Prodatron

  • EP user
  • *
  • Posts: 256
  • Country: de
  • Back on the Z80
    • http://www.symbos.de
Re: SymbOS
« Reply #421 on: 2014.November.29. 15:07:49 »
I don't know if you have some kind of label or map file after compiling SymbOS for EP (files contain addresses for labels) but then after a freeze maybe pressing button Z80 helps to know the EP segment and PC to find out where the execution is being done during the freeze.
Yes, it's the idle process, which is still running after the freeze. PC is somewhere around #044x, most registers are 0, only B and HL is changing, as the idle process is doing nothing else than increasing a counter.

One question about the memory array:
If I want to read data from page #f8, I can just use...
memory[0xF8*16384+offset]
...where offset is 0-16383, is this correct?

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: SymbOS
« Reply #422 on: 2014.November.29. 15:19:53 »
Yes, it's the idle process, which is still running after the freeze. PC is somewhere around #044x, most registers are 0, only B and HL is changing, as the idle process is doing nothing else than increasing a counter.

One question about the memory array:
If I want to read data from page #f8, I can just use...
memory[0xF8*16384+offset]
...where offset is 0-16383, is this correct?

It is, I would use bit shift instead of multiplication and "or" instead of addition but the result is the same, so yes.

Interesting that idle process is still running, does it mean that kernel works somehow just other processes can't get their CPU time by the scheduler for some reason? What I can imagine (but I am not a SymbOS internal expert as you of course!) that a high priority process stucks for some reason (maybe the incomplete WD emulation? in JSep only things are emulated which would just enough EXDOS work, so it can be a problem for softwares doing low level disk access by their own manner), and because it's high priority, no lower priority tasks (including the one which modifies the taskbar clock) gets CPU time. However I don't know if in this case IDLE process would get any CPU time, since it seem it does ...

One problem with the Z80 button in JSep that it's not "instant". JSep emulates processing Nick slots and doing Z80 opcodes and it ties to keep their ratio at a given value (the Z80 clock and nick "slot clock" ratio). After a full frame is processed (vsync, or out-of-sync with an upper limit) the used time is calculated and compared with the emulation time, and the needed JS "sleep" is calculated. What I want to say with this: pressing Z80 button may triggers more a dump at the "sleep" and not at "any time", so its "resolution" to be able to show the internals of the Z80 is somewhat limited (but it's up to the browser where button click event is processed exactly).

The best would be to figure out what triggers the freeze, but it's kinda hard without a decent debugger what JSep lacks :(

Thanks a lot to try to solve the mystery as it would be even useful to find some hidden bug in JSep too, so not exactly a SymbOS related problem it is, I guess.

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: SymbOS
« Reply #423 on: 2014.November.29. 15:22:42 »
Yes, it's the idle process, which is still running after the freeze. PC is somewhere around #044x, most registers are 0, only B and HL is changing, as the idle process is doing nothing else than increasing a counter.
It is can continously measure the CPU speed?

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: SymbOS
« Reply #424 on: 2014.November.29. 15:37:59 »
One question about the memory array:

Moreover:

If you are "brave" enough, you can stop the emulation with the stop button, and you can even modify memory and/or Z80 registers with JavaScript console and then you can continue the emulation with the Run button. So in theory you can implement some kind of debugger but you need to do it "by hand" without too much help, nice GUI, etc :-(

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: SymbOS
« Reply #425 on: 2014.November.29. 17:31:58 »
One question about the memory array:
If I want to read data from page #f8, I can just use...
memory[0xF8*16384+offset]
...where offset is 0-16383, is this correct?

Some hack, I've just implemented two simple JS function, which can be called from eg javascript console:

peek(ofs)
speek(seg,ofs)

Both of them dumps 16 hex bytes from the starting address. The first one doing this with the view point of the CPU, "ofs" must be between 0 - 0xffff of course. The speek dumps from the given segment "seg" (0-0xff) at offset ofs (0-0x3fff).
Hopefully it helps a bit.

Offline Prodatron

  • EP user
  • *
  • Posts: 256
  • Country: de
  • Back on the Z80
    • http://www.symbos.de
Re: SymbOS
« Reply #426 on: 2014.November.29. 18:05:26 »
It is can continously measure the CPU speed?
Yes, the idle process is increasing continously a counter. It has the lowest priority, so it only gets CPU time, when no other process is currently working.
Now you can compare the constant 50hz system counter with the counter of the idle process and calculate the free CPU time.

@LGB: Thanks for the new functions, such a hex dump makes some things easier! Yes, the kernel is still working after such a freeze. I guess the Desktop Manager process is hanging. I will add some debug code into SymbOS to find out, what is still alive and what not. Unfortunately this will take a while, as I am currently working on another things.

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: SymbOS
« Reply #427 on: 2014.November.29. 18:33:49 »
Yes, the idle process is increasing continously a counter. It has the lowest priority, so it only gets CPU time, when no other process is currently working.
Now you can compare the constant 50hz system counter with the counter of the idle process and calculate the free CPU time.

I am not sure if Zozo wants to ask this, but it can be used somehow to monitor the CPU clock as well, eg switching to "turbo EP" mode, SymbOS would be able to notice somehow, that CPU clock is higher, or such. The only problem with this: it won't work if there is no idle time, so idle process has never gets the control.

Quote
@LGB: Thanks for the new functions, such a hex dump makes some things easier! Yes, the kernel is still working after such a freeze. I guess the Desktop Manager process is hanging. I will add some debug code into SymbOS to find out, what is still alive and what not. Unfortunately this will take a while, as I am currently working on another things.

By the way, it would be useful the mentioned (by me) "label file" somehow, which can be feed (well will be, if I develope something like this into JSep, though segment numbers must be also provided ...) to JSep, so you can query a SymbOS data structure (or code) by symbol name ... I don't know ep128emu has this capability or not (but anyway you told, that it does not happen with ep128emu, though something like this can be useful with other software as well than SymbOS), but eg for Commodore 64 emulation I use VICE which has the ability to load a label file and use that for debugging.

Hmm, it's kinda interesting that every time you press Z80 button in JSep you get PC values belongs to the idle process and never for the desktop manager that can help where the execution is? By the way: as far as I can imagine, SymbOS should store all Z80 registers of a given process, since values must be restored when the scheduler gives back the control to that process. By knowing it, isn't it possible to eg peek() ;-) the kernel process structure to get to know what PC has the desktop manager process?

I thought that "desktop manager hangs" means that eg it's in a infinite loop. But it can't be since then IDLE process would never been invoked, since its priority (as far as I can imagine) is lower than the desktop manager. So, just seeing that execution is almost (?) always in the idle process means that no higher priority processes are in "working" state. Am I right? So maybe desktop manager hangs in a way that it waits for a message or such, so the theory above is not right, and maybe desktop manager should be inspected that why it is waiting for a message, what it could be, and so on. Or I only want to be too smart and I am totally wrong ...............

Or maybe desktop manager hangs only because it waits for another process through a message and that is which is "frozen" for some reason?
« Last Edit: 2014.November.29. 19:14:07 by lgb »

Offline Prodatron

  • EP user
  • *
  • Posts: 256
  • Country: de
  • Back on the Z80
    • http://www.symbos.de
Re: SymbOS
« Reply #428 on: 2014.November.29. 19:41:49 »
Switching the CPU speed after SymbOS has been booted is indeed a problem for the CPU usage measurement. As you said, you need to stop all other tasks and count how many instructions you can do during one VSYNC. Of course this can't be done all the time.

Yes, it seems, that the Desktop Manager process stopped in a way, that it doesn't consume any CPU time. Your new peek functions will make it easier to find the current PC and registers of the process by having a look at the table in the scheduler, where these are stored.

It's possible to export a label list. In WinApe, which I am using for developing, it looks like this (labelname #HEXADR):
Code: [Select]
[...]
fdccmd #AD44
fdcexe #AC87
fdcexe1 #AC9B
fdcexe2 #ACAE
fdcinp #AAF2
fdcinp0 #AAF5
fdcinp1 #AB18
[...]
I couldn't find an import function for it in Ep128emu, but I haven't fully used all the powerful features of its debugger yet. It would be quite helpfull.

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: SymbOS
« Reply #429 on: 2014.November.29. 20:15:07 »
Switching the CPU speed after SymbOS has been booted is indeed a problem for the CPU usage measurement. As you said, you need to stop all other tasks and count how many instructions you can do during one VSYNC. Of course this can't be done all the time.

I thought it's possible if IDLE task uses all its CPU time once it is running, because you know then it's about 1/50sec to execute and you can measure how many loops are executed in a waiting loop or so. If you know how much CPU cycles needed for one iteration of the loop, you can calculate the CPU clock as well and you can modify the CPU clock dependent things then. But it only works if I am right that IDLE task uses all its 1/50sec, and there is a problem if the system is busy and no IDLE task is scheduled, and CPU clock changes during that period. Also maybe the kernel itself should be modified a bit to examine the number of iterations, as the IDLE task does not know if scheduler gives the execution away. Well, I have the suspect that it does not work this way too much how I can imagine though ;)

Quote
Yes, it seems, that the Desktop Manager process stopped in a way, that it doesn't consume any CPU time. Your new peek functions will make it easier to find the current PC and registers of the process by having a look at the table in the scheduler, where these are stored.

Or maybe the queued messages can be examined as well? I'm not sure what Desktop Manager exactly does, but if it sends messages to other processes and sleeps on waiting the answer, the problem can be that the response message never arrives. But then the problem is not even in the Desktop Manager too much but the process which does not respond, so the problem should be located there. Again, if I am right.

Quote
It's possible to export a label list. In WinApe, which I am using for developing, it looks like this (labelname #HEXADR):
Code: [Select]
[...]
fdccmd #AD44
[...]

I see. I dunno about ep128emu and its abilities to load a label file, but it's not too hard to develop something similar into JSep which can be used by at least in the JavaScript console instead of numeric addresses. However the only problem that in case of EP, I should know the segment addresses as well ...
« Last Edit: 2014.November.29. 21:46:44 by lgb »

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: SymbOS
« Reply #430 on: 2014.December.01. 19:15:38 »
I tested the latest version, and Mouse works good also on 10MHz!

I attached a new version with 4 drive support. It should be possible to add and access drive C and drive D as well.
These setting can be saved for the next time?

I think just needed to extend the Mass Storage menu with a new options: Normal drive, HxC emulated drive.
The current Head 0/Head 1 (I think it is come from CPC) don't needed on Enterprise, can be replaced.
The Double stepping is also not needed, more better if done automaticaly, we talked about it some days ago.

I think there is will be a good place to put the special settings, Step Rate and Turbo Modes.

Offline edoz

  • EP fan
  • *
  • Posts: 135
  • Country: nl
Re: SymbOS
« Reply #431 on: 2014.December.01. 20:56:09 »
I tested the latest version, and Mouse works good also on 10MHz!
These setting can be saved for the next time?

I think just needed to extend the Mass Storage menu with a new options: Normal drive, HxC emulated drive.
The current Head 0/Head 1 (I think it is come from CPC) don't needed on Enterprise, can be replaced.
The Double stepping is also not needed, more better if done automaticaly, we talked about it some days ago.

I think there is will be a good place to put the special settings, Step Rate and Turbo Modes.

Normally you can save the settings (like the drives) using :



Did you do this ?
Have fun with the Z80!

Offline Prodatron

  • EP user
  • *
  • Posts: 256
  • Country: de
  • Back on the Z80
    • http://www.symbos.de
Re: SymbOS
« Reply #432 on: 2014.December.02. 15:26:50 »
Glad, that the mouse is now also working on faster machines!
These setting can be saved for the next time?
You can backup your SYMBOS.INI (after you saved the config like Edoz mentioned) and copy it to newer disc images.
Ok, I will think about the additional options :)

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: SymbOS
« Reply #433 on: 2014.December.03. 21:40:57 »
It is reported by user, who use! See the config. :-)
He is tested the latest 4 drives version, and working!

Offline Prodatron

  • EP user
  • *
  • Posts: 256
  • Country: de
  • Back on the Z80
    • http://www.symbos.de
Re: SymbOS
« Reply #434 on: 2014.December.03. 23:31:29 »
Thanks to him for testing it!
Now I am working on the SD card interface support. Gergelys hardware and Zozos software is really great to use!