Last active
February 12, 2021 12:04
-
-
Save fu-sen/cfc20b850eee53f29dea3bf32f523183 to your computer and use it in GitHub Desktop.
風船 Balloons version 2 MSX-DOS .com version | MSX-DOS / MSX2 / z88dk | download: https://msx.surge.sh/balloons.com | https://msxjpn.jimdofree.com/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0/%E9%A2%A8%E8%88%B9/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Balloons version 2 MSX-DOS .com version | MSX-DOS / MSX2 / z88dk | |
Copyright (c) 2019 Keiichi Shiga (BALLOON | FU-SEN) | |
The MIT License (MIT) - https://mit.balloon.net.eu.org/#2019 | |
zcc +msx -subtype=msxdos -bn balloons.com balloons-dos.c | |
(MSX-DOS 2.30+ set the following: SET EXPERT ON ) | |
--> BALLOONS | |
*/ | |
void wrtvdp(char reg, char data) | |
{ | |
#asm | |
ld ix,0 | |
add ix,sp | |
ld b,(ix+2) ; data | |
ld c,(ix+4) ; reg | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,0047h ; WRTVRM | |
call 001ch ; CALSLT | |
#endasm | |
} | |
void wrtvrm(int addr, char data) | |
{ | |
#asm | |
ld ix,0 | |
add ix,sp | |
ld a,(ix+2) ; data | |
ld l,(ix+4) ; addr | |
ld h,(ix+5) | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,004dh ; WRTVRM | |
call 001ch ; CALSLT | |
#endasm | |
} | |
void filvrm(int addr, int size, char data) | |
{ | |
#asm | |
ld ix,0 | |
add ix,sp | |
ld a,(ix+2) ; data | |
ld c,(ix+4) ; size | |
ld b,(ix+5) | |
ld l,(ix+6) ; addr | |
ld h,(ix+7) | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,0056h ; FILVRM | |
call 001ch ; CALSLT | |
#endasm | |
} | |
void chgclr(char forclr, char bakclr, char bdrclr) | |
{ | |
#asm | |
ld ix,0 | |
add ix,sp | |
ld a,(ix+2) ; BDRCLR | |
ld (0f3ebh),a | |
ld a,(ix+4) ; BAKCLR | |
ld (0f3eah),a | |
ld a,(ix+6) ; FORCLR | |
ld (0f3e9h),a | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,0062h ; CHGCLR | |
call 001ch ; CALSLT | |
#endasm | |
} | |
void init32() | |
{ | |
#asm | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,006fh ; INIT32 | |
call 001ch ; CALSLT | |
#endasm | |
} | |
int chsns() | |
{ | |
#asm | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,009ch ; INIT32 | |
call 001ch ; CALSLT | |
ld l,0 | |
ld h,0 | |
ret z | |
ld l,0ffh | |
#endasm | |
} | |
void cls() | |
{ | |
#asm | |
xor a ; ld a,0 | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,00c3h ; CLS | |
call 001ch ; CALSLT | |
#endasm | |
} | |
void kilbuf() | |
{ | |
#asm | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,0156h ; KILBUF | |
call 001ch ; CALSLT | |
#endasm | |
} | |
void height212() | |
{ | |
#asm | |
ld hl,0ffe8h ; rg9sav | |
set 7,(hl) | |
ld a,(hl) | |
ld b,a | |
ld c,9 ; R#9 | |
ld iy,(0fcc1h-1) ; EXPTBL-1 | |
ld ix,0047h ; WRTVDP | |
call 001ch ; CALSLT | |
#endasm | |
} | |
void poke(int addr, char data) | |
{ | |
#asm | |
ld ix,0 | |
add ix,sp | |
ld a,(ix+2) ; data | |
ld l,(ix+4) ; addr | |
ld h,(ix+5) | |
ld (hl),a | |
#endasm | |
} | |
int peek(int addr) | |
{ | |
#asm | |
ld a,(hl) | |
ld l,a | |
ld h,0 | |
#endasm | |
} | |
unsigned int r; | |
unsigned char rnd() | |
{ | |
r=(r*5)+1; | |
return(r); | |
} | |
char balloon[8] = {0x38,0x74,0xfa,0xfe,0xfe,0x7c,0x38,0x10}; | |
char ribbon[8] = {0x10,0x08,0x08,0x10,0x10,0x08,0x08,0x10}; | |
int s=0,y=27; | |
void main() | |
{ | |
kilbuf(); | |
r=peek(0xfc9e); | |
chgclr(15, 1, 1); | |
init32(); | |
height212(); | |
cls(); | |
filvrm(0x1800+24*32, 32*8, 32); | |
for(int c=2; c<16; c++){ | |
for(int d=0;d<8;d++){ | |
wrtvrm((120+c*8)*8+d, balloon[d]); | |
} | |
wrtvrm(0x2000+(120/8)+c, c*16+1); | |
} | |
for(int d=0;d<8;d++){ | |
wrtvrm(248*8+d, ribbon[d]); | |
} | |
while(!chsns()){ | |
int c=rnd()%14+1; | |
int x=rnd()%30+1; | |
int temp=rnd(); | |
wrtvrm(0x1800+y*32+x, 128+c*8); | |
for(int ss=0; ss<8; ss++){ | |
wrtvdp(23, s+ss); | |
int tim=peek(0xfc9e); | |
while(peek(0xfc9e)==tim && !chsns()) ; | |
} | |
s=(s+8)%256; | |
wrtvdp(23, s); | |
y=(y+1)%32; | |
filvrm(0x1800+y*32, 32, 32); | |
wrtvrm(0x1800+y*32+x, 248); | |
} | |
chgclr(15, 4, 7); | |
init32(); | |
kilbuf(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment