#COMPILE EXE
#DIM NONE

FUNCTION PBMAIN () AS LONG



     DIM r AS INTEGER
     DIM y AS INTEGER
     DIM x AS INTEGER
     DIM xshiftcount AS INTEGER
     DIM z AS INTEGER
    DIM i AS INTEGER

    DIM first AS BYTE
    KILL "mullut.asm"
    OPEN "mullut.asm" FOR OUTPUT AS #1
    FOR i = 2 TO 255
    xshiftcount = -1

        y = i
        PRINT #1, "Mul" + TRIM$(STR$(i)) + ":"
        first = 1


        WHILE y <> 0
             xshiftcount = xshiftcount + 1

    '       x = int(x*2) '<<=1
            IF y MOD 2 = 1 THEN
                    IF xshiftcount > 0 THEN PRINT #1, "        lsl.l #"+TRIM$(STR$(xshiftcount))+", \reg1"
                    IF first = 1 THEN
                        PRINT #1, "        move.l \reg1, \reg2"
                        first=0
                    ELSE
                        PRINT #1, "        add.l \reg1, \reg2"
                    END IF
                xshiftcount = 0
            END IF

            y = INT(y/2)'>>=1
        WEND
        PRINT #1, "        rts"
    NEXT i

END FUNCTION
