Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Speccy Wars
#22
In main file:
Code:
PRINT AT 3,13 ; PAPER 1 ; INK 7 ; "BattleField"
  PRINT AT 5,9 ; PAPER 7 ; INK 0 ; "Q - Up"
  PRINT AT 6,9 ; PAPER 7 ; INK 0 ; "A - Down"
  PRINT AT 7,9 ; PAPER 7 ; INK 0 ; "O - Left"
  PRINT AT 8,9 ; PAPER 7 ; INK 0 ; "P - Right"
  PRINT AT 9,9 ; PAPER 7 ; INK 0 ; "M  or Space- Select"
  PRINT AT 10,3 ; PAPER 7 ;INK 0 ; "C to End Turn"
  PRINT AT 10,3 ; PAPER 7 ; INK 0 ; "You have to select units"
  PRINT AT 11,3 ; PAPER 7 ; INK 0 ; "to fight the enemy units"
  PRINT AT 15,3 ; PAPER 7 ; INK 0 ; "Press any key to start"
You can change to:
Code:
PRINT AT 3,13 ;"\{p1}\{i7}BattleField"
  PRINT  AT 5,9 ; "\{p7}\{i0}Q - Up"; AT 6,9 ;"A - Down"; AT 7,9 ; "O - Left"; AT 8,9 ; "P - Right"; AT 9,9 ; "M  or Space- Select";AT 10,3; "C to End Turn";AT 10,3 ; "You have to select units"; PRINT AT 11,3; "to fight the enemy units"; PRINT AT 15,3; "Press any key to start";

Code:
60  LET j$ = INKEY$
  IF j$ = "" THEN GOTO 60: END IF
can be replaced with
Code:
Do
j$=inkey$
loop until j$<>""
No need to use line numbers.

Code:
PRINT AT 1,x ; PAPER 1 ; INK 0 ; " "
can be written as
Code:
PRINT AT 1,x ;"\{p1}\{i0} "

Code:
FUNCTION millisecs AS ULONG
REM Reads the FRAMES counter
RETURN INT((65536 * PEEK(23674) + 256 * PEEK(23673) + PEEK(23672)))
END FUNCTION

Code:
dim millisecs as ULONG at 23672
this sets the variable millisecs at frames sysvar, so reading it will return the milliseconds, writing to it will set the frames sysvar. Any you do not need a function for it (okay, you probably need to BAND it with $FFFFFF). Do you really need ULONG?
Also check if there are undimed variables as this make them float
There is a lot of optimisation potential. I'm sure, you can save 3-5 Kb.

It looks like you define UDG multiple times. Thats what I found quickly checking the sources.
Optimising the source is a bit time consuming because you did not use indentation.

You can also change:
Code:
dim selecty as byte
dim selectx as byte

dim selectedUnit as ubyte
dim targettedUnit as ubyte
to
Code:
dim selecty,selectx,selectedUnit,targettedUnit as ubyte
for better readibility
And as boriel said, you can set up org to 24200 without problems. Reduce the heap to 512.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)