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

Feature Request: keep modifier for procedures/functions #86

Closed
zbyti opened this issue Apr 8, 2022 · 4 comments
Closed

Feature Request: keep modifier for procedures/functions #86

zbyti opened this issue Apr 8, 2022 · 4 comments

Comments

@zbyti
Copy link
Collaborator

zbyti commented Apr 8, 2022

keep as modifier could be a compiler directive - this would be useful not to remove unnecessary in his opinion procedures or functions and maybe even data.

procedure foo; keep;
begin
end;
@zbyti
Copy link
Collaborator Author

zbyti commented Apr 8, 2022

@zbyti
Copy link
Collaborator Author

zbyti commented Apr 12, 2022

procedure vbi; keep;
begin
  if not game_over then begin
    update_time;
    snake_step;
    if not fruit_on_board then put_fruit;
    if time_bcd = TIME_THOLD then game_over := true;
  end;
end;

//o-------------------------------------------------------------o

procedure prepare;
begin
  Move(pointer(CRT_CHARS_ADR), pointer(CHARSET_ADR), CHARSET_SIZE);
  Move(pointer(CRT_TITLE_ADR), pointer(SCREEN_ADR), SCREEN_SIZE);

  {*
    hack for the compiler, call vbi procedure
    in other case optimizer remove unused - from his point of view - code
  
    vbi;
  *}
end;

MadPascal/samples/vic-20/snake$ make
rm -f output/* bin/*
/home/zbyti/Programs/MadPascal/mp src/vic20.pas -t raw -code A009 -o output/vic20.a65
Mad Pascal Compiler version 1.6.6 [2022/04/12] for 6502
Compiling src/vic20.pas
src/vic20.pas (12) Note: Local const 'GAME_BLACK' not used
src/vic20.pas (14) Note: Local const 'GAME_RED' not used
src/vic20.pas (15) Note: Local const 'GAME_CYAN' not used
src/vic20.pas (16) Note: Local const 'GAME_PURPLE' not used
src/vic20.pas (18) Note: Local const 'GAME_BLUE' not used
src/vic20.pas (20) Note: Local const 'GAME_ORANGE' not used
src/game.inc (69) Note: Local absolutevar 'SF0B' not used
src/game.inc (70) Note: Local absolutevar 'SF1B' not used
49 lines compiled, 0.81 sec, 8017 tokens, 627 idents, 217 blocks, 6 types
8 note(s) issued
/home/zbyti/Programs/mads/mads output/vic20.a65 -x -i:/home/zbyti/Programs/MadPascal/base -o:output/vic20-core.bin
ZPAGE: $0000..$0053
RTLIB: $A07C..$A113
SYSTEM: $A12D..$A143
SYS_VIC20: $A144..$A28E
CODE: $A00C..$A548
DATA: $A55C..$A55E
$R RCDATA  $B912..$BBFF 'res/title_cbm.scr'
$R RCDATA  $BC00..$BFFF 'res/snake_cbm.fnt'
        .local +MAIN.UPDATE_TIME
vic20.a65 (1238) ERROR: Undeclared label MAIN.UPDATE_TIME (BANK=0)
        .local +MAIN.SNAKE_STEP
vic20.a65 (1244) ERROR: Undeclared label MAIN.SNAKE_STEP (BANK=0)
        m@INLINE
vic20.a65 (1239) ERROR: Undeclared macro M@INLINE (BANK=0)
vic20.a65 (1245) ERROR: Undeclared macro M@INLINE (BANK=0)
        jsr PUT_FRUIT
vic20.a65 (1252) ERROR: Undeclared label PUT_FRUIT (BANK=0)
Writing listing file...
make: *** [makefile:11: build-vic20] Error 2

@zbyti
Copy link
Collaborator Author

zbyti commented Apr 15, 2022

#93

@zbyti zbyti closed this as completed Apr 15, 2022
@zbyti
Copy link
Collaborator Author

zbyti commented Apr 16, 2022

05c0045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant