WiiRd forum

USB Gecko Related => USB Gecko Dev => Topic started by: hawkeye2777 on December 28, 2009, 07:17:12 AM



Title: PyiiASMH
Post by: hawkeye2777 on December 28, 2009, 07:17:12 AM
EDIT (Update - v2.0.0 released):

PyiiASMH is a cross-platform WiiRd ASM helper tool coded in Python. Go to GitHub (https://github.com/hawkeye2777/PyiiASMH) to check it out and download it. Please submit feedback, bug reports, etc. if you have any.

Changelog:
PyiiASMH 2.0.0 (March 10, 2012):
    - Complete rewrite of the old code
    - New CLI interface (WIP)
    - New redesigned GUI (more internal changes)
    - PySide now supported
    - Multiple session support (opening/saving to files anywhere)
    - New preferences dialog with GUI Style selector, default codetype
      selector, confirmation prompts, and loading the last session on startup
    - Fields used for bapo, xor, and chksum now only allow hexadecimal input
    - Better error handling (most errors/exceptions logged to error.log)
    - Relicensed under the "new" BSD license
    - Cleaner code (WIP)
    - Bug fixes

What you need (summary):
 - Python 2.6.x or 2.7.x (download (http://python.org/getit/releases/2.7.2/))
 - PySide 1.0.6+ (download (http://qt-project.org/wiki/PySideDownloads)) OR PyQt 4.7.x+ (download (http://www.riverbankcomputing.co.uk/software/pyqt/download))

Other notes:
 - PyiiASMH is now released under the "new"/"modified"/3-clause BSD license.
 - For those of you who like to redistribute/repackage stuff, you cannot pack PyQt with PyiiASMH; the GPL doesn't allow it (unless PyiiASMH were GPL'd, which it is not anymore). However, I'll be working on "native" packages soon for Windows (and hopefully OS X too) using PySide instead, so just be patient... or just install stuff manually; it won't kill you.
 
Think that's all; ask away if you need to.


Title: Re: PyiiASMH
Post by: hawkeye2777 on April 10, 2010, 12:27:07 AM
Updated to v0.9.1. It contains a few bug fixes, assembling opcodes shouldn't* produce errors from time to time now. Find the packages on Google Code; the source can be checked out via svn too.


Title: Re: PyiiASMH
Post by: wiiztec on April 10, 2010, 01:06:34 AM
What are the differences between this and Link's ASMWiiRd?


Title: Re: PyiiASMH
Post by: hawkeye2777 on April 10, 2010, 01:35:25 AM
What are the differences between this and Link's ASMWiiRd?

From the README:

Quote
=== Features ===

    * Cross-platform, open-source
    * Session Loading/Saving support (currently only one session)
    * Assemble powerpc opcodes into WiiRd codes using any of the ASM codetypes (C0, C2/D2, F2/F4) or into raw hex
    * Disassemble Gecko codes into powerpc assembly opcodes

So just a few differences when compared to Link's tool.

One downside is that you'll have to download and install Python and PyQt4 if they are not already installed. I think both downloads run at about 36mb total (for Windows), so it'll take a while on slower connections to download.

If you have other questions, feel free to ask.


Title: Re: PyiiASMH
Post by: dcx2 on April 10, 2010, 02:01:48 AM
Looks yummy...perhaps you could add support for branch labels and comments at the end of the line?  The two major itches I have with asmwiird is that I have to manually calculate branch targets and I have to remove all my comments before I can copy/paste it into the assembler.

EDIT: Moving this up to the front page...

I'm making a post here with links to the appropriate stuff for Windows folks so that I have something easy to point to.


The google code page for PyiiASMH

http://code.google.com/p/pyiiasmh/


Python 2.7.2 (click "Windows x86 MSI Installer")

http://www.python.org/download/releases/2.7.2/


PyQt4 (click "PyQt-Py2.7-x86-gpl-4.8.4-1.exe") (or x64)

http://www.riverbankcomputing.co.uk/software/pyqt/download


Title: Re: PyiiASMH
Post by: conanac on April 10, 2010, 03:22:27 AM

Looks great and will try it out (I want to learn Python as well). Thanks for creating and improving it.

I agree with dcx2 on labeling the branch, especially when branching to prior lines with those 0xFFFFFFFF (negative) numbers.

Cheers.


Title: Re: PyiiASMH
Post by: hawkeye2777 on April 10, 2010, 04:00:25 AM
Looks yummy...perhaps you could add support for branch labels and comments at the end of the line?  The two major itches I have with asmwiird is that I have to manually calculate branch targets and I have to remove all my comments before I can copy/paste it into the assembler.

Could you give me an example or two? I'll give it a shot.


Title: Re: PyiiASMH
Post by: dcx2 on April 10, 2010, 05:05:04 AM
Real-world example is my synch code for Tales of Symphonia.

Quote
lbz r3,475(r29)      # get synch
cmpwi r3,0      # if no synch, not monster
beq- end

lis r4,-32691      # get controller pointer
ori r4,r4,30042
lha r0,4(r4)      # get button deltas hword
andi. r0,r0,12      # make sure it's not c or z changing
beq- end

lha r4,0(r4)      # get buttons
cmpwi r4,24584      # is czup?
bne- czdown

addi r3,r3,1      # inc monster synch
andi. r3,r3,15      # mask off any extra bits
bne- czdown      # did we lose synch?
li r3,1         # Replace with first synch

czdown:
cmpwi r4,24580      # is cz down?
bne- storesynch
subi r3,r3,1
andi. r3,r3,15
bne- storesynch
li r3,15         # replace with last synch

storesynch:
stb r3,475(r29)      # store synch

end:
nop

As it stands currently, I need to go through and remove all of my comments, then I need to carefully calculate the distances to each label.  If I modify the code at all, many (but not all!) of the branch distances could change.

You can make the comment character whatever you want.  You can also make any conditions on branch labels, like if you want branch labels to start with an & or something like that which will parsing easier.


Title: Re: PyiiASMH
Post by: hawkeye2777 on April 10, 2010, 04:07:24 PM
Real-world example is my synch code for Tales of Symphonia.

Quote
lbz r3,475(r29)      # get synch
cmpwi r3,0      # if no synch, not monster
beq- end

lis r4,-32691      # get controller pointer
ori r4,r4,30042
lha r0,4(r4)      # get button deltas hword
andi. r0,r0,12      # make sure it's not c or z changing
beq- end

lha r4,0(r4)      # get buttons
cmpwi r4,24584      # is czup?
bne- czdown

addi r3,r3,1      # inc monster synch
andi. r3,r3,15      # mask off any extra bits
bne- czdown      # did we lose synch?
li r3,1         # Replace with first synch

czdown:
cmpwi r4,24580      # is cz down?
bne- storesynch
subi r3,r3,1
andi. r3,r3,15
bne- storesynch
li r3,15         # replace with last synch

storesynch:
stb r3,475(r29)      # store synch

end:
nop

As it stands currently, I need to go through and remove all of my comments, then I need to carefully calculate the distances to each label.  If I modify the code at all, many (but not all!) of the branch distances could change.

You can make the comment character whatever you want.  You can also make any conditions on branch labels, like if you want branch labels to start with an & or something like that which will parsing easier.

Your original code:

Code:
C205CADC 0000000C
887D01DB 2C030000
4182004C 3C80804D #Diff 1
6084755A A8040004
7000000C 41820038 #Diff 2
A8840000 2C046008
40820014 38630001
7063000F 40820008
38600001 2C046004
40820014 3863FFFF
7063000F 40820008
3860000F 987D01DB
60000000 00000000

Assembled code using PyiiASMH:

Code:
C205CADC 0000000C
887D01DB 2C030000
41820050 3C80804D #Diff 1
6084755A A8040004
7000000C 4182003C #Diff 2
A8840000 2C046008
40820014 38630001
7063000F 40820008
38600001 2C046004
40820014 3863FFFF
7063000F 40820008
3860000F 987D01DB
60000000 00000000

Except for those two differences, everything else in the code is identical. Comments seem to work fine, I guess some of the branch labels are miscalculated.

One problem I did find though was the fixed size text fields. When comments are placed in, it's not very easy to read the assembly. I should try and fix that if I can.


Title: Re: PyiiASMH
Post by: dcx2 on April 10, 2010, 04:33:45 PM
Yeah, the branch label miscalculation was my bad (or was it a test to see if your app was working correctly..?   >:D)

In my notes I saved it with the calculated branches and I was trying to remake the one with branch labels...the original code is the correct one for sure, I messed up labels.

Anyway, that is just absolutely awesome that it supports comments and branch labels, I will definitely download and test this out.   ;D


Title: Re: PyiiASMH
Post by: dcx2 on May 23, 2010, 05:33:47 AM
Did you ever release the PyiiASMH that supports branch labels and comments?


Title: Re: PyiiASMH
Post by: Cory321 on May 23, 2010, 03:07:45 PM
Did you ever release the PyiiASMH that supports branch labels and comments?

I'm interested too!  :P


Title: Re: PyiiASMH
Post by: dcx2 on May 23, 2010, 03:58:55 PM
I downloaded PyiiASMH, and it does branch labels/comments.  You have to follow the readme to install prerequisites.


Title: Re: PyiiASMH
Post by: hawkeye2777 on May 24, 2010, 04:00:21 AM
Updated to v0.9.2; just a few minor changes. Archives are on Google Code, a deb package for Ubuntu should be coming soon (just have to rewrite some of the IO parts for it to work right).


Title: Re: PyiiASMH
Post by: dcx2 on June 02, 2010, 03:21:24 AM
Try to make a C0 code out of the following

ori r30,r30,2562

And you will get

C0000000 00000001
63DE0A 4E800020

It should be

C0000000 00000001
63DE0A02 4E800020

Amusingly, if you try to run the correct code backwards into opcodes, it works correctly.


Title: Re: PyiiASMH
Post by: hawkeye2777 on June 02, 2010, 10:06:46 PM
Try to make a C0 code out of the following

ori r30,r30,2562

And you will get

C0000000 00000001
63DE0A 4E800020

It should be

C0000000 00000001
63DE0A02 4E800020

Amusingly, if you try to run the correct code backwards into opcodes, it works correctly.

Does it work on Link's ASM Helper Tool?


Title: Re: PyiiASMH
Post by: dcx2 on June 02, 2010, 10:48:53 PM
Yes.  It only supports C2 codes, but here's the result of the ori.

C2000000 00000001
63DE0A02 00000000


Title: Re: PyiiASMH
Post by: hawkeye2777 on June 05, 2010, 02:30:27 AM
Found the cause of the bug: 0x0A is the newline character, and my function only read the first line (considering I didn't think there'd be more than one line in a binary file, but the 0x0A is considered a newline character). Should have a fix up soon.

EDIT: Version 0.9.3 released, fixes the above bug.


Title: Re: PyiiASMH
Post by: WiiOs-Ozelot on June 19, 2010, 09:13:21 AM
hi, i have problems with python.
i becomes error message from python:

C:\Python26>python PyiiASMH.py
Traceback (most recent call last):
  File "PyiiASMH.py", line 21, in <mod
    from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4


i have installed this, but i becomes a error message again ???

can you compile the py file to exe or programming to win32 executable?


Title: Re: PyiiASMH
Post by: hetoan2 on June 19, 2010, 01:22:35 PM
Thats why there are readme's Ozelot. So that you can follow them in the case that things dont work the way you want them to.

Make sure you've installed PyQt4 for python 2.6.X


Title: Re: PyiiASMH
Post by: hawkeye2777 on June 27, 2010, 12:44:09 AM
hi, i have problems with python.
i becomes error message from python:

C:\Python26>python PyiiASMH.py
Traceback (most recent call last):
  File "PyiiASMH.py", line 21, in <mod
    from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4


i have installed this, but i becomes a error message again ???

can you compile the py file to exe or programming to win32 executable?

http://www.riverbankcomputing.co.uk/software/pyqt/download

Download the one for Python 2.6.x and install.


Title: Re: PyiiASMH
Post by: dcx2 on July 23, 2010, 04:29:19 AM
I tried using psq_l and psq_st but PyiiASMH is complaining about unrecognized opcode.


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 23, 2010, 03:31:01 PM
I tried using psq_l and psq_st but PyiiASMH is complaining about unrecognized opcode.

Can't do much about that... sounds like a problem with the powerpc-eabi-* executables.


Title: Re: PyiiASMH
Post by: dcx2 on July 23, 2010, 04:03:59 PM
But WiiRDGUI and Gecko.NET can dis/assemble the paired single instructions...doesn't PyiiASMH use the same external apps?

I've been reduced to assembling them in Gecko.NET, and then copy/pasting the machine code over as a .long.  This is quite a laborious and error-prone process...


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 23, 2010, 06:43:23 PM
But WiiRDGUI and Gecko.NET can dis/assemble the paired single instructions...doesn't PyiiASMH use the same external apps?

I've been reduced to assembling them in Gecko.NET, and then copy/pasting the machine code over as a .long.  This is quite a laborious and error-prone process...

I think they use powerpc-gekko... I can't find the cross-platform versions of those executables online nor can I find the source to properly build them... hence why I packed powerpc-eabi (which is what devkitPro uses).

If you happen to find those executables (win32, linux, and osx) or the source code to it... I'll rewrite PyiiASMH to use it.


Title: Re: PyiiASMH
Post by: dcx2 on July 23, 2010, 08:08:18 PM
That makes sense, paired singles are a Gekko-specific extension to the PowerPC architecture.

Would it be possible to allow specification of the external executable to call?  That way you can default to powerpc-eabi, and the Win32 folks can specify powerpc-gekko if they want paired single support.


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 23, 2010, 10:31:20 PM
I could, but I would not be able to make the proper change until around August 5... kinda booked up right now with stuff to do.

In the meantime, you could just copy the powerpc-gekko executables to the same location of powerpc-eabi (delete the eabi ones), then just rename them to powerpc-eabi instead of powerpc-gekko.

Or, you could edit eabi.py to use powerpc-gekko. Find this code snippet:

Code:
# Win32, OSX, Linux are supported
# Other os's may work, but they are unsupported
self.eabi_as = "./ext/"+sys.platform+"/powerpc-eabi-as"
self.eabi_ld = "./ext/"+sys.platform+"/powerpc-eabi-ld"
self.eabi_objcopy = "./ext/"+sys.platform+"/powerpc-eabi-objcopy"
if (sys.platform == "win32"):
    self.eabi_as += ".exe"
    self.eabi_ld += ".exe"
    self.eabi_objcopy += ".exe"

then change 'powerpc-eabi' to 'powerpc-gekko'. Make sure you keep the indentation intact; Python requires it. Also, make sure you delete "eabi.pyc"; otherwise the change will not work.


Title: Re: PyiiASMH
Post by: dcx2 on July 23, 2010, 10:32:58 PM
Okay, thanks for the workaround.  I'll try it tonight.

It would be nice for PyiiASMH to support this at some point.  I'm getting ready to release a Paired Singles tutorial soon.


Title: Re: PyiiASMH
Post by: dcx2 on July 24, 2010, 03:48:03 AM
I tried replacing -eabi exe's with -gekko exe's, renamed.  Didn't work.

Went in and replaced the code in eabi.py with gekko.  Didn't work.

Even copied vdappc, which appeared to be different from the one that came with the win32 distributable.

:'(

EDIT: This is the instruction I put in

psq_l f0,0(r12),0,0

And this is what I got out

./tmp/code.txt: Assembler messages:
./tmp/code.txt:1: Error: Unrecognized opcode: `psq_l'


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 24, 2010, 03:26:57 PM
I tried replacing -eabi exe's with -gekko exe's, renamed.  Didn't work.

Went in and replaced the code in eabi.py with gekko.  Didn't work.

Even copied vdappc, which appeared to be different from the one that came with the win32 distributable.

:'(

EDIT: This is the instruction I put in

psq_l f0,0(r12),0,0

And this is what I got out

./tmp/code.txt: Assembler messages:
./tmp/code.txt:1: Error: Unrecognized opcode: `psq_l'

Does it work on Link's tool? If not, maybe it's a GDN/WiiRd added feature...


Title: Re: PyiiASMH
Post by: dcx2 on July 24, 2010, 04:30:40 PM
No, it doesn't work with Link's tool.  But I looked at how Gecko.NET assembles the instructions, and I noticed that there's another switch on the command line for the assembler.  -mgekko is needed to make the powerpc-gekko-as recognize the Paired Single opcodes.

I managed to add the extension to the Python call, but man...Python is a weird language. 

In addition to the powerpc-eabi ~> powerpc-gekko changes that are required, and copying over the powerpc-gekko files to the ext/win32 folder, you need to modify another line in eabi.py to add the -mgekko switch.

            output = sub.Popen([self.eabi_as, "-mgekko", "-mregnames", "-o", "./tmp/src1.o", self.txtfile], stdout=sub.PIPE, stderr=sub.PIPE).communicate()

Now PyiiASMH will recognize the Paired Single opcodes.  ^_^!!!  Thanks for your help!


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 24, 2010, 04:41:14 PM
Glad you have it figured out; I'll try to add an option for custom executables when I have time for it.

EDIT: What was the assembled output of psq_l f0,0(r12),0,0? I added -mgekko to the args list and got E00C0000 (this is using powerpc-eabi). If I got the right output, I might be able to upload new versions today.


Title: Re: PyiiASMH
Post by: dcx2 on July 24, 2010, 05:19:04 PM
Yes, E00C0000 is the correct output for psq_l blahblah

You should also try ps_nmsub f0,f0,f0,f0 = 1000003C

That's freaking awesome that it works with the eabi builds.

FYI, if you google "yet another gamecube documentation" they have a list of all the paired singles op codes, and what they do.


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 24, 2010, 05:58:49 PM
Uploaded new archives with the -mgekko argument added (on Google Code).

And yeah, that did work. Thanks for finding bugs and stuff.


Title: Re: PyiiASMH
Post by: dcx2 on July 25, 2010, 11:58:40 PM
I'm making a post here with links to the appropriate stuff for Windows folks so that I have something easy to point to.


The google code page for PyiiASMH

http://code.google.com/p/pyiiasmh/


Python 2.6.5 (click "Windows x86 MSI Installer")

http://www.python.org/download/releases/2.6.5/


PyQt4 (click "PyQt-Py2.6-gpl-4.7.4-1.exe")

http://www.riverbankcomputing.co.uk/software/pyqt/download


Title: Re: PyiiASMH
Post by: dcx2 on July 26, 2010, 04:47:14 AM
Hey hawkeye, where's the source for vdappc?  It looks like there's a bug, and I think it's in vdappc.

When I assemble ps_nmadd f0,f0,f0,f0 it turns into 1000003E.  Which is correct, according to YAGD.

But when you try to run the process backwards, 1000003E turns into ps_nmsub!  vdappc is what's used to turn machine code into assembly, right?


Title: Re: PyiiASMH
Post by: hawkeye2777 on August 01, 2010, 11:35:39 PM
I'm using the modified vdappc source that Link posted on his blog.


Title: Re: PyiiASMH
Post by: dcx2 on August 02, 2010, 12:32:12 AM
I'm pretty sure there's a bug in that vdappc code.  Lines 1638 and 1642 of the switch are backwards.  I checked out the other op codes and they all look good...


Title: Re: PyiiASMH
Post by: WiiOs-Ozelot on August 14, 2010, 10:54:34 PM
Hey hawkeye2777, can you add a Save/Load Dialog for Session's? The old session overwritten the old Sav file.
Can you add this? :) PyiiASMH works now :)

greetz oze


Title: Re: PyiiASMH
Post by: hawkeye2777 on August 14, 2010, 11:21:50 PM
Hey hawkeye2777, can you add a Save/Load Dialog for Session's? The old session overwritten the old Sav file.
Can you add this? :) PyiiASMH works now :)

