コード例 #1
0
ファイル: test.c プロジェクト: verfum/c2tzx
void ezPrintPattern(unsigned char pat, unsigned char x, unsigned char y)
{
   pat;
   x;
   y;

   _asm

// Work out first byte 40, 48, 50
   ld a, 6(ix)
   and #24
   ld b, #64 //Never changes form #64
   add a,b
   ld h,a
   // **** first byte in h ***

// Third nybble
   ld a, 6(ix)
   and #7
   add a,a
   ld b,a
   ld a, 5(ix)
   //and #16
   rrc a
   rrc a
   rrc a
   rrc a
   add a,b
   rlc a
   rlc a
   rlc a
   rlc a
   ld b,a
   // answer in b

// Fourth nybble
   ld a,5(ix)
   and #15
   // answer in a
   or b
   // second byte in a
   ld l,a
   // *** second byte in l ***

   ld b, #8
   ld a, 4(ix) // Print pattern
p_loop:
   ld (hl),a
   inc h

   djnz p_loop

   _endasm;

}
コード例 #2
0
ファイル: psg.c プロジェクト: retrodeluxe/rlengine-msx1
/*
 * set envelope period and shape,
 *
 * EP = R12 * 256 + R11
 *
 * T = (256 * EP) / fc
 *	 = (256 * EP) / 1.787725 [MHz]
 *	 = 143.03493  * EP [micro second]
 *
 * shape is 4 bit and corresponds to:
 *
 *         -------------------------------------------------
 * R13    |  x     x       x    x  | B3  | B2  | B1  | B0  |
 *         -------------------------------------------------
 *                                           |
 *       ------------------------------------+
 *       |
 *       V
 * ---------------------------------------------------------
 * |                     |    :\                           |
 * |   0   0    x    x   |  __:  \______________________   |
 * |                     |                                 |
 * |                     |      /:                         |
 * |   0   1    x    x   |  __/  :______________________   |
 * |                     |                                 |
 * |                     |    :\  :\  :\  :\  :\  :\  :\   |
 * |   1   0    0    0   |  __:  \:  \:  \:  \:  \:  \:_   |
 * |                     |                                 |
 * |                     |    :\                           |
 * |   1   0    0    1   |  __:  \______________________   |
 * |                     |                                 |
 * |                     |    :\     / \     / \     / \   |
 * |   1   0    1    0   |  __:  \ /     \ /     \ /       |
 * |                     |        _____________________    |
 * |                     |    :\  :                        |
 * |   1   0    1    1   |  __:  \:                        |
 * |                     |                                 |
 * |                     |      /:  /:  /:  /:  /:  /:     |
 * |   1   1    0    0   |  __/  :/  :/  :/  :/  :/  :/    |
 * |                     |        ______________________   |
 * |                     |      /                          |
 * |   1   1    0    1   |  __/                            |
 * |                     |                                 |
 * |                     |      / \     / \     / \        |
 * |   1   1    1    0   |  __/     \ /     \ /     \ /    |
 * |                     |                                 |
 * |                     |      /:                         |
 * |   1   1    1    1   |  __/  :______________________   |
 * |                     |                                 |
 * ---------------------------------------------------------
 *                           |   |
 *                           +---+
 *                             T
 *
 */
