ZX80 Golf 2024 code walkthrough

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ก.ย. 2024
  • Bonus video going through the ZX80 game "Golf 2024".
    This is a supplement to the main video repairing the original Golf game from 1982: • Can I fix a 40 year ol...

ความคิดเห็น • 13

  • @zx85
    @zx85 4 หลายเดือนก่อน +2

    Magnificent - I'd play it! ⛳

  • @IansMusical
    @IansMusical 4 หลายเดือนก่อน

    Those were the days Andy. There's something magical about them with the then limitations that strangely isn't present with the microcontrollers of today, even though it's amazing the power they pack and lots of peripherals etc. The automotive processors of today are impressive with their x cores but also highly frustrating due to complexity! Greetings from the UK.

  • @kalleguld
    @kalleguld 4 หลายเดือนก่อน +4

    You sure showed that 11-year old kid who's the better programmer :)

    • @andyhaslam
      @andyhaslam  4 หลายเดือนก่อน +3

      He didn't stand a chance!

  • @Chriswales
    @Chriswales 4 หลายเดือนก่อน

    That's a blast from the past, I started messing around with Basic on a ZX81. Still coding for a living but getting way too old for it. Impressive if that's only 2K worth of code. It seemed like more from what I remember of the 1K programs on the zx81.

    • @andyhaslam
      @andyhaslam  2 หลายเดือนก่อน

      Probably more like 3-4K.

  • @lordmuntague
    @lordmuntague 4 หลายเดือนก่อน +1

    Your use of VAR is sophisticated, elegant and highly relevant. You clearly don't work for the Premier League... 🤔

  • @cigmorfil4101
    @cigmorfil4101 4 หลายเดือนก่อน

    10:30 you could print one less space if variable is 0 and change the second condition on 990 to IF VAR

    • @andyhaslam
      @andyhaslam  2 หลายเดือนก่อน

      Thanks - great optimisations!

  • @cigmorfil4101
    @cigmorfil4101 4 หลายเดือนก่อน

    I know you're trying to think in modern day programming, but at 07:41 why have an IF on line 1830 at all? The IF on 1020 has exactly the opposite condition to that on 1030 so if the goto of 1020 isn't executed, the one on 1030 will be, and vice-versa, and each goto "returns" to 1040.

    • @andyhaslam
      @andyhaslam  2 หลายเดือนก่อน

      I had that in because it used to be a GOSUB until I realised I couldn't use it. Yes, you could optimise with GOTOs, but the code would be a little less clear IMHO. But that's just what I would have done in the 80s!

  • @michaelbluecastlestudio665
    @michaelbluecastlestudio665 3 หลายเดือนก่อน

    Really great video going through programming on this little piece of tech.
    Any chance to get this program to try out?

    • @andyhaslam
      @andyhaslam  2 หลายเดือนก่อน

      I had problems trying to turn it into a usable file, but here's the code as text:
      10 LET SCORE=0
      20 LET PARTOTAL=0
      25 DIM P(9)
      26 DIM S(9)
      30 FOR H=1 TO 9
      40 LET SHOT=0
      50 LET HOLEDIST=160+RND(300)
      60 LET PAR=HOLEDIST/80
      65 LET P(H-1)=PAR
      69 REM PRINT HOLE INFO
      70 GO TO 1000
      80 PRINT "WHICH CLUB?"
      90 INPUT C$
      95 IF C$="S" THEN STOP
      100 PRINT "POWER (1-10)?"
      110 INPUT POWER
      120 LET SHOTDIST=0
      129 REM GET DISTANCE
      130 GO SUB 1200
      139 REM CHECK FOR BAD INPUT
      140 IF SHOTDIST=0 THEN GO TO 1400
      150 LET HOLEDIST=ABS(HOLEDIST-SHOTDIST)
      160 LET SHOT=SHOT+1
      170 IF HOLEDIST>2 THEN GO TO 70
      180 REM BALL IN HOLE
      185 LET S(H-1)=SHOT
      190 LET SCORE=SCORE+SHOT
      200 LET PARTOTAL=PARTOTAL+PAR
      205 PRINT
      210 PRINT "BALL IN HOLE. ";SHOT;" SHOTS."
      220 PRINT "PRESS NEWLINE"
      230 INPUT A$
      240 NEXT H
      250 PRINT
      260 PRINT "GAME COMPLETE"
      270 PRINT "YOU TOOK ";SCORE;" SHOTS"
      280 LET PAR=SCORE-PARTOTAL
      290 IF SCORE>PARTOTAL THEN PRINT "YOU WERE ";PAR;" SHOTS OVER PAR"
      300 IF SCORE0 AND VAR0 THEN GO TO 840
      1040 PRINT
      1050 PRINT "D: DRIVER"
      1060 PRINT "1I-9I: IRON"
      1070 PRINT "P: PUTTER"
      1080 PRINT
      1090 PRINT "HOLE ";H;". PAR ";PAR
      1100 PRINT HOLEDIST;" YARDS TO PIN. SHOT ";SHOT+1
      1110 PRINT
      1120 GO TO 80
      1200 REM GET DISTANCE
      1210 IF POWER10 THEN RETURN
      1220 IF C$="D" THEN LET SHOTDIST=219
      1230 IF C$="P" THEN LET SHOTDIST=50
      1240 LET D$=TL$(C$)
      1250 IF CODE(C$)>28 AND CODE(C$)