I think this is something like what you need.
REM Points standings
REM Previous positions & points added to last race and sorted
Set Display Mode 800,600,16
Sync Rate 0
`number of drivers
length=7
dim driver$(length)
dim points(length)
dim chdriver$(length)
dim chpoints(length)
gosub RaceResults
gosub ChampionshipTable
REM Display current standings prior to driver sort and sum i,e
set cursor 0,0
print "Last Race Standings :"
for i=0 to length
print (driver$(i));" ";
print str$(points(i))
next i
REM Display old Table
set cursor 0,155
print "Old Table :"
for i=0 to length
print (chdriver$(i));" ";
print str$(chpoints(i))
next i
REM Update and Sort table
gosub Table_Sort
REM Display updated Table
set cursor 0,320
print "Updated Sorted Table :"
for i=0 to length
print (chdriver$(i));" ";
print str$(chpoints(i))
next i
wait key
END
`---------------------------------------------------------------
Table_Sort:
`Add race results to table.
for i=0 to length
for d=0 to length
If chdriver$(i)=driver$(d)
chpoints(i)=chpoints(i)+Points(d)
endif
next d
next i
`Sort table.
For p1 = 7 to 0 step -1
For p2 = 7 to 0 step -1
If chpoints(p2) > chpoints(p1)
HsTemp=chpoints(p1)
HsTemp$=chdriver$(p1)
chdriver$(p1)=chdriver$(p2)
chpoints(p1)=chpoints(p2)
chdriver$(p2)=HsTemp$
chpoints(p2)=HsTemp
Endif
Next p2
Next p1
return
`---------------------------------------------------------------
RaceResults:
REM Load last race results and points
rem load array "drivers.dat",driver$(0)
rem load array "racepoints.dat",points(0)
rem for purposes of diagnosis no seperate files are required !
points(0)=10
driver$(0)="Senna"
points(1)=8
driver$(1)="Schumacher"
points(2)=6
driver$(2)="Hill"
points(3)=5
driver$(3)="Berger"
points(4)=4
driver$(4)="Mansell"
points(5)=3
driver$(5)="Patrese"
points(6)=2
driver$(6)="Arnoux"
points(7)=1
driver$(7)="Prost"
return
`---------------------------------------------------------------
ChampionshipTable:
REM Load current Championship Standings
REM Load last race results and points
rem load array "chdrivers.dat",chdriver$(0)
rem load array "chpoints.dat",chpoints(0)
REM File to be created at game beginning to populate chdruvers.dat and chpoints.dat
REM with driver names and 0 points
REM this below to be replaced by files chdrivers.dat & chpoints.dat
REM Standings to date
chpoints(0)=28
chdriver$(0)="Hill"
chpoints(1)=21
chdriver$(1)="Arnoux"
chpoints(2)=16
chdriver$(2)="Prost"
chpoints(3)=15
chdriver$(3)="Mansell"
chpoints(4)=12
chdriver$(4)="Berger"
chpoints(5)=10
chdriver$(5)="Senna"
chpoints(6)=8
chdriver$(6)="Patrese"
chpoints(7)=4
chdriver$(7)="Schumacher"
return
`---------------------------------------------------------------
ToXic.