It is currently Sat May 27, 2017 4:51 am

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: asm6 + 65816 = asm16
PostPosted: Tue Apr 18, 2017 8:17 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 333
Location: ...
I seem to have a lot of fun doing random stuff with asm6.

Well today I decided to try turning it into an assembler for the snes.

Current features: automatic register size detection (possibly not for all opcodes), 24-bit addressing, basic support for all opcodes except for pei, mvn and mvp afaik.

With the fact that work started on this literally today, there's bound to be bugs and there's most definitely crappy code that can use a rewrite, but this has been a stressful and tiring couple of hours so I'm already itching for some feedback.

Windows users, a 32-bit binary can be found in the repo. Not preferable but easier to keep up with than binaries on here.

https://github.com/nicklausw/asm16

_________________
Buy stuff from my brother's retro gaming store!


Last edited by nicklausw on Fri Apr 21, 2017 7:13 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Tue Apr 18, 2017 10:27 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 2961
Location: Nacogdoches, Texas
I'm just glad to see you're still around. We can't afford any more losses to the SNES community. :lol:


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Wed Apr 19, 2017 4:24 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1576
Location: DIGDUG
Binary would be helpful.

And example code of a functional SNES template.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Wed Apr 19, 2017 4:43 am 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 333
Location: ...
Espozo wrote:
I'm just glad to see you're still around. We can't afford any more losses to the SNES community. :lol:

Yep, I'm alive. thefox's tile tool thing gave me some hope so I'm back!

Quote:
Binary would be helpful.

And example code of a functional SNES template.

(Insert misunderstanding here)

As for a full template, I plan on doing that today too.

_________________
Buy stuff from my brother's retro gaming store!


Last edited by nicklausw on Wed Apr 19, 2017 12:38 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Wed Apr 19, 2017 9:42 am 
Offline
User avatar

Joined: Mon Oct 01, 2012 3:47 pm
Posts: 148
Location: freemland (NTSC-U)
I get the feeling dougeff was asking for a binary of the program and not just general binary support? In any case, I've attached 32 and 64-bit binaries for Windows, compiled with tcc.

edit: these builds correspond to hash 17a4e8c and are now outdated.


Attachments:
File comment: 32-bit Windows build
asm16_w32_20170419.zip [11.3 KiB]
Downloaded 8 times
File comment: 64-bit Windows build
asm16_w64_20170419.zip [13.51 KiB]
Downloaded 15 times


Last edited by freem on Mon Apr 24, 2017 10:32 pm, edited 1 time in total.
Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Wed Apr 19, 2017 12:37 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 333
Location: ...
Thanks! I feel dumb now. :oops:

_________________
Buy stuff from my brother's retro gaming store!


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Wed Apr 19, 2017 2:03 pm 
Online
User avatar

Joined: Thu Jan 19, 2006 5:08 pm
Posts: 740
Location: Shelton, Washington.
For now, You can use these macros as a temporary workaround for the missing three opcodes:

EDIT: SEE BELOW FOR UP-TO-DATE MACROS!!!

_________________
AKA SmilyMZX/AtariHacker.


Last edited by Hamtaro126 on Wed Apr 19, 2017 7:34 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Wed Apr 19, 2017 7:25 pm 
Online
User avatar

Joined: Thu Jan 19, 2006 5:08 pm
Posts: 740
Location: Shelton, Washington.
Added more to the list of temporary 65816 macros,

EDIT- Here is my modified version of the test.s included with ASM16, which was stolen from bass appearently.


Attachments:
File comment: The rest of the 65816 opcodes (as macros).
opcodemacros.asm [597 Bytes]
Downloaded 14 times
File comment: modified 65816 processor test file
test2.s [2.79 KiB]
Downloaded 9 times

_________________
AKA SmilyMZX/AtariHacker.
Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Thu Apr 20, 2017 4:51 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 333
Location: ...
Update, cleaned up the repository, added a makefile and an example program that uses a lot of stuff borrowed from tepples. If I clean up the sloppy parts (so everything that was my code), it might end up being a good starting place for some new snes devs.

Also added some opcode aliases from here. I'll start regularly building windows binaries as soon as I figure out how cross-compilation works.

Edit, just added pei, inc a and dec a.

