Machine language issue

Basic and Machine Language

Moderator: Moderators

Post Reply
20questions
Vic 20 Hobbyist
Posts: 114
Joined: Sun Mar 10, 2019 7:39 pm
Location: lodi california
Occupation: student

Machine language issue

Post by 20questions »

Why is it that when I write an instruction such as LDA #$01 that it changes to jsr $2020? it does that for every single instruction. what Is going on. My only Vicmon experience is on this website:https://techtinkering.com/2013/04/16/be ... re-vic-20/
and everything there worls ok on my end but the moment I try to make something of my own, the above happens. please help.
Vicmon is set at $6000 Sys 24576
Bedroom coder=rock star
modern coder= pop star
i'd rather be a rock star than a pop start 8)
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Machine language issue

Post by srowe »

What address are you assembling at? If the result "changes" that suggests you're using an address that isn't RAM.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Machine language issue

Post by Mike »

srowe wrote:you're using an address that isn't RAM.
... or no memory at all.

Most probably the OP wanted to assemble the instruction at address $20xx. Read accesses from "open" address ranges quite often (but not reliably) return the high byte of the address as data. That means, even though LDA #$01 ($A9 $01) was written to $2000 and $2001, what got read back was $20 $20 $20 ... and this is disassembled (as control mechanism of the direct assembler) as JSR $2020.

Solution: Enable RAM in BLK1 ($2000..$3FFF) in VICE or add the necessary RAM expansion on real hardware.
20questions wrote:My only Vicmon experience is on this website:https://techtinkering.com/2013/04/16/be ... re-vic-20/
There's also the thread "A sample programming session in VICMON" you have already replied to. :?
20questions
Vic 20 Hobbyist
Posts: 114
Joined: Sun Mar 10, 2019 7:39 pm
Location: lodi california
Occupation: student

Re: Machine language issue

Post by 20questions »

Mike wrote:
srowe wrote:you're using an address that isn't RAM.
... or no memory at all.

Most probably the OP wanted to assemble the instruction at address $20xx. Read accesses from "open" address ranges quite often (but not reliably) return the high byte of the address as data. That means, even though LDA #$01 ($A9 $01) was written to $2000 and $2001, what got read back was $20 $20 $20 ... and this is disassembled (as control mechanism of the direct assembler) as JSR $2020.

Solution: Enable RAM in BLK1 ($2000..$3FFF) in VICE or add the necessary RAM expansion on real hardware.
20questions wrote:My only Vicmon experience is on this website:https://techtinkering.com/2013/04/16/be ... re-vic-20/
There's also the thread "A sample programming session in VICMON" you have already replied to. :?
so, not enough memory? got it. thanks :D
Bedroom coder=rock star
modern coder= pop star
i'd rather be a rock star than a pop start 8)
User avatar
OmegaMax
Vic 20 Newbie
Posts: 12
Joined: Fri Mar 08, 2019 9:59 pm
Location: Canada

Re: Machine language issue

Post by OmegaMax »

Working on your first Hello World! in assembly?
20questions
Vic 20 Hobbyist
Posts: 114
Joined: Sun Mar 10, 2019 7:39 pm
Location: lodi california
Occupation: student

Re: Machine language issue

Post by 20questions »

OmegaMax wrote:Working on your first Hello World! in assembly?
I've been absorbin as much as possible about the 6502, using Assembly Lines (Great book) and others. I use AppleWin when i want to do serious programming (even though I have no idea how to Use Merlin (no how to docs were released with the other stuff) nor how to exit the Editor/assembler.
I then try to replicate the code on the C64 or the Vic 20. So my day is usually full.
Bedroom coder=rock star
modern coder= pop star
i'd rather be a rock star than a pop start 8)
Post Reply