VOOZH about

URL: https://qiita.com/Stosstruppe/items/5866def3b7aa186bcdb7

⇱ MSX PSG #Z80 - Qiita


👁 Image
2

Go to list of users who liked

1

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@Stosstruppe

MSX PSG

2
Posted at

z88dkのzccでMSX PSGを鳴らす。

tone.c
/*
zcc +msx -lndos -create-app tone.c
bload"cas:",r
*/

# include <stdio.h>
# include <psg.h>

# define BOOL int
# define FALSE 0
# define TRUE 1

int snsmat(int line)
{
# asm
 ld a, l
 call $0141 ; SNSMAT
 ld l, a
 ld h, 0
# endasm
}

void main()
{
 BOOL press = FALSE;

 psg_init();
 sound(7, 076); // ch.A tone enable

 puts("Press A key.\n");

 for (;;) {
 int bits = snsmat(2);
 if (bits & 0x40) {
 if (press) {
 sound(8, 0);
 press = FALSE;
 }
 } else {
 if (! press) {
 sound(0, 0xfe);
 sound(1, 0);
 sound(8, 12);
 press = TRUE;
 }
 }
 }
}

WebMSXのCassetteにa.casをドロップする。

2

Go to list of users who liked

1
0

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2

Go to list of users who liked

1