Last file name string.

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
MonkZy
Manic Miner
Posts: 278
Joined: Thu Feb 08, 2018 1:01 pm

Re: Last file name string.

Post by MonkZy »

I could use your entry point to read the header, and then load the data block with a second call.....this also keeps the filename off of the screen.

Back to the text editor.
User avatar
MonkZy
Manic Miner
Posts: 278
Joined: Thu Feb 08, 2018 1:01 pm

Re: Last file name string.

Post by MonkZy »

This is a treble post (hat-trick?)

[mention]Ast A. Moore[/mention] You sexy Bas**rd!

Final code, and problem solved!!

Code: Select all

	
	org 60000

	ld ix,dummy_header			;set IX to point to dummy header location
	ld de,17				;load header bytes
	xor a					;zero A for header
	scf					;set carry for LOAD not VERIFY

	call 1366				;call load ROM routine

	ld ix,(dummy_header+13)			;set IX to data block destination from header
	ld de,(dummy_header+11)			;set DE to data block length from header
	ld a,255				;set A to FF for data block
	scf					;set CF for LOAD

	call 1366				;call ROM routine

	ret
	
dummy_header:
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Last file name string.

Post by Ast A. Moore »

MonkZy wrote: Mon May 07, 2018 4:56 pm Ast A. Moore You sexy Bas**rd!
:lol:

By the way, the following will save you one byte.

Instead of

Code: Select all

	ld a,255	;set A to FF for data block
	scf		;set CF for LOAD
do

Code: Select all

	scf		;set CF for LOAD
	sbc a,a		;set A to FF for data block
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
MonkZy
Manic Miner
Posts: 278
Joined: Thu Feb 08, 2018 1:01 pm

Re: Last file name string.

Post by MonkZy »

The following BASIC program provides a replacement for the LOAD "" CODE command. Simply substitute LOAD "" CODE with RANDOMIZE USR 60000. The data will be loaded without any on-screen text and the filename is stored in memory (60027-60036).

Code: Select all

  5 REM Reserve some RAM for the loader 
10 CLEAR 59999
20 GO SUB 9500

30 REM Your code would go here

9400 STOP

9499 REM This POKE's the loader machine code.
9500 RESTORE 9600
9510 FOR a=0 TO 25
9520 READ b
9530 POKE 60000+a,b
9540 NEXT a
9550 RETURN

9600 DATA 221,33,122,234,17,17,0,175
9610 DATA 55,205,86,5,221,42,135,234
9620 DATA 237,91,133,234,55,159,205,86
9630 DATA 5,201
Example BASIC usage

Code: Select all

 400 RANDOMIZE USR 60000
 520 PRINT AT 1,1;" Filename : ";
 530 FOR a=60027 TO 60036
 540 LET b=PEEK a
 550 PRINT CHR$(b);
 560 NEXT a
Post Reply