libws libws
WSwan hardware library for the Wonderful toolchain
Loading...
Searching...
No Matches
NEC V30MZ CPU

Macros

#define IA16_INT_DIV   0
 Divide error interrupt vector index.
#define IA16_INT_STEP   1
 Single step/break interrupt vector index.
#define IA16_INT_NMI   2
 Non-maskable interrupt vector index.
#define IA16_INT_BREAK   3
 Breakpoint (INT3) interrupt vector index.
#define IA16_INT_INTO   4
 Overflow (INTO) interrupt vector index.
#define IA16_INT_BOUNDS   5
 Array bounds (BOUND) interrupt vector index.
#define IA16_FLAG_CF   0x0001
 Carry CPU flag bit mask.
#define IA16_FLAG_PF   0x0004
 Parity CPU flag bit mask.
#define IA16_FLAG_AF   0x0010
 Auxillary carry CPU flag bit mask.
#define IA16_FLAG_ZF   0x0040
 Zero CPU flag bit mask.
#define IA16_FLAG_SF   0x0080
 Sign CPU flag bit mask.
#define IA16_FLAG_TF   0x0100
 Single step CPU flag bit mask.
#define IA16_FLAG_IF   0x0200
 Interrupt enable CPU flag bit mask.
#define IA16_FLAG_DF   0x0400
 Direction CPU flag bit mask.
#define IA16_FLAG_OF   0x0800
 Overflow CPU flag bit mask.
#define IA16_FLAG_MD   0x8000
 Mode CPU flag bit mask.
#define FP_SEG(x)
 Retrieve the segment of a far pointer.
#define FP_OFF(x)
 Retrieve the offset of a far pointer.
#define MK_FP(seg, ofs)
 Create a far pointer from a segment and offset.
#define _CS   ia16_get_cs()
#define _DS   ia16_get_ds()
#define _ES   ia16_get_es()
#define _SS   ia16_get_ss()
#define ia16_get_ds   __builtin_ia16_near_data_segment
 Retrieve the current value of the data segment DS.
#define ia16_get_ss   __builtin_ia16_ss
 Retrieve the current value of the stack segment SS.
#define ia16_port_inb(port)
#define ia16_port_inw(port)
#define ia16_port_outb(value, port)
#define ia16_port_outw(value, port)
#define ia16_critical(...)
 Define a critical code segment in which IRQs are disabled.

Typedefs

typedef void __far(* ia16_int_handler_t) (void)

Functions

static __segment ia16_get_cs ()
 Retrieve the current value of the code segment CS.
static __segment ia16_get_es ()
 Retrieve the current value of the data segment ES.
static uint16_t ia16_get_sp ()
 Retrieve the current value of the stack pointer SP.
static uint16_t ia16_get_flags ()
 Retrieve the current value of the CPU flag register.
static void ia16_set_flags (uint16_t flags)
 Set the CPU flag register to a new value.
static uint8_t inportb (uint8_t port)
 Read a byte from the given port.
static uint16_t inportw (uint8_t port)
 Read a word from the given port.
static void outportb (uint8_t port, uint8_t value)
 Write a byte to the given port.
static void outportw (uint8_t port, uint16_t value)
 Write a word to the given port.
static void ia16_halt (void)
 Halt the CPU until an interrupt is received.
static void ia16_enable_irq (void)
 Enable jumping to interrupt vectors on an interrupt being received by the CPU.
static void ia16_disable_irq (void)
 Disable jumping to interrupt vectors on an interrupt being received by the CPU.
void ia16_int_set_handler (uint8_t idx, ia16_int_handler_t handler)
 Register a CPU interrupt handler.

Detailed Description

Macro Definition Documentation

◆ _CS

#define _CS   ia16_get_cs()

Definition at line 181 of file ia16.h.

◆ _DS

#define _DS   ia16_get_ds()

Definition at line 182 of file ia16.h.

◆ _ES

#define _ES   ia16_get_es()

Definition at line 183 of file ia16.h.

