Games with real time played?

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Games with real time played?

Post by XoRRoX »

Hello,

Are there any (MC) games where the (real) time played was shown? Not a countdown.

TIA

Edit: FYI I'm interested in studying how these clock mechanisms work in code and wonder if the FRAMES system var is always used, or if there are also methods with interrupts disabled.
Last edited by XoRRoX on Wed Jan 03, 2024 11:54 am, edited 2 times in total.
worcestersource
Manic Miner
Posts: 530
Joined: Thu Feb 03, 2022 11:05 pm

Re: Games with real time played?

Post by worcestersource »

Project Future springs to mind.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: Games with real time played?

Post by Dr beep »

My 256 bytes F1 pitstopsimulator.
On the ZX81 better known as
"Max Verstappen Formula 1 pitstop simulator "
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: Games with real time played?

Post by XoRRoX »

worcestersource wrote: Wed Jan 03, 2024 11:21 am Project Future springs to mind.
Nice, thank you. On further inspection, when losing a life and its animation, that time doesn't seem to be counted.

Perhaps not a real issue for my purposes though.
User avatar
Oloturia
Manic Miner
Posts: 476
Joined: Sat Jan 15, 2022 9:11 pm

Re: Games with real time played?

Post by Oloturia »

(sorry but... what's a "MC game"?)

Micronaut One featured a working clock. Jet Set Willy had a clock but I think it's more like a countdown behaving like a clock.
Also, a few text adventures had a clock that triggered if you waited too long.
User avatar
Mpk
Dynamite Dan
Posts: 1008
Joined: Tue Feb 09, 2021 8:10 am

Re: Games with real time played?

Post by Mpk »

Stonkers
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: Games with real time played?

Post by XoRRoX »

Oloturia wrote: Wed Jan 03, 2024 1:20 pm (sorry but... what's a "MC game"?)
Machine Code, as opposed to BASIC.
berarma
Microbot
Posts: 106
Joined: Thu Mar 09, 2023 10:55 am

Re: Games with real time played?

Post by berarma »

I think the Spectrum doesn't have any real time clock mechanism other than the interrupts or counting the CPU cycles.
User avatar
Morkin
Bugaboo
Posts: 3277
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: Games with real time played?

Post by Morkin »

Atic Atac gives you a completion time at the end of the game.

Looking at @pobtastic's disassembly it seems to make use of FRAMES.
My Speccy site: thirdharmoniser.com
User avatar
jpnz
Manic Miner
Posts: 324
Joined: Tue Nov 14, 2017 4:07 pm
Location: Hamilt[r]on - City Of The Future - NZ

Re: Games with real time played?

Post by jpnz »

Impossible Mission - 6 hours to complete the task at hand
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: Games with real time played?

Post by XoRRoX »

Thank you, all.

I've implemented it. I'm updating FRAMES in IM2 and update my clock (Seconds/Minutes/Hours) every 50 count of FRAMES.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: Games with real time played?

Post by Dr beep »

Without an intrupt I checked if low byte was larger equal to 50 (in case of missed intrupt), if so subtract 50 and increase highbyte.
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: Games with real time played?

Post by XoRRoX »

Dr beep wrote: Thu Jan 04, 2024 8:42 pm Without an intrupt I checked if low byte was larger equal to 50 (in case of missed intrupt), if so subtract 50 and increase highbyte.
Sorry, I'm not quite understanding this.
Dr beep
Manic Miner
Posts: 381
Joined: Mon Oct 01, 2018 8:53 pm

Re: Games with real time played?

Post by Dr beep »

XoRRoX wrote: Fri Jan 12, 2024 3:10 pm Sorry, I'm not quite understanding this.
IM1 will do the update,
so you can check the update without an intruptroutine.

In case your code misses an intrupt you can use this test

Code: Select all

   ld hl,23672  : 50th time counter
   ld a,(hl)
   sub 50
   jr c,nosec
   ld (hl),a ; new start counter
   ld hl,seccount
   inc(hl)
nosec
XoRRoX
Manic Miner
Posts: 233
Joined: Wed Jul 11, 2018 6:34 am

Re: Games with real time played?

Post by XoRRoX »

I see. I'm either turning off interrupts or use IM2. And as far as I see the ROM part IM1 calls is also just updating FRAMES on the interrupt. So I'm now doing that instead in my IM2 routine.
User avatar
ParadigmShifter
Manic Miner
Posts: 671
Joined: Sat Sep 09, 2023 4:55 am

Re: Games with real time played?

Post by ParadigmShifter »

The interrupt routine also scans the keyboard and handles auto-repeat etc.

If you don't use the default interrupt you can put your frame counter anywhere (and it doesn't need to be 24 bits then either), you can safely use IY (unless you also call ROM routines), and ignore the sysvars entirely - gaining some more memory (again, assuming you don't use the ROM).

If you need to use the ROM you can stash IY (it's a constant) and restore it before calling the ROM anyway. You can't trash the sysvars then though unless you know which ones are important. You also can't return to basic if you trash the sysvars of course.
Post Reply