First steps in ML (split/OT from: Vixen - [...])

Basic and Machine Language

Moderator: Moderators

Robbie
Vic 20 Dabbler
Posts: 84
Joined: Tue Aug 11, 2020 4:36 am
Location: England

First steps in ML (split/OT from: Vixen - [...])

Post by Robbie »

hoot hoot! :D

Well, after a long wait for some low voltage Eproms:

I've got wAx burned to a 24-pin Eprom which slots into the Vixen motherboard and works! It's addressed at BLK5 (if I remember to flip the switch that turns the power on to slot 4). (SYS40960)

So now I've got a 1084s monitor (colour AND stereo!!) and a real 1541 drive..

I have a 16k RAM cartridge at blocks 1 and 2 and an 8k RAM cartridge on its way from Fleabay - I believe I can change some DIP switches to persuade the 8k RAM to move to BLK3? Can anyone point me to the right place for the DIP settings please?

No SD2IEC, no 35k RAM, just the original hardware I wish I'd owned in 1982. wAx is the only luxury, but there are limits! Admittedly, I really do now need a much bigger desk / spare room / boat.

I suppose the last question is whether the Super Expander can just be used to add an extra 3k or whether it uses memory addresses elsewhere and will argue with the other memory (which as I've learnt earlier is 'not recommended' :arrow: :shock: ). I'm not bothered about using any of the other Super Expander features to be honest.

Meanwhile, in between prevaricating on ebay and messing with hardware, I've now got LDA($FB,X) to do what I want. Though I'm struggling with:

LDA ($FB,X)
CMP $FC
BNE -@

It seems to take the branch whether $FC is greater than $FB, less than $FB, equal to $FB, or wearing a hat and a jaunty moustache and identifying as a transexual paint brush. I'll have another mess tomorrow, but will probably be seeking help very soon. :(
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: First steps in ML (split/OT from: Vixen - [...])

Post by chysn »

Robbie wrote: Wed Sep 30, 2020 3:32 pm hoot hoot! :D
I have a 16k RAM cartridge at blocks 1 and 2 and an 8k RAM cartridge on its way from Fleabay - I believe I can change some DIP switches to persuade the 8k RAM to move to BLK3? Can anyone point me to the right place for the DIP settings please?
Here you go: http://www.classiccmp.org/cini/pdf/Comm ... Memory.pdf. It's on the Denial Wiki somewhere, too, but I was too lazy to look it up. :)
I suppose the last question is whether the Super Expander can just be used to add an extra 3k or whether it uses memory addresses elsewhere and will argue with the other memory (which as I've learnt earlier is 'not recommended' :arrow: :shock: ). I'm not bothered about using any of the other Super Expander features to be honest.
The Super Expander's 3K will always be in the 3K area from $0400 to $0fff, right before the default BASIC RAM at $1000. It won't get in the way of any of the other 8K blocks.
Meanwhile, in between prevaricating on ebay and messing with hardware, I've now got LDA($FB,X) to do what I want. Though I'm struggling with:

LDA ($FB,X)
CMP $FC
BNE -@

It seems to take the branch whether $FC is greater than $FB, less than $FB, equal to $FB, or wearing a hat and a jaunty moustache and identifying as a transexual paint brush. I'll have another mess tomorrow, but will probably be seeking help very soon. :(
It's hard to comment on the behavior without knowing what the values of the memory locations $fc and ($fb,x) are. But keep in mind that you're not comparing the value in $fc to the value in $fb, as you seem to suggest above. You're comparing the value in $fc to the value at the memory location pointed to by $fb+x as the low byte and $fc+x as the high byte.

I'm having a hard time thinking of a case where the above code would be useful. Because it's oddly self-referential (potentially (depending on x) comparing the high byte of your pointer to the value AT the pointer), it's raising a red flag for me as maybe not looking at the values you think it is.
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
Robbie
Vic 20 Dabbler
Posts: 84
Joined: Tue Aug 11, 2020 4:36 am
Location: England

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Robbie »

chysn wrote: Wed Sep 30, 2020 7:17 pm It's hard to comment on the behavior without knowing what the values of the memory locations $fc and ($fb,x) are. But keep in mind that you're not comparing the value in $fc to the value in $fb, as you seem to suggest above. You're comparing the value in $fc to the value at the memory location pointed to by $fb+x as the low byte and $fc+x as the high byte.

I'm having a hard time thinking of a case where the above code would be useful. Because it's oddly self-referential (potentially (depending on x) comparing the high byte of your pointer to the value AT the pointer), it's raising a red flag for me as maybe not looking at the values you think it is.
Ahhhhhhhhh! :oops:
Robbie
Vic 20 Dabbler
Posts: 84
Joined: Tue Aug 11, 2020 4:36 am
Location: England

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Robbie »

Oh, hold on... I've just checked and I wasn't that dopey.

The code is:
.
.
.
-@ DEC $FB
.
.
.
LDA $FB
CMP $FD
BNE -@
LDA $FC
CMP $FE
BNE -@

It's basically comparing two addresses ($FB-FC and $FD-$FE), and if they're equal then continue, otherwise loop back.

It's hardly rocket science, so I must be missing something really, really obvious. I'll have another poke around later and shout if my brain turns to mush again.

Writing ML at 10pm with a big glass of whisky is perhaps not the best approach though.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: First steps in ML (split/OT from: Vixen - [...])

Post by chysn »

Based on what’s written here, you never leave the loop -@ unless the values at addresses $fc and $fe are the same. Is there anything in the ellipsis-ed code that changes at least one of them?
User avatar
Noizer
Vic 20 Devotee
Posts: 297
Joined: Tue May 15, 2018 12:00 pm
Location: Europa

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Noizer »

Basically one needs an idea before getting to code. Please explain clearly what you want to accomplish, so that we could help at target 😙
Valid rule today as earlier: 1 Byte = 8 Bits
-._/classes instead of masses\_.-
Robbie
Vic 20 Dabbler
Posts: 84
Joined: Tue Aug 11, 2020 4:36 am
Location: England

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Robbie »

Sorry for the cryptic code fellas, but I was (rightly) pretty convinced the code was ok, and that something else was going on. I copied the little bit of code into this thread because I thought I might be using -@ incorrectly, but it seems not.

The routine I've written takes the text "Hello orld" and turns it into "Hello World" - basically moving x characters after an insertion point up one address in memory and inserting character y. Ultimately part of Robbie's Text Editor, if I ever get that far.

At the start of the code I was declaring a few variables in memory at $5FF9 to $5FFF. I did this in the first few lines in wAx. When I checked, those variables were still there, and looking fine.

However, I've just discovered that if I save the file to disk then look back at those addresses then they contain remnants of the filename I've just saved. It seems that I've ended up using some I/O addresses at the top of BLK2. Not sure how I've done that as I thought BLK2 was completely free.

My workflow was to type 'RUN', and if it assembles ok then "SAVE". Then execute it.

Obviously, if I re-run the assembler before execution then it overwrites those I/O addresses with what I want, and everything works fine. My mistake was not doing that and just assuming I didn't need to - instead of activating the iterator addresses, it was activating some random addresses based on the filename and everything was going haywire.

Confused the pants off me for 3-4 days, but all is good now. The lesson - reassemble after saving!

Thanks for trying to help, but it felt like I just needed to prod at it for a while until I spotted the trouble.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: First steps in ML (split/OT from: Vixen - [...])

Post by chysn »

Robbie, when you start up wAx, is the URL centered on the screen or flush left?
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
Robbie
Vic 20 Dabbler
Posts: 84
Joined: Tue Aug 11, 2020 4:36 am
Location: England

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Robbie »

Now who's getting cryptic?

Pretty sure it's centred. I'll have a check in a bit and let you know if not.
Robbie
Vic 20 Dabbler
Posts: 84
Joined: Tue Aug 11, 2020 4:36 am
Location: England

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Robbie »

chysn wrote: Thu Oct 01, 2020 5:23 pm Robbie, when you start up wAx, is the URL centered on the screen or flush left?
Yep, it's centred. I'm using the BLK5 version with the Vixen Eprom socket.

Do you think it might be wAx that's storing the filename at $5FFD-ish? It's a strange thing to happen cost those addresses are only available if there's 16k+ of expanded RAM.

It's not a problem, just a conundrum really.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: First steps in ML (split/OT from: Vixen - [...])

Post by chysn »

Robbie wrote: Fri Oct 02, 2020 4:02 am Do you think it might be wAx that's storing the filename at $5FFD-ish? It's a strange thing to happen cost those addresses are only available if there's 16k+ of expanded RAM.
I asked about the centering because previous (until late-July) revisions used BASIC's $cb1e routine to print text to the screen. This routine has some... let's call it "interesrting" behavior when its pointer is in Page 2, which wAx uses for its buffers. Such strings are relocated to BASIC string memory (see $d4b5). I noticed this when my character sets were being clobbered when running some wAx commands, and fixed the issue by re-implementing the $cb1e routine in the wAx code. It appears that you have the fixed version, though.

But, I'm interested in reproducing what you're seeing, to rule out any problems. So I'll reach out via PM, if you don't mind.
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Mike »

Robbie wrote:Do you think it might be wAx that's storing the filename at $5FFD-ish? It's a strange thing to happen cost those addresses are only available if there's 16k+ of expanded RAM.
No, it's the BASIC interpreter which stores a temporary copy of the filename there at the end of BASIC memory.

You really should take a look into addresses 43/44 and 55/56, which define start and end of memory used by BASIC, respectively. Everything that happens to be placed in-between there (machine code, data, graphics), and which isn't part of a loaded program (such as machine code behind a BASIC stub), isn't at a save place when you do anything with BASIC!
Robbie
Vic 20 Dabbler
Posts: 84
Joined: Tue Aug 11, 2020 4:36 am
Location: England

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Robbie »

Mike wrote: Fri Oct 02, 2020 7:13 am You really should take a look into addresses 43/44 and 55/56, which define start and end of memory used by BASIC, respectively. Everything that happens to be placed in-between there (machine code, data, graphics), and which isn't part of a loaded program (such as machine code behind a BASIC stub), isn't at a save place when you do anything with BASIC!
That makes sense Mike, and it's reassuring to know the reason rather than just guessing and working around it.
I shall restrict BASIC before doing anything - I'll make it a boilerplate first line of anything I write.

I guess it's always useful to keep in the back of my mind that Evil Bill wrote CBM BASIC. :evil:
...looking forward to finding out if his Covid vaccine will come with a Blue Screen of Death.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: First steps in ML (split/OT from: Vixen - [...])

Post by chysn »

Robbie wrote: Fri Oct 02, 2020 11:29 am That makes sense Mike, and it's reassuring to know the reason rather than just guessing and working around it.
I shall restrict BASIC before doing anything - I'll make it a boilerplate first line of anything I write.
Robbie, you can restrict (or even move around) BASIC memory using wAx's BASIC Stage (up-arrow) tool:

https://github.com/Chysn/wAx/wiki/Change-BASIC-Stage

The resolution is in page (256-byte) increments, but it makes it easy to manage multiple BASIC programs in memory at a time, while protecting memory from BASIC.

(If you use block 5 for any BASIC stages, note that you won't be able to save such programs to tape)
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
Robbie
Vic 20 Dabbler
Posts: 84
Joined: Tue Aug 11, 2020 4:36 am
Location: England

Re: First steps in ML (split/OT from: Vixen - [...])

Post by Robbie »

chysn wrote: Fri Oct 02, 2020 8:48 pm Robbie, you can restrict (or even move around) BASIC memory using wAx's BASIC Stage (up-arrow) tool
I shall have a look.

As wAx is a wedge, I'm guessing that any ML I write with line numbers is stored in the BASIC stage, is that right?

I really should just try these things and see, but it's easier to ask you, chysn. :roll:
Post Reply