Jump to content



1

Added file access to MLC and PreCompiler (Tintin Example)


10 replies to this topic

#1 moulinaie OFFLINE  

moulinaie

    Chopper Commander

  • 185 posts
  • Location:France, Burgundy

Posted Mon Jan 9, 2012 4:23 PM

Hello,

I have added the file access instructions:
FOPEN, FCLOSE, FREAD, FWRITE, FDELETE, FSCRATCH, FSAVE, FLOAD, FRESTORE, FSTATUS.

To show this, I have made a program that replays a very little movie direct from disk:



Note that the first screen with scrolling title is in extended Basic and you'll notice the speed display when it goes to the Assembly routine for the animation.

Note 2: the FastLoader has been upgraded, you can see that at the very beginning, only few seconds are required to load and compile.

Here is the source code:


100 CALL CLEAR::DIM A$(60)
$MLC X 110 10 3000
300 GOSUB 1500::CALL CHAR(48,"7EFFFFFFFFFFFF7E")
330 CALL CLEAR::CALL LINK("TINTIN",Z)
335 CALL CLEAR::PRINT "THE END..."::END
;
; here define theborder for the film effect
;
1500 CALL CHAR(96,"C0C0C0FFFFFFFFFF060606FEFEFEFEFEC0C0C0C0C0C0C0C00606060606060606")
;
; borders white on black
; and text yellow on black
;
1510 RESTORE 2000::CALL CLEAR::CALL SCREEN(2)::CALL COLOR(9,16,2)
1515 FOR I=1 TO 8::CALL COLOR(I,12,2)::NEXT I
;
; display text with borders and centers
;
1520 READ R$::I=LEN(R$)::J=INT(I/2)::IF I=0 THEN RETURN
1530 PRINT "`a"&RPT$(" ",12-J)&R$&RPT$(" ",12+J-I)&"`a";
1540 READ R$::I=LEN(R$)::J=INT(I/2)::IF I=0 THEN RETURN
1550 PRINT "bc"&RPT$(" ",12-J)&R$&RPT$(" ",12+J-I)&"bc";::GOTO 1520
2000 DATA " "," ","WELCOME TO A NEW WORLD"
2010 DATA " "," "," "," "
2020 DATA "NO 3D EFFECT"," "," "," "
2030 DATA "NO SOUND"," "," "," "
2040 DATA "NO COLOR"," "," "," "
2050 DATA "NO STORY"," "," "," "
2060 DATA "NO SPEILBERG"," "," "," "
2070 DATA " "
2080 DATA "ONLY..."
2090 DATA " "," "," "," "," "," "," "," "," "," "," "," ",""
;
; here MLC routine TINTIN
;
$TINTIN
	HIGHMEM 0
	SCREEN 1		; black background
	FOR I 12 15
		COLOR I 16 1	; white on black for the "movie"
	NEXT
	FOR I 4 11
		COLOR I 3 1	; green for text
	NEXT
	COLOR 6 4 1		; light green for great title

	STARTDATA
		STRING " PURE...						"
		STRING "								"
		STRING " 0	 0  0 00   0	 0  0 00  "
		STRING "000	   00  0 000	   00  0 "
		STRING " 0	 0  0   0  0	 0  0   0 "
		STRING " 0	 0  0   0  0	 0  0   0 "
		STRING " 0  0  0  0   0  0  0  0  0   0 "
		STRING "  00  00 000 000  00  00 000 000"
		STRING "								"
		STRING "			 `flrx			  "
		STRING "			 agmsy			  "
		STRING "			 bhntz			  "
		STRING "			 ciou{			  "
		STRING "			 djpv|			  "
		STRING "			 ekqw}			  "
		STRING "								"
		STRING "	DIRECT STREAM FROM DISK!	"
		STRING "	  (MY LITTLE COMPILER)	  "
	ENDDATA M
	;
	; this assembly routine turns every ASCII char to
	; its screen equivalent: ASCII+96
	;
	$[
		mov @M,r0	; points to text bloc
		li r1,>6060	; offset for XB characters on screen
		li r2,288	; 18 lines with 16 words
		; here
		a r1,*r0+	; add offset to chars
		dec r2		; counter
		jne -3		; jump "here" if not finished
	$]

	BMOVECTOV M 576 96	; copy text to third screen line
	STARTDATA		; prepares the PAB for file access
		BYTE 0		; no Opcode for now
		FLAGS sequential, internal, fixed, input
		WORD 1536	; address for definition of char 96 and followings
		BYTE 240	; max length
		BYTE 240	; length
		WORD 0		; no rec number for sequential
		BYTE 0		; offset unused
		BYTE 10		; name is 10 bytes long
		STRING "DSK1.VIDEO"
	ENDDATA A

	LET B &h831A
	GETTABLE B(0) P		; peek(831A) = VDP address of free space
	SUB P 22		; place for PAB so P = PAB ADDRESS
	BMOVECTOV A 22 P	; copy PAB to VDP Ram
	FOPEN P			; open the file
	IF=			; if OK, go on!
		REPEAT
			FRESTORE P	; to beginning of file
			NDO N 5		; five images
				PUTTABLE P(5) 240	; size to read.
				FREAD P			; read 240 bytes into char defs
				NDO X 3000		; little wait loop
				NLOOP
			NLOOP
			KEY 0				; a key pressed?
		UNTIL>=					; if no, go on
	ENDIF
	PUTPARAM 1 Z					; return Z, the file error code (if any)