greetz oze

So you want a 'File->Save As' type dialog, where you could save the sessions anywhere?


Title: Re: PyiiASMH
Post by: Bully@Wiiplaza on August 27, 2010, 07:51:46 PM
Sry, but where´s the working download for the newest version? My system: 32bit and Vista.
I tried a few "packs" but they didn´t contain an exe data...



Title: Re: PyiiASMH
Post by: hawkeye2777 on August 27, 2010, 09:17:44 PM
Sry, but where´s the working download for the newest version? My system: 32bit and Vista.
I tried a few "packs" but they didn´t contain an exe data...

Please read the README. If you still can't get it working after you read it, post here and I'll try and help.


Title: Re: PyiiASMH
Post by: dcx2 on August 27, 2010, 09:27:32 PM
Bully, you need Python in order to run PyiiASMH.  You need all three links below.

I'm making a post here with links to the appropriate stuff for Windows folks so that I have something easy to point to.


The google code page for PyiiASMH

http://code.google.com/p/pyiiasmh/


Python 2.6.5 (click "Windows x86 MSI Installer")

http://www.python.org/download/releases/2.6.5/


PyQt4 (click "PyQt-Py2.6-gpl-4.7.4-1.exe")

http://www.riverbankcomputing.co.uk/software/pyqt/download


