Hello all,
Sorry for anyone without the slightest interest in coding or anything, but I
thought I'd post the prog to see if there were any glaringly obvious mistakes.
Note, at start of routine, E-Tune is a 32768 and this bit is at 65536. Also
Interrupts are disabled, and the E-Tune has been set up by calling 32768. And
a 100 byte Stack exists.
Also, please do not pick holes in it, it's just about my first program, and
as I far as I am concerned, it works (to an extent, minus the E-Tune).
And for clarity, the contents of (IX+0) and (IX+1) is the address of the start
of the line on which the star appears... (IX+2) is the X is added to it to find
the actual address (so it's the X co-ord in effect) and (IX+3) is the speed, ie,
what is taken from the stars X-coord every frame...
This may be wonky, it's from memory.
LD BC,504dec
loop_1 IN A,(B) ;Check current scan line of TV
CP 191
JP NZ, loop_1
LD BC,50dec ;Number of stars in total
LD IX,startable ;IX points to start of stars co-ords etc...
main_loop PUSH BC
LD L,(IX+0)
LD H,(IX+1) ;Load HL with start of line's address.
PUSH HL
LD B,0
LD C,(IX+2) ;Load BC with X-coord
ADD HL,BC ;HL contains star's address
LD A,(HL) ;If it's a star then this will contain a
CP 15 ;value of 15. This is my masking method, and
JP NZ, loop_2 ;it just means no INK 15 on the proper screen
LD (HL),0 ;or it'll be destroyed.
loop_2 LD A,(IX+3) ;Get star's speed, take it from star's X coord
SUB C ;and stick it back in star's main data list.
LD (IX+3),A
LD C,A
POP HL
ADD HL,BC ;HL now holds star's new address.
LD A,(HL)
CP 0 ;Check contents of address, if blank (0) then
JP NZ, loop_3 ;alter it to 15 (a star).
LD (HL),15
loop_3 INC IX
INC IX
INC IX
INC IX ;IX now points to next star in table.
POP BC
DJNZ main_loop
LD A,1
OUT A,(251) ;Page in E-tune.
CALL 32774 ;Call E-Tune.
IN A,(252)
AND 31
OUT A,(251) ;Page screen back into higher memory.
JP loop_1
And I think that's it. Looking at it now, an obvious improvement to the speed
could be made by replacing the Index Register with DE, as this ain't altered
at all in my routine. But, can you seen why it goes all wonky with an E-Tune
playing???
I can't. Bugger.
Graham