◆ _SS

#define _SS   ia16_get_ss()

Definition at line 184 of file ia16.h.

◆ FP_OFF

#define FP_OFF ( x)
Value:
__builtin_ia16_FP_OFF ((x))

Retrieve the offset of a far pointer.

Definition at line 175 of file ia16.h.

◆ FP_SEG

#define FP_SEG ( x)
Value:
__builtin_ia16_selector ((uint16_t) (((uint32_t) ((void __far*) (x))) >> 16))

Retrieve the segment of a far pointer.

Definition at line 170 of file ia16.h.

◆ ia16_critical

#define ia16_critical ( ...)
Value:
do { \
ia16_disable_irq(); \
__VA_ARGS__; \
ia16_enable_irq(); \
} while(0)

Define a critical code segment in which IRQs are disabled.

Note that returns from this block are not correctly supported!

Definition at line 346 of file ia16.h.

◆ IA16_FLAG_AF

#define IA16_FLAG_AF   0x0010

Auxillary carry CPU flag bit mask.

Definition at line 71 of file ia16.h.

◆ IA16_FLAG_CF

#define IA16_FLAG_CF   0x0001

Carry CPU flag bit mask.

Definition at line 63 of file ia16.h.

◆ IA16_FLAG_DF

#define IA16_FLAG_DF   0x0400

Direction CPU flag bit mask.

Definition at line 91 of file ia16.h.

◆ IA16_FLAG_IF

#define IA16_FLAG_IF   0x0200

Interrupt enable CPU flag bit mask.

Definition at line 87 of file ia16.h.

◆ IA16_FLAG_MD

#define IA16_FLAG_MD   0x8000

Mode CPU flag bit mask.

Definition at line 99 of file ia16.h.

◆ IA16_FLAG_OF

#define IA16_FLAG_OF   0x0800

Overflow CPU flag bit mask.

Definition at line 95 of file ia16.h.

◆ IA16_FLAG_PF

#define IA16_FLAG_PF   0x0004

Parity CPU flag bit mask.

Definition at line 67 of file ia16.h.

◆ IA16_FLAG_SF

#define IA16_FLAG_SF   0x0080

Sign CPU flag bit mask.

Definition at line 79 of file ia16.h.

◆ IA16_FLAG_TF

#define IA16_FLAG_TF   0x0100

Single step CPU flag bit mask.

Definition at line 83 of file ia16.h.

◆ IA16_FLAG_ZF

#define IA16_FLAG_ZF   0x0040

Zero CPU flag bit mask.

Definition at line 75 of file ia16.h.

◆ ia16_get_ds

#define ia16_get_ds   __builtin_ia16_near_data_segment

Retrieve the current value of the data segment DS.

Definition at line 201 of file ia16.h.

◆ ia16_get_ss

#define ia16_get_ss   __builtin_ia16_ss

Retrieve the current value of the stack segment SS.

Definition at line 218 of file ia16.h.

◆ IA16_INT_BOUNDS

#define IA16_INT_BOUNDS   5

Array bounds (BOUND) interrupt vector index.

Definition at line 58 of file ia16.h.

◆ IA16_INT_BREAK

#define IA16_INT_BREAK   3

Breakpoint (INT3) interrupt vector index.

Definition at line 50 of file ia16.h.

◆ IA16_INT_DIV

#define IA16_INT_DIV   0

Divide error interrupt vector index.

Definition at line 38 of file ia16.h.

◆ IA16_INT_INTO

#define IA16_INT_INTO   4

Overflow (INTO) interrupt vector index.

Definition at line 54 of file ia16.h.

◆ IA16_INT_NMI

#define IA16_INT_NMI   2

Non-maskable interrupt vector index.

Definition at line 46 of file ia16.h.

◆ IA16_INT_STEP

#define IA16_INT_STEP   1

Single step/break interrupt vector index.

Definition at line 42 of file ia16.h.

◆ ia16_port_inb

