C64 Game Update 3: I'm actually enjoying programming in BASIC and I don't care what anyone thinks about that

in #technology2 months ago


As you can see, my game has a name now :) There are also more monster/object types. I'm still enjoying the programming process.

There's a stigma about programming in basic, though - even compiled basic - and I am not entirely sure why.

Yeah, "GOTO considered harmful" and all that, but you don't have to use GOTO if you don't want to.

Heck, in a modern basic you don't even need to use GOSUB.

One thing I found confusing in this XC Basic (a compiled basic for C64), was it has parameterized Procedures (subroutines) with private variable scope, but didn't seem to have access to Global variables (I know, I know).

Turns out to access a Global you simply add a \ to the variable name:

dim this_is_global$
let this_is_global$ = "second line"

proc testing(x$)

        print x$
        print \this_is_global$


call testing("first line")   

You can also even pass a pointer as a parameter, and therefore use that to return a value.

proc somesub(result_addr)
  somevalue = 1
  doke result_addr, somevalue

result = 0
call somesub(@result)
print result