Struct ApplicationBuilder

Source
pub struct ApplicationBuilder { /* private fields */ }

Implementations§

Source§

impl ApplicationBuilder

Source

pub fn name(&mut self, name: &str) -> &mut Self

Set the name of the application.

Is used in comments when exporting to a dasm source using crate::generator::DasmGenerator

use c64_assembler::builder::ApplicationBuilder;
let application = ApplicationBuilder::default()
    .name("My application")
    .build();
Source

pub fn entry_point(&mut self, entry_point: Address) -> &mut Self

Change the entry point of the application.

NOTE: When not set to 0x0800 crate::builder::instruction::InstructionBuilder::add_basic_header cannot be used.

Default entry point is set to 0x0800.

use c64_assembler::builder::ApplicationBuilder;
let application = ApplicationBuilder::default()
    .entry_point(0x0800)
    .build();
Source

pub fn define_address(&mut self, name: &str, address: Address) -> &mut Self

Define a static address.

When using instructions each address needs to be accessed by its name. This function allows to add a new named address. There is no difference between zeropaged and regular addresses. When building the instruction stream the actual address will decide which opcode is used.

use c64_assembler::builder::ApplicationBuilder;
let application = ApplicationBuilder::default()
    .define_address("VIC_BORDER_COLOR", 0xD020)
    .define_address("ZEROPAGE_FE", 0xFE)
    .build();
Source

pub fn include_vic2_defines(&mut self) -> &mut Self

Add the address defines useful when using the VIC2.

Address NamePhysical AddressDescription
VIC2_BASE0xD000Base address for VIC registers
VIC2_SPRITE_0_X0xD000X coordinate of sprite 0
VIC2_SPRITE_0_Y0xD001Y coordinate of sprite 0
VIC2_SPRITE_1_X0xD002X coordinate of sprite 1
VIC2_SPRITE_1_Y0xD003Y coordinate of sprite 1
VIC2_SPRITE_2_X0xD004X coordinate of sprite 2
VIC2_SPRITE_2_Y0xD005Y coordinate of sprite 2
VIC2_SPRITE_3_X0xD006X coordinate of sprite 3
VIC2_SPRITE_3_Y0xD007Y coordinate of sprite 3
VIC2_SPRITE_4_X0xD008X coordinate of sprite 4
VIC2_SPRITE_4_Y0xD009Y coordinate of sprite 4
VIC2_SPRITE_5_X0xD00AX coordinate of sprite 5
VIC2_SPRITE_5_Y0xD00BY coordinate of sprite 5
VIC2_SPRITE_6_X0xD00CX coordinate of sprite 6
VIC2_SPRITE_6_Y0xD00DY coordinate of sprite 6
VIC2_SPRITE_7_X0xD00EX coordinate of sprite 7
VIC2_SPRITE_7_Y0xD00FY coordinate of sprite 7
VIC2_SPRITE_X_MSB0xD010Most significant bit for sprite X coordinates
VIC2_CONTROL_10xD011Screen control register 1
VIC2_RASTER0xD012Raster line position
VIC2_LIGHT_PEN_X0xD013Light pen X position
VIC2_LIGHT_PEN_Y0xD014Light pen Y position
VIC2_SPRITE_ENABLE0xD015Enables sprites
VIC2_CONTROL_20xD016Screen control register 2
VIC2_SPRITE_EXPAND_X0xD017Expands sprites horizontally
VIC2_MEMORY_SETUP0xD018VIC memory setup
VIC2_IRQ_STATUS0xD019Interrupt request status
VIC2_IRQ_ENABLE0xD01AInterrupt request enable
VIC2_SPRITE_PRIORITY0xD01BSprite priority over background
VIC2_SPRITE_MULTICOLOR0xD01CEnables multicolor mode for sprites
VIC2_SPRITE_EXPAND_Y0xD01DExpands sprites vertically
VIC2_SPRITE_COLLISION0xD01ESprite-to-sprite collision detection
VIC2_SPRITE_BG_COLLISION0xD01FSprite-to-background collision detection
VIC2_BORDER_COLOR0xD020Border color
VIC2_BACKGROUND_COLOR0xD021Background color
VIC2_BACKGROUND_COLOR_00xD021Background color 0
VIC2_BACKGROUND_COLOR_10xD022Background color 1
VIC2_BACKGROUND_COLOR_20xD023Background color 2
VIC2_BACKGROUND_COLOR_30xD024Background color 3
VIC2_SPRITE_MULTICOLOR_00xD025Multicolor mode color 0 for sprites
VIC2_SPRITE_MULTICOLOR_10xD026Multicolor mode color 1 for sprites
VIC2_SPRITE_0_COLOR0xD027Color of sprite 0
VIC2_SPRITE_1_COLOR0xD028Color of sprite 1
VIC2_SPRITE_2_COLOR0xD029Color of sprite 2
VIC2_SPRITE_3_COLOR0xD02AColor of sprite 3
VIC2_SPRITE_4_COLOR0xD02BColor of sprite 4
VIC2_SPRITE_5_COLOR0xD02CColor of sprite 5
VIC2_SPRITE_6_COLOR0xD02DColor of sprite 6
VIC2_SPRITE_7_COLOR0xD02EColor of sprite 7
use c64_assembler::builder::ApplicationBuilder;
let application = ApplicationBuilder::default()
    .include_vic2_defines()
    .build();
