; Author: Santiago Ontañón
; - Patterns are separated by a blank line
; - Patterns suggested by others are credited to them below.
; - If you do a pull request with more patterns, please credit yourself in a comment before the pattern.

include "pbo-patterns.txt"

pattern: Replace push ?regpair2; pop ?regpair1 with ld ?reg1l,?reg2l; ld ?reg1h,?reg2h
name: push2ld
0: push ?regpair2
1: pop ?regpair1
replacement:
0: ld ?reg1l,?reg2l
1: ld ?reg1h,?reg2h
constraints:
in(?regpair2,IX,IY)
in(?regpair1,BC,DE)
regpair(?regpair1,?reg1h,?reg1l)
regpair(?regpair2,?reg2h,?reg2l)

; thanks to bengalack for suggesting this pattern
pattern: Replace jr ?const with jp ?const
tags: tstatez80
0: jr ?const
replacement:
0: jp ?const
