Wargames Simulator in Basic

  • So wie's da liegt, ist es für MBASIC unter CP/M leider erstmal nicht brauchbar.

    Das Programm ist mit 42013Bytes einfach zu groß.

    Wenn ich MBASIC auf dem MFA starte, habe ich noch 30520 Bytes free.

    Es gibt sicher auch CP/M Versionen, die weniger Speicher brauchen, aber das reicht doch niemals.


    Was er da mit SYSGEN 64 image/boot Disk schreibt, erschließt sich mir nicht.

    MBASIC hat knapp 24 KB (190 Recs = 24320 Bytes).

    Die 42013 Bytes des Programms dazuaddiert ergibt 66333 Bytes.

    Das sind ja schon über 64 KB, und da ist noch kein BIOS und BDOS geladen.


    Oder hat jemand vielleicht die 8 KB Version von MBASIC?

    Die hätte dann aber keine Disk-Routinen...

    +++ ATH

  • Die Datei enthält 42000 ASCII Zeichen.

    Die BASIC Befehle werden aber tokenisiert und brauchen dann nur ein Byte.

    Vielleicht reichts ja. Ein Versuch ist es wert.

    ;------------------------------------
    ;----- ENABLE NMI INTERRUPTS
    (aus: IBM BIOS Source Listing)

  • Code
    BASIC-80 Rev. 5.29
    [CP/M Version]
    39224 Bytes free
    LOAD "WARGAMES.BAS"
    OK
    PRINT FRE(0)
     5376
    OK

    auf RunCPM [v6.0] => CCP:[INTERNAL v3.0] TPA:[60K]


    MBASIC /M:<max_mem> Highest mem location used by MBASIC (default all TPA)

    (bei einer TPA-Size von 64K bekomme ich in MBASIC trotzdem auch nur 39224 Bytes free) :(

    2 Mal editiert, zuletzt von guidol ()

  • Könnte man das Programm nicht mit BASCOM kompilieren?

    Ich weiß nicht, wie kompatibel das ist. Ist nur so ne Idee.

    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Ob das auch auf meinen Schreibmaschinen läuft? Muss ich mal testen... In dem einen Video ist eine wargames.com zu sehen, es muss sich also kompilieren lassen.

    evtl. als BRUN-Version - aber RunCPM schafft es nicht direkt als .COM:

  • Selbst zum Kompilieren zu groß? :wacko:

    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Ich weiß - lesen wäre zu einfach:


    NOTE: The code will run using a BASIC-80 interpreter (on a SYSGEN 64 image/boot disk), but it may not be possible to compile and link the code as it stands because of the 64KB TPA Memory limit of CP/M. To overcome this limitation of CP/M and to enable the code to be compiled and linked, I am considering breaking the code up into a series of smaller programs and using a data file to share variables between them.



    VG

    github.com/petersieg

  • Wenn man sich den Programmcode so anschaut, ist da viel Einsparpotential. Grob geschätzt kann man da bestimmt 5-10k rausholen. Ohne aufteilen und auslagern.


    Ich habe leider kein System mit MBasic-80 lauffähig. Aber vielleicht ist ja schon jemand dran.

    Es wäre nur gut, wenn man sich absprechen würde, sonst haben wir hinterher 3 unterschiedliche Versionen. ;)


    EDIT: Ich habe doch eine lauffähige CP/M-Umgebung. Ich hatte vor Jahren mal RunCPM unter DOS bzw. Windows installiert. Das funktioniert tatsächlich noch.

    MBasic hat nur einen Zeileneditor, oder? Da muss also erst mal ein brauchbarer Editor her. Meine Assembler-Files habe ich früher unter CP/M immer mit Wordstar editiert. :D

    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

    3 Mal editiert, zuletzt von detlef ()

  • Mit RunCPM habe ich ja direkten Zugriff von Windows auf die Files in den Laufwerken. Ich kann also einfach mit Notepad++ editieren. So gefällt mir das. ;)

    Ich habe jetzt mal auf die schnelle durch die Eleminierung von Leerzeichen und Linien 2,5k freibekommen. Ich hatte gedacht, dass da mehr drin ist.

    Ist es auch, aber dann wird es mühsamer. Man muss dann doch die Prrogrammstruktur verändern.


    Aber ganz nett gemacht. Man kann alles nachvollziehen, was David im Film mit einem IMSAI getrieben hat, inkl. dem Ändern der Schulnote seiner Freundin und dem Buchen des Flugtickets. Und natürlich auch das War-Dialing und die Einwahl in WOPR.


    Also wenn ich Zeit habe, dann versuche ich das mal zu optimieren. Speziell für die IMSAI-Besitzer ist das schon eine ganz nette Spielerei. Ich habe leider keinen.

    Falls das jemand anderes ebenfalls angehen möchte, dann bitte hier Bescheid geben. Damit wir das nicht doppelt machen.


    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Ich habe jetzt mal auf die schnelle durch die Eleminierung von Leerzeichen und Linien 2,5k freibekommen. Ich hatte gedacht, dass da mehr drin ist. Ist es auch, aber dann wird es mühsamer.

    Man könnte einfach die sehr langen Namen der Variablen entsprechend kürzen ... ;)

    Ja, habe ich auch mal teilweise gemacht. Das bringt aber nicht soo viel.

    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Ja, habe ich auch mal teilweise gemacht. Das bringt aber nicht soo viel.

    Maximal 3 Zeichen je Variable-Namen bringt hier über 1 KB ...

    Ja, das stimmt schon. Aber dafür muss man sinnvolle Namen vergeben und schauen, dass man nichts doppelt vergibt. Das geht eben nicht so auf die Schnelle.

    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Habt ihr vielleicht ein paar Bilder von der lauffaehigen Version ?

    Jetzt bin ich doch irgendwie neugierig geworden...... :)




    Viel weiter bin ich noch nicht gekommen. Ich habe das aber auch nur ganz kurz ausprobiert, ob es überhaupt startet.

    Wie der War-Dialer funktioniert, weiß ich noch nicht. Der verhält sich komisch. Und wie man in den WOPR reinkommt, weiß ich auch noch nicht.

    Es gibt Hilfe-Dateien, die müsste ich mal lesen. ;)


    Die meisten Infos, was das Programm alles macht, habe ich aus dem Quelltext entnommen.

    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Gerade auf Github gesehen. Es gibt auch ein Video zu dem Programm:

    https://www.youtube.com/watch?v=GsTtD4rpM6E

    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Ok, das Video erklärt genau, wie es funktioniert. ;)



    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Das ist jetzt meine Zwischenversion. Die ist jetzt um 4,3k kleiner. Vielleicht hilft das schon dem einen oder anderen.

    Auch alles nur quick&dirty.


    Aber kompiliert bekomme ich das immer noch nicht. Ich habe auch keine Idee, wie klein man das Programm bekommen muss, damit es kompiliert.

    Ich bin weder der BASCOM noch der CP/M Experte (nicht mehr). ;)

  • Zwei Kleinigkeiten:

    • Wenn es eine UCASE$() Funktion gibt, kann man viele der IF Vergleiche vereinfachen, indem man vorher die Eingabe in Großbuchstaben umwandelt
    • Manche wiederholte IF Sequenzen lassen sich kompakter als ein einziges IF mit GOTO schreiben (ist ja BASIC!)

    Genau. Einen UCASE gibt es zwar nicht, aber das kann man auch einfach als Unterprogramm erledigen.

    Ich habe jetzt erstmal nur die Variablennamen verkürzt, die häufig vorkommen. Ausserdem SPACE$ und STRING$ eingesetzt, da wo es lohnt.

    Aber das bringt immer nur ein paar Byte und das Programm wird immer unleserlicher.


    Um das Programm wirklich signifikant zu verkleinern, müsste man da wohl strukturell ganz anders rangehen. So wie der Programmierer selbst schon vorgescjlagen hat. Aber dann ist man kurz davor, das Programm neu zu schreiben. ;)

    • i-Telex 7822222 dege d

    • technikum29 in Kelkheim bei Frankfurt

    • Marburger Stammtisch

    Douglas Adams: "Everything, that is invented and exists at the time of your birth, is natural. Everything that is invented until you´re 35 is interesting, exciting and you can possibly make a career in it. Everything that is invented after you´re 35 is against the law of nature. Apply this list to movies, rock music, word processors and mobile phones to work out how old you are."

  • Bei mir ist das Programm in der ASCII-Version jetzt 37.219 Bytes groß.

    Damit habe ich auf dem MFA unter MBASIC genug freien Speicher:

    Es ließe sich noch mehr an Speicher einsparen, da das Programm jetzt aber Problemlos bei mir läuft, habe ich keine Lust mehr, in der Richtung weiterzubasteln. :tüdeldü:


    Die Abfragen für Delay und Terminal-Typ habe ich entfernt, und die Ausgabe VT-100 kompatibel umgebaut.

    Somit konnte ich auch den unerwünschten Zeilensprung bei der Nummereingabe im Dialer eliminieren.

    Es gab bei zu großen Delay-Werten an mehreren Stellen einen Überlauf, da dieser Wert nochmal mit bis zu 250 multipliziert wird.

    Bei einem Delay von 600, was bei mir halbwegs passt, kam das mit Integer dann nicht mehr so ganz hin...


    Beim Ablauf des Programms habe ich am Ende leichte Zweifel, ob das so richtig ist.

    Nachdem der Abschusscode bestätigt wird, startet ohne weitere Ankündigung Tic-Tac-Toe.

    Und nach der Tic-Tac-Toe Sitzung kommt dann der Schlußsatz: "A STRANGE GAME. THE ONLY WINNING MOVE IS NOT TO PLAY!"

    Scheint mir irgendwie durcheinander.

    Vielleicht sollte ich mir den Film nochmal ansehen, und dementsprechend nacharbeiten.

    Am besten dann auch direkt die Unmengen Ausdrucke raushauen, an die ich mich aus dem Film erinnere... ;)


    EDIT: Tippfehler im Programm behoben, Spieleliste im WOPR nach dem Ansehen des passenden Filmausschnitts vervollständigt.

    Dateigröße ist jetzt 37.296 Bytes.