PB - 1000
 

 

Site Home

PB-1000 Home

Informations

The ASM codes

The Memory

The Disassembler

Programs

Hardware

Description of differents assembler instructions types

 

The PB-1000 assembler instructions uses between 1 and 4 bytes. The signification of each byte can be different according to the instruction type
For each instruction, the first byte is invariable and allows identifying. the instruction, others bytes differs according to parameters used by the instruction.

Some NOT PUBLISHED informations are explained here !

9 differents types of instructions exists.

WARNING
Some instructions can have an extra byte from CASIO documentation. It represents a relative jump (JR +/- C7) which will be executed just AFTER the next instruction. In this case, one of the bit of one of the instruction byte will be set to 1 instead of 0. Types 2, 4 and 5 are concerned.

CONVENTIONS :
$c5 : register number (5 bit code: 0 to 31)
C7 : 7 bits numeric value (0 to 127)
C8 or n : 8bits numeric value (0 à255)
+/- : sign bit : 0 = '+' ; 1 = '-'

bits of Byte will be written from MSB to LSB from left to right:

bit nb.
7
6
5
4
3
2
1
0
calc.
2^7
2^6
2^5
2^4
2^3
2^2
2^1
2^0
value
128
64
32
16
8
4
2
1

 

TYPE 1

- 1 byte , no parameter
- Codes concerned: &HD8,&HD9,&HF0 à&HFF

byte 1
xxxx xxxx
code


TYPE 2

Can use 2 or 3 bytes

- 2 bytes instruction:

byte 1 byte 2
xxxx xxxx 0 op xxxxx
code 0 op $C5


1st byte : instruction code

2nd byte :

bit 7 : 0
bits 5 et 6 : OP code (see codes list)
bits 0 a 4 : $C5

Concerned codes :
&H14-&H1F , &H26, &H27, &H2E, &H2F, &H96-&H9F, &HA6, &HA7, &HAE,&HAF, &HDC, &HDD

 

- Use 3 bytes if 7 th bit of 2 nd byte set to 1 instead of 0:

Then, the 3rd byte represent a relative jump: JR +/- C7

byte 1 byte 2 byte 3
xxxx xxxx 1-xx-x xxxx xxx xxx
code 1 - op - $C5 C7


1st byte : instruction code
2nd byte :

bit 7 : 0
bits 5 et 6 : OP code (see codes list)
bits 0 a 4 : $C5

3rd byte :

bit 8 : jump sign : 0 = '+' ; 1= '-'
bits 0 to 6 : C7 jump value


TYPE 3

Use 2 bytes:

byte 1 byte 2
xxxx xxxx xxxxxxx
code C7


1er byte : instruction code

2nd byte :

bit 7 : sign (+/-) 0 = '+' ; 1 = '-'
bits 0 à 6 : C7

concerned codes : &H5C, &H5D, &HB0-&HB5, &HB7


TYPE 4
Use 2 ou 3 bytes:

- Use 3 bytes (if bits 5 and 6 of 2 nd byte set to 1)

Instruction neaning: LD $C5,(IX+/-$C5)

byte 1 byte 2 byte 3
xxxx xxxx x 11 xxxxx 000 xxxxx
code 11 $C5 000 $C5

codes concerned:
&H20-&H25, &H28-&H2D, &H38-&H3F &HA0-&HA5, &HA8-&HAD, &HB8-&HBF

OR

byte 1 byte 2 byte 3
xxxx xxxx 0 11 xxxxx 000 xxxxx
code 0 11 $C5 000 $C5

codes concerned: &H00-&H11, &H80-&H91.

- Use 2 bytes (if bits 5 and 6 of 2 nd byte are différents from 11).
Then, the value of the 3 rd lacking byte is indicated by bits 5 and 6 of 2nd byte.

byte 1 byte 2
xxxx xxxx op xxxx
code op $c5

op signification
0 0 &H00
0 1 &H01
1 0 $0

 

- Use 3 bytes (with JR +/- C7) if bit 7 of 2 nd byte set to 1 instead of 0.

Concerned codes &H00-&H11 et &H80-&H91

byte 1 byte 2 byte 3
xxxx xxxx 1 xx xxxxx xxxxxxx
code 1 op $c5 C7

op
signification
00
&H00
01
&H01
10
$0

TYPE 5

Can use 3 or 4 bytes:

- Use 3 bytes

Codes concerned: &H40-&H4F,&H60-&H63,&H68-&H6B,&H64,&H65,&H6C,&H6D,&H78-&H7F.

- if code &H40-&H4F : [ LD $C5, n ]

byte 1 byte 2 byte 3
xxxx xxxx 0 op xxxxx xxxx xxxx
code 0 00 $c5 n

- if code &H60-&H63, &H68-&H6B, &H78-&H7F... :
[ LD $C5, (IX +/- n) ] .

byte 1 byte 2 byte 3
xxxx xxxx 00 xxxxx xxxx xxxx
code 00 $c5 n

- Use 4 bytes if:

- code : &H40-&H4F AND bit 7 of 2nd byte set to 1

Then le 4 th byte represents a relative jump:
[JR +/- C7]

byte 1 byte 2 byte 3 byte 4
xxxx xxxx 1 op xxxxx xxxx xxxx xxxxxxx
code 1 00 $c5 c8 C7

 


TYPE 6


Use 3 bytes:

Concerned codes: &H30-&H35,&H37,+&H36?,&H70-&H75,&H77,+&H76?
ex: JP Z,m ou CAL Z,m

byte 1 byte 2 byte 3
xxxx xxxx xxxx xxxx xxxx xxxx
code adr. Low adr. High

 


TYPE 7

Use 3 bytes

concerned codes: &H56,&H57

byte 1 byte 2 byte 3
xxxx xxxx 0 op 00000 xxxx xxxx
code 0 op 00000 c8

op signification : see codes list


TYPE 8


Use 4 bytes

ONLY code concerned: &HD1 : LDW $C5,(ADR)

byte 1 byte 2 byte 3 byte 4
xxxx xxxx 000 xxxxx xxxx xxxx xxxx xxxx
code 000 $c5 adr. Low adr. High

TYPE 9


Use 4 bytes
Codes concerned: &HD6, &HD7

byte 1 byte 2 byte 3 byte 4
xxxx xxxx 0 op 0 0000 xxxx xxxx xxxx xxxx
code 0 op 0 0000 adr. Low adr. High


op signification : see codes list

 

 


Airbug.two 2002