New and Improved 3D Ant Attack


People always whine about the keyboard controls on the Spectrum version of Ant Attack, so I've produced a hacked version of the snapshot which I hope will address such concerns. The changes I've made are:

Here's a zip file containing .z80 and .sna snapshots of the new version and a .pok file for the do-it-yourself types.


For the curious, here's the new code. In addition I nop'd out bits of the camera angle code, and changed the call instruction so it calls my keyboard handler.

I think the chunk of memory I put it in is unused...

; New keyboard code in patch space:

          .org $9400          ;37888

; ### get player direction and flags ###
start:    ld a,($B422)        ;city view number
          ld h,a
          ld d,(ix+4)         ;player direction
          ld a,(ix+7)         ;player flags
          and $f9             ;no walk/jump by default
          ld e,a
; ### jumping ###
          ld bc,$7FFE         ;key port for jump1 key (space)
          in a,(c)
          and $01             ;key bit for jump1 key
          jr nz,nojump1
          set 1,e
nojump1:  ld b,$FE            ;key port for jump2 key (X)
          in a,(c)
          and $04             ;key bit for jump2 key
          jr nz,nojump2
          set 1,e
; ### walking in current direction ###
nojump2:  ld b,$FE            ;key port for walk key (V)
          in a,(c)
          and $10             ;key bit for walk key
          jr nz,nowalk
          set 2,e
nowalk:   ld a,(ix+6)         ;boy sleep count
          and a
          jr nz,noturn        ;no turning while asleep
; ### turning left/right ###
          inc d               ;where left turn goes
          ld b,$7F            ;key port for left key (N)
          in a,(c)
          and $08             ;key bit for left key
          jr z,doturn
          dec d               ;where right turn goes
          dec d
          ld b,$7F            ;key port for right key (M)
          in a,(c)
          and $04             ;key bit for right key
          jr z,doturn
; ### directional walk keys ###
          ld d,0
          ld b,$FD            ;key port for dir0 (A)
          in a,(c)
          and $01             ;key bit for dir0
          jr z,dodir
          inc d               ;dir1
          ld b,$DF            ;key port for dir1 (P)
          in a,(c)
          and $01             ;key bit for dir1
          jr z,dodir
          inc d               ;dir2
          ld b,$FB            ;key port for dir2 (Q)
          in a,(c)
          and $01             ;key bit for dir2
          jr z,dodir
          inc d               ;dir3
          ld b,$BF            ;key port for dir3 (L)
          in a,(c)
          and $02             ;key bit for dir3
          jr nz,noturn
dodir:    ld a,d              ;walk direction
          sub h               ;view direction
          ld d,a
          set 2,e
doturn:   ld (ix+4),d         ;set player direction
noturn:   ld (ix+7),e         ;set player flags
; ### recenter view ###
          ld b,$BF            ;key port for ENTER
          in a,(c)
          and $01             ;key bit for ENTER
          ret nz              ;leave now if not
          ld de,$12FD
          ld a,h              ;view direction
          and a
          jr z,doview
          ld de,$FDEE
          dec a
          jr z,doview
          ld de,$EE03
          dec a
          jr z,doview
          ld de,$0312
doview:   jp $843B            ;into view rotation routine


Web page by Tyrone C. | Back to homepage