Simple USR call no longer working.
Posted: Thu Sep 19, 2019 10:19 pm
I've been trying to learn how to do some machine code programming on the Spectrum.
So I am following this tutorial - Machine code game in 30 minutes.
https://chuntey.wordpress.com/2010/01/1 ... 0-minutes/
It's just the perfect level of detail for my current level of learning. And! Amazingly, the things it said to do all worked... until...
I'm using fuse emulator, version 1.5.1, on Kubuntu 18.04. After installing and running for the first time, I was getting a warning on startup saying that it couldn't find 48.rom and that it was defaulting to opense.rom? I think. That default rom worked fine though - just as the tutorial said. I loaded the 4 byte machine code program into 33000 and was able to call it through BASIC using:
However. Working through the code in the tutorial, I got to a point where I was worried things would stop working with the screen colours of the default rom - it boots up with a black screen instead of the off-white of the 48.rom. So I installed the spectrum-roms package. After that the Spectrum48K machine booted. So I amn't getting the warning at startup any more...
But. The code doesn't work now.
I have, like, the simplest 4 byte program:
1,0,0,201
(That's:
I have loaded it into memory two ways:
- Using File -> Load binary data... in fuse.
- Using a BASIC READ, POKE loop.
I'm looking in the memory in fuse using Machine -> Memory Browser... and I can actually see the bytes are in there, where they're supposed to be!
But when I do:
all I get now is..
Have restarted fuse, of course - still same thing.
Has anyone seen anything like this before?
Am I missing some simple difference in the way these two ROMs deal with USR calls?
Could I have a dodgy version of the ROM?
Maybe I should revert to the opense version of the rom again?
Really don't know. Any and all help appreciated.
So I am following this tutorial - Machine code game in 30 minutes.
https://chuntey.wordpress.com/2010/01/1 ... 0-minutes/
It's just the perfect level of detail for my current level of learning. And! Amazingly, the things it said to do all worked... until...
I'm using fuse emulator, version 1.5.1, on Kubuntu 18.04. After installing and running for the first time, I was getting a warning on startup saying that it couldn't find 48.rom and that it was defaulting to opense.rom? I think. That default rom worked fine though - just as the tutorial said. I loaded the 4 byte machine code program into 33000 and was able to call it through BASIC using:
Code: Select all
PRINT "Return value is "; USR 33000
But. The code doesn't work now.
I have, like, the simplest 4 byte program:
1,0,0,201
(That's:
Code: Select all
ld bc,0
ret
- Using File -> Load binary data... in fuse.
- Using a BASIC READ, POKE loop.
I'm looking in the memory in fuse using Machine -> Memory Browser... and I can actually see the bytes are in there, where they're supposed to be!
But when I do:
Code: Select all
PRINT USR 33000
Code: Select all
2 Variable not found, 0:1
Has anyone seen anything like this before?
Am I missing some simple difference in the way these two ROMs deal with USR calls?
Could I have a dodgy version of the ROM?
Maybe I should revert to the opense version of the rom again?
Really don't know. Any and all help appreciated.