![]() |
.. (לתיקייה המכילה) | |
How do I reserve n bytes in memory? | |
There is no byte equivalent of .blkw, but you can use . = . + n like this: my_array: . = . + n This way you'll get n empty bytes at my_array. |
I don't know the board size in advance, how can I allocate space for it? | |
You don't have to reserve the board memory explicitly; you can place it anywhere you want as long as you make sure you don't corrupt any important data (or code). That means you can safely place the board array at the end of your data section, and treat it like a very long array (since all your data and code will be stored in lower addresses). You can do it like this: ; Your programme here ; Your data here board: ;This is the last line in your source file Just make sure you don't reach the automatic checker's memory addresses. |
How can the player win the game if he didn't blank all the white squares? | |
The only thing the player has to do in order to win the game is to set all the black squares, and only the correct black squares (i.e. the position of the set squares on the board should match the data in Row_Nums and Col_Nums). When you check the board to see whether the player correctly filled it you should treat both clear and blank squares as empty squares (i.e. not a part of any sequence of black squares). The ONLY difference between clear and blank squares is their visual representation and that the board is initially filled with clear squares. The reason for having two seemingly equivalent square types is that it aids the player, because he can blank a square when he's sure it's white, and clear a square if he's not sure about its colour. |
I'm not sure about printing strings with the interrupt mechanism, can you give an example? | |
Sure, just take a look at the code in the dry part of the assignment, it should give you a fairly good idea of how your string-printing code should look. Also, keep in mind that you may switch interrupt service routines during the programme, so you can write different routines for different IO situations. |
But the code in the dry part is waiting on the pBusy flag in a loop, isn't that just like using busy-wait printing? | |
Yes and no. Since your programme won't have anything else to do while it prints something, it will have to wait until the printer finished its work. Yes, in this situation it would have been possible to use busy-wait for printing instead of interrupts. However, since the purpose of this assignment is to familiarise you with the interrupt mechanism, you may NOT use busy-wait (that is, you are not allowed to poll the TPS, and whenever you have a character for printing you must send it to the TPB in the interrupt handler). Your programme may still wait on a certain flag, like the pBusy flag, of course. No, since using the interrupts mechanism allows your programme to do other productive things while it waits for the printer/keyboard, instead of polling the status registers all the time. If, for example, I would have asked you to fill the memory with quotations from Shakespeare's works, you could put a piece of code that does that instead of the loop, and the IO in your programme would still work. If you're curious you can take a look at the previous semester's assignment, which asks for something similar. |
Regarding the dry question: I think that line 81 in the code is supposed to read .byte 12, 0 -- is that a mistake in the question? | |
No. This line is intended to be as it is. Think what it means regarding the programme's output. |