MZ 700 - detect PAL/NTSC

hlide
Posts: 304
Joined: Thu Jan 25, 2018 9:31 pm

Re: MZ 700 - detect PAL/NTSC

Post by hlide » Thu Nov 07, 2019 9:17 am

I guess you wrap it with

Code: Select all

DI : ... : EI
to delete any interrupt?

hlide
Posts: 304
Joined: Thu Jan 25, 2018 9:31 pm

Re: MZ 700 - detect PAL/NTSC

Post by hlide » Thu Nov 07, 2019 10:40 am

Emulator: I'm not expecting the emulator to run each instruction at an accurate 3.57 MHz frequency. An emulator tends to run a batch of instructions then pause to make the overall speed close to the simulated frequency. So you may not capture the counter value at the right time.

Hardware: Was it a true MZ-700 or a MZ-800 in MZ-700 mode?

BLNK(MZ-700)/HSYNC(MZ-800) frequency is 15.6KHz. So 15.6KHz / 509 ~= 30 Hz.

For me the computation should be : lines = 1024 - counter1.

Code: Select all

uint8_t lobyte = *((uint8_t*)0xe005);
uint8_t hibyte = *((uint8_t*)0xe005);
uint16_t lines = 1024 - ((uint16_t(hibyte) << 8) | uint16_t(lobyte));
By the way, it seems you read first high byte then low byte - remember Intel is little-endian, not big-endian.

hlide
Posts: 304
Joined: Thu Jan 25, 2018 9:31 pm

Re: MZ 700 - detect PAL/NTSC

Post by hlide » Thu Nov 07, 2019 10:45 am

Anyway, I agree something is still fishy with counter1. I will check it on my MZ-700 with Unicard. ^^

Jo Even
Site Admin
Posts: 120
Joined: Wed Jan 17, 2018 9:28 pm

Re: MZ 700 - detect PAL/NTSC

Post by Jo Even » Thu Nov 07, 2019 8:48 pm

hlide wrote:
Thu Nov 07, 2019 9:17 am
I guess you wrap it with

Code: Select all

DI : ... : EI
to delete any interrupt?
No, I did not. Tried this now but it did not make a difference.
hlide wrote:
Thu Nov 07, 2019 10:40 am
Emulator: I'm not expecting the emulator to run each instruction at an accurate 3.57 MHz frequency. An emulator tends to run a batch of instructions then pause to make the overall speed close to the simulated frequency. So you may not capture the counter value at the right time.
Yes, that's possible, I don't know the internals of this emulator. Unfortunately it's the only emulator I've got working on Linux.
hlide wrote:
Thu Nov 07, 2019 10:40 am
Hardware: Was it a true MZ-700 or a MZ-800 in MZ-700 mode?
It's a real 700.
hlide wrote:
Thu Nov 07, 2019 10:40 am
By the way, it seems you read first high byte then low byte - remember Intel is little-endian, not big-endian.
I know, it looks strange but this gives the correct result with this compiler. C is big endian, but shifting the most significant byte to the left gives the opposite result of what I expect.

Post Reply