Jump to content
IGNORED

Assembly Language Question


Recommended Posts

I have a .bin file I am trying to deconstruct into somewhat understandable and readable assembly language.  It's code for the 6500/1 series of cpus.  These cpus combine the 6502 with 2K of ROM, 64byte of RAM and 32 bi-directional TTL compatible I/0 lines(4 ports) among other goodies.  All addressing is internal.  The four 8-bit I/O ports are for want of a better designation PORTA, PORTB, PORTC and PORTD.  There are also four 8-bit registers associated with the ports located on page zero(80,81,82,83).  

 

My question centers around a series of instructions that are confusing to me.

 

            lda #$FF         ;Load accumulator with hex value FF
            sta PORTA        ;Store that value in memory location 80(PortA)

            ldx #$F7         ;Load Index X with hex value F7
            stx PORTA        ;Store Index X value in memory location 80(PortA)
            sta PORTA        ;Store accumulator value in memory location 80(PortA)

 

 I don't get the last two instructions.  Why would a programmer load a zero page memory location at 80 with one hex number and then turn around without seeming to use it, clobber the same memory location with a completely different hex number?

   

Link to comment
Share on other sites

Well you said it yourself. If those memory locations are mapped to I/O ports, writing to them means writing to I/O ports. I mean you say 'associated with', so it's not clear, but the code looks just like writing to external chip, let's say POKEY or ANTIC, with memory-mapped registers.

Link to comment
Share on other sites

Have you disassembled the code properly?

 

In the PIA sense, PORTA also serves as it's own data direction register which looks somewhat like what's going on there.

Generally you write to PACTL to hit the bitsetting to put PORTA into DDR mode.

Then write PORTA with 0 representing what bits will be inputs, and 1 to select outputs.

Then write PACTL again to put PORTA back into data mode.

Then subsequent reads get your inputs, writes perform outputs.

Link to comment
Share on other sites

Using a .bin dump of internal code from the 40pin CPU in the Supra Microstuffer printer buffer device, I used the old program Dis6502 to come up with the disassembly.  First I entered all the known equ for the 6500/1 chips, then deleted all the other default equ.  I then loaded up the raw .bin file and set the code start at $800.

 

I've been slowly going through the resulting disassembly, trying to comment and more importantly understand what the code is doing.  Since these cpus are no longer made and they were masked at the factory I've been trying to come up with an alternative chip/software combination. 

 

The code in question comes rather early in the setup portion.

 

SupraMicroStuffer.zip

Edited by Dropcheck
further info
Link to comment
Share on other sites

34 minutes ago, Dropcheck said:

So essentially the code is simply putting the hex number on the selected port and whatever is connected to that port responds to that number according to its dictates?

 

It's not loading a lo-byte then the high-byte memory address onto the PORTA register?

The code is simple and clear. It writes 3 numbers to that address, and you mention, there is hardware register associated with it, so I assume it writes to that register.

Now how the hardware connected to this register interprets those 3 numbers, is outside scope of the code.

 

 

Link to comment
Share on other sites

2 minutes ago, R0ger said:

The code is simple and clear. It writes 3 numbers to that address, and you mention, there is hardware register associated with it, so I assume it writes to that register.

Now how the hardware connected to this register interprets those 3 numbers, is outside scope of the code.

 

 

Thank you.  ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...