News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

CPC6128 CPM 2.2 or Plus time measurement

Started by Wawavoun, 12:28, 12 June 23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Wawavoun

Hello,

I try to measure the execution time of cpm programs.

Into Locomotive Basic there is native functions to do that.
Also it is possible to read HB8B4 --> HB8B7 and get how many 1/300th second are elapsed since last reset.

I believe these addresses are feeded by a basic routine into the rom.

Run CPM and they stop to move on.

Is there something equivalent onto CPM ?

I see on some documentations that there a bios TIME function so probably somewhere an equivalent information is stored but where.
If yes how to call this function from eg basic ?

The language I use (Basic80, Bascom, Fortran80) looks to not have any function related to time management...

Regards.
Philippe


If you think adventure is dangerous try routine, you'll see it's deadly!

McArti0

CPM plus works the same like BASIC, B8B4-B8B7 and CALL BD0D return time in DE,HL registers.
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

Wawavoun

You mean that I should be able to read HB8B4 --> HB8B7 under CPM and get the same information than with Locomotive Basic ?
If you think adventure is dangerous try routine, you'll see it's deadly!

McArti0

YES!

In CPM 2.2 Interrupt is identical like Rom Firmware. 0038 JP B941

In CPM plus 

0038   JP &FDAE

.LFD96
PUSH AF
PUSH HL
EXX
LD A,#C1
OUT (C),A
EXX
LD HL,(#FEDF) ; in HL is B941
CALL LFDAD
LD A,(#FE58)
CALL #FD04
POP HL
POP AF
RET
.LFDAD
JP (HL)    ;  Jump to default Int procedure.
.LFDAE
JR LFD96 ; from 0038

CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

McArti0

#4
BUT in CPM plus ....

User program work in C2 setting of RAM. (OUT 7F00,C2) Bank 4,5,6,7

Timer memory is in C1 setting. Bank 0,1,2,7.

Your procedure to read Timer memory must have an absolute addres above C0A0, jump to C1, read memory and back to C2.

ps. Maybe there is some elegant solution by calling system function. I don't know that.
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

ajcasado

#5
In CPM+ there are bdos functions to manage the system time (104 & 105): https://www.seasip.info/Cpm/bdosfunc.html

You will only have a resolution of seconds, not 1/300th of a second as when using the CPC firmware.

Using a Basic dialect you should be able to use the CALL statement to reach the BDOS. For example, look at the pages 2-3 and C-5 of the BASIC-80 reference document:
https://ia800708.us.archive.org/8/items/BASIC-80_MBASIC_Reference_Manual/BASIC-80_MBASIC_Reference_Manual_text.pdf

EDIT:
Using Fortran you can use a subprogram call, see apendix C on page 102 of this Fortran manual:
https://ia902904.us.archive.org/31/items/bitsavers_microsoftc03.0ReferenceManual1977_4603160/Microsoft_FORTRAN-80_3.0_Reference_Manual_1977.pdf
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

McArti0

#6
YES YES YES!!!  ;D

In CPM plus

CALL &FC5A  ; For CPM 2.2 &BE9B

DW &BD0D ; - Addres Firmware Procedure

in register DE,HL is time counter.

Its work!  :-*

Inspired by  turpas3.angelfire.com/unifirm.pas



175   &BD0D   KL TIME PLEASE
      Action: Returns the time that  has  elapsed  since the computer
              was switched on or reset (in 1/300ths of a second)
      Entry:  No entry conditions
      Exit:   DEHL contains the four byte  count of the time elapsed,
              and all other registers are preserved
      Notes:  D holds the most signifilcant byte of the time elapsed,
              and L holds the least  significant; the four byte count
              overflows after approximately l66 days have elapsed.
CPC 6128, Whole 6128 and Only 6128, with .....
NewPAL v3 for use all 128kB RAM by CRTC as VRAM
TYPICAL :) TV Funai 22FL532/10 with VGA-RGB-in.

Powered by SMFPacks Menu Editor Mod