Code Monkey home page Code Monkey logo

a2asm's People

Contributors

taeber avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

a2asm's Issues

Bad output when calling JMP to a label that's yet to be defined

	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.

Add support for literals in arithmetic

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

Fix high-byte subtraction

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)
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.