Title: Re: PyiiASMH
Post by: Bully@Wiiplaza on August 28, 2010, 02:26:08 PM
okay thanks...
since it´s better to have everything in one package, here it is:

http://jafile.com/uploads/wiiplaza/packagepyiiasmh_wiiplaza.rar

hosted on wiiplaza... Package + TuT by WiiOS

Installation
1.) Start "python-2.6.5.msi"
2.) Install PyQt-Py2.6-gpl-4.7.4-1.exe
Finished!

Starting
1.) Go to the PyiiASMH folder
2. Double click on PyiiASMH.py and the PyiiASMH tool is launched!




Title: Re: PyiiASMH
Post by: Panda On Smack on October 07, 2010, 08:15:45 PM
Perhaps a bit of a stupid question but does a global 'translation' of asm to hex exist somewhere that's ported into apps like this or is it all written from scratch?



Title: Re: PyiiASMH
Post by: Romaap on October 07, 2010, 08:34:58 PM
VDAPPC is the program that does the conversion IIRC.


Title: Re: PyiiASMH
Post by: hawkeye2777 on October 07, 2010, 09:54:13 PM
ASM to Hex: powerpc-eabi-as, powerpc-eabi-ld, powerpc-eabi-objcopy

Hex to ASM: vdappc

Correct me if I'm wrong. In this app, powerpc-eabi is supplied only due to the lack of powerpc-gekko tools for linux and OSX.