void psg_set_envelope(unsigned int period, byte shape)
{
    period;
    shape;

    __asm
    ld l,4(ix)
    ld h,5(ix)
    ld b,6(ix)
    ld c,psg_set
    ld a,#11
    out (c),a
    inc c
    out (c),l
    dec c
    inc a
    out (c),a
    inc c
    out (c),h
    dec c
    inc a
    out (c),a
    inc c
    out (c),b
    __endasm;
}
コード例 #3
0
ファイル: blk_out_inst.c プロジェクト: lipro/tv80
char cksum_up (char *buf, char len) {
  // pointer should be in 4(ix) and 5(ix), length in 6(ix)
  cksum_value = 0;
  _asm
    ld   l, 4(ix)
    ld   h, 5(ix)
    ld   b, 6(ix)
    ld   c, #_cksum_accum
    otir
    in   a, (_cksum_value)
    ld   l, a
  _endasm;
}
コード例 #4
0
ファイル: bios.c プロジェクト: 128keaton/ltdc
void SetScreenColor(u8 text, u8 back, u8 border)
{
	text; back; border;
	__asm
		ld		a,4(ix)
		ld		(FORCLR),a
		ld		a,5(ix)
		ld		(BAKCLR),a
		ld		a,6(ix)
		ld		(BDRCLR),a
		call	CHGCLR
	__endasm;
}
コード例 #5
0
ファイル: blk_out_inst.c プロジェクト: lipro/tv80
char cksum_dn (char *buf, char len) {
  // pointer should be in 4(ix) and 5(ix), length in 6(ix)
  cksum_value = 0;
  //buf += BUF_SIZE-1;
  _asm
    ld   de, #127
    ld   l, 4(ix)
    ld   h, 5(ix)
    add  hl, de
    ld   b, 6(ix)
    ld   c, #_cksum_accum
    otdr
    in   a, (_cksum_value)
    ld   l, a
  _endasm;
}
コード例 #6
0
ファイル: bios.c プロジェクト: 128keaton/ltdc
// Files
void LoadToVRAM(const char* filename, u16 x, u16 y)
{
	filename; x; y;
	//subRom.SX = (u16)filename; 
	//subRom.SY = 0; 
	//subRom.DX = x; 
	//subRom.DY = y; 
	//subRom.NX = 0; 
	//subRom.NY = 0; 
	//subRom.CLR = 0;
	//subRom.ARG = 0;
	//subRom.CMD = 0;

#define EXTROM  #0x015F
#define BLTVD   #0x019D
#define SX		#0xF562 // X-coordinate of the source
#define SY		#0xF564 // Y-coordinate of the source
#define DX		#0xF566 // X-coordinate of the destination
#define DY		#0xF568 // Y-coordinate of the destination
#define NX		#0xF56A // number of dots in the X direction
#define NY		#0xF56C // number of dots in the Y direction
#define CDUMMY	#0xF56E // dummy (not required to be set)
#define ARG		#0xF56F // selects the direction and expansion RAM (same as VDP R#45)
#define LOGOP	#0xF570 // logical operation code (same as the logical operation code of VDP) 

	__asm
		;// Init data
		ld		l,4(ix)
		ld		h,5(ix)
		ld		(SX), hl
		ld		l,6(ix)
		ld		h,7(ix)
		ld		(DX), hl
		ld		l,8(ix)
		ld		h,9(ix)
		ld		(DY), hl
		xor		a 
		ld		(ARG), a ;// ARG doit toujours être mis à zéro !!!
		ld		(LOGOP), a ;// Idem LOGOP
		;// Call BLTVD function
		di
		ld		hl, #0xF562
		ld		ix, BLTVD
		call	EXTROM
		ei
	__endasm;
}
コード例 #7
0
ファイル: blk_out_inst.c プロジェクト: lipro/tv80
char cksum_up_sn (char *buf, char len) {
  // pointer should be in 4(ix) and 5(ix), length in 6(ix)
  cksum_value = 0;

  _asm
    ld   l, 4(ix)
    ld   h, 5(ix)
    ld   b, 6(ix)
    ld   c, #_cksum_accum
    ld   a, #0

cksum_up_sn_loop:
    outi
    cp   b
    jp   nz, cksum_up_sn_loop

    in   a, (_cksum_value)
    ld   l, a
  _endasm;
}
コード例 #8
0
ファイル: psg.c プロジェクト: retrodeluxe/rlengine-msx1
void psg_set_tone(unsigned int period, byte chan)
{
    period;
    chan;

    __asm
    ld l,4(ix)
    ld h,5(ix)
    ld c,psg_set
    ld a,6(ix)
    sla a
    ld b,a
    out (c),a
    inc c
    out (c),l
    dec c
    ld a,b
    inc a
    out (c),a
    inc c
    out (c),h
    __endasm;

}
コード例 #9
0
ファイル: test.c プロジェクト: verfum/c2tzx
void ezPrintChar(unsigned char ch, unsigned char x, unsigned char y)
{
   ch;
   x;
   y;

   _asm

   jp vlaa

mult:
   ld hl,#0
   ld a,b
   or a
   ret z
   ld d,#0
   ld e,c
clappa:
   add hl,de
   djnz clappa
   ret

vlaa:
   ld b, #8
   ld c, 4(ix)//char
   call mult
   ld b, h
   ld c, l

   ld hl, #0x3c00
   add hl,bc


   ld d,h
   ld e,l

// Work out first byte 40, 48, 50
   ld a, 6(ix)
   and #24
   ld b, #64 //Never changes form #64
   add a,b
   ld h,a
   // **** first byte in h ***

// Third nybble
   ld a, 6(ix)
   and #7
   add a,a
   ld b,a
   ld a, 5(ix)
   //and #16
   rrc a
   rrc a
   rrc a
   rrc a
   add a,b
   rlc a
   rlc a
   rlc a
   rlc a
   ld b,a
   // answer in b

// Fourth nybble
   ld a,5(ix)
   and #15
   // answer in a
   or b
   // second byte in a
   ld l,a
   // *** second byte in l ***

   ld b, #8
loop:
   ld a, (de)
   ld (hl),a
   inc h

   inc de
   djnz loop

   _endasm;

}