mirror of
https://github.com/mre/mos6502.git
synced 2024-11-28 22:51:26 +00:00
Upgrade to Rust 2018 edition
This commit is contained in:
parent
b6e4a5ce8b
commit
24973d7fbd
@ -34,6 +34,7 @@ version = "0.2.0"
|
|||||||
authors = ["The 6502-rs Developers"]
|
authors = ["The 6502-rs Developers"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
exclude = ["examples/**"]
|
exclude = ["examples/**"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
# This will look in src/lib.rs
|
# This will look in src/lib.rs
|
||||||
|
14
README.md
14
README.md
@ -17,24 +17,23 @@ use mos6502::address::Address;
|
|||||||
use mos6502::cpu;
|
use mos6502::cpu;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
||||||
let zero_page_data = [56, 49];
|
let zero_page_data = [56, 49];
|
||||||
|
|
||||||
let program = [
|
let program = [
|
||||||
// (F)irst | (S)econd
|
// (F)irst | (S)econd
|
||||||
// .algo
|
// .algo
|
||||||
0xa5, 0x00, // Load from F to A
|
0xa5, 0x00, // Load from F to A
|
||||||
// .algo_
|
// .algo_
|
||||||
0x38, // Set carry flag
|
0x38, // Set carry flag
|
||||||
0xe5, 0x01, // Substract S from number in A (from F)
|
0xe5, 0x01, // Substract S from number in A (from F)
|
||||||
0xf0, 0x07, // Jump to .end if diff is zero
|
0xf0, 0x07, // Jump to .end if diff is zero
|
||||||
0x30, 0x08, // Jump to .swap if diff is negative
|
0x30, 0x08, // Jump to .swap if diff is negative
|
||||||
0x85, 0x00, // Load A to F
|
0x85, 0x00, // Load A to F
|
||||||
0x4c, 0x12, 0x00, // Jump to .algo_
|
0x4c, 0x12, 0x00, // Jump to .algo_
|
||||||
// .end
|
// .end
|
||||||
0xa5, 0x00, // Load from S to A
|
0xa5, 0x00, // Load from S to A
|
||||||
0xff,
|
0xff,
|
||||||
// .swap
|
// .swap
|
||||||
0xa6, 0x00, // load F to X
|
0xa6, 0x00, // load F to X
|
||||||
0xa4, 0x01, // load S to Y
|
0xa4, 0x01, // load S to Y
|
||||||
0x86, 0x01, // Store X to F
|
0x86, 0x01, // Store X to F
|
||||||
@ -51,6 +50,5 @@ fn main() {
|
|||||||
cpu.run();
|
cpu.run();
|
||||||
|
|
||||||
assert_eq!(7, cpu.registers.accumulator);
|
assert_eq!(7, cpu.registers.accumulator);
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -25,11 +25,10 @@
|
|||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
use address::{Address, AddressDiff};
|
use crate::address::{Address, AddressDiff};
|
||||||
use instruction;
|
use crate::instruction::{self, DecodedInstr, Instruction, OpInput};
|
||||||
use instruction::{DecodedInstr, Instruction, OpInput};
|
use crate::memory::Memory;
|
||||||
use memory::Memory;
|
use crate::registers::{Registers, StackPointer, Status, StatusArgs};
|
||||||
use registers::{Registers, StackPointer, Status, StatusArgs};
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CPU {
|
pub struct CPU {
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
use address::Address;
|
use crate::address::Address;
|
||||||
use address::AddressDiff;
|
use crate::address::AddressDiff;
|
||||||
use cpu::CPU;
|
use crate::cpu::CPU;
|
||||||
|
|
||||||
// Abbreviations
|
// Abbreviations
|
||||||
//
|
//
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
use address::{Address, AddressDiff};
|
use crate::address::{Address, AddressDiff};
|
||||||
|
|
||||||
// JAM: We can probably come up with a better way to represent address ranges.
|
// JAM: We can probably come up with a better way to represent address ranges.
|
||||||
// Address range type?
|
// Address range type?
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
// POSSIBILITY OF SUCH DAMAGE.
|
// POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
use address::{Address, AddressDiff};
|
use crate::address::{Address, AddressDiff};
|
||||||
use memory::{STACK_ADDRESS_HI, STACK_ADDRESS_LO};
|
use crate::memory::{STACK_ADDRESS_HI, STACK_ADDRESS_LO};
|
||||||
|
|
||||||
// Useful for constructing Status instances
|
// Useful for constructing Status instances
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
|
Loading…
Reference in New Issue
Block a user