vhelin / wla-dx

WLA DX - Yet Another GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package
Other
549 stars 98 forks source link

enhancement: make .SMSTAG work with 16KB ROMs too #13

Closed sverx closed 10 years ago

sverx commented 10 years ago

It would be very useful to have .SMSTAG tag place the header (with the calculated checksum) at $3FF0 when ROM size is 16KB.

cr1901 commented 10 years ago

Ville would need to be the person to do this, as I don't have experience with the SMS backend (although I could learn when I have more free time).

Right now, I don't have much time to add features in WLA/fix the gaps in my knowledge.

sverx commented 10 years ago

I forked the repository and I will try to change this myself... well, we'll see.

sverx commented 10 years ago

I sent a pull request. Unfortunately it's fixing only half of the problem.

vhelin commented 10 years ago

On Thu, Oct 9, 2014 at 9:52 PM, William D. Jones notifications@github.com wrote:

Ville would need to be the person to do this, as I don't have experience with the SMS backend (although I could learn when I have more free time).

Right now, I don't have much time to add features in WLA/fix the gaps in my knowledge.

Hi guys,

I could give it a try. But any ideas how what I need to do to be able to compile WLA DX under Windows (8.1 and Cygwin)? I just get some errors:

...

Ville@Villes-PC /cygdrive/c/Users/Ville/Desktop/wla-dx $ ls amiga decode_z80.c main.c.orig opcodes_65816.c pass_2.h TODO amigaos4 defines.h main.h opcodes_65c02.c pass_3.c txt binaries examples main.o opcodes_gb.c pass_3.h unix.sh CHANGELOG icopy makefile opcodes_huc6280.c pass_4.c win32 dasm_opcodes include_file.c makefile? opcodes_spc700.c pass_4.h win32.orig decode_6502.c include_file.h makefile_templates opcodes_z80.c print_opcodes win32.rej decode_6510.c include_file.o makefiles parse.c README win32cl.bat decode_65816.c INSTALL memorymaps parse.h README.md wlab decode_65c02.c LICENSE msdos.bat parse.o run_unit_tests.sh wlad decode_gb.c listfile.c opcode_table_generator pass_1.c SCOPTIONS wlad_new decode_huc6280.c listfile.h opcodes_6502.c pass_1.h stack.c wlalink decode_spc700.c main.c opcodes_6510.c pass_2.c stack.h

Ville@Villes-PC /cygdrive/c/Users/Ville/Desktop/wla-dx $ ./unix.sh ./unix.sh: line 2: $'\r': command not found ./unix.sh: line 114: syntax error: unexpected end of file

Ville@Villes-PC /cygdrive/c/Users/Ville/Desktop/wla-dx $ ./win32 ./win32: line 2: $'\r': command not found ./win32: line 3: $'\r': command not found ./win32: line 6: $'\r': command not found


./win32: line 12: $'\r': command not found : No such file or directorye_table_generator cp: cannot stat ‘create_tables.win32’: No such file or directory cp: cannot stat ‘makefile.win32’: No such file or directory : No such file or directorytables.sh : No such file or directory ./win32: line 18: $'\r': command not found


./win32: line 24: $'\r': command not found : No such file or directory cp: cannot stat ‘makefile.win32’: No such file or directory '. Stop. No rule to make target ' cp: cannot stat ‘wlab.exe’: No such file or directory '. Stop. No rule to make target 'clean : No such file or directory ./win32: line 31: $'\r': command not found : No such file or directory cp: cannot stat ‘makefile.win32’: No such file or directory '. Stop. No rule to make target ' cp: cannot stat ‘wlad.exe’: No such file or directory '. Stop. No rule to make target 'clean : No such file or directory ./win32: line 38: $'\r': command not found


./win32: line 44: $'\r': command not found '. Stop. No rule to make target 'clean '. Stop. No rule to make target ' cp: cannot stat ‘wla-gb.exe’: No such file or directory ./win32: line 49: $'\r': command not found '. Stop. No rule to make target 'clean '. Stop. No rule to make target ' cp: cannot stat ‘wla-z80.exe’: No such file or directory ./win32: line 54: $'\r': command not found '. Stop. No rule to make target 'clean '. Stop. No rule to make target ' cp: cannot stat ‘wla-6502.exe’: No such file or directory ./win32: line 59: $'\r': command not found '. Stop. No rule to make target 'clean '. Stop. No rule to make target ' cp: cannot stat ‘wla-65c02.exe’: No such file or directory ./win32: line 64: $'\r': command not found '. Stop. No rule to make target 'clean '. Stop. No rule to make target ' cp: cannot stat ‘wla-6510.exe’: No such file or directory ./win32: line 69: $'\r': command not found '. Stop. No rule to make target 'clean '. Stop. No rule to make target ' cp: cannot stat ‘wla-65816.exe’: No such file or directory ./win32: line 74: $'\r': command not found '. Stop. No rule to make target 'clean '. Stop. No rule to make target ' cp: cannot stat ‘wla-spc700.exe’: No such file or directory ./win32: line 79: $'\r': command not found '. Stop. No rule to make target 'clean '. Stop. No rule to make target ' cp: cannot stat ‘wla-huc6280.exe’: No such file or directory ./win32: line 84: $'\r': command not found '. Stop. No rule to make target 'clean ./win32: line 86: $'\r': command not found


