$MLC F 100 10 3000
300 CALL CLEAR
310 INPUT "Number of loops:":N
320 CALL LINK("TEST",N)
330 GOTO 310

;
; here the MLC program that will run "n" times the GPU one
;

$TEST
    GETPARAM 1 N            ; number of loops
    GPURUN &h4000           ; runs GPU program that stops immediately
    NDO I N
        GPUWAKE             ; wakes up the GPU program
        REPEAT              ; little loop to wait for the GPU to finish
            GPUSTATE
        UNTIL=              ; state will be "=" when GPU has finished
    NLOOP
    KEYWAIT 0               ; wait for a key
$$

;
; here the GPU program in assembly code
; the compiler sends it to VDP location >4000, the new F18A area
; this example fills the screen with the capital letters from A to Z
;

$GPU
    idle                    ; stops the program and wait for WAKE to run
    li r0,26                ; 26 letters from A to Z
    li r1,>A1A1             ; start with double >A1 = "A" in XB
    
        ; letter loop
        clr r2              ; screen address
        li r3,384           ; 384 words = 768 bytes = 24*32 positions
    
            ; fill loop
            mov r1,*r2+     ; write two letters on screen
            dec r3          ; decrement counter
            jne -3          ; if not finished, jump to fill loop
    
        ai r1,>0101         ; next letter (>A2A2, >A3A3 etc...)
        dec r0              ; decrement counter
        jne -10             ; if not finished, jump to letter loop
        
    b @>4000                ; back to idle state
$$
$END