|
Post by mobluse on Mar 28, 2021 20:06:49 GMT
|
|
|
Post by Unbeliever on Apr 6, 2021 23:47:03 GMT
I'm quite certain you could accomplish this by poking a new value into the top-of-stack pointer... but I'm also reasonably certain that if you're feeling the need to turn GOSUBs into GOTOs, you're probably making some poor life decisions somewhere. I mean... *SHUDDER*. I can't believe Apple Basic actually built that in...
|
|
|
Post by mobluse on Apr 8, 2021 23:55:04 GMT
I'm quite certain you could accomplish this by poking a new value into the top-of-stack pointer... but I'm also reasonably certain that if you're feeling the need to turn GOSUBs into GOTOs, you're probably making some poor life decisions somewhere. I mean... *SHUDDER*. I can't believe Apple Basic actually built that in... You cannot change the machine stack pointer from BASIC so you need a machine code routine. If it is possible to read the stack pointer from BASIC you could GOSUB 99, swap the two top elements using PEEK and POKE, update the top element to the next next line in BASIC using PEEK and POKE and RETURN twice. That would have the same effect as POP or SYS699 in the program below. Maybe some other solution without machine code is possible. A person in a Swedish C64 forum, bjonte, solved the problem using machine code for C64 and VIC20: 0 fori=0to19:reada:poke699+i,a:next:data104,133,251,104,133,252,186,138,24,105 1 data7,170,154,165,252,72,165,251,72,96 10 gosub100 20 print"finished":end 100 gosub1000 110 print"not here!" 120 return 1000 print"now it happens!" 1010 sys699:rem pop 1020 return bjonte used archive.org/details/Compute_s_Mapping_the_Commodore_64 and archive.org/details/COMPUTEs_Mapping_the_VIC_1984_COMPUTE_Publications as references. POP comes from Apple Integer BASIC by Steve "Woz" Wozniak, and then the later floating point Applesoft BASIC was made backwards compatible with that. Also Atari BASIC has POP. I think POP might be needed in some situations. Anyway, now it is possible to port some Applesoft or Atari BASIC programs with POP to C64 or VIC20.
|
|