Absolute Addressing

z80 » Variables

We already went over previously how the TI86 switches in and out ROM and RAM Pages so you can look back at that if you want to refresh yourself real quick. Here is a chart that tells the equivalents of the Absolute Address Pointer (ABS) to the RAM Page with an 16 bit address (addressing using the register pairs: de, bc, hl, and ix).

24 Bit Address RAM Page 16 Bit Address
$0c000 to $0ffff 0 $c000 to $ffff
$10000 to $13fff 1 $8000 to $bfff
$14000 to $17fff 2 $8000 to $bfff
$18000 to $1bfff 3 $8000 to $bfff
$1c000 to $1ffff 4 $8000 to $bfff
$20000 to $23fff 5 $8000 to $bfff
$24000 to $27fff 6 $8000 to $bfff
$28000 to $2bfff 7 $8000 to $bfff

You don't really have to know this table. It really isn't helpful in a program or anything. I just thought I'd copy it down for you. It's basically just to illustrate how the TI86's system of 24 bit (ahl or bde, absolute pointers) can be converted to a 16 bit (hl, bc, de, or ix, register pair pointers). The TI86's own routines deal with this mainly. One call that converts ABS ahl into a RAM Page and a 16 bit address is _Load_RAM_ahl.

Calls
_Load_RAM_ahl
_Conv_ahl
_Set_ABS_Src_Addr
_Set_ABS_Dest_Addr
_Set_MM_Num_Bytes
_MM_Ldir
_ABS_Mov10toOP1_NoSet
_ABS_Mov10B
_ABS_MovFrOP1
_DataSize
_Inc_Ptr_ahl
_Inc_Ptr_ade
_Inc_Ptr_bde
_Dec_Ptr_ahl
_Dec_Ptr_ade
_Dec_Ptr_bde
_GetB_AHL
_RAM_Page_1
_RAM_Page_7
_WriteB_Inc_ahl
_Cp_ahl_bde
_Ex_ahl_bde
_Get_Word_ahl
_Set_Word_ahl
_ahl_Plus_2_Pg3

_Load_RAM_ahl=$462f

Description Converts ABS pointer ahl into RAM page and hl as pointer (loads RAM page)
Input ahl - ABS pointer (24 bit)
Destroys ahl
Output appropriate RAM page loaded
hl - address on that page according to ahl

_Conv_ahl=$4633

Description Converts ABS pointer ahl into RAM page and hl as pointer (does not load RAM page)
Input ahl - ABS pointer (24 bit)
Destroys ahl
Output a - RAM page to load
hl - address on that page according to ahl

_Set_ABS_Src_Addr=$4647

Description Copies ahl into _Abs_Src_Addr for use with block copies
Input ahl is ABS pointer
Destroys none
Output ahl is stored in _Abs_Src_Addr for use with block copies

_Set_ABS_Dest_Addr=$5285

Description Copies ahl into _Abs_Dest_Addr for use with block copies
Input ahl is ABS pointer
Destroys none
Output ahl is stored in _Abs_Dest_Addr for use with block copies

_Set_MM_Num_Bytes=$464f

Description Sets number of bytes to be copied in ABS block copies
Input ahl is ABS pointer
Destroys none
Output ahl is stored in _MM_Num_Bytes for use with block copies

_MM_Ldir=$52ed

Description Performs ABS pointer block copy like ldir
Input ABS_Src_Addr - source to copy from
ABS_Dest_Addr - destination to copy to
MM_Num_Bytes - number of bytes to copy
Note: These are all setup using _Set_ABS_Src_Addr, _Set_ABS_Dest_Addr, and _Set_MM_Num_Bytes.
Destroys none
Output Abs_Src_Addr, Abs_Dest_Addr, mm_num_bytes - modified just like ldir does in 16 bit block copies

_ABS_Mov10toOP1_NoSet=$5239

Description Copy 10 bytes from ABS pointer in _ABS_Src_Addr to OP1
Input Abs_Src_Addr - ABS pointer of where to copy from
Destroys a and hl
Output OP1 - a copy of the 10 bytes starting at Abs_Src_Addr

_ABS_Mov10B=$5249

