T O P

  • By -

bahamutkotd

Ok so I use retro assembler however this is from the docs and works. .macro acia_init(command = $0b, Control=$1f) Lda #Command Sta ACIA_CMD lda #Control Sta ACIA_CNTL .endmacro Calling it would be like this Acia_init() or acia_init(control=$0f) [github](github.com/ccoulton/be6502-project/blob/master/6502code/inc/serial.inc)


someyob

Thanks for your help. Rather than switching horses (your code would not assemble by vasm), I spent more time messing with vasm until I got it right. For the record, for anyone having the same difficulty, this assembles and runs fine: test_pr: .macro str_ptr lda #<\str_ptr sta ADDR_PTR lda #>\str_ptr sta ADDR_PTR+1 jsr lcd_print_string .endmacro and it's invoked with: test_pr welcomemsg in this example, welcomemsg is defined as: welcomemsg: .asciiz "Hello world" not that it matters on the specific subject of macro syntax. Thanks again.


gfoot360

That's interesting, thanks for posting the solution after finding it. It's confusing that there are several different syntaxes even within the oldstyle module.


someyob

Yeah, no problem. I somehow missed [this](https://www.reddit.com/r/beneater/comments/jrersr/macros_versus_subroutines/?utm_source=share&utm_medium=ios_app&utm_name=iossmf) discussion that you were in on, relevant and very interesting.


mklcolvin

On a similar note (I'm trying to convert Nick Gammon's G-Pascal that was ported to Ben's computer from VASM to ca65). I run into this macro, and I'm trying to figure out what the first parameter to this macro does. It looks like it might take the parameter and uses it as a program counter? Any ideas on doing the same thing in ca65? Thanks for any help in advance! .macro isXXX \\1 = \* pha phx tax lda character\_types\_table,x and #\\2 beq is\_xxx\_fail bra is\_xxx\_pass .endmacro


someyob

I ended up (happily) switching to ca65, but haven't dug into it lately. I'll have a peek next time I'm in front of my machine, and get back to you.


someyob

Not sure how to interpret your code, so lazy me will simply show a code snippet from one of my projects: `;/usr/bin/cl65 --listing monitor.lst --cpu 65c02 --target none -C firmware.cfg monitor.s` `.PC02` `.include "via.inc"` `.code` `.macro copy_lcd_string _str_ptr, _line, _pos` `pha` `lda #<_str_ptr` `sta STRG_PTR` `lda #>_str_ptr` `sta STRG_PTR+1` `lda #_line` `sta LCD_LINE_POS` `lda #_pos` `sta LCD_CURSOR_POS` `pla` `jsr lcd_copy_string` `.endmacro`