> 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 Zbend%=bmbuff%+&2000 d"bptr%=bend%: start at the end n: 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$:#rr%: : F -- the bitmap is stored in reverse order, with the bitmap header & -- information stored at the end G -- the header contains a special identifies (CODE) and the length " -- of the bitmap in bytes , bptr%=bptr%-2: step over ID 6bptr%?&00=code% &0100 @bptr%?&01=code% &0100 J'bptr%=bptr%-2: step over bit count Tbptr%?&00=&00 ^bptr%?&01=&00 h9bcadr%=bptr%: but remember where we need to place it r: | : 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 &F padded (this is required due to the lo-address byte being stored 0 in the highest bit) :\ (bc%=0) insert (bc%>0 bc%<8) loop%=bc% 1 -1:val%=(val%*2)+0::insert D bc%=8 bptr%=bptr%+1 N: X' (#rr% #ar%) (bptr% bptr%"  bptr%>=bmbuff% (save$) :  :  insert : place a byte into the bitmap, and decrement pointers  &bptr%?&00=val%:numbits%=numbits%+1   : * check 4( - check if a byte needs relocating > d% H v1%=v2% addbit(0): R they are different \3 check they are always the same distance apart fd%=v2%-v1% p\ dist%<>0 d%<>dist% "Fatal error - difference not constant" dist%=0 dist%=d% z:  "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%