Last active
April 19, 2025 02:21
-
-
Save fu-sen/aa472e46843a349ccfbc6bde6fdfd86e to your computer and use it in GitHub Desktop.
MSX2+ YJK Colors | MSX-BASIC 3.0+ (MSX2+/turbo R) / z88dk https://msxjpn.jimdofree.com/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0/yjk-%E8%A1%A8%E7%A4%BA/
This file contains hidden or 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
/* | |
MSX2+ YJK colors | MSX2+ / z88dk | |
Copyright (c) 2019-2024 BALLOON | FU-SEN | |
The MIT License (MIT) - https://mit.balloon.net.eu.org/#2019-2024 | |
zcc +msx -lndos -create-app -subtype=disk -bn yjkcolor yjkcolor.c | |
--> BLOAD"YJKCOLOR.MSX",R | |
*/ | |
void ldirvm(int addr, int vaddr, int size) | |
{ | |
#asm | |
ld ix,0 | |
add ix,sp | |
ld c,(ix+2) ; size | |
ld b,(ix+3) | |
ld e,(ix+4) ; vaddr | |
ld d,(ix+5) | |
ld l,(ix+6) ; addr | |
ld h,(ix+7) | |
call 005ch ; LDIRVM | |
#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 ix,0111h ; CHGCLR | |
call 015fh ; EXTROM | |
#endasm | |
} | |
void chgmdp(char mode) | |
{ | |
#asm | |
ld a,l ; mode | |
ld ix,01b5h ; CHGMDP | |
call 015fh ; EXTROM | |
#endasm | |
} | |
void screen12() | |
{ | |
#asm | |
ld hl,0fffah ; rg25sa | |
res 4,(hl) | |
set 3,(hl) | |
ld a,(hl) | |
ld b,a | |
ld c,25 ; R#25 | |
call 0047h ; WRTVDP | |
#endasm | |
} | |
int gttrig(char num) | |
{ | |
#asm | |
ld a,l ; num | |
call 00d8h ; GTTRIG | |
ld l,a | |
ld h,0 | |
#endasm | |
} | |
char buf[256]; | |
void main() | |
{ | |
int c=15; | |
chgmdp(8); | |
screen12(); | |
chgclr(255, 0, 0); | |
c=c<<3; | |
for (int x=0; x<256; x+=4) { | |
int j=x*64/256-32; | |
buf[x+2]=c|j&7; | |
buf[x+3]=c|j>>3&7; | |
} | |
for (int k=-32; k<32; k++) { | |
int y=(k+32)*212/64; | |
for (int x=0; x<256; x+=4) { | |
buf[x] =c|k&7; | |
buf[x+1]=c|k>>3&7; | |
} | |
ldirvm(buf,y*256,256); | |
ldirvm(buf,(y+1)*256,256); | |
ldirvm(buf,(y+2)*256,256); | |
ldirvm(buf,(y+3)*256,256); | |
} | |
while (! gttrig(0)); | |
} |
Author
fu-sen
commented
Dec 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment