Skip to content

Instantly share code, notes, and snippets.

@fu-sen
Last active April 19, 2025 02:15
Show Gist options
  • Save fu-sen/e5d6e4282109044681fd08e07d310212 to your computer and use it in GitHub Desktop.
Save fu-sen/e5d6e4282109044681fd08e07d310212 to your computer and use it in GitHub Desktop.
Pi Boot (Rainbow colored screen like Raspberry Pi boot) | 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/
/*
Pi Boot (Rainbow colored screen like Raspberry Pi boot) | 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 piboot piboot.c
--> BLOAD"PIBOOT.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 cls()
{
#asm
xor a ; Clear Z flag
call 00c3h ; CLS
#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[192] = { 0 };
void main()
{
int c=15;
chgmdp(8);
screen12();
chgclr(255, 0, 0);
cls();
c=c<<3;
for (int x=0; x<192; x+=4) {
int k=x*64/192-32;
buf[x] =c|k&7;
buf[x+1]=c|k>>3&7;
}
for (int j=-32; j<32; j++) {
int y=106-(j+1)*212/64;
for (int x=0; x<192; x+=4) {
buf[x+2]=c|j&7;
buf[x+3]=c|j>>3&7;
}
ldirvm(buf, y*256+32,192);
ldirvm(buf,(y+1)*256+32,192);
ldirvm(buf,(y+2)*256+32,192);
ldirvm(buf,(y+3)*256+32,192);
}
while (! gttrig(0));
}
@fu-sen
Copy link
Author

fu-sen commented Dec 29, 2024

piboot_0000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment