BeebAsm's Hello World - printing part of file name, not "Hello World"

Discuss all aspects of programming here. From 8-bit through to modern architectures.
Post Reply
occularis
Posts: 15
Joined: Wed Aug 30, 2017 3:56 pm
Contact:

BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by occularis » Sun Jan 14, 2018 8:49 pm

I've downloaded BeebAsm for Mac 1.08 (the precompiled version).

I'm trying the Hello World example (as given at https://github.com/tom-seddon/beebasm/b ... /about.txt), which is as follows:

Code: Select all

\ Simple example illustrating use of BeebAsm

oswrch = &FFEE
osasci = &FFE3
addr = &70

ORG &2000         ; code origin (like P%=&2000)

.start
    LDA #22:JSR oswrch
    LDA #7:JSR oswrch
    LDX #mytext MOD 256:STA addr
    LDY #mytext DIV 256:STA addr+1
    LDY #0
.loop
    LDA (addr),Y
    BEQ finished
    JSR osasci
    INY
    BNE loop
.finished
    RTS

.mytext EQUS "Hello world!", 13, 0
.end

SAVE "MyCode", start, end
Then I run beebasm like this:

Code: Select all

beebasm -i simple.asm -do test.ssd -boot MyCode -v
When I load and run the resulting .ssd in BeebEm 4.0a for Mac (set to BBC Model B hardware mode) it's not behaving as expected. Upon running we change to mode 7 (as expected) but then we output the text "Code" (not expected). By experimentation I can see that it's outputting the filename (which is "MyCode") minus the first two characters; if I change the filename this pattern persists.

I can't work out why this is happening. The assembled code output when running beebasm looks correct:

Code: Select all

.start
     2000   A9 16      LDA #&16
     2002   20 EE FF   JSR &FFEE
     2005   A9 07      LDA #&07
     2007   20 EE FF   JSR &FFEE
     200A   A2 1F      LDX #&1F
     200C   85 70      STA &70
     200E   A0 20      LDY #&20
     2010   85 71      STA &71
     2012   A0 00      LDY #&00
.loop
     2014   B1 70      LDA (&70),Y
     2016   F0 06      BEQ &201E
     2018   20 E3 FF   JSR &FFE3
     201B   C8         INY
     201C   D0 F6      BNE &2014
.finished
     201E   60         RTS
.mytext
     201F   48 65 6C ...
     202B   0D
     202C   00
.end
Saving file 'MyCode'
Processed file 'simple.asm' ok
[{'end':8237L,'finished':8222L,'loop':8212L,'mytext':8223L,'start':8192L}]
I've had a look at the .ssd contents in a text editor and I can't see anything strange looking about that, either.

I verified the value of PAGE in BeebEm - which is &1900, as expected - and there's no BASIC program in memory so LOMEM is &1902.

This is probably something painfully simple, but I just can't see it!

I also ran the .ssd through jsbeeb via its web page, and the result is much the same.
Last edited by occularis on Sun Jan 14, 2018 9:02 pm, edited 1 time in total.

User avatar
hoglet
Posts: 7694
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by hoglet » Sun Jan 14, 2018 8:54 pm

occularis wrote:This is probably something painfully simple, but I just can't see it!
Indeed!

This bit doesn't look right:

Code: Select all

    LDX #mytext MOD 256:STA addr
    LDY #mytext DIV 256:STA addr+1
should be:

Code: Select all

    LDA #mytext MOD 256:STA addr
    LDA #mytext DIV 256:STA addr+1
Dave

occularis
Posts: 15
Joined: Wed Aug 30, 2017 3:56 pm
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by occularis » Sun Jan 14, 2018 9:12 pm

Ahhh well done! Thankyou.

Just before I saw your reply I printed out the contents of &70 and &71 after executing the code and they both contained the value 7 (which is not what I'd expected -- it's from the 7 still in the accumulator from the mode 7 call). No idea why the example code is so broken!

Cheers!
Last edited by occularis on Sun Jan 14, 2018 9:12 pm, edited 1 time in total.

User avatar
sweh
Posts: 1980
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by sweh » Sun Jan 14, 2018 9:12 pm

hoglet wrote:
occularis wrote:This is probably something painfully simple, but I just can't see it!
Indeed!

This bit doesn't look right:

Code: Select all

    LDX #mytext MOD 256:STA addr
    LDY #mytext DIV 256:STA addr+1
should be:

Code: Select all

    LDA #mytext MOD 256:STA addr
    LDA #mytext DIV 256:STA addr+1
Dave
Yeah, that bug would mean that (addr) would point to &0707 ('cos the value of A was 07 after the JSR &FFEE), which points to the BASIC command line input buffer, which would be point to "CODE" in "*RUN MYCODE"
Rgds
Stephen

occularis
Posts: 15
Joined: Wed Aug 30, 2017 3:56 pm
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by occularis » Sun Jan 14, 2018 9:13 pm

Ok, working now!

Is beebasm still being maintained on github? I can submit a pull request to fix that.

User avatar
Rich Talbot-Watkins
Posts: 1393
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by Rich Talbot-Watkins » Sun Jan 14, 2018 9:33 pm

Erm, oops, yeah... my bad. I clearly wrote that help text as quickly as I wrote the initial release of BeebAsm. Sorry about that.

Dunno who maintains the BeebAsm repo these days, but yeah feel free to get that changed. I guess I never expected anyone to ever try to assemble that (it was more of a "rhetorical example"!). The spinning globes demo was always intended as the "Hello World" of BeebAsm!

User avatar
tricky
Posts: 2947
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by tricky » Sun Jan 14, 2018 9:36 pm

There were some additions last year (can't find the thread).
RichTW was working talking about a new version, but it didn't look very lightly.

User avatar
sweh
Posts: 1980
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by sweh » Sun Jan 14, 2018 9:52 pm

I've created a pull request against Tom's repo - https://github.com/tom-seddon/beebasm/pull/21
Rgds
Stephen

SteveF
Posts: 510
Joined: Fri Aug 28, 2015 8:34 pm
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by SteveF » Sun Jan 14, 2018 10:15 pm

tricky wrote:There were some additions last year (can't find the thread).
There have been a few threads here and there, but FWIW I believe most of my changes are on the proposed-updates branch in Tom's repo: https://github.com/tom-seddon/beebasm/t ... ed-updates.

tom_seddon
Posts: 226
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by tom_seddon » Mon Jan 15, 2018 12:29 am

I keep putting off thinking about this, but github sent me an email about the new PR, so I suppose I just have to admit it: I've been a terrible steward of this project :(

Shall we get this sorted out properly once and for all? What I suppose needs to happen: ownership needs to be transferred to stardot, Steve F's proposed-updates branch needs to be merged into master, and development can continue from there, probably by merging in sweh's changes and carrying on.

(There's some stuff in my branch, but that can be sorted out later... I never quite got it working anyway.)

The stupid thing is that when the stardot organisation was created, I think this actually all got set up! But I'd read something about some problems that could stem from doing this the obvious way, though I don't remember what any more, and so as the repo owner I nixed it, intending to sort it out properly later. Which of course I never did. Bleargh.

--Tom

User avatar
Rich Talbot-Watkins
Posts: 1393
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by Rich Talbot-Watkins » Mon Jan 15, 2018 8:19 am

tom_seddon wrote:I keep putting off thinking about this, but github sent me an email about the new PR, so I suppose I just have to admit it: I've been a terrible steward of this project :(
Not as bad as me! :lol:

User avatar
kieranhj
Posts: 732
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by kieranhj » Mon Jan 15, 2018 11:51 am

tom_seddon wrote:I keep putting off thinking about this, but github sent me an email about the new PR, so I suppose I just have to admit it: I've been a terrible steward of this project :(

Shall we get this sorted out properly once and for all? What I suppose needs to happen: ownership needs to be transferred to stardot, Steve F's proposed-updates branch needs to be merged into master, and development can continue from there, probably by merging in sweh's changes and carrying on.

(There's some stuff in my branch, but that can be sorted out later... I never quite got it working anyway.)

The stupid thing is that when the stardot organisation was created, I think this actually all got set up! But I'd read something about some problems that could stem from doing this the obvious way, though I don't remember what any more, and so as the repo owner I nixed it, intending to sort it out properly later. Which of course I never did. Bleargh.

--Tom
Hey Tom,

Don't be hard on yourself, we all have RL to compete with our Acorn/retro lives!! When I created the Stardot organisation on GitHub I originally forked your repo of beebasm but later deleted it so that we could arrange for a transfer instead as this will preserve all existing forks etc. I am not aware of any issues regarding repo transfers but I am not a Git expert. I have done this successfully with projects that I started in my personal account and then moved over to our Bitshifters organisation.

The details look straightforward: https://help.github.com/articles/transf ... l-account/ and you are already an owner in the Stardot organisation so there shouldn't be any permission issues.

Perhaps it would be a start to just get the existing repo transfered then everyone else can help get SteveF & sweh's changed merged in and approved? It doesn't have to be all on you to sort out the various branches that have accumulated over time, unless you want to!
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

tom_seddon
Posts: 226
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by tom_seddon » Wed Jan 17, 2018 10:51 pm

I've transferred BeebAsm to stardot: https://github.com/stardot/beebasm/

(https://github.com/tom-seddon/beebasm now redirects to that via some github magic or other, so hopefully this won't break anything for anybody!)

I didn't merge anything in, so it's all just as it was. I'd quite like to pass the baton on at this point ;) - I have to admit I never ended up using BeebAsm much in the end and I probably won't do much on it in the future. Might make a PR for the changes on my branch once it's up and running in its new home, but probably not more than that.

I made SteveF an admin, but I think any of the stardot admins are automatically admins on it anyway, so maybe that was unnecessary. Anyway, fingers crossed it should be easy for others to add additional contributors and accept PRs and so on now.

--Tom

SteveF
Posts: 510
Joined: Fri Aug 28, 2015 8:34 pm
Contact:

Re: BeebAsm's Hello World - printing part of file name, not "Hello World"

Post by SteveF » Thu Jan 18, 2018 11:15 pm

Thanks Tom, I can see it and (as you'd expect) the proposed-updates branch with my changes on is still there.

What I'd like to do next is merge sweh's recent pull request and my proposed-updates branch onto master and call it v1.09. Or maybe v1.09-pre, if anyone feels inclined to build it and try building their own projects with it to shake out any bugs? (Then again, if you're so inclined, you can always do that directly with the proposed-updates branch.)

Does anyone else have any changes they want to submit a pull request for first? Obviously we can have a v1.10 etc later on, so there's no great rush, but if you're keen to get stuff into v1.09 now's the time, I guess.

Does anyone really hate any of the changes on my proposed-updates branch and objects to them going into master? I'd hope not as most of them were posted over on the BeebAsm forum at RetroSoftware without sparking big flame wars. :-)

Cheers.

Steve

ETA: I wonder if we should ask an admin to split off the latter part of this thread, since we've drifted off the original subject. Thoughts? It might make more sense to be discussing this in the "Development tools" forum, for example.

Post Reply