The and/or support you talked about in another thread sure sounded interesting, even though this is already very useful as it stands.
I'm using dopple's smbdis.asm to test the macros, so maybe I can share that as well.
I'll document it better later, time to head to work..
http://mynesdev.blogspot.ca/2012/10/ca6 ... again.html
http://pastebin.com/azMMvh4r .. updated 1 times.
Documentation updated! I will add more but it explains most things well.
I'm also going to use the wiki on that page to document it's use, though there is not much there yet.
This version also includes integrated <, >, <>, >= <= operators (unsigned) as well as the assignment macro and assignment macro supported operators &, |, ^ ( bitwise) +, - (clear/set carry) --, ++ (with carry), >>, <<, *, / (times and divide also shift left or right with powers of two.)
It will also default to behaving as if any non zero result is true if no cpu flags are specified and (hopefully) it makes sense to do so.
Following the same rules as the previous version, you can test 'expressions' that represent or result in a CPU flag being set/clear and branch appropriately. The latest code allows parentheses to create more complex logical conditions, as well as a negate operator that can distribute across parenthesis. The code generated aims to be efficient and will short circuit as soon as the outcome can be determined.
The only limitation is that all OR logic must be before all AND logic in the same parentheses set. ( Add parentheses to work around this.)
Code: Select all
; branch to label: * = 8000 foo = $00 bar = $01 baz = $03 myLabel = * + $50 if ( ( foo >= #$03 && ! bar ) || ((zero && negative) || baz = #1)) goto myLabel ; code output: 8000 A5 00 LDA $00 8002 C9 03 CMP #$03 8004 90 04 BCC $800A 8006 A5 01 LDA $01 8008 F0 46 BEQ $8050 800A D0 02 BNE $800E 800C 30 42 BMI $8050 800E A5 03 LDA $03 8010 C9 01 CMP #$01 8012 F0 3C BEQ $8050 ; if-endif ( else supported ) * = 8000 foo = $00 bar = $01 baz = $03 if ( !( bar & #$03 && baz == N set ) || (( V set || baz < #$10 ) || foo = #1) ) nop endif ; code output: 8000 A5 01 LDA $01 8002 29 03 AND #$03 8004 F0 12 BEQ $8018 8006 A5 03 LDA $03 8008 10 0E BPL $8018 800A 70 0C BVS $8018 800C A5 03 LDA $03 800E C9 10 CMP #$10 8010 90 06 BCC $8018 8012 A5 00 LDA $00 8014 C9 01 CMP #$01 8016 D0 01 BNE $8019 8018 EA NOP 8019
1)C-style of loop:
for ( <thing to do 1st>, <Flag to test - continue while true >, <stuff to do at end of loop> )
Code: Select all
for ( x := #$3, not negative, dex ) ; code next ; more complex: for ( x := foo, (x > #10) && (foo <> #1), dex:dex) ; some code next
This actually tries to optimize some, and will break if you mess with your counter register or variable without thinking:
Code: Select all
for x := #$AA to #$10 step -3 ;some code next
Next is to fix 'elseif'.
Nothing specifically, just want to understandMovax12 wrote:What specifically would you like to see in a video on this topic?
How macro operators work. And how you can use operators in disassembler. This only works in Mario Disasm, or it can be used with any disassembler?
End users would still have to make sure not to use up too many cycles but that's life.
Yeah. batari BASIC does work in the way you just described. It has different canned kernels for a specific set of needs.3gengames wrote:But Atari, despite being harder to make stuff for, is sumpler in what it is needed to do and such. I don't think you'd be able to make anything scrolling/map-updating+sound+sprites with a little basic thingy. Maybe if you made it work on modules, that'd be cool to try out.
set kernel_options pfheights pfcolors
(use the canned kernel that has adjustable playfield heights & colors)
would give you a different game engine than
set kernel_options pfheights playercolors
(use kernel that allows adjustable playfield height and the first sprite can have multiple colors)
Likewise I'd imagine an NES version would have different kernels whether you want single screen games using no MMC or side-scrolling using MMC1.