Gury Posted April 26, 2022 Author Share Posted April 26, 2022 New version 2.1.5 is released! 4 4 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted April 26, 2022 Share Posted April 26, 2022 Thank you for the continued improvement for a great tool Quote Link to comment Share on other sites More sharing options...
Steril707 Posted August 28, 2022 Share Posted August 28, 2022 Not sure if this is the right topic for questions about MADS, so if not please move it to wherever it fits.. My question is about if it's possible to iterate through those indexed arrays. Or the indexed structs. I mean, it's really nice to have these structures and arrays, yet I somehow cannot find anything about how to iterate through these with MADS. Maybe someone can give me a pointer (pun intended) on how to accomplish this. 1 Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted January 11 Share Posted January 11 In an experiment with a nested .REPT I see unexpected behaviour. org $2000 .rept 4, # ; .byte :1 .rept 4, :1, # .byte :1, :2 .endr .endr With the line commented out the output is: mads 2.1.5 build 3 (21 Feb 22) Source: test.asm 1 org $2000 2 3 .rept 4, # 6 .BYTE :1, :2 8 .endr Source: REPT 8 .endr Source: REPT 6 FFFF> 2000-201F> 00 00 .BYTE 0, 0 6 2002 00 01 .BYTE 0, 1 6 2004 00 02 .BYTE 0, 2 6 2006 00 03 .BYTE 0, 3 Source: test.asm 6 .endr Source: REPT 6 2008 00 00 .BYTE 0, 0 6 200A 00 01 .BYTE 0, 1 6 200C 00 02 .BYTE 0, 2 6 200E 00 03 .BYTE 0, 3 Source: test.asm 6 .endr Source: REPT 6 2010 00 00 .BYTE 0, 0 6 2012 00 01 .BYTE 0, 1 6 2014 00 02 .BYTE 0, 2 6 2016 00 03 .BYTE 0, 3 Source: test.asm 6 .endr Source: REPT 6 2018 00 00 .BYTE 0, 0 6 201A 00 01 .BYTE 0, 1 6 201C 00 02 .BYTE 0, 2 6 201E 00 03 .BYTE 0, 3 Source: test.asm Source: test.asm But with the line included it becomes: mads 2.1.5 build 3 (21 Feb 22) Source: test.asm 1 org $2000 2 3 .rept 4, # 4 .BYTE :1 6 .BYTE :1, :2 8 .endr Source: REPT 4 FFFF> 2000-2023> 00 .BYTE 0 4 .endr Source: REPT 6 2001 00 00 .BYTE 0, 0 6 2003 00 01 .BYTE 0, 1 6 2005 00 02 .BYTE 0, 2 6 2007 00 03 .BYTE 0, 3 Source: test.asm 4 2009 01 .BYTE 1 4 .endr Source: REPT 6 200A 01 00 .BYTE 1, 0 6 200C 01 01 .BYTE 1, 1 6 200E 01 02 .BYTE 1, 2 6 2010 01 03 .BYTE 1, 3 Source: test.asm 4 2012 02 .BYTE 2 4 .endr Source: REPT 6 2013 02 00 .BYTE 2, 0 6 2015 02 01 .BYTE 2, 1 6 2017 02 02 .BYTE 2, 2 6 2019 02 03 .BYTE 2, 3 Source: test.asm 4 201B 03 .BYTE 3 4 .endr Source: REPT 6 201C 03 00 .BYTE 3, 0 6 201E 03 01 .BYTE 3, 1 6 2020 03 02 .BYTE 3, 2 6 2022 03 03 .BYTE 3, 3 Source: test.asm Source: test.asm Is this a bug? I can use this as an alternative way to reference the outer variable for it to be passed correctly to the inner but not produce code: org $2000 .rept 4, # @myvar:1 equ :1 .rept 4, @myvar:1, # .byte :1, :2 .endr .endr Producing: mads 2.1.5 build 3 (21 Feb 22) Source: test.asm 1 org $2000 2 3 .rept 4, # 4 @MYVAR:1 EQU :1 6 .BYTE :1, :2 8 .endr Source: REPT 4 = 0000 @MYVAR0 EQU 0 4 .endr Source: REPT 6 FFFF> 2000-201F> 00 00 .BYTE 0, 0 6 2002 00 01 .BYTE 0, 1 6 2004 00 02 .BYTE 0, 2 6 2006 00 03 .BYTE 0, 3 Source: test.asm 4 = 0001 @MYVAR1 EQU 1 4 .endr Source: REPT 6 2008 01 00 .BYTE 1, 0 6 200A 01 01 .BYTE 1, 1 6 200C 01 02 .BYTE 1, 2 6 200E 01 03 .BYTE 1, 3 Source: test.asm 4 = 0002 @MYVAR2 EQU 2 4 .endr Source: REPT 6 2010 02 00 .BYTE 2, 0 6 2012 02 01 .BYTE 2, 1 6 2014 02 02 .BYTE 2, 2 6 2016 02 03 .BYTE 2, 3 Source: test.asm 4 = 0003 @MYVAR3 EQU 3 4 .endr Source: REPT 6 2018 03 00 .BYTE 3, 0 6 201A 03 01 .BYTE 3, 1 6 201C 03 02 .BYTE 3, 2 6 201E 03 03 .BYTE 3, 3 Source: test.asm Source: test.asm Quote Link to comment Share on other sites More sharing options...
matosimi Posted January 15 Share Posted January 15 @Wrathchild these nested loops are not behaving good, I had an issue and got elegant solution directly in this very thread: it is using the temporary labels (those with questionmarks)... it is well readable and what is important is that it is forward compatible (not relying on nested loop behavior of particular mads release) 1 Quote Link to comment Share on other sites More sharing options...
tebe Posted April 20 Share Posted April 20 https://github.com/tebe6502/Mad-Assembler added support for .BI binary directive .bi 110101, 101010, 000* .bi 1 11 101 11* 10101* the '*' character at the end of the string indicates invers 4 2 Quote Link to comment Share on other sites More sharing options...
Teapot Posted May 25 Share Posted May 25 Anybody know how to build a macro that will repeat over a variable number of args? I'd like to call it thusly: SetTabs %00001000 or SetTabs %00001000 %00100001 %00000010 Something like: .macro SetTabs .rept :0 ?i=#+1 lda #:?i sta TABMAP+# .endr .endm That fails because it's looking for the global label ?i on the LDA and not finding it. I've also tried it with %%?i and it assembles but results in the raw index value. The %% seems to be ignored. I'll probably just use a bunch of ".if :0 > x" lines to check each arg index for now. Quote Link to comment Share on other sites More sharing options...
tebe Posted May 25 Share Posted May 25 .macro SetTabs .put = :1, :2, :3 .rept 3 .print .get[#] .endr .endm SetTabs 1,5,7 1 Quote Link to comment Share on other sites More sharing options...
Teapot Posted May 25 Share Posted May 25 Thanks @tebe I'll just have to make a long .put line. And put a :0 check to catch when there's too many args. You should add a description of that .put usage in the docs. I also see .wget (etc) got added. Any chance of matching .wput (etc) for this kind of usage? Quote Link to comment Share on other sites More sharing options...
matosimi Posted July 3 Share Posted July 3 (edited) ins "filename.dat"* it does not invert the bytes, it only inverts the highest bit (like when used with strings in dta d'xx'*) - is that intentional or bug? Documentation says it inverts bytes. Edited July 3 by matosimi Quote Link to comment Share on other sites More sharing options...
tebe Posted July 3 Share Posted July 3 50 minutes ago, matosimi said: ins "filename.dat"* it does not invert the bytes, it only inverts the highest bit (like when used with strings in dta d'xx'*) - is that intentional or bug? Documentation says it inverts bytes. '*' invert bit 7 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.