Intro to ROM Calls

Since assembly language is only one step above machine code, we have to program EVERY single task ourselves; there is no "print text" or anything like that unless we write the code for it. Luckily though, there are certain tasks, like displaying text, that are so commonly needed that they have already been written for us and stored in the calculator’s ROM (Read Only Memory). But just how do we access these pre-made functions? If we know their memory addresses, we can "call” them.

Instruction b_call
b_call is the instruction that we use to perform one of the pre-made functions. All we need to do is provide the address of the function like so: b_call(address) If you remember how we used memory addresses to find and store data, this is very similar. In fact, we can even use equates to substitute a name instead of using a number for the address.

ROM Call _ClrLCDFull
For instance, a very useful function for clearing the screen is "Clear LCD Full," which starts at location $4540 in memory. It is equated to the name _ClrLCDFull, so we can simply do this:

b_call(_ClrLCDFull)    ;the screen is now blank

This might look like it has the same effect as ClrHome in TI-basic, but be careful: the cursor has to be changed manually, or can use b_call(_HomeUp) to get the cursor to $0000.

ROM Call _DispHL
_DispHL will display the number that is stored in HL. Note that the number is right-aligned, which means that the last number of HL is always displayed four places right of the current value of (CurCol). Each number will be placed left of the origional one.

For example, we want to display 5698 at the right side of the screen, at the first line: b_call(_ClrLCDFull) LD   HL, $0B00      ;$0B is the 11th row, so the last number will be displayed 4 places left of 0B, so at 0F, and 0F is the most left place. LD   (CurRow), HL LD    HL, 5698 b_call(_DispHL)     ;Displays the number. And there we have it.