ok, it was not so dumb after all...
So I tried the PCALL and I have the error : Invalid opcode. I added the macro in a file (branch.mac) and added as an include at the end
@@loop CALL WAITVBL ; wait for VBlank
; jump to the current main routine
PCALL SUBROUT
B @@loop ; loop forever
EDIT: Ok I have added them to the beginning, and replaced p by r. It assembles but never goes back to the loop.
And I tried the "optimized version"
@@loop CALL WAITVBL ; wait for VBlank
; jump to the current main routine
MVII #@@loop, R5 ; return to @@loop
MVI SUBROUT, PC ; call the routine
but it never goes back to the loop, SUBROUT contains the address of RED_MAIN:
RED_MAIN PROC
; CALL CLRSCR ; commented, creates bugs
CALL PRINT.FLS
DECLE 7
DECLE $200 + 3*20 + 1
DECLE "THIS IS RED...", 0
JR R5
;B MAIN.loop
ENDP
is it due to the CALL PRINT which changes the R5 ?