Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pioasm: allow optional target for .wrap #2163

Open
magy00 opened this issue Jan 6, 2025 · 1 comment
Open

pioasm: allow optional target for .wrap #2163

magy00 opened this issue Jan 6, 2025 · 1 comment
Labels
enhancement New feature or request pioasm
Milestone

Comments

@magy00
Copy link

magy00 commented Jan 6, 2025

It could sometimes be convenient (and possibly allow more descriptive source code) if .wrap would optionally accept the same target expressions as jmp (with .wrap_target as the default):

.wrap (<target>)

E.g.

loop:
    mov osr, rxfifo[y]
    ...
    jmp y--, loop
    .wrap loop

would be equivalent to

.wrap_target
loop:
    mov osr, rxfifo[y]
    ...
    jmp y--, loop
    .wrap

@lurch lurch added enhancement New feature or request pioasm labels Jan 6, 2025
@kilograham kilograham added this to the 2.2.0 milestone Jan 7, 2025
@magy00
Copy link
Author

magy00 commented Jan 13, 2025

Perhaps even allow .wrap <target> at the end of an instruction (like side).

It would also be convenient to have e.g. . return the current location. Then

delay:
    jmp x--, delay

could be written as

    jmp x--, .

and

    .origin 0
    irq set   0
.wrap
    irq clear 0
.wrap_target
    …
    out pc, 1

as

    .origin 0
    irq set   0   .wrap skip
    irq clear 0
skip:
    …
    out pc, 1

or as an (extreme) example (alternative ringing cadence generator):

.program ring_sequence_irq_0
    .pio_version 1
    .fifo txget
    //mov y, ~null    // start of reversed sequence

    .origin   0
    irq set   0   .wrap .+1
    irq clear 0

    mov osr, rxfifo[y]
    mov x, osr
    jmp x--, .      // delay

    mov osr, y      // used to toggle irq flag
    jmp y--, .+1    // decrement only

    out pc, 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pioasm
Projects
None yet
Development

No branches or pull requests

3 participants