Timer on the screen countdown

Page 2/5
1 | | 3 | 4 | 5

By HAL9000

Supporter (14)

HAL9000's picture

05-04-2020, 22:04

Sorry, I was wrong to post the series of the first two images.

Hodine is unverted, the one below is right.

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

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

By HAL9000

Supporter (14)

HAL9000's picture

05-04-2020, 23:50

Ok, so far, correct (my) typing errors of listing 1. Smile

By HAL9000

Supporter (14)

HAL9000's picture

06-04-2020, 21:28

Hello manuel
As for list 1, also in 2, the problem of incorrect positioning of the double points was again a problem on my part oO , of incorrect compilation of the basic list.

Now all 2 programs work great Smile . Thanks again .

By Manuel

Ascended (16407)

Manuel's picture

07-04-2020, 00:09

Yes, I noticed. You should copy-paste the program, not type it over Smile

By gdx

Prophet (3432)

gdx's picture

08-04-2020, 12:03

I improved a little the timer. Now it supports the format as TIME and also in seconds (eg. Enter 3:00 or 180 for 3 minutes), and it can be used until 23:59:59.

10 DEFINT A-S: DEFSNG T: FG=15: BG=1: DIM C(2): COLOR FG,BG,BG
20 SCREEN0: BEEP: LINE INPUT"Please Enter timer time: ";T$: L=LEN(T$): C=0
30 FOR I=1 TO L
40 IF MID$(T$,I,1)=":" THEN C=C+1: C(C)=I: GOSUB 290
50 NEXT
60 IF C=0 THEN T=VAL(T$): IF T=0 OR T>86399! THEN 20
70 IF H>23 OR M>59 OR S>59 THEN 20
80 ON INTERVAL=60-10*(PEEK(&H2B)\128) GOSUB 180: ON STOP GOSUB 310: STOP ON
90 SCREEN 3: OPEN"GRP:" AS 1
100 INTERVAL ON: PRESET(68,56): PRINT#1,":  :"
110 IF STRIG(0) THEN RUN
120 IF T>0 THEN 110
130 INTERVAL OFF: SCREEN0: COLOR15,4,4
140 PRINT"Time's up!":PRINT"Hit any key":TIME=0
150 IF TIME>19 THEN BEEP: TIME=0
160 IF INKEY$<>"" THEN END ELSE 150
170 '
180 H=T/3600: M=(T/60)MOD60: S=T-(H*3600)-(M*60)
190 H$=STR$(H+100): H1$=MID$(H$,3,1): H2$=MID$(H$,4,1)
200 M$=STR$(M+100): M1$=MID$(M$,3,1): M2$=MID$(M$,4,1)
210 S$=STR$(S+100): S1$=MID$(S$,3,1): S2$=MID$(S$,4,1)
220 IF S1$<>S3$ THEN LINE(214,82)-(196,56),BG,BF: PRINT#1,S1$:S3$=S1$
230 IF S2$<>S4$ THEN LINE(246,82)-(228,56),BG,BF: PRINT#1,S2$:S4$=S2$
240 IF M1$<>M3$ THEN LINE(118,82)-(100,56),BG,BF: PRINT#1,M1$:M3$=M1$
250 IF M2$<>M4$ THEN LINE(150,82)-(132,56),BG,BF: PRINT#1,M2$:M4$=M2$
260 IF H1$<>H3$ THEN LINE(22,82)-(4,56),BG,BF: PRINT#1,H1$:H3$=H1$
270 IF H2$<>H4$ THEN LINE(54,82)-(36,56),BG,BF: PRINT#1,H2$:H4$=H2$
280 T=T-1: RETURN
290 IF C=1 THEN M=VAL(LEFT$(T$,C(1))): S=VAL(RIGHT$(T$,C(1)-T)): T=M*60+S: RETURN
300 H=VAL(LEFT$(T$,C(1))): M=VAL(MID$(T$,C(1)+1,2)): S=VAL(MID$(T$,C(2)+1,2)): T=H*3600+M*60+S: RETURN
310 END

By HAL9000

Supporter (14)

HAL9000's picture

09-04-2020, 22:02

Hi Manuel. I could copy to txt, but then how do I get the txt listing to the MSX
in a basic environment?

By HAL9000

Supporter (14)

HAL9000's picture

09-04-2020, 22:03

Hi gdx.
Thanks, I will also try your program.

By Manuel

Ascended (16407)

Manuel's picture

10-04-2020, 00:10

gdx: nice! Why limit to 24 hours? Why not 99:59:59?
I do have some doubts.... Loooks like the subroutine at line 300 isn't used. Also, I added CTRL-STOP handling to restore the colors. Looks like you removed that, or accidentally changed 130 into 310.
Why line 110? What's the idea of line 150 and 160?

By Manuel

Ascended (16407)

Manuel's picture

10-04-2020, 00:11

HAL9000 wrote:

Hi Manuel. I could copy to txt, but then how do I get the txt listing to the MSX
in a basic environment?

You could save it to a floppy disk for the MSX. Or an SD card. Or on a disk image for a Nowind. Or use openMSX to save it into a WAV file to load with your MSX. If you can't use any of these... then you'll have to type it over, I guess, indeed Smile

By gdx

Prophet (3432)

gdx's picture

10-04-2020, 02:10

Manuel wrote:

gdx: nice! Why limit to 24 hours? Why not 99:59:59?

An error occurs before with your program because of the MOD function. I fixed it but I think we have to change the calculation methods to go to 99:59:59.

Page 2/5
1 | | 3 | 4 | 5