ld [hl+], a
; 3) make rooms
+
+ ; TODO: this is a test room
+ ld hl, mapgen_tiles+1+MAP_W
+ ld bc, 0x0505 ; 5x5
+ call mapgen_mak_room
; cleanup) finally
ld [mapgen_game_seed+1], a
ld [srand+1], a
ret
+
+ ; generates a single rectanglular room
+ ; the caller must ensutre hl has enough tiles in
+ ; the y and x direction to allow the room to fit.
+ ; places actors in the room
+ ; inputs:
+ ; hl: start position in tile map
+ ; b/c: height/width of room
+mapgen_mak_room:
+ ld de, MAP_W
+@draw_row:
+ ; save original hl
+ push hl
+
+ ; save original w
+ push bc
+
+@draw_col:
+ ld a, TI_FLOOR
+ ld [hl+], a
+
+ dec c ; width--
+ jr nz, @draw_col REL
+
+ ; restore w
+ ld a, b ; need to save height
+ pop bc
+ ld b, a
+
+ pop hl
+ ; go to next row
+ add hl, de
+ dec b ; height--
+ jr nz, @draw_row REL
+
+ ; TODO: place actors
+ ret
+