Timer on the screen countdown

Страница 1/5
| 2 | 3 | 4 | 5

By HAL9000

Supporter (14)

Аватар пользователя HAL9000

28-03-2020, 22:28

Hello everybody.
Information.
There is an MSX program that plays a Timer on the screen
countdown?

For example, similar to the default "Deskpack"
on the Toshiba FS-TM1 "Utility" section, "Alarm" option.

Thanks.

or similar to this graphic but countdown

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By Manuel

Ascended (16977)

Аватар пользователя Manuel

29-03-2020, 00:22

If you don't mind something simple, it should be really easy to make in a few lines of MSX-BASIC...

By HAL9000

Supporter (14)

Аватар пользователя HAL9000

31-03-2020, 12:00

Hi Manuel, thanks for the reply.
Unfortunately I have never been brought in
programming. I did some
program many years ago, but nothing
in particular, of the small type
which they put as examples in the basic manuals.

I will definitely have to try anyway, since
apparently there is nothing ready.

Thanks again, good MSX !!!

(Sorry my english .... I use a translator.)

By Manuel

Ascended (16977)

Аватар пользователя Manuel

31-03-2020, 23:16

OK, I decided to have some fun. My first version is this:

10 LINE INPUT"Please enter timer time in seconds:";T$:T=VAL(T$)
20 ON INTERVAL=60-10*(PEEK(&H2B)\128) GOSUB 100
30 SCREEN 3:OPEN"GRP:" AS 1
40 INTERVAL ON
50 IF T>0 THEN 50
60 INTERVAL OFF:SCREEN0: PRINT"Time's up!":BEEP:BEEP:BEEP:END
100 REM
101 H=T\3600:M=(T\60)MOD60:S=TMOD60
102 H$=RIGHT$(STR$(H+100),2)
103 M$=RIGHT$(STR$(M+100),2)
104 S$=RIGHT$(STR$(S+100),2)
106 IF OS$<>S$ THEN LINE(196,56)-(246,80),4,BF
107 IF OM$<>M$ THEN LINE(100,56)-(150,80),4,BF
108 IF OH$<>H$ THEN LINE(4,56)-(52,80),4,BF
109 PRESET(4,56):PRINT#1,H$;":";M$;":";S$
110 OH$=H$:OM$=M$:OS$=S$
190 T=T-1
200 RETURN

Then I decided to make a slightly more beautiful version like this:

10 FG=15:BG=1
20 LINE INPUT"Please enter timer time in seconds:";T$:T=VAL(T$)
30 ON INTERVAL=60-10*(PEEK(&H2B)\128) GOSUB 100:ON STOP GOSUB 70: STOP ON
40 COLOR FG,BG,BG: SCREEN 3: OPEN"GRP:" AS 1: PRESET(4,56):PRINT#1,"  :  :  "
50 INTERVAL ON
60 IF T>0 THEN 60
70 INTERVAL OFF:SCREEN0:COLOR15,4,4
80 IF T=0 THEN PRINT"Time's up!":BEEP:BEEP:BEEP
90 END
100 H=T\3600:M=(T\60)MOD60:S=TMOD60
110 H$=STR$(H+100):H1$=MID$(H$,3,1):H2$=MID$(H$,4,1)
120 M$=STR$(M+100):M1$=MID$(M$,3,1):M2$=MID$(M$,4,1)
130 S$=STR$(S+100):S1$=MID$(S$,3,1):S2$=MID$(S$,4,1)
140 IF H1$<>H3$ THEN COLORBG:PRESET(4  ,56):PRINT#1,H3$:COLORFG:PRESET(4  ,56):PRINT#1,H1$:H3$=H1$
150 IF H2$<>H4$ THEN COLORBG:PRESET(36 ,56):PRINT#1,H4$:COLORFG:PRESET(36 ,56):PRINT#1,H2$:H4$=H2$
160 IF M1$<>M3$ THEN COLORBG:PRESET(100,56):PRINT#1,M3$:COLORFG:PRESET(100,56):PRINT#1,M1$:M3$=M1$
170 IF M2$<>M4$ THEN COLORBG:PRESET(132,56):PRINT#1,M4$:COLORFG:PRESET(132,56):PRINT#1,M2$:M4$=M2$
180 IF S1$<>S3$ THEN COLORBG:PRESET(196,56):PRINT#1,S3$:COLORFG:PRESET(196,56):PRINT#1,S1$:S3$=S1$
190 IF S2$<>S4$ THEN COLORBG:PRESET(228,56):PRINT#1,S4$:COLORFG:PRESET(228,56):PRINT#1,S2$:S4$=S2$
200 T=T-1
210 RETURN

Please improve Smile

By HAL9000

Supporter (14)

Аватар пользователя HAL9000

04-04-2020, 00:04

Wow .... Big smile Big smile Big smile Thanks Manuel.
Tomorrow I will try these listings.
I'll let you know as soon as possible.

Good night.

By HAL9000

Supporter (14)

Аватар пользователя HAL9000

04-04-2020, 22:15

Hi Manuel.

Thanks again for the basic Timer listings.
The first one doesn't work, and I have to understand why.

The second works and it's okay for now.
We have to solve the part of the representation
on video of the double points between hours and minutes.
We are just part of the program, but they come
immediately covered by the hour digits.

Slowly I study the programs well and well
I will try to solve the points described.

Hello.

By Manuel

Ascended (16977)

Аватар пользователя Manuel

04-04-2020, 22:47

Can you indicate what is not working in the first program?

Note that the program can't handle a number of seconds that would cause more than 99 hours. So the maximum you can input is 100*3600 - 1 seconds. So do not input more than 359999 seconds... otherwise the amount of hours won't fit and will overlap with the left colon (Smile.

If needed, I can add comments to clarify how the programs work. In that case, please tell me which parts you understand and which you do not, so I can focus on the unclear parts.

By HAL9000

Supporter (14)

Аватар пользователя HAL9000

05-04-2020, 14:42

As for inserting the seconds, ok, I had it
guessed.

To better explain you, how can I add mine
images (produced by me) to make you understand better?
Here, I can only enter the URL for the images of
this same site, but to show mine (from my PC)
how you do it?

By Grauw

Ascended (9342)

Аватар пользователя Grauw

05-04-2020, 16:11

Hi HAL9000, this answer in the FAQ will answer your question: How can I upload a picture?

By HAL9000

Supporter (14)

Аватар пользователя HAL9000

05-04-2020, 21:08

Hi Grauw.

Thank you very much

By HAL9000

Supporter (14)

Аватар пользователя HAL9000

05-04-2020, 21:56

Hi Manuel.

I made some screenshots (sorry for the poor quality).
The first refers to the first listing, which I called "TIMER-01.BAS".
As you can see, once the program is launched, it immediately stops at line 10.

https://www.msx.pics/image/VirVl

The other four screens refer to the second "TIMER-02.BAS" listing.
Here the program works, but there is the problem that the double points are positioned
too close (red circles) to where they should be (green rectangles).

https://www.msx.pics/image/Vietz
https://www.msx.pics/image/ViXem
https://www.msx.pics/image/VikCS
https://www.msx.pics/image/Vi2W4

Страница 1/5
| 2 | 3 | 4 | 5