初代PC-6001(32K)でセミグラフィックその2

前回BASIC+セミグラフィックライブラリーでプログラミングしたものの速度が遅すぎました。

ここらへんを参考にカセットポンで動くバイナリをHI-TECH Cでつくってみました。

http://www.geocities.jp/submarine600/html/p6/demo9.html

f:id:tanam:20160620113731p:image:w360

サンプルプログラム

CPM ZAS -OCRT0.O CRT0.ASM
CPM C -V -C HELLO.C
CPM LINK -MHELLO.MAP -Z -C4000H -Ptext=4000H -OHELLO.BIN CRT0.O HELLO.OBJ LIBC.LIB

CRT0.ASM

;
;	crt0 routine
;
psect	text
global	_main
_crt0:
	defb	41h,42h,04h,40h
	di
	jp	_main

HELLO.C

char number[][6]={
{0x3A,0x30,0x2A,0x2C,0x0C,0x28},
{0x00,0x2A,0x00,0x00,0x28,0x00},
{0x33,0x33,0x2A,0x2C,0x0C,0x08},
{0x33,0x33,0x2A,0x0C,0x0C,0x28},
{0x2A,0x15,0x00,0x30,0x34,0x20},
{0x3B,0x33,0x22,0x0C,0x0C,0x28},
{0x3B,0x33,0x22,0x2C,0x0C,0x28},
{0x30,0x30,0x2A,0x00,0x00,0x28},
{0x3B,0x33,0x2A,0x2C,0x0C,0x28},
{0x3B,0x33,0x2A,0x0C,0x0C,0x28},
};

char alpha[][6]={
{0x3A,0x30,0x2A,0x38,0x30,0x28},
{0x3B,0x33,0x08,0x2C,0x0C,0x20},
{0x3A,0x30,0x20,0x2C,0x0C,0x08},
{0x3A,0x30,0x0A,0x2C,0x0C,0x20},
{0x3B,0x33,0x20,0x2C,0x0C,0x08},
{0x3B,0x33,0x20,0x28,0x00,0x00},
{0x3A,0x33,0x22,0x2C,0x0C,0x28},
{0x2B,0x03,0x2A,0x28,0x00,0x28},
{0x10,0x3A,0x00,0x04,0x2C,0x00},
{0x00,0x00,0x2A,0x2C,0x0C,0x28},
{0x2B,0x06,0x20,0x28,0x10,0x08},
{0x2A,0x00,0x00,0x2C,0x0C,0x08},
{0x2E,0x06,0x2A,0x28,0x00,0x28},
{0x2E,0x02,0x2A,0x28,0x10,0x28},
{0x3A,0x30,0x2A,0x2C,0x0C,0x28},
{0x3B,0x33,0x2A,0x28,0x00,0x00},
{0x3A,0x30,0x2A,0x2C,0x18,0x08},
{0x3B,0x33,0x2A,0x28,0x10,0x08},
{0x3B,0x33,0x22,0x0C,0x0C,0x28},
{0x30,0x3A,0x20,0x00,0x28,0x00},
{0x2A,0x00,0x2A,0x2C,0x0C,0x28},
{0x29,0x01,0x28,0x10,0x18,0x00},
{0x2A,0x02,0x2A,0x2C,0x24,0x28},
{0x24,0x06,0x20,0x18,0x10,0x08},
{0x24,0x06,0x20,0x00,0x28,0x00},
{0x30,0x36,0x20,0x1C,0x0C,0x08},
{0x3F,0x3F,0x3F,0x3F,0x3F,0x3F},
{0x7F,0x7F,0x7F,0x7F,0x7F,0x7F},
{0xBF,0xBF,0xBF,0xBF,0xBF,0xBF},
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}
};

int main(int ac, char **av)
{
    int i;
    char *v=(char *)0x8000;
    char *d=(char *)0x8200;
    for(i=0; i<0x200; i++) {
        if (i<0x100) *v++=0x60;
        else *v++=0x62;
        *d++=0x00;
    }
    d=(char *)0x8240;
    for(i=0; i<10; i++) {
        *v++=number[i][0];
        *v++=number[i][1];
        *v++=number[i][2];
        v+=0x1d;
        *v++=number[i][3];
        *v++=number[i][4];
        *v++=number[i][5];
        v-=0x20;
        *d++=alpha[i][0];
        *d++=alpha[i][1];
        *d++=alpha[i][2];
        d+=0x1d;
        *d++=alpha[i][3];
        *d++=alpha[i][4];
        *d++=alpha[i][5];
        d-=0x20;
    }
    v=(char *)0x8280;
    d=(char *)0x82C0;
    for(i=0; i<10; i++) {
        *v++=alpha[i+10][0];
        *v++=alpha[i+10][1];
        *v++=alpha[i+10][2];
        v+=0x1d;
        *v++=alpha[i+10][3];
        *v++=alpha[i+10][4];
        *v++=alpha[i+10][5];
        v-=0x20;
        *d++=alpha[i+20][0];
        *d++=alpha[i+20][1];
        *d++=alpha[i+20][2];
        d+=0x1d;
        *d++=alpha[i+20][3];
        *d++=alpha[i+20][4];
        *d++=alpha[i+20][5];
        d-=0x20;
    }
    memcpy(0x8300,0x8200,0x100);
#asm
    halt
#endasm
}