Title: Re: PyiiASMH
Post by: giantpune on October 08, 2010, 02:23:26 AM
the "powerpc-gekko-" tools are all included in devkitPPC r17, at least for linux.  i think they changed to '"-eabi-" in r18 or 19.


Title: Re: PyiiASMH
Post by: dcx2 on October 08, 2010, 02:51:55 AM
I believe this is consistent with our experience regarding the Paired Singles instructions that are specific to the Gekko architecture.  If you use the -mgekko switch with the powerpc-eabi-as it will recognize them.  Follow the thread starting here http://wiird.l0nk.org/forum/index.php/topic,4845.msg55322.html#msg55322


Title: Re: PyiiASMH
Post by: SouL on April 17, 2011, 06:59:55 AM
Thanks A LOT for this. Now I can code C2 easy. Time to start making ASM codes. :D


Title: Re: PyiiASMH
Post by: dcx2 on May 22, 2011, 05:29:26 PM
I found a weird error.

If you have a comment with # and it starts with a number, PyiiASMH will stop at 35%.  So this will not work

Code:
# 0

And this will

Code:
# x0


Title: Re: PyiiASMH
Post by: hetoan2 on May 23, 2011, 10:18:27 PM
i seriously was always wondering why it did that D:

although I'm pretty sure i've gotten this error in other places too inexplicably :(


Title: Re: PyiiASMH
Post by: dcx2 on May 23, 2011, 10:29:20 PM
Another thing I noticed is that if I use a branch label without defining it (e.g. b _END with no _END: label anywhere else), PyiiASMH gets to 100%, and then...nothing happens.  It took me a while before I realized I was just missing a branch label.


Title: Re: PyiiASMH
Post by: hawkeye2777 on May 29, 2011, 07:35:37 PM
I'll check this out when I get a chance.

I may also try to update this in the future as well, possibly trying out a new GUI toolkit and porting this to Python 3.


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 23, 2011, 04:55:22 AM
Alright, sorry for the really late reply - have been busy with other stuff I want to get done.

I found a weird error.

If you have a comment with # and it starts with a number, PyiiASMH will stop at 35%.  So this will not work

Code:
# 0

And this will

Code:
# x0

This is not the case for me... can you tell me the version of Python, etc. that you are using? Both comments work just fine. Maybe if you gave a more elaborate example that doesn't work, I could try and figure it out.

Another thing I noticed is that if I use a branch label without defining it (e.g. b _END with no _END: label anywhere else), PyiiASMH gets to 100%, and then...nothing happens.  It took me a while before I realized I was just missing a branch label.

I get the following output when doing that: "An error has occured; please try assembling again." From looking at my source, an IO error occurred, so something went wrong during the whole powerpc-eabi-as, powerpc-eabi-ld, and powerpc-eabi-objcopy process.

Hopefully once I start working on this again, I can implement much better error handling/checking than I currently have.


Title: Re: PyiiASMH
Post by: dcx2 on July 23, 2011, 03:10:39 PM
No problem man.  Other people have lives, too. ^_^

Here's the versions I'm using.

Python 2.6.5

PyQt4 ("PyQt-Py2.6-gpl-4.7.4-1.exe")

I'll try to come up with some more examples.  Also, it looks like sometimes when it disassembles, it doesn't create the right branch offsets..?  I'll make some examples that are meatier.


Title: Re: PyiiASMH
Post by: Bully@Wiiplaza on July 23, 2011, 03:43:14 PM
I'll try to come up with some more examples.  Also, it looks like sometimes when it disassembles, it doesn't create the right branch offsets..?  I'll make some examples that are meatier.
yep.
I assembled a code and applied it....
freeze. LOL
ASMWiird gave a different offset and it didn´t freeze.


Title: Re: PyiiASMH
Post by: dcx2 on July 23, 2011, 04:28:47 PM
It helps if you give him the code so he can see what went wrong...


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 23, 2011, 09:03:08 PM
Hmm, if you want, you can try the latest Python 2 release (2.7.2 at this time) and the latest PyQt to go with it. That's what I have on my computer at the moment.

I'm working on rewriting most of it though, so I may just wait until I get that finished to implement any bug fixes "officially".

Also, it looks like sometimes when it disassembles, it doesn't create the right branch offsets..?  I'll make some examples that are meatier.

Yeah, I've seen that before... never really looked into it though. My guess is that Link's tool creates them properly?


Title: Re: PyiiASMH
Post by: dcx2 on July 25, 2011, 04:26:02 AM
For me, this C2 code disassembles differently in each app.

C20A3DA4 00000009
A95E0048 3D80802D
A16CAED8 716B0400
41820034 A95E005A
896CAEDB 7D6B0774
7D6B1E70 7D4A5A14
2C0A270F 40810008
39400000 2C0A0000
40800008 3940270F
B15E005A 00000000

lha r10,72(r30)
lis r12,-32723
lhz r11,-20776(r12)
andi. r11,r11,1024
beq- 0x34
lha r10,90(r30)
lbz r11,-20773(r12)
extsb r11,r11
srawi r11,r11,3
add r10,r10,r11
cmpwi r10,9999
ble- 0x08
li r10,0
cmpwi r10,0
bge- 0x08
li r10,9999
sth r10,90(r30)

lha r10,72(r30)
lis r12,-32723
lhz r11,-20776(r12)
andi. r11,r11,1024
beq- 0x0034
lha r10,90(r30)
lbz r11,-20773(r12)
extsb r11,r11
srawi r11,r11,3
add r10,r10,r11
cmpwi r10,9999
ble- 0x0034
li r10,0
cmpwi r10,0
bge- 0x0034
li r10,9999
sth r10,90(r30)

---

Also, the single line

# 0

still causes 35% stop, but there's the following message in the command line console


Traceback (most recent call last):
  File "F:\Wii\wiird\pyiiasmh-0.9.3-win32\PyiiASMH.py", line 249, in assemble
    numlines = ("%x" % ((len(asm.codelist) / 2) + 1, )).upper()
AttributeError: Assemble instance has no attribute 'codelist'

---

I updated to 2.7.2 and Qt for 2.7.  These problems still happen. =(

On the bright side, if I use undefined symbols in the assembler, it gives me an error now.


Title: Re: PyiiASMH
Post by: hawkeye2777 on July 25, 2011, 05:12:38 AM
EDIT (for the >9000 time): <notes about branch instruction bug removed, not relevant anymore - see patch below>

Branch instruction bug is actually fixed now - made a really dumb error in my code... patch included below.

What to patch - vdappc.py (make sure to open it in a text editor, e.g. notepad):

1.) Find the following snippet (lines 52-62):

Code:
            #branch instruction fixes
            for i in range(len(b)):
                if ("0x" in b[i]) == True:
                    c.append(b[i])
            for i in range(len(c)):       
                c[i] = c[i][15:].split("\t", 1)[0]
            for i in range(len(a)):
                if ("0x" in a[i]) == True:
                    j = 0
                    a[i] = a[i].split("0x")[0]+"0x"+c[j]
                    j = j + 1

2.) Replace it with this:

