File size: Difference between revisions

Content added Content deleted
(Added solution for Action!)
Line 156: Line 156:
RETURN</lang>
RETURN</lang>
{{out}}
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/File_size.png Screenshot from Atari 8-bit computer]
<pre>
<pre>
Dir "D:*.*"
Dir "D:*.*"
Line 165: Line 164:


Size of "D:INPUT.TXT" is 1274 bytes
Size of "D:INPUT.TXT" is 1274 bytes
</pre>

The '''Sparta DOS X''' system stores the size of the file in the directory. The readout of the values is performed with the XIO 39 operation. In the ICAX3, ICAX4, ICAX5 registers values are returned in 24-byte format. Calculation according to the formula: ICAX3 + ICAX4 * 256 + ICAX5 * 65536.
{{libheader|Action! Tool Kit}}
<lang Action!>INCLUDE"REAL.ACT" ;from the Action! Tool Kit

proc MAIN()
byte array astring
byte IOCB1=$350,ICAX3=IOCB1+12,ICAX4=IOCB1+13,ICAX5=IOCB1+14
real A,B,C,FLEN

open(1,"D:REAL.ACT",4,0) xio(1,0,39,"D:REAL.ACT") close(1)

IntToReal(ICAX3,FLEN)
IntToReal(ICAX4,A) astring="256" ValR(astring,B) RealMult(A,B,C) RealAdd(FLEN,C,FLEN)
IntToReal(ICAX5,A) astring="65536" ValR(astring,B) RealMult(A,B,C) RealAdd(FLEN,C,FLEN)
print("Size of REAL.ACT is ") printRD(DEVICE,FLEN) printe(" bytes")
return
</lang>
{{out}}
<pre>
Size of D:REAL.ACT is 4995 bytes
</pre>
</pre>