ggn Posted December 15, 2018 Share Posted December 15, 2018 (edited) Unary operators: + Plus (does nothing) - Minus (changes sign) ~ Bitwise not (complements all bits) ! Logical not (changes true to false and vice versa) < Low (extracts low byte) > High (extracts high byte) ^ High 24bit (extracts high byte) = Extracts memory bank : Extracts global variable value Bitwise not will turn %00000001 to %11111110, not %10000000 (bit reverse) like ascrnet asked . I'm not sure if there is a reverse bits function in mads but worst case you can probably create a macro that does this for you. Or maybe tebe can add that functionality. Edited December 15, 2018 by ggn Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4177564 Share on other sites More sharing options...
+JAC! Posted December 15, 2018 Share Posted December 15, 2018 Oh, sure, I didn't read correctly. Here's one way: lines = 8 org $2000 .proc mirror_player ldx #.len player-1 loop_x lda player,x ldy #8 loop_y asl ror player_mirrored,x dey bne loop_y dex bpl loop_x rts .endp .local player .byte %00000001 .byte %00000011 .byte %00000111 .byte %00001111 .byte %00011111 .byte %00111111 .byte %01111111 .byte %11111111 .endl .local player_mirrored .rept lines .byte $00 .endr .endl Another way would be to use WUDSN's graphics converter, to convert the bitmap directly to the desired format including mirroring without generating any source. But that belongs to another thread. Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4177801 Share on other sites More sharing options...
ascrnet Posted December 16, 2018 Share Posted December 16, 2018 thank you very much JAC! for the example!!!!! I was failing to do it, since it had not occurred to me to use a variable with zeros when trying to invert the bits of a byte. so I leave it in my code and it works: .macro pm_escorpion :sprite ldx #12 read_escorpion .if :1=1 lda escorpion_1,x .else lda escorpion_2,x .endif ldy #8 mirrored asl ror player_temp,x dey bne mirrored dex bpl read_escorpion ldx #00 read_temp lda player_temp,x sta VPOSP2+116,x inx cpx #12 bne read_temp .endm Just a doubt of your second option uses less RAM or more regards Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4177950 Share on other sites More sharing options...
+JAC! Posted December 16, 2018 Share Posted December 16, 2018 thank you very much JAC! for the example!!!!! I was failing to do it, since it had not occurred to me to use a variable with zeros when trying to invert the bits of a byte. Just a doubt of your second option uses less RAM or more regards IDE would simply create the normal plus the reversed data like you originally did by hand. Whether this requires more or less RAM (in the XEX) than generating the reverse data at runtime depend on many factors (number of sprites, the height of sprites, ...). And after all, it doesn't matter for a normal project. In your case, you could pass the parameters to the subroutine, instead of duplicating the code with the macro. mwa #scorpion1 mirror_player.source jsr mirror_player ... .proc mirror_player ldx #.len player-1 loop_x lda player,x source = *-2 ldy #8 1 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4178029 Share on other sites More sharing options...
ascrnet Posted December 16, 2018 Share Posted December 16, 2018 IDE would simply create the normal plus the reversed data like you originally did by hand. Whether this requires more or less RAM (in the XEX) than generating the reverse data at runtime depend on many factors (number of sprites, the height of sprites, ...). And after all, it doesn't matter for a normal project. In your case, you could pass the parameters to the subroutine, instead of duplicating the code with the macro. mwa #scorpion1 mirror_player.source jsr mirror_player ... .proc mirror_player ldx #.len player-1 loop_x lda player,x source = *-2 ldy #8 understood thank you very much for the explanation, I will follow your recommendation to not repeat the code. regards 1 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4178244 Share on other sites More sharing options...
Heaven/TQA Posted December 19, 2018 Share Posted December 19, 2018 Regarding the + in Xasm or quickasm... I never understood that you type + and it does nothing? Always run into that when getting source from Eric or Fox. Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4180077 Share on other sites More sharing options...
matosimi Posted December 20, 2018 Share Posted December 20, 2018 (edited) Hi guys, is it possible to run .rept within .rept in order to do something like this? for x,0,nosprites-1 for y,0,3 dta (sprites+14*y*4+x*14*4*4) / 256 next next Edited December 20, 2018 by matosimi Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4181091 Share on other sites More sharing options...
NRV Posted December 20, 2018 Share Posted December 20, 2018 (edited) ?varX = 0 .rept nosprites :4 .byte >(sprites+14*#*4+?varX*14*4*4) ?varX++ .endr Don't remember about nested repts, but something like this should work.. Working example from some code: ?cy = 0 .rept ITEM_MATRIX_SIZEY :ITEM_MATRIX_SIZEX .byte <[screenBuffer1+LINE_SIZE+1+[?cy*3*LINE_SIZE+3*#]] ?cy++ .endr I believe nested repts were added in the last few years, but you should test it. Edited December 20, 2018 by NRV Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4181140 Share on other sites More sharing options...
+JAC! Posted December 20, 2018 Share Posted December 20, 2018 Hi guys, is it possible to run .rept within .rept in order to do something like this? for x,0,nosprites-1 for y,0,3 dta (sprites+14*y*4+x*14*4*4) / 256 next next nosprites = 5 .macro m_do_x_y x y .echo ,:y .endm .macro m_for_y x .rept 4 m_do_x_y ,# .endr .endm .rept nosprites m_for_y # .endr 3 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4181144 Share on other sites More sharing options...
matosimi Posted December 20, 2018 Share Posted December 20, 2018 @NRV: thanks, looks nice @JAC!: Your solution is utterly evil 2 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4181152 Share on other sites More sharing options...
+JAC! Posted December 21, 2018 Share Posted December 21, 2018 @JAC!: Your solution is utterly evil It's just the way I used to do it back in ATASM and because typically in inner code is more complex, so I prefer this type of "subroutining". In MADS the most straightforward translation does not need macro, but only aliasing of # via variables. .rept 8 ?x=# .rept 4 ?y=# dta [sprites+14*?y*4+?x*14*4*4] / 256 .endr .endr 2 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4181272 Share on other sites More sharing options...
matosimi Posted December 21, 2018 Share Posted December 21, 2018 .rept 8 ?x=# .rept 4 ?y=# dta [sprites+14*?y*4+?x*14*4*4] / 256 .endr .endr Love this one, because I don't need to rewrite insides of those repeats, only minimal touch is needed. Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4181452 Share on other sites More sharing options...
matosimi Posted December 21, 2018 Share Posted December 21, 2018 (edited) I have been playing around with BBC Micro code and I have found one handy feature of beebasm compiler (directive) which is called "guard". So "guard" is coupled with previous "org" and it looks like this: org $2000 guard $2100 ;bla bla code org $2100 ;bla bla data if your code is so long that compiler reaches $2100 it shows the error that code reached guarded address. This way it could be possible to prevent code and data overlapping... which sometimes occurs if you are not carefull enough. note: to be honest, this could help me back in the days when I was using orgs very much, but these days i'm usually placing all data after code separated by .align and additional orgs I usually use only when adding rastapictures,g2f or rmt. Edited December 21, 2018 by matosimi 1 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4181455 Share on other sites More sharing options...
Xuel Posted December 21, 2018 Share Posted December 21, 2018 Sounds like you could simulate "guard $2100" with ert, e.g.: org $2000 :257 dta 0 ert *>$2100 ; Previous block exceeds boundary Xasm outputs: ert *>$2100 ; Previous block exceeds boundary t.asm (3) ERROR: User-defined error Mads outputs: ert *>$2100 ; Previous block exceeds boundary t.asm (3) ERROR: User error Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4181842 Share on other sites More sharing options...
snicklin Posted December 22, 2018 Share Posted December 22, 2018 Sounds like you could simulate "guard $2100" with ert, e.g.: org $2000 :257 dta 0 ert *>$2100 ; Previous block exceeds boundary Xasm outputs: ert *>$2100 ; Previous block exceeds boundary t.asm (3) ERROR: User-defined error Mads outputs: ert *>$2100 ; Previous block exceeds boundary t.asm (3) ERROR: User error And then a simple extension to Xuel's helpful suggestion is to make a 'guard' macro, so it will feel like the Beeb. .macro guard ert *>:1 .endm Invoked with : guard $C000 4 1 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4182053 Share on other sites More sharing options...
+Sheddy Posted January 2, 2019 Share Posted January 2, 2019 Just wondering how do people handle strings of text to be put on screen with MADS? .sb 'Text' converts to ATASCII codes, which is great, but .cb 'Text' does EOR $80 to the last character which is perfect to denote the end, except it is only ASCII and not ATASCII? IE the capitals don't work. Is there a simple trick I'm missing to have it do the EOR for ATASCII codes, or am I just approaching things the wrong way? Thanks! Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4189136 Share on other sites More sharing options...
phaeron Posted January 2, 2019 Share Posted January 2, 2019 Use "Text" or d'Text' to encode strings as INTERNAL instead of ATASCII. 1 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4189150 Share on other sites More sharing options...
+Sheddy Posted January 3, 2019 Share Posted January 3, 2019 Use "Text" or d'Text' to encode strings as INTERNAL instead of ATASCII. Thanks, that does work for "dta" but not ".cb" unfortunately Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4189957 Share on other sites More sharing options...
Xuel Posted January 4, 2019 Share Posted January 4, 2019 Not ideal, but you could manually add $80 to the last byte: org $2000 .sb 'This is a high-bit terminated strin' 'g'+$80 1 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4190035 Share on other sites More sharing options...
+Sheddy Posted January 4, 2019 Share Posted January 4, 2019 Yep, thanks. looks like I'll have to be doing that. On another note, is .align supposed to work to exact bytes rather than just pages? Not that it turns out to be that useful for padding out to 128 byte sectors, but when I was experimenting it seems to behave peculiarity with things like ".align $7f"? Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4190235 Share on other sites More sharing options...
snicklin Posted January 4, 2019 Share Posted January 4, 2019 I use: .byte c'I want to print this message',$9B 1 Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4190260 Share on other sites More sharing options...
flashjazzcat Posted January 4, 2019 Share Posted January 4, 2019 I use: .byte 'string',0 But Sheddy wants to set the high bit of the last character of the string to serve as a terminator. I guess a macro would do it if macros can iterate through string arguments. Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4190265 Share on other sites More sharing options...
Wrathchild Posted January 4, 2019 Share Posted January 4, 2019 MADS should be covering that already with: dta d'abecadlo'* Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4190301 Share on other sites More sharing options...
flashjazzcat Posted January 4, 2019 Share Posted January 4, 2019 MADS should be covering that already with: dta d'abecadlo'* Unfortunately this sets bit 7 on every character in the string. Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4190303 Share on other sites More sharing options...
Wrathchild Posted January 4, 2019 Share Posted January 4, 2019 this seems OK .cb +$80 "Hello"* Quote Link to comment https://forums.atariage.com/topic/114443-mad-assembler-mads/page/4/#findComment-4190330 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.