News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_CraigsBar

M4 Clock DIsplay using variables

Started by CraigsBar, 20:44, 18 March 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CraigsBar

An eon ago (About 3 years) I was speakinf with @Duke about how to use the clock features of the M4 to display a real time clock and or date using variables in Basic. He wonderfully provided the a program in posting https://www.cpcwiki.eu/forum/amstrad-cpc-hardware/amstrad-cpc-wifi/msg147645/#msg147645 . I have now tweaked this as follows....



10 FOR a=&9000 TO &908A
20 READ b: POKE a,b
30 NEXT
40 CALL &9000
50 IF PEEK(&908A) = 255 THEN PRINT"M4 not found!"
60 MODE 2
70 PRINT "Time:"
80 PRINT "Date:"
90 LOCATE 7,1:FOR n=0 TO 8:m4time$=CHR$(PEEK(&908B+n)):PRINT m4time$;:NEXT
100 m4year$="":FOR n=0 TO 3:m4$=CHR$(PEEK(&9094+n)):m4year$=m4year$+m4$:NEXT
110 m4month$="":FOR n=0 TO 1:m4$=CHR$(PEEK(&9099+n)):m4month$=m4month$+m4$:NEXT
120 m4day$="":FOR n=0 TO 1:m4$=CHR$(PEEK(&909C+n)):m4day$=m4day$+m4$:NEXT
130 LOCATE 7,2:PRINT m4day$;"/";m4month$;"/";m4year$
140 CALL &BD19:REM frame - Basic 1.0 equivalent
150 CALL &9000:REM refresh time
160 GOTO 90
170 DATA &F3,&1,&84,&7F,&ED,&49,&3A,&8A,&90,&FE,&FF,&CC,&4B,&90,&FE,&FF,&C4,&1F,&90,&1,&C,&7F,&ED,&49,&1,&0,&DF,&ED,&49,&FB,&C9,&1,&0,&DF,&ED,&79,&3E,&2,&1,&0,&FE,&11,& 24,&43,&ED,&79,&ED,&59,&ED,&51,&1,&0,&FC,&ED,&49,&21,&2,&FF,&5E,&23,&56,&EB
180 DATA &1,&3,&0,&9,&11,&8B,&90,&1,&16,&0,&ED,&B0,&C9,&F3,&FD,&21,&82,&90,&16,&7F,&D5,&1,&0,&DF,&ED,&51,&3A,&0,&C0,&FE,&1,&20,&1C,&3A,&4,&C0,&6F,&3A,&5,&C0,&67,&FD,&E5,&D1,&1A,&AE,&20,&D,&1A,&23,&13,&E6,&80,&28,&F5,&D1,&7A,&32,&8A,&90,&C9
190 DATA &D1,&15,&20,&D3,&3E,&FF,&C9,&4D,&34,&20,&42,&4F,&41,&52,&C4,&FF


which in general works, however after it is running it crashes after about 21 seconds. (Sometimes more, sometimes less but always around 21 seconds). As I am hoping to produce a large font clock and I now have all the variables I would need (m4time$, m4year$, m4month$ and m4day$) I'l love this not co crash. Any thoughts on where this crash may be coming from or assistance in troubleshooting, I am running M4 board revision 2.4e with Software V2.0.5b12


Hopefully someone can help with the code, although I can probably fix the basic the M/C is way beyond my skills LOL.


thanks in advance


Craig

IRC:  #Retro4All on Freenode

GUNHED

Well, I have an routine which is used for FutureOS to read time and date, but it's in Z80 assembler. Would this be of any use for you?
http://futureos.de --> Get the revolutionary FutureOS (Update: 2024.10.27)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

teopl

#2
looks like some kind of timing issue.

if you write this:

101 gosub 1000
111 gosub 1000
121 gosub 1000
131 gosub 1000
141 gosub 1000
151 gosub 1000
1000 for i=0 to 200: next: return

it works...

edit: it also crashes but later... so, not sure...

CraigsBar

OK I got it working.... WIth a posting from Duke a little later in theoriginal thread... Memory &8fff added to line 10 and the clock works, snag now however is htat it no longer works with the Double Height Characters "dheight.bas" from AA tape 6. Hmmmm.



IRC:  #Retro4All on Freenode

GUNHED

Well, the MC code can be reassembled to another code address.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2024.10.27)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Powered by SMFPacks Menu Editor Mod