push hl
; load base room ptr
- ; TODO we are simply loading base_room_header every time
+
+ ; TODO begin test
+ ; TODO we are simply loading base_room_header every time
+ ; TODO for now we are just copying room1 and room2 and linking them
ld hl, base_room_table
ld a, [hl+]
ld e, a
; now we copy
push hl ; save original ptr for now
call map_gen_copy_base_room
- pop hl
+ ; hl = next room
+ push hl
+ pop bc ; bc = next room ptr
+ pop hl
+
+ ; set up link to room 2
+ ld de, room_exit_table
+ add hl, de ; hl = exit table ptr
+ ld a, [hl+]
+ ld e, a
+ ld a, [hl]
+ ld d, a
+
+ ; de = NORTH exit
+
+ ; store bc in north exit
+ ld a, c
+ ld [de], a
+ inc de
+ ld a, b
+ ld [de], a
+
+ push bc
+
+ ; load base room from table
+ ld hl, base_room_table
+ ld de, 2
+ add hl, de ; hl = second room entry
+ ld a, [hl+]
+ ld e, a
+ ld a, [hl]
+ ld d, a
+ pop hl ; hl = next room ptr again
+ call map_gen_copy_base_room
+
+ ; TODO end test
; select a direction to walk into and call again
; and set up pointers