Code:
            #branch instruction fixes
            for i in range(len(b)):
                if ("0x" in b[i]) == True:
                    c.append(b[i])
            for i in range(len(c)):       
                c[i] = c[i][15:].split("\t", 1)[0]
            for i in range(len(a)):
                if i == 0:
                    j = 0
                if ("0x" in a[i]) == True:
                    a[i] = a[i].split("0x")[0]+"0x"+c[j]
                    j = j + 1

Why did it not work before? Because j kept getting reassigned to 0...

---

Quote
Also, the single line

# 0

still causes 35% stop, but there's the following message in the command line console


Traceback (most recent call last):
  File "F:\Wii\wiird\pyiiasmh-0.9.3-win32\PyiiASMH.py", line 249, in assemble
    numlines = ("%x" % ((len(asm.codelist) / 2) + 1, )).upper()
AttributeError: Assemble instance has no attribute 'codelist'

That traceback will be helpful, but I still can't reproduce or find a potential fix... I have ideas now of what is causing the problem, but have no idea which is the true culprit.

*I apologize if parts of this post don't make any sense... had a long day to say the least. xD


Title: Re: PyiiASMH
Post by: hawkeye2777 on March 10, 2012, 10:06:18 AM
Finally finished.

EDIT (Update - v2.0.0 released):

PyiiASMH is a cross-platform WiiRd ASM helper tool coded in Python. Go to Google Code (http://code.google.com/p/pyiiasmh/) to check it out and download it. Please submit feedback, bug reports, etc. if you have any.

Changelog:
PyiiASMH 2.0.0 (March 10, 2012):
    - Complete rewrite of the old code
    - New CLI interface (WIP)
    - New redesigned GUI (more internal changes)
    - PySide now supported
    - Multiple session support (opening/saving to files anywhere)
    - New preferences dialog with GUI Style selector, default codetype
      selector, confirmation prompts, and loading the last session on startup
    - Fields used for bapo, xor, and chksum now only allow hexadecimal input
    - Better error handling (most errors/exceptions logged to error.log)
    - Relicensed under the "new" BSD license
    - Cleaner code (WIP)
    - Bug fixes

What you need (summary):
 - Python 2.6.x or 2.7.x (download (http://python.org/getit/releases/2.7.2/))
 - PySide 1.0.6+ (download (http://qt-project.org/wiki/PySideDownloads)) OR PyQt 4.7.x+ (download (http://www.riverbankcomputing.co.uk/software/pyqt/download))

Other notes:
 - PyiiASMH is now released under the "new"/"modified"/clause 3 BSD license.
 - For those of you who like to redistribute/repackage stuff, you cannot pack PyQt with PyiiASMH; the GPL doesn't allow it (unless PyiiASMH were GPL'd, which it is not anymore). However, I'll be working on "native" packages soon for Windows (and hopefully OS X too) using PySide instead, so just be patient... or just install stuff manually; it won't kill you.
 
Think that's all; ask away if you need to.

As always, let me know if you find a bug or a screwup (pretty likely; given the time that I posted this).


Title: Re: PyiiASMH
Post by: Bully@Wiiplaza on March 10, 2012, 10:56:24 AM
cool I was looking forward to thoses fixes.

Btw. do Windows 7 64bit folks need to install the following:

http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-Py3.2-x64-gpl-4.9.1-1.exe
http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi

And then extract this to a folder:
http://code.google.com/p/pyiiasmh/downloads/detail?name=pyiiasmh-2.0.0-win32.zip

Cuz I just copied in the new files and it failed to boot the application...


Title: Re: PyiiASMH
Post by: hawkeye2777 on March 10, 2012, 05:30:59 PM
For windows, I don't think it matters if you install 32 or 64 bits... as long as both python and pyqt/pyside are both 32 bits or both 64 bits. For the app archive, extract it anywhere where you have permissions to be safe.

For your problem, you installed PyQt for Python 3.2 instead of 2.7 (grab the PyQt installer with Py2.7).


Title: Re: PyiiASMH
Post by: Bully@Wiiplaza on March 10, 2012, 06:21:51 PM
 ;D

Downloads for Win7 64bit:
http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-Py2.7-x64-gpl-4.9.1-1.exe
http://python.org/ftp/python/2.7.2/python-2.7.2.amd64.msi
http://pyiiasmh.googlecode.com/files/pyiiasmh-2.0.0-win32.zip

1.) Run the installer from the first two links
2.) Extract the contents of the third link anywhere and run the application

DONE.


Title: Re: PyiiASMH
Post by: hawkeye2777 on March 11, 2012, 06:07:12 AM
A couple of compatibility issues with older versions of PySide/PyQt have surfaced; at least one issue is fixed (http://code.google.com/p/pyiiasmh/issues/detail?id=3), let me know if others come up. The fixes are on the git repo right now (I'll make a new release eventually).


Title: Re: PyiiASMH
Post by: fantleas on April 15, 2012, 04:50:01 AM
Just a few bugs/suggestions:

1.

I have an "en dash" character (\u2013) inside one comment of my code. PyiiASMh won't assemble the code if this character is found. Old PyiiASMh didn't have this problem.

This is the output I get from the console:

"Traceback (most recent call last):
  File ".\pyiiasmh.py", line 420, in <lambda>
    lambda: self.convert("asm"))
  File ".\pyiiasmh.py", line 63, in convert
    self.get_uivars(action)
  File ".\pyiiasmh.py", line 98, in get_uivars
    self.opcodes = str(self.ui.opcodesPTextEdit.toPlainText())+"\n"
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 1
6587: ordinal not in range(128)"

--------

2.

Also, when using only Python 2.7.2 and PyQt 4.9.1 (both x64), the application works fine. However, looking forward to the future "native packages" you mentioned, I decided to install PySide 1.1.0 for Python 2.7 (amd64).
Surprisingly, PyiiASMH is unable to launch with PySide installed. The console opens and prints some output, then instantly closes. I checked the error logs but couldn't find anything related to the crashes.

--------

3.

Suggestion: When expanding the window, the options panel (Address/Offset, XOR Checksum, Code Type, etc.) should not be expanded at all. Instead, the panel should keep its default size, allowing the text boxes to have a bigger vertical size.

:)

Edit: Fixed typo. Had typed '\u2012' instead of '\u2013' for the Unicode character.


Title: Re: PyiiASMH
Post by: Bully@Wiiplaza on April 19, 2012, 08:34:50 PM
Also, PyiiASMH is WAY slower than ASMWiiRd in terms of convertion to Gecko Code.
I once rendered a video (eats up almost all CPU power), hit the convert button. Waiting... nothing happened for like 10 seconds.
I booted ASMWiiRd, pasted the same assembly, hit the convert button. About 3 secs later, ASMWiiRd gave out the converted code while PyiiASMH still wasn´t done with the "same job". ;)


