A football management game [ZX80]

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: A football management game [ZX80]

Post by Moggy »

GIMME GIMME GIMME I WANT IT NOWWWWW!!
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: A football management game [ZX80]

Post by Shaun_B »

Thanks to Dr Beep and Andy Rea for their patience. Here's a custom (bloated) clear screen routine for a 4K ROM ZX80. This will need some refinements and may need some changes as I'm using z88dk as a base to put C wrappers around assembly.

The $0747 call doesn't actually clear the screen as such, just returns to the top line of the screen, so for now, we have:

Code: Select all

	ld hl,($400c) ;DFILE
	ld bc,$0300 ;No of bytes to write
	ld d,$21 ; No of bytes before we put in a carriage return
	inc hl ; We're not worried about the first byte of the DFILE
	CLS:
		dec d ; Count down until the next carriage return
		jp z,NEWLINE ; Are we there yet? Branch to the next line
		ld (hl),$00 ; Else we're writing a space
	DECC:
		inc hl ; Increase the screen pointer
		dec c ; Decrease our number of bytes to write (or the least significant in the registry pair)
		jp z,DECB ; Is this zero? If so, we should decrease the most significant value in the registry pair as well
		jr CLS ; Loop to CLS marker
	DECB:
		dec b ; Decrease the most significant register in the BC pair
		jp z,EXIT ; If this is zero, let's get the ROCK out of here
		jr CLS ; No? Re-loop
	NEWLINE:
		ld (hl),$76 ; Store a carriage return
		ld d,$21 ; Reset the d counter
		jr DECC ; Jump to mid-way through the CLS routine
	EXIT:
	call $0747 ; This returns us to the top-left 
If this is called as a function, I've found with other things I've done with z88dk and assembly, you need to use exx before calling it and exx before returning, i.e.,

Code: Select all

	cls()
	{
		#asm
		exx
		; Assembly here
		exx
		#endasm
	}
If you want a fast and simple clear screen with z88dk, this also works (saves bytes as well):

Code: Select all

	int i;
	
	main()
	{
		// codez
		cls();
		// more codez
	}
	
	cls()
	{
		for(i=23; i>0; i--)
		{
			printf("\n");
		}
		#asm
			call 0x0747 ; Returns to top-left
		#endasm
	}
I've noted that the compiler makes smaller builds if you count down to zero, rather than counting up to x, hence why the for loop is like that.

Regards,

Shaun.
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: A football management game [ZX80]

Post by Shaun_B »

I've put it on GIT for sanity; see the develop branch for the latest additions.

Link to Sunday Football Manager repo

Thanks,

Shaun.
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: A football management game [ZX80]

Post by Shaun_B »

I have a printat() routine which works when I hard-code a value, but I'm currently unable to get it to work with z88dk - some of you may find this useful if you want to delve into ZX80 machine codes (4K ROM): Also note that it might not be optimised. We're using BC as x number of chars from top-left of the screen.

Code: Select all

	ld bc,$010f	;; No of chars from top left
	ld hl,($400c)	;; Get the screen pointer
	inc hl		;; Ignore the first byte of the DFILE
	add hl,bc	;; Increace the DFILE pointed by BC number of chars (around 272 chars - number of lines)
	ld (hl),$26	;; We'll just put an A character here for testing
If you set your screen up with the cls() sub routine that I mentioned earlier, you have ((y*32)+y)+x as your x and y screen coordinates as each line of text will be 32 chars + a new line character. Note that Sinclair ZX81 BASIC assumes PRINT AT Y,X;"A" whereas I like to think in X,Y when dealing with screen locations.

When I get this to work with z88dk I may be able to make some arcade-ish type games as well, but that's for the future.

Thanks,

Shaun.
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: A football management game [ZX80]

Post by Shaun_B »

The release here is simply for the purposes of testing on hardware to see if my custom assembly routines actually work as expected. Nothing playable yet.

https://github.com/sbebbers/sunday-leag ... tag/1.0.0a

Thanks,

Shaun.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: A football management game [ZX80]

Post by Moggy »

Works on real ZX80 with Zxpand.
Tried entering more than 16 Characters for name which it allowed but no instruction screen followed, so some error trapping required there I think.

Also I KNOW IT'S ONLY A DEMO but with the real thing could you up the cash level to something more realistic,£10,000 wasn't even viable in the 1930's.

I know the ZX80 can only count up to 32767 but with some string manipulation it should be possible to make it a bit more real world.

One of the weaknesses of Grandstand was starting with something like 30 grand and it demanding 15 grand a pop to buy players and going bust after 12 matches.

Just constructive murmurings on my part Shaun. :)
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: A football management game [ZX80]

Post by Shaun_B »

Moggy wrote: Wed Aug 23, 2017 12:02 pm Works on real ZX80 with Zxpand.
Tried entering more than 16 Characters for name which it allowed but no instruction screen followed, so some error trapping required there I think.

Also I KNOW IT'S ONLY A DEMO but with the real thing could you up the cash level to something more realistic,£10,000 wasn't even viable in the 1930's.

I know the ZX80 can only count up to 32767 but with some string manipulation it should be possible to make it a bit more real world.

One of the weaknesses of Grandstand was starting with something like 30 grand and it demanding 15 grand a pop to buy players and going bust after 12 matches.

Just constructive murmurings on my part Shaun. :)
£10.000 is unrealistic for *non-league* even?

This is a Sunday League football manager in a non-league division that just happens upon sponsorship from a family-friendly Chemical company. The Sweet FA Challenge Cup is another cup for non-league teams, again with a family-friendly sponsor.

Thanks for the feedback; I can only really up the buffer but there may not be a good way to cover all eventualities unless I put the buffer at something stupid like 1000 bytes which'll take up RAMs when running. I want to get as much game in as possible. The instructions will have to cover things like "Entering more characters than the prompt will cause unpredictable effects and may crash the game".

Regards,

Shaun
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: A football management game [ZX80]

Post by Moggy »

No worries Shaun, you write it I'll certainly play it. :D
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: A football management game [ZX80]

Post by Shaun_B »

Moggy wrote: Thu Aug 24, 2017 3:07 pm No worries Shaun, you write it I'll certainly play it. :D
From your feedback, I've upped the starting funds to a more-than-generous £12,250 so that should be more than enough. The more feedback, the faster things will be developed.

Regards,

Shaun.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: A football management game [ZX80]

Post by Moggy »

One thing does spring to mind and that's the actual matchplay.

With Football Manager on the 81 as you know a pause loop is used between goals terminating in a full time score.
The simulation Grandstand for the 80 relies on you having to manually tap a key to advance the game a goal at a time till full time.

My question is this.. Given the lack of a pause command on the 80 would there be some way to replicate the method used on the 81or is the manual key tap game advance the only way?
Post Reply