> GenBitMap * generates bitmap for the given image * the program requires two ROM images: (' the original (assembled at &8000) 2H the alternative (assembled >= &8100) used to check for differences bmbuff% &2000: 8K should be large enough for the bitmap dbend%=bmbuff%+&2000 n"bptr%=bend%: start at the end x: #code%=&DEC0: bitmap identifier dist%=&0000 numbits%=&0000 address%=&8000-1 : @ "File containing ROM image assembled at &8000 => "realrom$ E "File containing ROM image assembled for relocation => "altrom$ : rr%=(realrom$) , rr%=0 "Could not open ";realrom$: : ar%=(altrom$) 1 ar%=0 "Could not open ";altrom$:#rz%: : F -- the bitmap is stored in reverse order, with the bitmap header & -- information stored at the end "G -- the header contains a special identifier (CODE) and the length , -- of the bitmap in bytes 6 bptr%=bptr%-2: step over ID @bptr%?&00=code% &0100 Jbptr%?&01=code% &0100 T'bptr%=bptr%-2: step over bit count ^bptr%?&00=&00 hbptr%?&01=&00 r9bcadr%=bptr%: but remember wheze we need to place it |:  : bptr%=bptr%-1  val%=0  bc%=8 :  :  v1%=#rr%  v2%=#ar% address%=address%+1 : , ((v1% >= &7F) (v1% <= &BF)) check :  (bc%=0) (#rr% #ar%) : &D check and see if the last byte in the bitmap table needs to be 0F padded (this is required due to the lo-address byte being stored : in the highest bit) D\ (bc%=0) insert (bc%>0 bc%<8) loop%=bc% 1 -1:val%=(val%*2)+0::insert N bc%=8 bptr%=bptr%+1 X: b' (#rr% #ar%) (bptr% bptr%"  bptr%>=bmbuff% (save$) :  :  insert  : place a byte into the bitmap, and decrement pointers &bptr%?&00=val%:numbits%=numbits%+1   *: 4 check >( - check if a byte needs relocating H d% R v1%=v2% addbit(0): \ they are different f3 check they are always the same distance apart pd%=v2%-v1% z\ dist%<>0 d%<>dist% "Fatal error - difference not constant" dist%=0 dist%=d% :  "Diff at &";~address% : addbit(1)  : addbit(v%) , - add the bit given into the structure ? this is done by remembering the bit in the current byte E bc% : global that holds the bit count within the current byte 1 val% : global that holds the current byte  bc%=bc%-1 val%=(val%*2)+v%