Author: ajcord
Posted: 22 Dec 2012 11:09:23 pm (GMT -5)
I've got a lot of stuff working now, including random continent/terrain generation, the map view, a basic menu system, and units. I'll post a screenshot soon hopefully.
What has surprisingly taken me the most time lately is getting my custom input routine working. When you select a settler and choose to build a city, it prompts you for the name of the new city. I wanted to save on program size, so rather than check each key individually, I used a routine that would convert getKey values into their corresponding characters. The problem is that getKey→K always returns zero for me. So I did some research on WikiTI (thank goodness for that website, it's saved me more than once) and played around with the bcall KbdScan.
I figured out that if I put that bcall in my custom interrupt routine:
Code:
then getKey→K works, although getKey is quickly reset due to the interrupt running again. One could fix this by only running the bcall every few interrupts, but it works fine for what I need. It seems to me that getKey by itself (as in returning the last key pressed, not checking for a specific key) only checks kbdScanCode for the most recent keypress. However, kbdScanCode is only updated when bcall KbdScan is called, which normally happens during an interrupt. Since I was using a custom interrupt, I had to add the bcall into my interrupt routine using the above inline assembly. Please correct me if my getKey theory is wrong.
Anyway, I thought I'd share this solution with anyone who has similar problems. The extra bcall doesn't seem to slow down the game noticeably.
Posted: 22 Dec 2012 11:09:23 pm (GMT -5)
I've got a lot of stuff working now, including random continent/terrain generation, the map view, a basic menu system, and units. I'll post a screenshot soon hopefully.
What has surprisingly taken me the most time lately is getting my custom input routine working. When you select a settler and choose to build a city, it prompts you for the name of the new city. I wanted to save on program size, so rather than check each key individually, I used a routine that would convert getKey values into their corresponding characters. The problem is that getKey→K always returns zero for me. So I did some research on WikiTI (thank goodness for that website, it's saved me more than once) and played around with the bcall KbdScan.
I figured out that if I put that bcall in my custom interrupt routine:
Code:
Asm(EF1540)
Anyway, I thought I'd share this solution with anyone who has similar problems. The extra bcall doesn't seem to slow down the game noticeably.