6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 5:51 pm

All times are UTC




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Tue Apr 04, 2017 2:29 pm 
Offline
User avatar

Joined: Fri Mar 31, 2017 7:52 pm
Posts: 45
Looking at the 64tass manual, a [$xxxx] can be a long indirect which is not what you wanted. Of course a ($xxxx) can be an indirect which isn't what you want either, but they can also set order of operation. I think since the *2 is outside the () it will be used to set order of operation.

You can assemble with a listing file. I would do that and see what the actual bytes that line of code generates--that will tell you how it behaved and then you can decide if that's how you think it should have behaved.

Bottom line is that I think you are okay.

Glad you found min_mon. I wasn't sure if that was part of the EhBasic package or something that someone else added. I've been focused on OSI 6 digit basic and had set EhBasic to the side but plan to pick it up again soon. I got bogged down in expanding the monitor portion to something more powerful. At this point I'm thinking I'll a single EPROM that I'll page with OSI basic, EhBasic, the expanded monitor and then something yet to be determined.

You might want to consider converting the min_mon that comes with Symon, assembling the whole thing, and seeing if it working in Symon. If it does, then you only need to modify min_mon to fit the IO on your system.

Jim


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 04, 2017 2:36 pm 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Vladimir wrote:
BTW, I replaced the square brackets with parentheses.
Code:
CMP   #(TK_TAB-$80)*2   ; compare normalised token * 2 with TAB

The first error disappeared. Has it affected anything else, God knows.
What should mean square brackets there?
If you replace brackets with parenthesis in the Kowalski assembler you get
Quote:
ERROR E017: Missing constant value (number, label, function or '*'). ROW 1562, FILE D:\Elektronik\6502\ehbasic\high ROM test\basic.asm
As I said earlier: "Every assembler has its own disease." It seems that in Kowalski's assembler parenthesis are reserved for indirect operands only. If you want to force operator precedence, you must use brackets in this assembler.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 05, 2017 1:44 am 
Offline

Joined: Wed Jul 20, 2016 2:14 am
Posts: 78
Location: Irkutsk, Russia
jim30109 wrote:
Looking at the 64tass manual, a [$xxxx] can be a long indirect which is not what you wanted. Of course a ($xxxx) can be an indirect ...

CMP #[XXXX] or CMP #(XXXX) cannot be the indirect for the reason of '#' sign. I watched the source and the listing and understood what this line does. The brackets determine the order of operations. For 64ass it must be parentheses, and for Kowalski, as Klaus mentioned, square brackets are mandatory.
jim30109 wrote:
...Glad you found min_mon. I wasn't sure if that was part of the EhBasic package or something that someone else added....

The file min_mon.asm is a part of the EhBasic package added by author. What for? My understanding is as follows (if I'm wrong, you can correct me).
To run the BASIC on a real machine, you need an environment, system routines. If you are trying to run EhBASIC using Michal Kowalski's 6502 simulator then you need to use min_mon as simulation of such environment. The procedure is described in the manual.
In addition, min_mon.asm has a second and, perhaps, more important mission. It is an example, the study of this file is necessary in order to understand how to correctly install the BASIC on a real machine. But, in this case, min_mon should be replaced with a real OS.
For now, I ran out of questions, everything became more or less clear.
Thank you, Kameraden :)


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 23, 2019 5:59 pm 
Offline

Joined: Mon Nov 18, 2019 8:08 pm
Posts: 9
Sorry for digging up this old thread. While there were plenty of unclear points they were mostly sorted so I don't want to address everything unless someone asks for a clarification.

There's one misunderstanding however which bothered me for years. Worse it appears to spread so I'd like to address it at the source here.
Code:
basic.asm:1558:19: error: invalid operands to multiply '*' 'address' and 'int'
        CMP     #[TK_TAB-$80]*2 ; compare normalised token * 2 with TAB
                             ^
I have to admit this message was a bit low-level and misleading. Later versions (like the old 1.53.1515 released a month after the incident) print this improved message instead:
Code:
basic.asm:1558:19: error: multiply '*' of address '[43]' and int '2' not possible
        CMP     #[TK_TAB-$80]*2 ; compare normalised token * 2 with TAB
                             ^
An address for 64tass is a (numeric) value together with indexing, immediate and indirection operations. This is somewhat different from normal use where it usually stands for a numeric value identifying a memory location.

In this case the address is [TK_TAB-$80] which can't be multiplied as the numeric value 43 had already an indirect long addressing mode applied on. The immediate mode operation haven't joined in yet due to precedence rules.

Probably I could make the expression parser more complicated by special casing brackets to not mean indirection here but I won't. It wouldn't help either as parentheses are used for expression grouping not brackets.

The parser is generic and accepts any random (but syntactically correct) addressing modes even if it turns out that it does not work with the opcode it or it's just nonsense.

There are various design reasons why addresses for 64tass are more than just simple numbers. One of the easiest ones is to support register based addresses:
Code:
tmp = 1,s   ; indirection is only valid at opcodes but indexing is fine here
lda tmp+1   ; lda 2,s


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 51 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: