ref: 64a6af405240dcef1fdf4b4d321d9cc2093d2fd0
parent: cc98fab33ed222d89bba5fa3f96641ad3c8db6fb
author: yenatch <[email protected]>
date: Thu Aug 29 16:02:40 EDT 2013
condense some repetitive asm with rept macros
--- a/main.asm
+++ b/main.asm
@@ -421,55 +421,17 @@
.row
; write a row of 20 tiles
+rept 9
pop de
ld [hl], e
inc l
ld [hl], d
inc l
+endr
pop de
ld [hl], e
inc l
ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
; next row
add hl, bc
; done?
@@ -528,6 +490,8 @@
.loop
; put 1 tile (16 bytes) into hl from sp
+
+rept 3
pop de
ld [hl], e
inc l
@@ -537,6 +501,7 @@
inc l
ld [hl], d
inc l
+endr
pop de
ld [hl], e
inc l
@@ -545,24 +510,6 @@
ld [hl], d
inc l
ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- ld [hl], d
; next tile
inc hl
; done?
@@ -639,41 +586,13 @@
.loop
; put 1 tile (16 bytes) into hl from sp
+rept 7
pop de
ld [hl], e
inc l
ld [hl], d
inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
- pop de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
+endr
pop de
ld [hl], e
inc l