taeber / a2asm Goto Github PK
View Code? Open in Web Editor NEWSimple 6502 assembler
License: MIT License
Simple 6502 assembler
License: MIT License
ORG $800
JSR MAIN
JMP EXIT
EXIT EQU $3D0
INIT EQU $FB2F
HOME EQU $FC58
MAIN JSR INIT
JSR HOME
RTS
Should assemble to:
20 06 08 4C D0 03 20 2F
FB 20 58 FC 60
20 06 08 4C 06 08 20 2F
FB 20 58 FC 60
Note: JMP EXIT
becomes JMP $806
instead of JMP $3D0
. Confirmed that MERLIN produces the expected result.
XPOS EQU 1
YPOS EQU 0
LDA SHIPS+XPOS,X
RTS
SHIPS DFB 00,00
Should assemble to BD 04 80 60 00 00
, but fails with error:
expected hex, binary, or decimal literal; got XPOS
PRPLA EQU $FDE2
LDX #>PRPLA-1
Should assemble to A2 FD
, not A2 FE
.
I think this is happening because num
is unsigned, so -1
becomes 0xFFFF
(then saved as 0xFF
).
Adding 0xFF
to 0xFDE2
results in 0xFEE1
and the high-byte 0xFE
is returned.
Repro
func TestHighByteSubtraction(t *testing.T) {
out := bytes.NewBuffer(nil)
prg := strings.NewReader(`
PRPLA EQU $FDE2
LDX #>PRPLA-1
`)
_, err := Assemble(out, prg, true)
if err != nil {
t.Error(err)
return
}
// 0000- A2 FD LDX #>PRPLA-1
expected := []byte("\xA2\xFD")
actual := out.Bytes()
if !bytes.Equal(expected, actual) {
t.Errorf("Expected %v; got %v", expected, actual)
}
}
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.