informedcitizenry / 6502.net Goto Github PK
View Code? Open in Web Editor NEWA .Net-based Cross-Assembler for Several 8-Bit Microprocessors
License: MIT License
A .Net-based Cross-Assembler for Several 8-Bit Microprocessors
License: MIT License
Hi, I'm back! I was able to update my project using your latest source code, and after a bit of finicking I got it to work :)
As a test I compiled my ongoing C64 project, and I'm now getting a new compile error, from this macro declaration:
GOTOMENU .macro menuBlockName
.SET16 zp_menu_request, \menuBlockName.Menu
.endmacro
The way it work is that I pass the name of a block, and I'm setting a variable with the address of the label "Menu" inside the block.
It used to work, but now it's complaining with "Reference parameter not valid.", pointing at the \menuBlockName.Menu part. My assumption is that it's probably now including the ".Menu" with the macro name and therefore does not recognize it?
I've been going through the documentation up and down and can't find a way to concatenate macro arguments. Am I misunderstanding something, or is there an easy work around?
Thanks!
Me again! I just pulled your latest version (2.1.8.1) and it all works perfectly.
That being said I needed to add a small tweak to make it work in my non-CL context, and thought maybe you'd be interested in adding it to your codebase. Basically, "CommandLineOptions.cs" has an hardcoded behavior of pulling arguments from the command line array. In my non-CL project it's not working, of course. So what I did is:
public AssemblyController(List<string> args = null)
{
Assembler.Initialize(args);
_assemblers = new List<AssemblerBase>();
}
public static void Initialize(List<string> args)
{
...
Options.ParseArgs(args);
public void ParseArgs(List<string> args = null)
{
args = args ?? Environment.GetCommandLineArgs().Skip(1).ToList();
I'm not quit sure if you're interested in supporting this paradigm, and it not, by all mean ignore my request and close this bug entry. I can maintain this change in my local project. Just thought I'd let you know in case you are interested :)
When I build my code that contains ".ifdef", I'm getting an error message:
Symbol "true" is not defined.
So at the top of my main.a file that contains all my project included files, I make sure to define them myself, like so:
true = 1 ; Needed by the compiler to handle .ifdef
false = 0 ; for some reason
Which allow me to build fine. I would assume these two symbols wouldn't have to be defined by the source code.
This is a very specific issue I have encountered when using this format:
lda #<NUM
Where NUM can be any number between 0 and 65535. With these positives numbers it works fine. It also seems to work fine with negative numbers... with the exception of numbers between -128 and -255 (inclusive).
For instance, these works:
lda #<-127
lda #<-256
But these doesn't:
lda #<-128
lda #<-200
lda #<-255
For any numbers between these two, assembly stops on this error:
Mode not supporter for "lda" in selected CPU.
I mean, if Program Counter (PC) is 9, for example, is there any way to know which line of the generated assembly corresponds to it?
Thanks :)
Currently the .bank command is 64kb. for the NES for example this would be more useful at 8,16,or 32kb.
I considered using .dsection but the end address can't be $10000 or higher which means I can't use that approach.
Found another issue, something that used to work before but is now throwing an error: whenever I have a "+" or "-" anonymous label on a line where I call a macro, I'm getting this error:
Cannot redefine "+".
For instance:
GetWritePtr
lda zp_write_buffer
beq +
.SET16 BC, RAMMap.Map1
rts
+ .SET16 BC, RAMMap.Map0
rts
(note that my macro does not contain a + label, which was my first guess).
Using an anonymous label seems to always work fine if I use it on a non-macro instruction. For instance if I add a "nop" instruction on the + line in the example above, it compiles without errors.
Hi! Sorry I didn't respond to your latest questions regarding my issues tickets, I was on a hiatus on my project. I'm looking forward to get back to it, and excited with the new direction of you project, leveraging Antlr.
I grabbed latest, but it appears the entire Sixty502DotNetParser symbol is missing. Is there a missing file from the repo by any chance?
When I try to define and use a function, like so:
FP .function val=1
.return val * 64
.endfunction
testFP
.word FP(500)
The assembler freezes, and I need to kill the process manually.
Just found this repo and thought I'd give it a test. I tried to build the project but there are many compile errors -
>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(15,18,15,37): error CS0101: The namespace 'Core6502DotNet' already contains a definition for 'InvalidCpuException'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(32,27,32,39): error CS0101: The namespace 'Core6502DotNet' already contains a definition for 'CpuAssembler'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\m65xx\Asm6502.cs(18,33,18,40): error CS0534: 'Asm6502' does not implement inherited abstract member 'CpuAssembler.OnSetCpu()'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\m65xx\Asm6502.cs(18,33,18,40): error CS0534: 'Asm6502' does not implement inherited abstract member 'CpuAssembler.IsCpuValid(string)'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\m65xx\Asm6502.cs(18,33,18,40): error CS0534: 'Asm6502' does not implement inherited abstract member 'CpuAssembler.AssembleCpuInstruction(SourceLine)'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(21,16,21,35): error CS0111: Type 'InvalidCpuException' already defines a member called 'InvalidCpuException' with the same parameter types
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(47,19,47,31): error CS0111: Type 'CpuAssembler' already defines a member called 'CpuAssembler' with the same parameter types
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(72,32,72,39): error CS0111: Type 'CpuAssembler' already defines a member called 'OnReset' with the same parameter types
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(77,33,77,41): error CS0111: Type 'CpuAssembler' already defines a member called 'OnSetCpu' with the same parameter types
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(84,35,84,57): error CS0111: Type 'CpuAssembler' already defines a member called 'AssembleCpuInstruction' with the same parameter types
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(91,30,91,40): error CS0111: Type 'CpuAssembler' already defines a member called 'IsCpuValid' with the same parameter types
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(93,14,93,27): error CS0111: Type 'CpuAssembler' already defines a member called 'OnPassChanged' with the same parameter types
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\Line Assemblers\CpuAssembler.cs(97,35,97,45): error CS0111: Type 'CpuAssembler' already defines a member called 'OnAssemble' with the same parameter types
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\z80\Z80Asm.cs(18,33,18,39): error CS0534: 'Z80Asm' does not implement inherited abstract member 'CpuAssembler.OnSetCpu()'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\z80\Z80Asm.cs(18,33,18,39): error CS0534: 'Z80Asm' does not implement inherited abstract member 'CpuAssembler.IsCpuValid(string)'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\z80\Z80Asm.cs(18,33,18,39): error CS0534: 'Z80Asm' does not implement inherited abstract member 'CpuAssembler.AssembleCpuInstruction(SourceLine)'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\m680x\M6809Asm.cs(18,33,18,41): error CS0534: 'M6809Asm' does not implement inherited abstract member 'CpuAssembler.OnSetCpu()'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\m680x\M6809Asm.cs(18,33,18,41): error CS0534: 'M6809Asm' does not implement inherited abstract member 'CpuAssembler.IsCpuValid(string)'
1>C:\Users\John Tsombakos\Desktop\6502.Net\Core6502DotNet\src\m680x\M6809Asm.cs(18,33,18,41): error CS0534: 'M6809Asm' does not implement inherited abstract member 'CpuAssembler.AssembleCpuInstruction(SourceLine)'
Sorry I hope you don't mind me filling up issues/requests, I'm just really excited by your project and using it a TON :)
This one is not as much an issue, but a request to support negative numbers. I have a few situations where it's easier to declare data as negative number, for instance:
spriteOffset
.word -10, -5
Currently 6502.Net trigger an error message on that one. I looked into it, and it seems that a very simple change could add support, although I'm not sure if my change is enough to handle ALL situations, you know way better than I do.
But what I'm doing on my local version was adding this little value adjustment right before the error check, in the file Evaluator.cs, in the DoEvaluation() method:
if (isMath && r < minValue)
r += (maxValue + 1); // wrap the value around
if (isMath && (r < minValue || r > maxValue))
throw new IllegalQuantityException(tokens.First());
That seems to work great for my project!
Hi :) Really interesting project!
I've taken a look to the code and I found almost impossible to use your library to assemble code without calling the .exe.
My goal is to invoke your code from another C# project, so I can avoid writing files to disk. I'd like to get the assembled result as byte[];
I'd expected something like:
var assembler = new Z80Assembler();
var source = @"CALL main
HALT
main:
LD hl, 30h
LD (hl), 1
RET";
byte[] output = assembler.Assemble(source);
Maybe I'm missing something, but this would be a really good API in my humble opinion :)
I hope you can help me getting something like this out of the code.
Thanks in advance!
I have a simple Config.a that get included once in my project, that looks like so:
Config .block
boot_menu = Test.Menu
.endblock
With 6502.Net from about a month ago, it assemble just fine. But tonight I tried to get the latest version of 6502.Net (May 24th 2020) and now the same code is getting me an error:
Cannot assign boot_menu after it has been assigned.
When assembling this code:
LABEL ld hl, 1
djnz LABEL
It should have assembled as:
21
01
00
10
FB
However, it assembled as:
21
01
00
10
FC
Please, notice that the last line is different (FB vs FC)
Am I missing something?
Thanks!
I have a bit of code mutation going on in my project, which requires me to pass the address of code into a macro. It used to work when I passed underscore-prefixed labels (local scoped labels), but it's not working anymore.
Error: Symbol "_hackReadAddr_d" is not defined.
I can easily fix it by removing the underscores and it works again, but making these labels global is of course not ideal.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.