Great ! I was certain there was a hardware explanation and kc5tja explained very well.
Thanks for all this information. I'll try to do my best now.
Oh, and as I'm here, a last question

Do you know where I can find a 6502 compiler with which I can take a source and obtain the binary result ?
I had a look at the Michal Kowalski which is great for test my own simulator, as I can compile a source code and test the result, but I can't grab the binary in order to use it in my own simulator : I don't want to do a compiler, just a simulator
EDIT :
By the way, after verification. When compilig and debugging a simple code source like this :
Code: Select all
.ORG $4000
start:
; EXPECTED FINAL RESULTS: $0210 = FF
; (any other number will be the
; test that failed)
; initialize:
LDA #$00
STA $0210
; store each test's expected
LDA #$55
STA $0200
LDA #$AA
STA $0201
LDA #$FF
STA $0202
LDA #$6E
STA $0203
LDA #$42
STA $0204
LDA #$33
STA $0205
LDA #$9D
STA $0206
LDA #$7F
STA $0207
LDA #$A5
STA $0208
LDA #$1F
STA $0209
LDA #$CE
STA $020A
LDA #$29
STA $020B
LDA #$42
STA $020C
LDA #$6C
STA $020D
LDA #$42
STA $020E
This simulator (the one by Michal Kowalski) is initializing everything to a 0 value apart :
- the Processor Status : $20 no problem
- the Stack Pointer : $FF ok, this is the top of the stack
- the Program Counter : $4000, strange, because all vectors are empty (from $FFFA to $FFFF)
So, I guess loading the binary inside this simulator tends to use the first ORG to initialize the PC...
EDIT 2 :
I found this in the programmingmanual.pdf :
The code generated by the assembler, when linked, will begin at the default origin location, $2000.
Is it possible to verify this default value by using a real hardware processorand just read the PC value without programming anything ? (maybe reading on some pin I guess... But I'm not an electronic scientist, just a poor computer developer)