Loading files at &400

bbc micro/electron/atom/risc os coding queries and routines
Post Reply
fuzzel
Posts: 660
Joined: Sun Jan 02, 2005 1:16 pm
Location: Cullercoats, North Tyneside
Contact:

Loading files at &400

Post by fuzzel » Tue Sep 22, 2020 7:22 pm

I'm trying to load a file which is &200 long at &400 from within my assembly language program using &FFF7 but it's crashing.
Is there a reason for this? I was hoping this would be a nice location to store a bit of game data.
Hopefully it is ok to do this and I've got my programming wrong somehow.

User avatar
MartinB
Posts: 5340
Joined: Mon Mar 31, 2008 10:04 pm
Location: Obscurity
Contact:

Re: Loading files at &400

Post by MartinB » Tue Sep 22, 2020 8:18 pm

That should be fine as long as BASIC is ‘off’ and not being used. Can you temporarily load the data somewhere else, say &0900-&0AFF or higher up in memory (but below screen mem) to see if it is a location problem?

User avatar
Diminished
Posts: 519
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Loading files at &400

Post by Diminished » Tue Sep 22, 2020 8:39 pm

Conversely, you could try scribbling 0x400-0x5ff with some other data (like zeroes) and see if it still crashes.

fuzzel
Posts: 660
Joined: Sun Jan 02, 2005 1:16 pm
Location: Cullercoats, North Tyneside
Contact:

Re: Loading files at &400

Post by fuzzel » Wed Sep 23, 2020 12:39 pm

I've spotted my error, I'd put in the following lines in my code:

.start4
EQUS"*L. MOB"
.start4a
EQUB1

but forgot to set the value of the byte at .start4a to 13 (carriage return) so got a bad string error.

Doh!

User avatar
lurkio
Posts: 2909
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Loading files at &400

Post by lurkio » Wed Sep 23, 2020 1:08 pm

fuzzel wrote:
Wed Sep 23, 2020 12:39 pm
.start4
EQUS"*L. MOB"
.start4a
EQUB1

but forgot to set the value of the byte at .start4a to 13 (carriage return) so got a bad string error.
Can you do this?:

Code: Select all

.start4
EQUS"*L. MOB"+CHR$13
(Genuine question. I'm not good with assembler.)

:?:

fuzzel
Posts: 660
Joined: Sun Jan 02, 2005 1:16 pm
Location: Cullercoats, North Tyneside
Contact:

Re: Loading files at &400

Post by fuzzel » Wed Sep 23, 2020 2:34 pm

Hi Lurkio, you had me hopeful for a while but I'm afraid your suggestion results in the error "Bad expression."

User avatar
lurkio
Posts: 2909
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Loading files at &400

Post by lurkio » Wed Sep 23, 2020 2:47 pm

fuzzel wrote:
Wed Sep 23, 2020 2:34 pm
Hi Lurkio, you had me hopeful for a while but I'm afraid your suggestion results in the error "Bad expression."
Hmm. This works in the inline BASIC assembler:

Code: Select all

   10 FORO=0TO3STEP3
   20 P%=&3000
   30 [OPT O
   40 LDX#0
   50 .loop
   60 LDA msg,X
   70 JSR &FFE3
   80 INX
   90 CMP#13
  100 BNE loop
  110 RTS
  120 .msg EQUS "HELLO"+CHR$13
  130 ]
  140 NEXTO
  150 CALL&3000
Maybe it's not compatible with BeebAsm, if that's what you're using..?

:?:

User avatar
tricky
Posts: 4672
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Loading files at &400

Post by tricky » Wed Sep 23, 2020 6:45 pm

Beebasm let's you do
EQUS "hello",13

Post Reply

Return to “programming”