$$
$END


Guillaume.

Edited by moulinaie, Mon Jan 9, 2012 4:35 PM.


#2 unhuman OFFLINE  

unhuman

    Dragonstomper

  • 784 posts
  • Location:Vienna, VA

Posted Mon Jan 9, 2012 9:17 PM

Wow. The sound is amazing! :P

#3 RXB OFFLINE  

RXB

    Dragonstomper

  • 539 posts
  • Location:Vancouver, Washington, USA

Posted Tue Jan 10, 2012 1:08 AM

Very cool work. Nicely done.

#4 moulinaie OFFLINE  

moulinaie

    Chopper Commander

  • 185 posts
  • Location:France, Burgundy

Posted Tue Jan 10, 2012 1:46 AM

View Postunhuman, on Mon Jan 9, 2012 9:17 PM, said:

Wow. The sound is amazing! :P

Unfortunately, it's not the TI that plays the sound!
It is the music from a serie of cartoons with all the original adventures of Tintin.

Guillaume.

#5 moulinaie OFFLINE  

moulinaie

    Chopper Commander

  • 185 posts
  • Location:France, Burgundy

Posted Tue Jan 10, 2012 1:49 AM

View PostRXB, on Tue Jan 10, 2012 1:08 AM, said:

Very cool work. Nicely done.

Thanks!!!
As the replay is from disk, the number of images is not limited by the amount of RAM. And the CF7 is so fast that I had to include a loop delay between every frame.
The limitation comes from the file size (is there a limit for a file?). Every frame uses a rectangle of 5*6 characters, this is 30*8=240 bytes.

Guillaume.

#6 ti99userclub OFFLINE  

ti99userclub

    Moonsweeper

  • 280 posts
  • Location:Italy

Posted Tue Jan 10, 2012 5:00 AM

Ah!
Great Funny Effect ! :-)

#7 eck OFFLINE  

eck

    Combat Commando

  • 4 posts

Posted Tue Jan 10, 2012 8:55 AM

127 files on TI-formatted disks is the maximum, I think. Your work looks very promising.

#8 moulinaie OFFLINE  

moulinaie

    Chopper Commander

  • 185 posts
  • Location:France, Burgundy

Posted Tue Jan 10, 2012 9:39 AM

View Posteck, on Tue Jan 10, 2012 8:55 AM, said:

127 files on TI-formatted disks is the maximum, I think. Your work looks very promising.

Thanks!
127 files looks enough for such a system...
I was thinking about the limit for the size of ONE file?
According to the E/A manual, a record number can be from 0 to 32767, and a record can be 255 bytes long (a quarter of KB) so it's close to 8192KB, in other words, 8MB ??

Guillaume.

#9 moulinaie OFFLINE  

moulinaie

    Chopper Commander

  • 185 posts
  • Location:France, Burgundy

Posted Tue Jan 10, 2012 1:19 PM

Hi,

Everything is on my pages with the new files and the TINTIN example

http://gtello.pagesp...ge.fr/mlc_e.htm (english)
http://gtello.pagesp...ge.fr/mlc_f.htm (français)

Guillaume.

#10 Lee Stewart OFFLINE  

Lee Stewart

    Chopper Commander

  • 175 posts

Posted Tue Jan 10, 2012 4:01 PM

View Postmoulinaie, on Tue Jan 10, 2012 9:39 AM, said:

I was thinking about the limit for the size of ONE file?
According to the E/A manual, a record number can be from 0 to 32767, and a record can be 255 bytes long (a quarter of KB) so it's close to 8192KB, in other words, 8MB ??

Guillaume.

The actual file size for a single file with fixed-length records occupying all the available space on a TI-99/4A disk depends on the smaller of two numbers, viz., 32768 X 256 = 8MB (as you concluded) and the size of the disk less disk overhead (usually much smaller). If you actually had enough space for an 8MB file with 32767 records of 255 bytes each + 1 sector for its FDR, you will have 8,388,608 bytes allocated but will waste one byte per sector of the 32767 records or 32767 bytes (32K - 1 bytes); and, of course, you cannot use the FDR for your data. So, the actual amount of space for data is 8,388,608 - 32767 - 256 = 8,355,585 bytes.

Fixed-length records are stored as an integral number of records per sector. That's the reason for the wasted byte in each sector noted above. However, if you use 128-byte records, you can use every byte of available space with 2 records/sector on a 4MB disk or smaller. On a DSDD disk (360KB total disk space) with one file occupying all available space, all but 3 sectors (768 bytes) for the VIB, the FDIR and the FDR for the lone file, can be filled with data. That is a file with only 2874 records of 128 bytes each.

...lee

#11 marc.hull OFFLINE  

marc.hull

    Dragonstomper

  • 646 posts
  • Location:Oklahoma CIty.

Posted Thu Jan 12, 2012 10:40 PM

You really seem to have a good grasp of what is going on and I appreciate you passion as far as providing avenues for people goes but.....You are rather talented and I would like to see your efforts on games for the TI.... TinTin didn't appear in the fog on your mirror ya know..... I'd like to see you stretch your coding a bit more...... Might be kinda kewl....




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users