Skip to content

Commit

Permalink
Updated deexoopt
Browse files Browse the repository at this point in the history
Updated deexoopt_f3
  • Loading branch information
uniabis committed Aug 2, 2019
1 parent e2dc3f0 commit e8e9844
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 52 deletions.
44 changes: 31 additions & 13 deletions deexoopt.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;
; SIZE speed 0 speed 1 speed 2 speed 3 range88-ef
; forw nolit 152 154 171 208 +5
; back nolit 150 152 169 206 +5
; forw liter 167 170 189 219 +5
; back liter 165 168 187 217 +5
; forw nolit 152 154 171 208 +2
; back nolit 150 152 169 206 +2
; forw liter 167 170 189 219 +3
; back liter 165 168 187 217 +3
; output deexoopt.bin
; define mapbase $5b00
; define speed 3
Expand Down Expand Up @@ -154,22 +154,34 @@ exlit ldi
IF speed=0
exloop call exgetb
jr c, exlit
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld c, 256-1
ELSE
ld c, 112-1
ENDIF
exgeti call exgetb
ENDIF
IF speed=1
exloop add a, a
call z, exgetb
jr c, exlit
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld c, 256-1
ELSE
ld c, 112-1
ENDIF
exgeti add a, a
call z, exgetb
ENDIF
IF speed=2 OR speed=3
exloop add a, a
jr z, exgbm
jr c, exlit
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
exgbmc ld c, 256-1
ELSE
exgbmc ld c, 112-1
ENDIF
exgeti add a, a
jr z, exgbi
exgbic inc c
Expand All @@ -179,21 +191,22 @@ exgbic inc c
exgbic inc c
jr nc, exgeti
ENDIF
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
bit 4, c
IF literals=1
jr nz, excat
ELSE
ret nz
ENDIF
ELSE
IF literals=1
jp m, excat
ELSE
ret m
ENDIF
ENDIF
push de
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ex af, af'
ld a,256-112
add c
ld iyl, a
ex af, af'
ELSE
ld iyl, c
ENDIF
IF speed=2 OR speed=3
ld de, 0
ENDIF
Expand Down Expand Up @@ -297,8 +310,13 @@ exgoit ld d, e
jr exloop

IF literals=1
excat:
excat
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
bit 0, c
ret z
ELSE
ret pe
ENDIF
IF speed=3
ld b, (hl)
IF back=1
Expand Down
99 changes: 60 additions & 39 deletions deexoopt_f3.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,11 @@
; License along with this library; if not, write to the Free Software
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;
;push de

IF (low mapbase)<256+112-128 AND (low mapbase)>112-52*2+127
DEFINE map_ofs 0
ELSE
DEFINE map_ofs 112
ENDIF
map_iyh equ (high (mapbase-map_ofs+128))
map_disp_bit equ ((low (mapbase-map_ofs+128))-128)
map_disp_lo equ (map_disp_bit+52*1)
map_disp_hi equ (map_disp_bit+52*2)

ld iy, map_iyh*256+map_ofs
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld iy, 256+mapbase/256*256
ELSE
ld iy, (mapbase+16)/256*256+112
ENDIF

cp a ;set ZF
ex af, af';'
Expand Down Expand Up @@ -73,9 +65,15 @@ get4 adc a, a
rrca
inc a

ld (iy+map_disp_bit), a
ld (iy+map_disp_lo), e
ld (iy+map_disp_hi), d
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld (iy-256+mapbase-mapbase/256*256), a
ld (iy-204+mapbase-mapbase/256*256), e
ld (iy-152+mapbase-mapbase/256*256), d
ELSE
ld (iy-112+mapbase-(mapbase+16)/256*256), a
ld (iy-60+mapbase-(mapbase+16)/256*256), e
ld (iy-8+mapbase-(mapbase+16)/256*256), d
ENDIF

jr nc, get5
sub 128-8+1
Expand Down Expand Up @@ -108,26 +106,21 @@ litcop ldi
mloop add a, a
jr z, gbm
jr c, litcop
gbmc ld c, (map_ofs-1)&255
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
gbmc ld c, 256-1
ELSE
gbmc ld c, 112-1
ENDIF
getind add a, a
jr z, gbi
gbic inc c
jr nc, getind
IF map_ofs==0
ld b, a
IF literals=1
ld a, 16
ELSE
ld a, 15
ENDIF
cp c
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
bit 4, c
IF literals=1
ret z
ld a, b
jr c, litcat
jr nz, litcat
ELSE
ret c
ld a, b
ret nz
ENDIF
ELSE
IF literals=1
Expand All @@ -140,35 +133,61 @@ gbic inc c
push de
ld iyl, c
ld c, 0
ld b,(iy+map_disp_bit)
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld b, (iy-256+mapbase-mapbase/256*256)
ELSE
ld b, (iy-112+mapbase-(mapbase+16)/256*256)
ENDIF
dec b
call nz, getbits
ex de, hl
ld l,(iy+map_disp_lo)
ld h,(iy+map_disp_hi)
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld l, (iy-204+mapbase-mapbase/256*256)
ld h, (iy-152+mapbase-mapbase/256*256)
ELSE
ld l, (iy-60+mapbase-(mapbase+16)/256*256)
ld h, (iy-8+mapbase-(mapbase+16)/256*256)
ENDIF
add hl, bc
ex de, hl
push de
inc d
dec d
jr nz, dontgo
ld bc, 512+(map_ofs+48)/4
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld bc, 512+48/4
ELSE
ld bc, 512+160/4
ENDIF
dec e
jr z, goit
dec e
dontgo ld bc, 1024+(map_ofs+32)/16
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
dontgo ld bc, 1024+32/16
ELSE
dontgo ld bc, 1024+144/16
ENDIF
jr z, goit
dec c
goit:
call lee8
ld iyl, c
ld c, b
ld b,(iy+map_disp_bit)
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld b, (iy-256+mapbase-mapbase/256*256)
ELSE
ld b, (iy-112+mapbase-(mapbase+16)/256*256)
ENDIF
dec b
call nz, getbits
ex de, hl
ld l,(iy+map_disp_lo)
ld h,(iy+map_disp_hi)
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
ld l, (iy-204+mapbase-mapbase/256*256)
ld h, (iy-152+mapbase-mapbase/256*256)
ELSE
ld l, (iy-60+mapbase-(mapbase+16)/256*256)
ld h, (iy-8+mapbase-(mapbase+16)/256*256)
ENDIF
add hl, bc
ex de, hl
pop bc
Expand All @@ -182,7 +201,9 @@ goit:

IF literals=1
litcat:
IF map_ofs==0
IF mapbase-mapbase/256*256<240 AND mapbase-mapbase/256*256>135
bit 0, c
ret z
ELSE
ret pe
ENDIF
Expand Down

0 comments on commit e8e9844

Please sign in to comment.