easy6502 icon indicating copy to clipboard operation
easy6502 copied to clipboard

Disassembled code will not reassemble

Open ZenithRogue opened this issue 6 years ago • 2 comments

I attempted to plug the disassembled code back into the assembler, at which point it will not run. Below is the disassembly of snake. it is throwing an error Syntax error line 38: BEQ $0660

JSR $0606 
JSR $0638 
JSR $060d 
JSR $062a 
RTS 
LDA #$02
STA $02
LDA #$04
STA $03
LDA #$11
STA $10
LDA #$10
STA $12
LDA #$0f
STA $14
LDA #$04
STA $11
STA $13
STA $15
RTS 
LDA $fe
STA $00
LDA $fe
AND #$03
CLC 
ADC #$02
STA $01
RTS 
JSR $064d 
JSR $068d 
JSR $06c3 
JSR $0719 
JSR $0720 
JSR $072d 
JMP $0638 
LDA $ff
CMP #$77
BEQ $0660
CMP #$64
BEQ $066b
CMP #$73
BEQ $0676
CMP #$61
BEQ $0681
RTS 
LDA #$04
BIT $02
BNE $068c
LDA #$01
STA $02
RTS 
LDA #$08
BIT $02
BNE $068c
LDA #$02
STA $02
RTS 
LDA #$01
BIT $02
BNE $068c
LDA #$04
STA $02
RTS 
LDA #$02
BIT $02
BNE $068c
LDA #$08
STA $02
RTS 
RTS 
JSR $0694 
JSR $06a8 
RTS 
LDA $00
CMP $10
BNE $06a7
LDA $01
CMP $11
BNE $06a7
INC $03
INC $03
JSR $062a 
RTS 
LDX $02
LDA $10,X
CMP $10
BNE $06b6
LDA $11,X
CMP $11
BEQ $06bf
INX 
INX 
CPX $03
BEQ $06c2
JMP $06aa 
JMP $0735 
RTS 
LDX $03
DEX 
TXA 
LDA $10,X
STA $12,X
DEX 
BPL $06c7
LDA $02
LSR A
BCS $06dc
LSR A
BCS $06ef
LSR A
BCS $06f8
LSR A
BCS $070b
LDA $10
SEC 
SBC #$20
STA $10
BCC $06e6
RTS 
DEC $11
LDA #$01
CMP $11
BEQ $0716
RTS 
INC $10
LDA #$1f
BIT $10
BEQ $0716
RTS 
LDA $10
CLC 
ADC #$20
STA $10
BCS $0702
RTS 
INC $11
LDA #$06
CMP $11
BEQ $0716
RTS 
DEC $10
LDA $10
AND #$1f
CMP #$1f
BEQ $0716
RTS 
JMP $0735 
LDY #$00
LDA $fe
STA ($00),Y
RTS 
LDX $03
LDA #$00
STA ($10,X)
LDX $00
LDA #$01
STA ($10,X)
RTS 
LDX $00
NOP 
NOP 
DEX 
BNE $082f
RTS 

ZenithRogue avatar Nov 02 '17 19:11 ZenithRogue

I'm not sure, but I think what's happening is that the assembler demands that branches go to labels, not to hex addresses. Probably fixable without too much difficulty. https://github.com/skilldrick/easy6502/blob/df2b89573add05cf8fc988bd6caeadeea83883e3/simulator/assembler.js#L2155

BigEd avatar Nov 05 '17 09:11 BigEd

Oops, i don't know how i messed up the title. I am currently working on a 6502 emulator, and i wanted to make sure my disassembler was working properly.

ZenithRogue avatar Nov 05 '17 16:11 ZenithRogue