Source

pub fn include_sid_defines(&mut self) -> &mut Self

Add the address defines useful when using the SID.

Address NamePhysical AddressDescription
SID_BASE0xD400Base address for SID registers
SID_VOICE_1_FREQ_LO0xD400Voice 1 frequency (low byte)
SID_VOICE_1_FREQ_HI0xD401Voice 1 frequency (high byte)
SID_VOICE_1_PW_LO0xD402Voice 1 pulse width (low byte)
SID_VOICE_1_PW_HI0xD403Voice 1 pulse width (high byte)
SID_VOICE_1_CTRL0xD404Voice 1 control register
SID_VOICE_1_AD0xD405Voice 1 attack/decay settings
SID_VOICE_1_SR0xD406Voice 1 sustain/release settings
SID_VOICE_2_FREQ_LO0xD407Voice 2 frequency (low byte)
SID_VOICE_2_FREQ_HI0xD408Voice 2 frequency (high byte)
SID_VOICE_2_PW_LO0xD409Voice 2 pulse width (low byte)
SID_VOICE_2_PW_HI0xD40AVoice 2 pulse width (high byte)
SID_VOICE_2_CTRL0xD40BVoice 2 control register
SID_VOICE_2_AD0xD40CVoice 2 attack/decay settings
SID_VOICE_2_SR0xD40DVoice 2 sustain/release settings
SID_VOICE_3_FREQ_LO0xD40EVoice 3 frequency (low byte)
SID_VOICE_3_FREQ_HI0xD40FVoice 3 frequency (high byte)
SID_VOICE_3_PW_LO0xD410Voice 3 pulse width (low byte)
SID_VOICE_3_PW_HI0xD411Voice 3 pulse width (high byte)
SID_VOICE_3_CTRL0xD412Voice 3 control register
SID_VOICE_3_AD0xD413Voice 3 attack/decay settings
SID_VOICE_3_SR0xD414Voice 3 sustain/release settings
SID_FILTER_CUTOFF_LO0xD415Filter cutoff frequency (low byte)
SID_FILTER_CUTOFF_HI0xD416Filter cutoff frequency (high byte)
SID_FILTER_CTRL0xD417Filter control register
SID_VOLUME_FC0xD418Volume and filter control
SID_POT_X0xD419Paddle X position (read)
SID_POT_Y0xD41APaddle Y position (read)
SID_OSC3_RANDOM0xD41BOscillator 3 output/random number generator
SID_ENV30xD41CEnvelope generator for voice 3 (read)
use c64_assembler::builder::ApplicationBuilder;
let application = ApplicationBuilder::default()
    .include_sid_defines()
    .build();
Source

pub fn module(&mut self, module: Module) -> &mut Self

Source

pub fn build(&mut self) -> AssemblerResult<Application>

Build the application

Trait Implementations§

Source§

impl Clone for ApplicationBuilder

Source§

fn clone(&self) -> ApplicationBuilder

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ApplicationBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.