./win32: line 92: $'\r': command not found : No such file or directorynk cp: cannot stat ‘makefile.win32’: No such file or directory '. Stop. No rule to make target ' cp: cannot stat ‘wlalink.exe’: No such file or directory '. Stop. No rule to make target 'clean : No such file or directory ./win32: line 99: $'\r': command not found


MinGW? Something else? :) I just sold my MacBook Pro, and all I have left is this Windows machine...

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-58558905.

cr1901 commented 10 years ago

More line-break woes, it appears (I could've sworn I had these setting correct for the repo so that my Windows line breaks don't get comitted) :/.

Ville, run dos2unix on ./unix and see if that works. See Issue #12 (although I thought commit db3ce5d3814b63548b0621f846ae261bb68b97e6 fixes that?).

The ./win32 script should really be called MinGW.

vhelin commented 10 years ago

On Sat, Oct 11, 2014 at 9:18 PM, William D. Jones notifications@github.com wrote:

More line-break woes, it appears (I could've sworn I had these setting correct for the repo so that my Windows line breaks don't get comitted) :/.

Ville, run dos2unix on ./unix and see if that works. See Issue #12 https://github.com/vhelin/wla-dx/pull/12 (although I thought commit db3ce5d https://github.com/vhelin/wla-dx/commit/db3ce5d3814b63548b0621f846ae261bb68b97e6 fixes that?).

dos2unix seems to solve my problem, thanks! I'll commit the fixed *.unix files soon. I'll also fix couple of new warnings that cygwin's gcc gives me currently...

The ./win32 script should really be called MinGW.

Hmm time to rename that file?

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-58759058.

vhelin commented 10 years ago

On Fri, Oct 10, 2014 at 12:52 PM, sverx notifications@github.com wrote:

I sent a pull request. Unfortunately it's fixing only half of the problem.

Sorry about missing your pull request, I've never handled one, I'm still a beginner with the Git. But I saw your comment about "how to fix pass_2.c?". Here's what I did:

I know this is bad processwise, but could you guys test this new 16KB ROM support also? I pushed the commit without testing it that much, but it should work (the famous last words)... :)

But yeah, WLA itself doesn't know about the final ROM size, thus smstag and checksum can be injected / computed in WLALINK only... I hope the mod works.

Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-58634925.

cr1901 commented 10 years ago

Pull requests are like "merges from someone else". It's what happens when a person forks your code and wants to merge the changes in their private source tree back into your main tree.

sverx commented 10 years ago

When ROM size is 16KB the last byte of the ROM shouldn't be 0x4C but should be 0x4B. Check the code I submitted with my pull request. Thanks!

vhelin commented 10 years ago

Ok, thanks. Next I'll need to find a button in the Windows GUI that does the merge / pull. :) Can I still merge the pull request with my main tree now that I've committed new mods to the sources after getting the pull request?

On Monday, October 13, 2014, William D. Jones notifications@github.com wrote:

Pull requests are like "merges from someone else". It's what happens when a person forks your code and wants to merge the changes in their private source tree back into your main tree.

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-58822557.

vhelin commented 10 years ago

Ok, I'll look through your code later today when I get back home. BTW, do you have a link to some document that would explain the bits and bytes in the tag? Yesterday I only found some older docs, I think... At least they contained no information about 16kB ROMs...

On Monday, October 13, 2014, sverx notifications@github.com wrote:

When ROM size is 16KB the last byte of the ROM shouldn't be 0x4C but should be 0x4B. Check the code I submitted with my pull request. Thanks!

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-58822699.

sverx commented 10 years ago

http://www.smspower.org/Development/ROMHeader Check the last section, there's a nibble for rom size.

vhelin commented 10 years ago

On Mon, Oct 13, 2014 at 11:54 AM, sverx notifications@github.com wrote:

http://www.smspower.org/Development/ROMHeader

Thanks! I just committed the fix...

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-58863402.

sverx commented 10 years ago

Seems correct now! :) What about the SDSC Header? http://www.smspower.org/Development/SDSCHeader Can we place it before the rom header in 16KB roms too? It would be nice!

vhelin commented 10 years ago

On Mon, Oct 13, 2014 at 8:13 PM, sverx notifications@github.com wrote:

Seems correct now! :)

Cool!

What about the SDSC Header?

Can we place it before the rom header in 16KB roms too? It would be nice!

That's actually a separate issue, but after taking a quick look I think it can be done pretty easily - just adjust the absolute address, in WLALINK, of the section "!__WLA_SDSCTAG_STRINGS", that WLA generates after encountering .SDSCTAG. I'll give it a try today or later tomorrow.

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-58924142.

vhelin commented 10 years ago

Hey, is the last nibble again 0xB is the ROM size is 16KBs? This doesn't say it:

