beautypg.com

Uext hl (unsigned extension), Sext hl (signed extension), Ld bc,de – Zilog EZ80F916 User Manual

Page 176

background image

UM014423-0607

Using the ANSI C-Compiler

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

156

PSEUDOINSTRUCTION MACROS GENERATED BY THE C-COMPILER

A small number of pseudoinstruction macros are implemented in the C-Compiler so that
the compiler can more easily generate efficient assembly code. A pseudoinstruction has
the syntax of a single processor instruction, but it is actually a combination of two or more
processor instructions that work together. These macros are not primarily intended for use
by assembly coders; they are generated by the compiler and so sometimes can be seen in
compiler-generated assembly code. These descriptions are provided so that users can
understand the translation from these macros to actual assembly instructions. The follow-
ing pseudoinstruction macros are implemented in the eZ80

®

C-Compiler:

“UEXT HL (Unsigned Extension)” on page 156

“SEXT HL (Signed Extension)” on page 156

“LD BC,DE” on page 156

UEXT HL (Unsigned Extension)

This macro clears register HL so that later an 8-bit value can be moved to L, resulting in a
24-bit unsigned extension (into HL) of the 8-bit value. Register A is always used as the
source. The assembler translates this pseudoinstruction into the following sequence of
instructions:

OR A,A
SBC HL,HL

SEXT HL (Signed Extension)

This macro fills register HL with all 0’s or all 1’s depending on the sign bit (that is, bit 7)
of register A. This is done so that later moving the original value of register A into register
L will result in a 24-bit sign extension (into HL) of the 8-bit value in register A. The
assembler translates this pseudoinstruction into the following sequence of instructions:

RLA
SBC HL,HL

LD BC,DE

There is no actual eZ80

®

instruction to move data between 24-bit general-purpose regis-

ters. The assembler implements these pseudoinstructions with a sequence of

push

and

pop

instructions:

PUSH DE
POP BC

This manual is related to the following products: