OpenCores
URL https://opencores.org/ocsvn/z80soc/z80soc/trunk

Subversion Repositories z80soc

[/] [z80soc/] [branches/] [RonivonCosta/] [ROM/] [psf2mif.sh] - Blame information for rev 41

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 rrred
#!/bin/sh
2
IN=$1
3
 
4
# Shift the bits left or right
5
SHIFT="+1"
6
 
7
addr () {
8
 s=$1
9
 ss=${s//+/?}
10
 sss=${ss//-/?}
11
 #echo $sss
12
 echo ${sss:11:2}
13
 
14
}
15
 
16
convbin () {
17
 s=$1
18
 ss=${s//X/1}
19
 echo ${ss// /0}
20
 
21
}
22
 
23
echo "%------------------------------------------------------------------%"
24
echo "% File generate automatically by:                                  %"
25
echo "%                                                                  %"
26
echo "% psf2mif.sh                                                       %"
27
echo "%                                                                  %"
28
echo "% Convert fonts from PSF format to MIF format                      %"
29
echo "%                                                                  %"
30
echo "% by:                                                              %"
31
echo "%                                                                  %"
32
echo "% Ronivon C. Costa                                                 %"
33
echo "% 2008/04/17                                                       %"
34
echo "%                                                                  %"
35
echo "%------------------------------------------------------------------%"
36
echo "Depth = 2048;
37
Width = 8;
38
Address_radix = hex;
39
Data_radix = bin;
40
Content
41
  Begin"
42
 
43
 
44
ADDR=0
45
 
46
for L in `cat $IN | awk '{ if (substr($0,1,1)!="+") { print $0 } }' | grep -v [0-9] | sed s/" "/0/g`
47
do
48
   ISADDR=`echo $L | grep "++"`
49
   if [[ -z "$ISADDR" ]]; then
50
      LIN=${L//X/1}
51
      ROMADDR="000"`printf "%02X" $ADDR`
52
      FADDR=${ROMADDR:(-4)}
53
 
54
# print Letter using * in front of the binary code
55
 
56
      ASCII1=${LIN//0/" "}
57
      ASCII2=${ASCII1//1/*}
58
 
59
      if [[ $SHIFT == "+1" ]]; then
60
         LIN="0"${LIN:0:7}
61
      else
62
         if [[ $SHIFT == "+2" ]]; then
63
            LIN="00"${LIN:0:6}
64
         else
65
            if [[ $SHIFT == "-1" ]]; then
66
               LIN=${LIN:1:7}"0"
67
            else
68
               if [[ $SHIFT == "-2" ]]; then
69
                  LIN=${LIN:2:6}"00"
70
               fi
71
            fi
72
         fi
73
       fi
74
 
75
 
76
      echo "$FADDR : $LIN ; % $ASCII2 %"
77
 
78
      let ADDR=$ADDR+1
79
    fi
80
 
81
done
82
 
83
echo "End;"
84
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.