Jump to content
Turbo Laser Lynx

Atari Lynx programming tools and tutorials (wip)

Recommended Posts

Excuse my ignorance, but I'm looking for information on how to set up / configure lynxass / BLL so I can build the hello_a.asm example. (I'm getting "Unsolved labels"error when I run lynxass).

 

Is there a best/latest version of BLL I can download, and some documentation on how to build a simple example? (BLL download on http://www.monlynx.de/lynx/bll.htmlis broken).

 

Alternatively is there any info/examples of how to build simple example using ca65?

 

Thanks and apologies if I am missing something obvious.

 

Edit: Nevermind - got it working by including the right macros/vardefs/includes.

Edited by jum

Share this post


Link to post
Share on other sites

Excuse my ignorance, but I'm looking for information on how to set up / configure lynxass / BLL so I can build the hello_a.asm example. (I'm getting "Unsolved labels"error when I run lynxass).

 

Is there a best/latest version of BLL I can download, and some documentation on how to build a simple example? (BLL download on http://www.monlynx.de/lynx/bll.htmlis broken).

 

Oh, yes, thanks for the info.

I am currently working on an update of BJL and BLL but should put at least something on the page.

 

Maybe I should put an .exe on the lyxass page.

Share this post


Link to post
Share on other sites

I have been using similar macros for developing asm code using ca65. Sage wrote some nice if/else macros for ca65. But it would be nice to be able to write structural assembly that compiles on ca65 as well. I don't have anything against using lyxass. It is just that linking lyxass object with cc65 objects does not really work so well.

 

So I wonder if BLJ and BLL could be extended to BLC also? (C - for linkable with C-code)

 

I really like the idea of structural assembly. It makes reading the code much easier.

Share this post


Link to post
Share on other sites

So I wonder if BLJ and BLL could be extended to BLC also? (C - for linkable with C-code)

 

I really like the idea of structural assembly. It makes reading the code much easier.

 

You mean, using an intermediate object format?

I doubt that this is an easy task to do.

For the Jaguar I do not see much of a benefit, as you can always export the symbols from lyxass and then import them in a stub assembly file together with the binary.

The GPU/DSP code needs to run in the internal RAM anyway, so not much of a code movement.

 

For cc65, this would be interesting. But it is likely easier to change ca65 to accept lyxass macro syntax.

  • Like 1

Share this post


Link to post
Share on other sites

I have been using similar macros for developing asm code using ca65.

 

I really like the idea of structural assembly. It makes reading the code much easier.

 

Do you have Lynx libs / macros you use with ca65? (I have a cc65 installation, which only has asminc/lynx.inc).

 

Or even a "ca65 Lynx toolkit"? (wishful thinking :) )

 

What is "structural assembly"?

Share this post


Link to post
Share on other sites

 

What is "structural assembly"?

 

Something like this:

  bit MATHE_AKKU
  _IFMI
    inc temp
    _IFEQ
      inc temp+1
    _ENDIF
  _ENDIF

Like in Pascal.

The macros hide the the branches.

 

Or:

 ldx #16
 _WHILENE X
   sta $fda0-1,x
   dex
 _WEND

See if_while.mac

Edited by 42bs
  • Like 1

Share this post


Link to post
Share on other sites

You can actually see the ca65 macros in both sage's chipper and my abcmusic. They are identical to 42bs BLL macros. But only a small subset exists.

 

        lda SndActive,x
        _IFNE
                lda SndEnvVol,x
                _IFNE
                        phx
                        jsr SndChangeVol
                        plx
                _ENDIF
                lda SndEnvFrq,x
                _IFNE
                        phx
                        jsr SndChangeFrq
                        plx
                _ENDIF
                lda SndEnvWave,x
                _IFNE
                        phx
                        jsr SndChangeWave
                        plx
                _ENDIF
                jsr SndGetCmd
        _ENDIF
        plx
        dex

The only macro-kit that I have seen for ca65 is made by sage. But there is no while construct or other BLL goodies.

 

;----------------------------------------------------------------------------
; Macros
;


if_count        .set    0
nest_count      .set    0


.macro  _IFNE
        if_count        .set    if_count +1
        nest_count      .set    nest_count +1
        beq             .ident (.sprintf ("else%04d", if_count))
        .ident (.sprintf ("push%04d", nest_count)) .set if_count
.endmacro


.macro  _IFEQ
        if_count        .set    if_count +1
        nest_count      .set    nest_count +1
        bne             .ident (.sprintf ("else%04d", if_count))
        .ident (.sprintf ("push%04d", nest_count)) .set if_count
.endmacro


