[OSM-dev] Algorithm help

Richard Fairhurst richard at systemeD.net
Thu May 29 12:16:56 BST 2008


SteveC wrote:

> it's like reading undocumented assembler!

I could do that if it helps?

         ld hl,table: call &BD58
         ld hl,&BD2B: ld de,mc_pc: ld bc,mc_pco: call patch
         ld hl,&BD31: ld de,mc_sp: ld bc,mc_spo: call patch
         ld hl,&BDF1: ld de,mc_wp: ld bc,mc_wpo: jp   patch
.mc_pc  call bit8
.mc_pco ds 3
.mc_sp  call bit8
.mc_spo ds 3
.mc_wp  call bit8
.mc_wpo ds 3
.bit8   push af: push bc
          ld bc,&BC0C: out (c),c: ld c,a
          ld b ,&BF  : in a,(c) : and 247
          bit 7,c: jr z,bit8_0  : or  8
.bit8_0  ld bc,&BC0C: out (c),c
          inc b      : out (c),a
         pop bc: pop af: ret
.patch  ld a,(hl): ld (bc),a: inc bc: inc hl
         ld a,(hl): ld (bc),a: inc bc: inc hl
         ld a,(hl): ld (bc),a: dec hl: dec hl
         ld (hl),&C3: inc hl
         ld (hl),e  : inc hl
         ld (hl),d  : ret

I did try and find an example of self-modifying code for you, which I  
thought you'd especially love, but my CPC source discs are in the attic.

cheers
Richard





More information about the dev mailing list