Title: Re: PyiiASMH
Post by: hetoan2 on April 20, 2012, 01:28:28 AM
PyiiASMH has never taken more than a second for me... Are you sure your python install is correct?

I know it can "freeze" on certain %s if you're missing things... Check your filestructure too, because a missing folder may be the culprit.


Title: Re: PyiiASMH
Post by: Bully@Wiiplaza on April 20, 2012, 05:46:45 AM
PyiiASMH has never taken more than a second for me... Are you sure your python install is correct?

I know it can "freeze" on certain %s if you're missing things... Check your filestructure too, because a missing folder may be the culprit.
It *only* applies when I don´t render a video at the same time.
Yes, it normally works fine, just like you described. I noticed that on low remaining CPU power ASMWiiRd converts way faster.
Wonder what´s the reason for it, they both do the same operation.


Title: Re: PyiiASMH
Post by: hetoan2 on April 20, 2012, 09:24:53 PM
PyiiASMh is not already compiled. Every time you run the .py file it creates a .pyo/.pyc file (i'm fairly certain it doesn't reuse, although i'm not entirely sure) and the exe is already compiled.

Also PyiiASMh has more features. You can't do things like macros or certain pseudoops like you can with PyiiASMh. :\


Title: Re: PyiiASMH
Post by: dcx2 on April 20, 2012, 11:25:35 PM
I've seen ASMWiiRd convert pretty much anything.  Only problem is you need to make sure you maximize the window so there is no word wrap going on in the ASM window; it really chokes on that.

PyiiASMH lets me compile raw, though, which I've used for compiling multiple C2 codes simultaneously.  I had to do all of them in one pass so that they could automatically calculate pointers to data from other C2 codes.

FWIW, I can't remember there being a significant difference in speed between one or the other.


Title: Re: PyiiASMH
Post by: hawkeye2777 on April 21, 2012, 01:45:11 AM
If you monitored which threads or cores each program runs on, that could be why PyiiASMH may be slower under heavy CPU load. So, unless some of the modules used use multiple threads, PyiiASMH is probably locked to one thread, and if that thread is on the CPU with a heavy load that will probably slow it down. I have no idea how to monitor that on Windows or how Windows handles that kind of stuff, so I can't help there; concurrency stuff is on my TODO list though once I get a chance to put it in. Other than that, I'm guessing it isn't a problem with the PyiiASMH program itself. Like ASMWiiRd, it is just a frontend for the powerpc-eabi-as, vdappc, etc. tools; all it does is "automate" the process of using those tools for you.

Just a few bugs/suggestions:

[...snip...]

--------

2.

Also, when using only Python 2.7.2 and PyQt 4.9.1 (both x64), the application works fine. However, looking forward to the future "native packages" you mentioned, I decided to install PySide 1.1.0 for Python 2.7 (amd64).
Surprisingly, PyiiASMH is unable to launch with PySide installed. The console opens and prints some output, then instantly closes. I checked the error logs but couldn't find anything related to the crashes.

--------

3.

Suggestion: When expanding the window, the options panel (Address/Offset, XOR Checksum, Code Type, etc.) should not be expanded at all. Instead, the panel should keep its default size, allowing the text boxes to have a bigger vertical size.

First of all, thanks for the feedback. Right now things are very busy for me as school is coming to a close, but hopefully I'll be able to tackle some of that stuff soon. For 2: I haven't had a chance to test PySide on Windows yet, so not sure why it's doing that (PySide works fine for me, under Linux). Somehow I wonder if it's a problem with environment variables on Windows... not sure, but it's something I'll have to look into. As far as #3 goes... well I'm not sure if I can do that, and if I can I don't know how to do that in Qt. I'll definitely consider that though. :)



Title: Re: PyiiASMH
Post by: Bully@Wiiplaza on June 19, 2012, 01:41:24 PM
A little bug I´ve found:

If you put a lot of assembly instructions into the compiler, it will miss out zeros in the first line before the lines counter value. The more instructions, the more zeros are left out ;D

Try to compile this:
lwz r5,0(r4)

lis r10, 0x8053
lhz r10, 0x56D2 (r10)

lis r12, 0x9371

cmpwi r10, 0x1000
bne- _END

stw r5, 0 (r12)
lwz r11, 4 (r4)
stw r11, 4 (r12)
lwz r11, 8 (r4)
stw r11, 8 (r12)
lwz r11, 12 (r4)
stw r11, 12 (r12)
lwz r11, 16 (r4)
stw r11, 16 (r12)
lwz r11, 20 (r4)
stw r11, 20 (r12)
lwz r11, 24 (r4)
stw r11, 24 (r12)
lwz r11, 28 (r4)
stw r11, 28 (r12)
lwz r11, 32 (r4)
stw r11, 32 (r12)
lwz r11, 36 (r4)
stw r11, 36 (r12)
lwz r11, 40 (r4)
stw r11, 40 (r12)
lwz r11, 44 (r4)
stw r11, 44 (r12)
lwz r11, 48 (r4)
stw r11, 48 (r12)
lwz r11, 52 (r4)
stw r11, 52 (r12)
lwz r11, 56 (r4)
stw r11, 56 (r12)
lwz r11, 60 (r4)
stw r11, 60 (r12)
lwz r11, 64 (r4)
stw r11, 64 (r12)
lwz r11, 68 (r4)
stw r11, 68 (r12)
lwz r11, 72 (r4)
stw r11, 72 (r12)
lwz r11, 76 (r4)
stw r11, 76 (r12)
lwz r11, 80 (r4)
stw r11, 80 (r12)
lwz r11, 84 (r4)
stw r11, 84 (r12)
lwz r11, 88 (r4)
stw r11, 88 (r12)
lwz r11, 92 (r4)
stw r11, 92 (r12)
lwz r11, 96 (r4)
stw r11, 96 (r12)
lwz r11, 100 (r4)
stw r11, 100 (r12)
lwz r11, 104 (r4)
stw r11, 104 (r12)
lwz r11, 108 (r4)
stw r11, 108 (r12)
lwz r11, 112 (r4)
stw r11, 112 (r12)
lwz r11, 116 (r4)
stw r11, 116 (r12)
lwz r11, 120 (r4)
stw r11, 120 (r12)
lwz r11, 124 (r4)
stw r11, 124 (r12)
lwz r11, 126 (r4)
stw r11, 126 (r12)
lwz r11, 130 (r4)
stw r11, 130 (r12)
lwz r11, 134 (r4)
stw r11, 134 (r12)
lwz r11, 138 (r4)
stw r11, 138 (r12)
lwz r11, 142 (r4)
stw r11, 142 (r12)
lwz r11, 146 (r4)
stw r11, 146 (r12)
lwz r11, 150 (r4)
stw r11, 150 (r12)
lwz r11, 154 (r4)
stw r11, 154 (r12)
lwz r11, 158 (r4)
stw r11, 158 (r12)
lwz r11, 162 (r4)
stw r11, 162 (r12)
lwz r11, 166 (r4)
stw r11, 166 (r12)
lwz r11, 170 (r4)
stw r11, 170 (r12)
lwz r11, 174 (r4)
stw r11, 174 (r12)
lwz r11, 178 (r4)
stw r11, 178 (r12)
lwz r11, 182 (r4)
stw r11, 182 (r12)
lwz r11, 186 (r4)
stw r11, 186 (r12)
lwz r11, 190 (r4)
stw r11, 190 (r12)
lwz r11, 194 (r4)
stw r11, 194 (r12)
lwz r11, 198 (r4)
stw r11, 198 (r12)
lwz r11, 202 (r4)
stw r11, 202 (r12)
lwz r11, 208 (r4)
stw r11, 208 (r12)
lwz r11, 212 (r4)
stw r11, 212 (r12)
lwz r11, 216 (r4)
stw r11, 216 (r12)

_END:

cmpwi r10, 0x10
bne- _ENDO

lwz r11, 0 (r12)
stw r11, 0 (r4)
lwz r11, 4 (r12)
stw r11, 4 (r4)
lwz r11, 8 (r12)
stw r11, 8 (r4)
lwz r11, 12 (r12)
stw r11, 12 (r4)
lwz r11, 16 (r12)
stw r11, 16 (r4)
lwz r11, 20 (r12)
stw r11, 20 (r4)
lwz r11, 24 (r12)
stw r11, 24 (r4)
lwz r11, 28 (r12)
stw r11, 28 (r4)
lwz r11, 32 (r12)
stw r11, 32 (r4)
lwz r11, 36 (r12)
stw r11, 36 (r4)
lwz r11, 40 (r12)
stw r11, 40 (r4)
lwz r11, 44 (r12)
stw r11, 44 (r4)
lwz r11, 48 (r12)
stw r11, 48 (r4)
lwz r11, 52 (r12)
stw r11, 52 (r4)
lwz r11, 56 (r12)
stw r11, 56 (r4)
lwz r11, 60 (r12)
stw r11, 60 (r4)
lwz r11, 64 (r12)
stw r11, 64 (r4)
lwz r11, 68 (r12)
stw r11, 68 (r4)
lwz r11, 72 (r12)
stw r11, 72 (r4)
lwz r11, 76 (r12)
stw r11, 76 (r4)
lwz r11, 80 (r12)
stw r11, 80 (r4)
lwz r11, 84 (r12)
stw r11, 84 (r4)
lwz r11, 88 (r12)
stw r11, 88 (r4)
lwz r11, 92 (r12)
stw r11, 92 (r4)
lwz r11, 96 (r12)
stw r11, 96 (r4)
lwz r11, 100 (r12)
stw r11, 100 (r4)
lwz r11, 104 (r12)
stw r11, 104 (r4)
lwz r11, 108 (r12)
stw r11, 108 (r4)
lwz r11, 112 (r12)
stw r11, 112 (r4)
lwz r11, 116 (r12)
stw r11, 116 (r4)
lwz r11, 120 (r12)
stw r11, 120 (r4)
lwz r11, 124 (r12)
stw r11, 124 (r4)
lwz r11, 126 (r12)
stw r11, 126 (r4)
lwz r11, 130 (r12)
stw r11, 130 (r4)
lwz r11, 134 (r12)
stw r11, 134 (r4)
lwz r11, 138 (r12)
stw r11, 138 (r4)
lwz r11, 142 (r12)
stw r11, 142 (r4)
lwz r11, 146 (r12)
stw r11, 146 (r4)
lwz r11, 150 (r12)
stw r11, 150 (r4)
lwz r11, 154 (r12)
stw r11, 154 (r4)
lwz r11, 158 (r12)
stw r11, 158 (r4)
lwz r11, 162 (r12)
stw r11, 162 (r4)
lwz r11, 166 (r12)
stw r11, 166 (r4)
lwz r11, 170 (r12)
stw r11, 170 (r4)
lwz r11, 174 (r12)
stw r11, 174 (r4)
lwz r11, 178 (r12)
stw r11, 178 (r4)
lwz r11, 182 (r12)
stw r11, 182 (r4)
lwz r11, 186 (r12)
stw r11, 186 (r4)
lwz r11, 190 (r12)
stw r11, 190 (r4)
lwz r11, 194 (r12)
stw r11, 194 (r4)
lwz r11, 198 (r12)
stw r11, 198 (r4)
lwz r11, 202 (r12)
stw r11, 202 (r4)
lwz r11, 208 (r12)
stw r11, 208 (r4)
lwz r11, 212 (r12)
stw r11, 212 (r4)
lwz r11, 216 (r12)
stw r11, 216 (r4)

_ENDO:
Zeros are missing...
C2000000 72
80A40000 3D408053
A14A56D2 3D809371
2C0A1000 408201B8
90AC0000 81640004
916C0004 81640008
916C0008 8164000C
916C000C 81640010
916C0010 81640014
916C0014 81640018
916C0018 8164001C
916C001C 81640020
916C0020 81640024
916C0024 81640028
916C0028 8164002C
916C002C 81640030
916C0030 81640034
916C0034 81640038
916C0038 8164003C
916C003C 81640040
916C0040 81640044
916C0044 81640048
916C0048 8164004C
916C004C 81640050
916C0050 81640054
916C0054 81640058
916C0058 8164005C
916C005C 81640060
916C0060 81640064
916C0064 81640068
916C0068 8164006C
916C006C 81640070
916C0070 81640074
916C0074 81640078
916C0078 8164007C
916C007C 8164007E
916C007E 81640082
916C0082 81640086
916C0086 8164008A
916C008A 8164008E
916C008E 81640092
916C0092 81640096
916C0096 8164009A
916C009A 8164009E
916C009E 816400A2
916C00A2 816400A6
916C00A6 816400AA
916C00AA 816400AE
916C00AE 816400B2
916C00B2 816400B6
916C00B6 816400BA
916C00BA 816400BE
916C00BE 816400C2
916C00C2 816400C6
916C00C6 816400CA
916C00CA 816400D0
916C00D0 816400D4
916C00D4 816400D8
916C00D8 2C0A0010
408201BC 816C0000
91640000 816C0004
91640004 816C0008
91640008 816C000C
9164000C 816C0010
91640010 816C0014
91640014 816C0018
91640018 816C001C
9164001C 816C0020
91640020 816C0024
91640024 816C0028
91640028 816C002C
9164002C 816C0030
91640030 816C0034
91640034 816C0038
91640038 816C003C
9164003C 816C0040
91640040 816C0044
91640044 816C0048
91640048 816C004C
9164004C 816C0050
91640050 816C0054
91640054 816C0058
91640058 816C005C
9164005C 816C0060
91640060 816C0064
91640064 816C0068
91640068 816C006C
9164006C 816C0070
91640070 816C0074
91640074 816C0078
91640078 816C007C
9164007C 816C007E
9164007E 816C0082
91640082 816C0086
91640086 816C008A
9164008A 816C008E
9164008E 816C0092
91640092 816C0096
91640096 816C009A
9164009A 816C009E
9164009E 816C00A2
916400A2 816C00A6
916400A6 816C00AA
916400AA 816C00AE
916400AE 816C00B2
916400B2 816C00B6
916400B6 816C00BA
916400BA 816C00BE
916400BE 816C00C2
916400C2 816C00C6
916400C6 816C00CA
916400CA 816C00D0
916400D0 816C00D4
916400D4 816C00D8
916400D8 00000000
No big deal, though. We can add them in.
C2000000 00000072
80A40000 3D408053
A14A56D2 3D809371
2C0A1000 408201B8
90AC0000 81640004
916C0004 81640008
916C0008 8164000C
916C000C 81640010
916C0010 81640014
916C0014 81640018
916C0018 8164001C
916C001C 81640020
916C0020 81640024
916C0024 81640028
916C0028 8164002C
916C002C 81640030
916C0030 81640034
916C0034 81640038
916C0038 8164003C
916C003C 81640040
916C0040 81640044
916C0044 81640048
916C0048 8164004C
916C004C 81640050
916C0050 81640054
916C0054 81640058
916C0058 8164005C
916C005C 81640060
916C0060 81640064
916C0064 81640068
916C0068 8164006C
916C006C 81640070
916C0070 81640074
916C0074 81640078
916C0078 8164007C
916C007C 8164007E
916C007E 81640082
916C0082 81640086
916C0086 8164008A
916C008A 8164008E
916C008E 81640092
916C0092 81640096
916C0096 8164009A
916C009A 8164009E
916C009E 816400A2
916C00A2 816400A6
916C00A6 816400AA
916C00AA 816400AE
916C00AE 816400B2
916C00B2 816400B6
916C00B6 816400BA
916C00BA 816400BE
916C00BE 816400C2
916C00C2 816400C6
916C00C6 816400CA
916C00CA 816400D0
916C00D0 816400D4
916C00D4 816400D8
916C00D8 2C0A0010
408201BC 816C0000
91640000 816C0004
91640004 816C0008
91640008 816C000C
9164000C 816C0010
91640010 816C0014
91640014 816C0018
91640018 816C001C
9164001C 816C0020
91640020 816C0024
91640024 816C0028
91640028 816C002C
9164002C 816C0030
91640030 816C0034
91640034 816C0038
91640038 816C003C
9164003C 816C0040
91640040 816C0044
91640044 816C0048
91640048 816C004C
9164004C 816C0050
91640050 816C0054
91640054 816C0058
91640058 816C005C
9164005C 816C0060
91640060 816C0064
91640064 816C0068
91640068 816C006C
9164006C 816C0070
91640070 816C0074
91640074 816C0078
91640078 816C007C
9164007C 816C007E
9164007E 816C0082
91640082 816C0086
91640086 816C008A
9164008A 816C008E
9164008E 816C0092
91640092 816C0096
91640096 816C009A
9164009A 816C009E
9164009E 816C00A2
916400A2 816C00A6
916400A6 816C00AA
916400AA 816C00AE
916400AE 816C00B2
916400B2 816C00B6
916400B6 816C00BA
916400BA 816C00BE
916400BE 816C00C2
916400C2 816C00C6
916400C6 816C00CA
916400CA 816C00D0
916400D0 816C00D4
916400D4 816C00D8
916400D8 00000000


Title: Re: PyiiASMH
Post by: hawkeye2777 on June 21, 2012, 03:24:43 AM
Hey guys, I moved the repo to GitHub (https://github.com/hawkeye2777/PyiiASMH); everything that was at the Google Code page is there now. I'll probably leave the Google Code page up for a bit, but eventually I'll remove it (or at least post a link to the GitHub page).

A little bug I´ve found:

If you put a lot of assembly instructions into the compiler, it will miss out zeros in the first line before the lines counter value. The more instructions, the more zeros are left out ;D

---SNIP---

Confirmed (https://github.com/hawkeye2777/PyiiASMH/issues/7), thanks! I know where the problematic code is, so now I just have to think of how to fix it.

EDIT: If you want to fix this, here's a patch:

Code:
--- a/ppctools.py
+++ b/ppctools.py
@@ -208,7 +208,7 @@ def construct_code(rawhex, bapo=None, xor=None, chksum=None, ctype=None):
 
     numlines = ("%x" % len(rawhex.split("\n"))).upper()
     leading_zeros = []
-    for i in range(8 - (int(numlines, 16) // 16 + 1)):
+    for i in range(8 - len(str(numlines))):
         leading_zeros.append("0")
 
     if rawhex[-1] == " ":

Will be on GitHub soon.