tebe6502 / Mad-Pascal

Mad Pascal Compiler for 6502 (Atari XE/XL, C64, C4Plus, Neo6502)
122 stars 19 forks source link

procedure aling not workiong properly #154

Closed zbyti closed 5 months ago

zbyti commented 5 months ago
program test;

//-----------------------------------------------------------------------------

const
    NMI_IRQ     = $10c;
    VBLANK_IRQ  = $10e;
    COLORS      = $101;
    VIDEO       = $100;
    VIDEO_PAGE  = $f;
    SCREEN      = VIDEO_PAGE * $1000;
    SCREEN_SIZE = 64;

//-----------------------------------------------------------------------------

var
    i, j : byte;

procedure vbi; assembler; interrupt;
asm
  phr
  plr
end;

//-----------------------------------------------------------------------------

{$codealign proc = $100}

procedure palette_pico8; assembler; inline;
asm
    by $00,$00,$00
    by $1D,$2B,$53
    by $7E,$25,$53
    by $00,$87,$51
    by $AB,$52,$36
    by $5F,$57,$4F
    by $C2,$C3,$C7
    by $FF,$F1,$E8
    by $FF,$00,$4D
    by $FF,$A3,$00
    by $FF,$EC,$27
    by $00,$E4,$36
    by $29,$AD,$FF
    by $83,$76,$9C
    by $FF,$77,$A8
    by $FF,$CC,$AA  
end;

{$codealign proc = 0}

//-----------------------------------------------------------------------------

procedure init;
begin
    asm { sei };
    dpoke(VBLANK_IRQ, word(@vbi));
    poke(COLORS, hi(word(@palette_pico8)));
    poke(VIDEO, VIDEO_PAGE); 
    asm { cli };   
end;

//-----------------------------------------------------------------------------

begin
    init;

    for j := 0 to SCREEN_SIZE + 1 do
        for i := 0 to SCREEN_SIZE + 1 do
            poke(SCREEN + (j * SCREEN_SIZE) + i, (i and %00111111) shr 2);

    repeat until false;
end.

//-----------------------------------------------------------------------------

procedure init and palette_pico8 have the same address in lts file.

output.zip

zbyti commented 5 months ago

OK. inline confuse compiler.

{$codealign proc = $100}

procedure palette_pico8; assembler;
asm
    .byte $00,$00,$00
    .byte $1D,$2B,$53
    .byte $7E,$25,$53
    .byte $00,$87,$51
    .byte $AB,$52,$36
    .byte $5F,$57,$4F
    .byte $C2,$C3,$C7
    .byte $FF,$F1,$E8
    .byte $FF,$00,$4D
    .byte $FF,$A3,$00
    .byte $FF,$EC,$27
    .byte $00,$E4,$36
    .byte $29,$AD,$FF
    .byte $83,$76,$9C
    .byte $FF,$77,$A8
    .byte $FF,$CC,$AA  
end;

{$codealign proc = 0}

works