Search found 10 matches

by secamline
Sun Sep 13, 2020 4:10 pm
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Re: Questions about 6502 assemblers

So far I'm back to where I stopped when using regex, the assembler does work with all addressing modes, decimal, hex, binary, and the labels are resolved correctly. You've all submitted many ideas, now where should I start? I guess I should implement the basic "org", "db" and "dw" pseudo ...
by secamline
Thu Sep 10, 2020 8:33 pm
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Re: Questions about 6502 assemblers

So if an instruction other than a branching condition happens to contain a label, I can just treat it as an absolute address. What a relief!
By the way, I've already started rewriting the code from scratch. I replaced the regex dictionnary with a new "Instruction" class that parses the opcode, the ...
by secamline
Thu Sep 10, 2020 7:11 pm
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Re: Questions about 6502 assemblers

Ok, thanks!
I just realized that I may encounter some problems with the labels.
Let's say I'm trying to assemble this piece of code:

lda label
...
label:
...

lda could either be a 1 byte instruction or a 2 bytes instruction depending on wether label is a zeropage address or not.
I have to ...
by secamline
Thu Sep 10, 2020 1:27 pm
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Re: Questions about 6502 assemblers

Sorry, my questions are poorly phrased.
Basically in the first version of my assembler I would convert all litterals into hex, so this piece of code :

start:
lda #$0A
sta %0001001
label:
inx
bne label
jmp start

would be converted into this:

lda #$0A
sta $11
inx
bne $FF
jmp $0000

I chose ...
by secamline
Thu Sep 10, 2020 5:24 am
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Re: Questions about 6502 assemblers

Alright, I'll each of your advice into consideration. First thing first I will start from scratch and make a real parser. Btw should I convert numerical values into decimal?
by secamline
Tue Sep 08, 2020 10:02 pm
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Re: Questions about 6502 assemblers

I don't know much about conditionnal assembly, what kind of conditions can be implemented?
by secamline
Mon Sep 07, 2020 8:37 pm
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Re: Questions about 6502 assemblers

Then branching instructions would still be a special case during pass 2, right?
The reason I chose to use regex was because I didn't want to use a bunch of if-elif-else commands.
by secamline
Mon Sep 07, 2020 3:48 pm
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Re: Questions about 6502 assemblers

Having hex constants for instruction operands is rather limiting. When you write big programs you need to be able to reference named constants (like peripheral addresses, bits in
It does support labels as operands, maybe I didn't get what you meant?
I'll attach the source code in my first message ...
by secamline
Mon Sep 07, 2020 1:32 pm
Forum: Emulation and Simulation
Topic: Questions about 6502 assemblers
Replies: 24
Views: 4980

Questions about 6502 assemblers

Hi!
I recently started a fun little project: making a 6502 assembler in python.
The assembler itself isn't the real goal though, it's really all about testing my knowledge of the processor.
As of now it works pretty much the way it's supposed to. However like pretty much everything regarding ...
by secamline
Mon Sep 07, 2020 10:36 am
Forum: General Discussions
Topic: Introduce yourself
Replies: 716
Views: 417887

Re: Introduce yourself

Hello!
I'm new to this forum. I don't really know how to introduce myself, so here comes nothing.
I'm french so expect some engrish here and there, rest assured that I'm doing my best :(
I'm 20 and I've programmed several games for the Atari 2600 and the NES so I'm quite familiar with the 6502 (the ...