http://www.smspower.org/Development/SDSCROMTagSpecification?sid=7b848a4cbaed76c4ba218e8749ba6547

On Tue, Oct 14, 2014 at 8:45 PM, Ville Helin ville.helin@gmail.com wrote:

On Mon, Oct 13, 2014 at 8:13 PM, sverx notifications@github.com wrote:

Seems correct now! :)

Cool!

What about the SDSC Header?

Can we place it before the rom header in 16KB roms too? It would be nice!

That's actually a separate issue, but after taking a quick look I think it can be done pretty easily - just adjust the absolute address, in WLALINK, of the section "!__WLA_SDSCTAG_STRINGS", that WLA generates after encountering .SDSCTAG. I'll give it a try today or later tomorrow.

  • Ville

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-58924142.

sverx commented 10 years ago

That's one of many outdated docs that are around. The ones I pointed out contain updated and checked info.

vhelin commented 10 years ago

On Tue, Oct 14, 2014 at 11:23 PM, sverx notifications@github.com wrote:

That's one of many outdated docs that are around. The ones I pointed out contain updated and checked info.

Ouch, I guess I mixed up the links... :)

Anyway, I don't have the time to complete this today, I'm going to be busy lying on the couch and learning design patterns - they might ask them in a job interview. But I made it so that .SDSCTAG outputs only sections, and if one changes the addresses of sections !WLA_SDSCTAG_STRINGS and !WLA_SDSCTAG_TIMEDATE in WLALINK if the ROM size is 16KBs, then that should be it! I'll get back to this tomorrow.

Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-59110185.

Kroc commented 10 years ago

The SDSC spec does not specify alternate locations for the header; Is it allowed to move it to $1FF0/$3FF0, or anywhere for that matter? (I need to be aware of this for my own assembler)

sverx commented 10 years ago

The spec says "The SDSC tag is found at offset $7fe0, directly before the standard ROM header (if it's in the usual place)." which implicitly says that it's there only for homebrew which ROM size is >= 32KB. I believe we could extend this to have the SDSC header at $3fe0, right before the ROM header, when ROM size is = 16KB. As for ROM size = 8KB, we could have the SDSC header at $1fe0 too, but WLA-DX currently doesn't support ROM headers for ROM sizes < 16KB, and I guess there are no requests for that.

vhelin commented 10 years ago

On Thu, Oct 16, 2014 at 11:27 AM, sverx notifications@github.com wrote:

The spec say "The SDSC tag is found at offset $7fe0, directly before the standard ROM header (if it's in the usual place)." which implicitly says that it's there only for homebrew which ROM size is >= 32KB. I believe we could extend this to have the SDSC header at $3fe0, right before the ROM header, when ROM size is = 16KB. As for ROM size = 8KB, we could have the SDSC header at $1fe0 too, but WLA-DX currently doesn't support ROM headers for ROM sizes < 16KB, and I guess there are no requests for that.

Oh cock, I just read this email after committing a fix that adds support for 16KB ROMs, LOL. :) Anyway, yeah, at this point adding support for 8KB ROMs would be trivial, but what do you guys think, would it be worth it?

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-59329485.

sverx commented 10 years ago

Personally I don't think it's worth it, there was hardly request for 16KB ROMs before I started begging for this enhancement ;) I tested this one minute ago and it works... there's just a tiny bug that probably was already there: if you specify "0.1" as version number, it will store it as "0.10" in the ROM, so I had to write "0.01" instead, and it stored it correctly. Not a big problem, though...

vhelin commented 10 years ago

On Thu, Oct 16, 2014 at 6:19 PM, sverx notifications@github.com wrote:

Personally I don't think it's worth, there was hardly request for 16KB ROMs before I started begging for this enhancement ;)

Ok. :)

I tested this on minute ago and it works... there's just a tiny bug that probably was already there: if you specify "0.1" as version number, it will store it as "0.10" in the ROM, so I had to write "0.01" instead, and it stored it correctly. Not a big problem, though...

I, too, bet it's an old bug in the parser. I'll give it a look later...

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-59378492.

vhelin commented 10 years ago

On Thu, Oct 16, 2014 at 6:21 PM, Ville Helin ville.helin@gmail.com wrote:

On Thu, Oct 16, 2014 at 6:19 PM, sverx notifications@github.com wrote:

Personally I don't think it's worth, there was hardly request for 16KB ROMs before I started begging for this enhancement ;)

Ok. :)

Well, 8KB ROMs should now be supported.

I tested this on minute ago and it works... there's just a tiny bug that probably was already there: if you specify "0.1" as version number, it will store it as "0.10" in the ROM, so I had to write "0.01" instead, and it stored it correctly. Not a big problem, though...

I, too, bet it's an old bug in the parser. I'll give it a look later...

Yeah, I used the data from the floating point value parser wrong, now it should work.

— Reply to this email directly or view it on GitHub https://github.com/vhelin/wla-dx/issues/13#issuecomment-59378492.

sverx commented 10 years ago

I guess we can close this issue, then... I'm going to open a new one right away :)