Basic BMP to Mode3 graphics convertor

512x192 4bit screen example
   10 MODE 3: LOAD "pic.bmp" CODE 100000
   11 PALETTE 0,0: PALETTE 1,15
   12 PALETTE 2,120: PALETTE 3,127
   20 LET m=100118, a=24576, s=507904, l=256
   30 FOR i=0 TO a*2 STEP l
   35 LET d=s+a-128*(i/l+1)
   40 FOR y=0 TO l-1 STEP 2
   50 LET p=0
   60 LET p1=PEEK (m+i+y)
   70 LET p2=PEEK (m+i+y+1)
   75 LET p=p2 BAND 3
   80 IF p1=&33: LET p=p BOR 240
   81 ELSE IF p1=&01: LET p=p BOR 16
   82 ELSE IF p1=&02: LET p=p BOR 32
   83 ELSE IF p1=&03: LET p=p BOR 48
   84 ELSE IF p1=&10: LET p=p BOR 64
   85 ELSE IF p1=&11: LET p=p BOR 80
   86 ELSE IF p1=&12: LET p=p BOR 96
   87 ELSE IF p1=&13: LET p=p BOR 112
   88 ELSE IF p1=&20: LET p=p BOR 128
   89 ELSE IF p1=&21: LET p=p BOR 144
   90 ELSE IF p1=&22: LET p=p BOR 160
   91 ELSE IF p1=&23: LET p=p BOR 176
   92 ELSE IF p1=&30: LET p=p BOR 192
   93 ELSE IF p1=&31: LET p=p BOR 208
   94 ELSE IF p1=&32: LET p=p BOR 224
   95 END IF 
  120 IF p2=&10: LET p=p BOR 4
  121 ELSE IF p2=&11: LET p=p BOR 5
  122 ELSE IF p2=&12: LET p=p BOR 6
  123 ELSE IF p2=&13: LET p=p BOR 7
  130 ELSE IF p2=&20: LET p=p BOR 8
  131 ELSE IF p2=&21: LET p=p BOR 9
  140 ELSE IF p2=&22: LET p=p BOR 10
  141 ELSE IF p2=&23: LET p=p BOR 11
  150 ELSE IF p2=&30: LET p=p BOR 12
  151 ELSE IF p2=&31: LET p=p BOR 13
  152 ELSE IF p2=&32: LET p=p BOR 14
  153 ELSE IF p2=&33: LET p=p BOR 15
  155 END IF 
  170 POKE d+y/2,p
  180 NEXT y
  190 NEXT i
  200 PAUSE : SAVE "pic" SCREEN$: PALETTE

Download

convertor disk mgt
original picture bmp

BMP parametres:

512*192 pixels
4 bits per pixel
= 16 colours
4 colours used only!
49270 bytes

SimCoupé Tip:

Disable framesync option (go to menu/view or press F7 key).

4bit screen example