Description Move 10 bytes from ABS pointer in _Abs_Src_Addr to ABS pointer in _Abs_Dest_Addr
Input Abs_Src_Addr - ABS pointer of where to copy from
Destroys a and hl
Output Abs_Dest_Addr - ABS pointer of where 10 bytes copied to

_ABS_MovFrOP1=$5245

Description Move 10 bytes from OP1 to the ABS pointer in _Abs_Dest_Addr
Input ABS pointer in _Abs_Dest_Addr where to copy to
OP1 - 10 bytes to copy
Destroys a and hl
Output ABS pointer in _Abs_Dest_Addr where copied to

_DataSize=$477f

Description After performing _FindSym, use it to find the variable's size.
Input The output of _FindSym (like _Delvar=$475f).
Destroys a, bc, de, and hl
Output c - variable type
de - size of variable's data
carry cleared

_Inc_Ptr_ahl=$4637

Description Increase the ABS pointer ahl
Input ahl - the ABS pointer to increase
Destroys ahl (always l, sometimes h, rarely a)
Output ahl = ahl + 1

_Inc_Ptr_ade=$45ef

Description Increase the ABS pointer ade
Input ade - the ABS pointer to increase
Destroys ade (always e, sometimes d, rarely a)
Output adecode> = ade + 1

_Inc_Ptr_bde=$463F

Description Increase the ABS pointer bde
Input bde - the ABS pointer to increase
Destroys bde (always e, sometimes d, rarely b)
Output bde = bde + 1

_Dec_Ptr_ahl=$463b

Description Decrease the ABS pointer ahl
Input ahl - the ABS pointer to decrease
Destroys ahl (always l, sometimes h, rarely a)
Output ahl = ahl - 1

_Dec_Ptr_ade=$46bf

Description Decrease the ABS pointer ade
Input ade - the ABS pointer to decrease
Destroys ade (always e, sometimes d, rarely a)
Output ade = ade - 1

_Dec_Ptr_bde=$4643

Description Decrease the ABS pointer ade
Input ade - the ABS pointer to decrease
Destroys ade (always e, sometimes d, rarely a)
Output ade = ade - 1

_GetB_AHL=$46c3

Description Gets the byte at ABS ahl
Input ahl - where to get byte from
Destroys a and hl
Output a - byte at ABS ahl
hl - converted ahl to 16 bit address hl and correct RAM page swapped

_RAM_Page_1=$47e3

Description Loads RAM page 1 (Floating Point Stack)
Input none
Destroys none
Output RAM Page 1 swapped in

_RAM_Page_7=$47f3

Description Loads RAM page 7 (Variable Allocation Table)
Input none
Destroys none
Output RAM Page 7 swapped in

_WriteB_Inc_ahl=$5567

Description Store a byte at ABS ahl
Input c - the byte to store
ahl - the ABS pointer to where to store to
Destroys ahl is incremented just like _Inc_Ptr_ahl
Output c is stored at ahl
ahl = ahl + 1

_Cp_ahl_bde=$46c7

Description Compare the bytes at ahl and bde much like cp.
Input ahl and bde are ABS pointers to the byte being checked
Destroys none
Output Flags set accordingly

_Ex_ahl_bde=$45f3

Description Exchange the ABS pointers ahl and bde much like ex de,hl
Input ahl and bde are the ABS addresses to be swapped around.
Destroys ahl now is bde
bde is now ahl
Output ahl now is bde
bde is now ahl

_Get_Word_ahl=$521d

Description Get the word at ABS ahl
Input ahl - where to get the two bytes from
Destroys de and ahl
Output de = (ahl)
ahl = ahl + 2

_Set_Word_ahl=$5221

Description Load de into memory at ahl
Input ahl - where to set the two bytes
Destroys ahl
Output (ahl) = de
ahl = ahl + 2

_ahl_Plus_2_Pg3=$4c3f

Description Increments ahl twice
Input ahl - address to increment
Destroys ahl is always two more
Output ahl = ahl + 2


More from z80 » Variables
Absolute Addressing // Binary Coded Decimal // Creating Variables // External Levels // _FindSym // Messing with Variable Data // OP Math // TI-OS Variable Manipulation // Variable Name Format // VAT Searches