Another edit, added mvn and mvp too. Had to add them as directives, but syntactically they're the same as if they were just opcodes.

_________________
Buy stuff from my brother's retro gaming store!


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Thu Apr 20, 2017 7:21 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1576
Location: DIGDUG
PEI.

I'm assuming you also included PEA and PER ?

(Not that I use them.)

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Fri Apr 21, 2017 9:08 am 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 333
Location: ...
dougeff wrote:
PEI.

I'm assuming you also included PEA and PER ?

(Not that I use them.)

Yep, the gang's all here. Except WDM (opcode 0x42). If you want that, I recommend a macro but due to asm6's internal design, I need at least one byte that isn't an opcode (but rather can be used to mean "stop looking for addressing modes, this meets none of them") and WDM is the easiest.

_________________
Buy stuff from my brother's retro gaming store!


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Sat Apr 22, 2017 5:53 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 333
Location: ...
The first "real release" is up. Gonna quote the changelog on this one.
Code:
asm16 1.7 4/22/17
 * added 65816 instruction set.
 * added 24-bit addressing support.
 * added automatic register size handling
    * on by default, off with NOSMART, back on with SMART
    * manual handling done with A8,A16,I8,I16
       * XY8,XY16 -> I8,I16
 * added FDB and FDW to force DB and DW values into their respective ranges.
 * added pre-existing directive aliases for ca65 porting:
    * ENDMACRO -> ENDM
    * REPEAT -> REPT
    * ENDREPEAT -> ENDR
    * ENDENUM -> ENDE

Say, if I were to implement automatic direct page handling, would it just be a case of tracking the value of A, then switching on TAD? The bigger question, would it even be useful? I'm not sure if it's necessary as most people are willing to use the < operator to rid of the higher byte of their opcodes for DP use, but it just seems like a nice feature to have to handle that for you if need be.

What I mean is that the following code...
Code:
lda #$2100
tad
stz $2100

...would have the assembler auto-replace the last line with stz $00.

_________________
Buy stuff from my brother's retro gaming store!


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Sat Apr 22, 2017 7:22 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 18357
Location: NE Indiana, USA (NTSC)
You can't track D in general, but there's a proposal in cc65's GitHub issues to allow setting the direct page base. It arose in the context of HuC6280, which fixes D at $2000 (unlike most 65xx which fix it at $0000). Thus the code might look like this:
Code:
lda #$2100
tad
dpage $2100
stz $2100    ; generates stz <$00


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Sat Apr 22, 2017 7:44 pm 
Offline
User avatar

Joined: Sat Jan 03, 2015 5:58 pm
Posts: 333
Location: ...
tepples wrote:
You can't track D in general

Perhaps not with ca65, but "linkerlessness" makes a different story. If you mean what I think you do, anyway.

On its final pass at the latest, asm16 absolutely knows every value that it reads in, assuming that the code has no errors such as a label typo. And so if you say lda #$2100 then tad, it is possible for the program to grab the higher byte of A and set all incoming could-be-direct-page opcodes accordingly...if it tracks A, which just seems like an odd thing to do. Makes the assembler basically double as an interpreter, which I suppose isn't a bad thing. The program already does that with REP and SEP tracking.

Not sure why I felt the need to expand on that so much; I could have just said "it's capable". :P Whether it's necessary is where I'm still kinda mixed.

_________________
Buy stuff from my brother's retro gaming store!


Top
 Profile  
 
 Post subject: Re: asm6 + 65816 = asm16
PostPosted: Sun Apr 23, 2017 5:40 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1576
Location: DIGDUG
Forgive me, if this is already true. I don't see it documented.

There should be a way to cast a value to direct-page, absolute, or absolute long.

Please don't try to guess that the user wants a direct page (based on D values). I would rather that you use direct page if the address (or label) is < 0x100. Absolute if the address is between 0x100 and 0xffff. Long if the address is >= 0x10000.

Then the user can force direct-page by using...

LDA <(label)

And maybe force long (from absolute) if you add or use a vertical bar,pipe | operator

LDA $800000|label
or
LDA $800000+label

How do you have it detect that the user wants LONG addressing?


And, now that I think of it, how would you force a long address back to absolute ? With & operator, maybe ?

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group