#define ia16_port_inb ( port)
Value:
inportb(port)
static uint8_t inportb(uint8_t port)
Read a byte from the given port.
Definition ia16.h:261

Definition at line 315 of file ia16.h.

◆ ia16_port_inw

#define ia16_port_inw ( port)
Value:
inportw(port)
static uint16_t inportw(uint8_t port)
Read a word from the given port.
Definition ia16.h:277

Definition at line 316 of file ia16.h.

◆ ia16_port_outb

#define ia16_port_outb ( value,
port )
Value:
outportb(port, value)
static void outportb(uint8_t port, uint8_t value)
Write a byte to the given port.
Definition ia16.h:293

Definition at line 317 of file ia16.h.

◆ ia16_port_outw

#define ia16_port_outw ( value,
port )
Value:
outportw(port, value)
static void outportw(uint8_t port, uint16_t value)
Write a word to the given port.
Definition ia16.h:307

Definition at line 318 of file ia16.h.

◆ MK_FP

#define MK_FP ( seg,
ofs )
Value:
((void __far*) (((uint16_t) ofs) | (((uint32_t) ((uint16_t) seg)) << 16)))

Create a far pointer from a segment and offset.

Definition at line 180 of file ia16.h.

Typedef Documentation

◆ ia16_int_handler_t

typedef void __far(* ia16_int_handler_t) (void)

Definition at line 353 of file ia16.h.

Function Documentation

◆ ia16_disable_irq()

void ia16_disable_irq ( void )
inlinestatic

Disable jumping to interrupt vectors on an interrupt being received by the CPU.

Definition at line 337 of file ia16.h.

◆ ia16_enable_irq()

void ia16_enable_irq ( void )
inlinestatic

Enable jumping to interrupt vectors on an interrupt being received by the CPU.

Definition at line 330 of file ia16.h.

◆ ia16_get_cs()

__segment ia16_get_cs ( )
inlinestatic

Retrieve the current value of the code segment CS.

Definition at line 189 of file ia16.h.

◆ ia16_get_es()

__segment ia16_get_es ( )
inlinestatic

Retrieve the current value of the data segment ES.

Definition at line 206 of file ia16.h.

◆ ia16_get_flags()

uint16_t ia16_get_flags ( )
inlinestatic

Retrieve the current value of the CPU flag register.

Definition at line 235 of file ia16.h.

◆ ia16_get_sp()

uint16_t ia16_get_sp ( )
inlinestatic

Retrieve the current value of the stack pointer SP.

Definition at line 223 of file ia16.h.

◆ ia16_halt()

void ia16_halt ( void )
inlinestatic

Halt the CPU until an interrupt is received.

Definition at line 323 of file ia16.h.

◆ ia16_int_set_handler()

void ia16_int_set_handler ( uint8_t idx,
ia16_int_handler_t handler )

Register a CPU interrupt handler.

Parameters
idxThe interrupt (IA16_INT_*)
handlerThe interrupt handler function.

◆ ia16_set_flags()

void ia16_set_flags ( uint16_t flags)
inlinestatic

Set the CPU flag register to a new value.

Definition at line 247 of file ia16.h.

◆ inportb()

uint8_t inportb ( uint8_t port)
inlinestatic

Read a byte from the given port.

Parameters
portPort address
Returns
uint8_t The value read.

Definition at line 261 of file ia16.h.

◆ inportw()

uint16_t inportw ( uint8_t port)
inlinestatic

Read a word from the given port.

Parameters
portPort address
Returns
uint8_t The value read.

Definition at line 277 of file ia16.h.

◆ outportb()

void outportb ( uint8_t port,
uint8_t value )
inlinestatic

Write a byte to the given port.

Parameters
portPort address
valueThe value to write.

Definition at line 293 of file ia16.h.

◆ outportw()

void outportw ( uint8_t port,
uint16_t value )
inlinestatic

Write a word to the given port.

Parameters
portPort address
valueThe value to write.

Definition at line 307 of file ia16.h.