[Q] Apple ][ 6502 machine language addressing

Apple hardware/software and related topics.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
mnorton
Posts: 223
Joined: Tue May 17, 2005 11:36 am
Location: Caulifawnia

[Q] Apple ][ 6502 machine language addressing

Unread postby mnorton » Tue Mar 17, 2015 3:39 pm

I have a question regarding 6502 machine language. It's about the memory addressing.

Example:

0600: a9 01 8d 00 02 a9 05 8d 01 02 a9 08 8d 02 02

Address Hexdump Dissassembly
-------------------------------
$0600 a9 01 LDA #$01
$0602 8d 00 02 STA $0200
$0605 a9 05 LDA #$05
$0607 8d 01 02 STA $0201
$060a a9 08 LDA #$08
$060c 8d 02 02 STA $0202

My question is:


Is the address $0600 in little endian notation?
Is this page memory 06 -> 6 * 256 = 1536 decimal + offset 0 = 1536?
And $0602 is at 0x06 x 0x100 = page n + offset 2 = 1538 d

thanks

Mike
Image x1 Image x2

User avatar
Raion-Fox
Donor
Donor
Posts: 1333
Joined: Thu Jan 30, 2014 5:01 pm
Location: near King George, Virginia
Contact:

Re: [Q] Apple ][ 6502 machine language addressing

Unread postby Raion-Fox » Tue Mar 17, 2015 4:14 pm

The answer to your first question is yes, every address in 6502 ASM is little endian, O took a course on it when I was trying for electrical engineering.

The other two questions I can't remember enough of the class to definitely answer.
:O3x02L: R16000 700MHz 8GB RAM kanna
:Octane: R12000 300MHz SI 896MB RAM yuuka
:Octane2: R12000A 400MHz V6 2.5GB RAM
:Indy: (Acclaim) R4600 133MHz XL Graphics 32MB RAM
:Indy: (Challenge S) R4600 133MHz (MIPS III Build Server)
Thinkpad W530 i7 3940XM 3GHz, 32GB, K1000M Windows 8.1 Embedded rin
Thinkpad R40 Pentium M 1.5GHz 2GB RAM kasha

robespierre
Posts: 1554
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: [Q] Apple ][ 6502 machine language addressing

Unread postby robespierre » Tue Mar 17, 2015 6:04 pm

'$0600' is hexadecimal notation. There is no such thing as "little endian notation": endianness is about how numbers are stored in memory, not how they are written.

$0600 is simply 6*16^2 or 1536. You can enter numbers in either base to the assembler, it doesn't care. Usually the syntax is #42 for decimal constants or #$2A for hexadecimal constants. When using unix or C tools, the syntax usually is 42 for decimal, or 0x2A for hexadecimal. You aren't likely to find much C software on a 6502, although compilers did exist for the Apple ][ and others.

Pages are a virtual memory concept. I can't think of too many 6502s that implement virtual memory, but that doesn't mean they aren't out there.
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

User avatar
commodorejohn
Posts: 652
Joined: Tue Oct 02, 2012 1:22 pm
Contact:

Re: [Q] Apple ][ 6502 machine language addressing

Unread postby commodorejohn » Tue Mar 17, 2015 6:17 pm

robespierre wrote:Pages are a virtual memory concept. I can't think of too many 6502s that implement virtual memory, but that doesn't mean they aren't out there.

No, "pages" on the 6502 are sections of 256 bytes, although the only ones that are special are zero page (which can be addressed in a single byte, as well as also having the only general-purpose indirect-addressing modes) and page 1 (which doesn't have any special addressing modes, but serves as the stack.)

OP: As has been stated, and as you more or less inferred, $0600 is just the conventional way of writing a 16-bit hexadecimal number, and doesn't have anything to do with the endianness of the CPU. A value of $0600 stored in memory on the 6502 is going to look like $00 $06 in a hex dump, but on a 68000 it would be $06 $00 instead.
Computers: Amiga 1200, DEC VAXStation 4000/60, DEC MicroPDP-11/73
Synthesizers: Roland JX-10/SH-09/HS-80/MT-32/D-50, Yamaha DX7-II/V50/TX7/TG33/FB-01, Korg MS-20 Mini/ARP Odyssey/DW-8000/M1, Ensoniq SQ-80, E-mu Emax HD/Proteus-2, Casio CZ-5000, Moog Satellite, Sequential Circuits Prophet-600


Return to “Apple”

Who is online

Users browsing this forum: No registered users and 2 guests