.macro  _IFMI
        if_count        .set    if_count +1
        nest_count      .set    nest_count +1
        bpl             .ident (.sprintf ("else%04d", if_count))
        .ident (.sprintf ("push%04d", nest_count)) .set if_count
.endmacro


.macro  _IFPL
        if_count        .set    if_count +1
        nest_count      .set    nest_count +1
        bmi             .ident (.sprintf ("else%04d", if_count))
        .ident (.sprintf ("push%04d", nest_count)) .set if_count
.endmacro


.macro  _IFGE
        if_count        .set    if_count +1
        nest_count      .set    nest_count +1
        bcc             .ident (.sprintf ("else%04d", if_count))
        .ident (.sprintf ("push%04d", nest_count)) .set if_count
.endmacro


.macro  _IFCS
        if_count        .set    if_count +1
        nest_count      .set    nest_count +1
        bcc             .ident (.sprintf ("else%04d", if_count))
        .ident (.sprintf ("push%04d", nest_count)) .set if_count
.endmacro


.macro  _IFCC
        if_count        .set    if_count +1
        nest_count      .set    nest_count +1
        bcs             .ident (.sprintf ("else%04d", if_count))
        .ident (.sprintf ("push%04d", nest_count)) .set if_count
.endmacro


.macro  _ELSE
        bra     .ident (.sprintf ("endif%04d", .ident (.sprintf ("push%04d", nest_count))))
        .ident  (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count)))) := *
.endmacro


.macro  _ENDIF
        .if .not .defined( .ident (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count)))))
                .ident  (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count)))) := *
        .endif
        .ident  (.sprintf ("endif%04d", .ident (.sprintf ("push%04d", nest_count)))) := *
        nest_count      .set    nest_count -1
.endmacro
  • Like 1

Share this post


Link to post
Share on other sites

And ca65 macros for Lynx-specific functions (like INITMIKEY, INITSUZY, FRAMERATE 60 etc) ??? Do they exist?

Share this post


Link to post
Share on other sites

There is similar asm routines that could be called by macros in cc65/libsrc/lib/lynx. But I have not seen anything except _IF/_ELSE stuff.

  • Like 1

Share this post


Link to post
Share on other sites

Not a bad idea with the colour picker. I used this approach because I used a palette export file from GIMP so my colours were already picked :P

Share this post


Link to post
Share on other sites

What about adding the Lynx palette to sp65 output? Currently it outputs only the bitmaps. But we could build in a new keyword to also export the palette to the C-file.

Share this post


Link to post
Share on other sites

I've not used sp65 yet, been using sprpck instead...I see the '--dump-palette' option in the github version of cc65, is that pretty much what you're after?

Share this post


Link to post
Share on other sites

I've made this palette generator that I found useful when I was working on a game. Decided to put it up online for others to use now...

 

https://atarigamer.com/pages/atari-lynx-palette-generator

 

It creates an array of colours that can be passed into tgi_setpalette().

 

Very nice! Nifty tool! :thumbsup: I added the link to the top post.

  • Like 1

Share this post


Link to post
Share on other sites

What about adding the Lynx palette to sp65 output? Currently it outputs only the bitmaps. But we could build in a new keyword to also export the palette to the C-file.

sprpck does it "-p[0..2]", so if sp65 is derived from it ...

Share this post


Link to post
Share on other sites

sprpck does it "-p[0..2]", so if sp65 is derived from it ...

 

Actually the sp65 has nothing from sprpck. I wrote the stuff directly from the doc's and so it has completely different optimisations as well. Sometimes it mixes literal packing with runlength to save space. It also produce shaped sprites that allow for 16 colours in a sprite that is not rectangular. The output is also C-code.

 

heart0.c : maptiles.pcx
        $(SP) -r $< --slice 0,350,7,6 -c lynx-sprite,mode=literal,ay=3 -w $*.c,ident=$*

The command line syntax has 3 options

 

-r file --slice

-c lynx-sprite,mode,ax,ay

-w filename,objectname

 

I could add a keyword "palette" to the -c section for adding the palette to the output.

 

/*
 * This file was generated by sp65 2.13.9 from
 * Slice of maptiles.pcx (7x6, 16 colors, indexed)
 */


#define heart0_COLORS       16
#define heart0_WIDTH        7
#define heart0_HEIGHT       6
const unsigned char heart0[] = {
    0x05,0x01,0x22,0x24,0x00,0x05,0x00,0x12,0x40,0x00,0x05,0x00,0x01,0x00,0x00,0x01,
    0x05,0x12,0x2B,0x22,0x40,0x05,0x12,0xB1,0xBE,0x40,0x05,0x01,0x10,0x44,0x00,0x00,
};

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...