Import Amiga applications and desktop tools

This commit is contained in:
Alberto committed 2026-11-11 16:21:50 +01:00
commit 1c144c9a3c
347 files changed
+423483

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
# AmberMonitor
Sorgenti raccolti da work/sysmon. Binario installato conservato in dist/Monitor; risorse in assets.
Build: ./build.ps1 -Toolchain <VBCC/VASM/VLINK + NDK m68k-amigaos>.
Gli script originali sono conservati senza modificarne i percorsi: alcuni generatori leggono C:/Amiga o font Windows. Il binario presente in dist e quello effettivamente installato; il sorgente raccolto e la versione locale piu recente.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
param([string]$Toolchain = $env:AMIGA_TOOLCHAIN)
$ErrorActionPreference = 'Stop'
if (!$Toolchain) { throw 'Specificare -Toolchain con la cartella che contiene bin e targets/m68k-amigaos.' }
$Toolchain = (Resolve-Path -LiteralPath $Toolchain).Path
$targetPath = Join-Path $Toolchain 'targets/m68k-amigaos'
$buildPath = Join-Path $PSScriptRoot 'build'
$configPath = Join-Path $buildPath 'vbcc'
New-Item -ItemType Directory -Path (Join-Path $configPath 'config') -Force | Out-Null
$config = [IO.File]::ReadAllText((Join-Path $PSScriptRoot 'vbcc-config.in')).Replace('@TARGET@', $targetPath.Replace('\','/'))
[IO.File]::WriteAllText((Join-Path $configPath 'config/boing'), $config)
$previousVBCC = $env:VBCC
$previousPath = $env:PATH
try {
$env:VBCC = $configPath
$env:PATH = (Join-Path $Toolchain 'bin') + ';' + $env:PATH
Push-Location -LiteralPath $PSScriptRoot
try {
& (Join-Path $Toolchain 'bin/vc.exe') +boing -O2 -c99 -o build/Monitor monitor.c
if ($LASTEXITCODE -ne 0) { throw 'Compilazione fallita.' }
Copy-Item -LiteralPath assets/face.bin,assets/font.bin,assets/Monitor.info -Destination $buildPath -Force
} finally { Pop-Location }
} finally {
$env:VBCC = $previousVBCC
$env:PATH = $previousPath
}
Write-Output ('Pronto per Amiga: ' + $buildPath)
+1
View File
@@ -0,0 +1 @@
static UBYTE colors[][3]={{20,19,16},{236,220,189},{255,183,66},{100,72,34},{48,35,18},{197,145,66},{113,212,135},{41,77,48},{235,102,57},{165,139,95},{94,75,45},{76,64,44},{71,57,35},{67,59,43},{69,53,31},{67,54,33},{67,51,30},{63,51,32},{53,47,32},{35,46,36},{35,45,35},{34,44,34},{44,37,25},{32,29,22},{30,27,21},{28,26,20},{26,27,21},{28,25,20},{27,25,21},{27,25,20},{27,25,19},{26,25,20},{27,24,19},{26,24,19},{26,23,18},{24,23,18},{23,22,18},{22,20,17},{21,20,17},{21,19,16},{20,19,17},{20,19,16},{20,19,15},{18,20,17},{19,19,17},{19,18,15},{18,18,15},{17,17,14},{15,18,16},{15,18,15},{15,17,16},{14,17,15},{13,17,14},{13,16,15},{13,16,14},{12,16,14},{15,15,13},{13,15,14},{13,15,13},{12,15,13},{14,14,13},{12,13,13},{10,13,12},{6,9,10}};
BIN
View File
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
from PIL import Image,ImageDraw,ImageFont
from pathlib import Path
import math
p=Path(__file__).parent;S=2
im=Image.new('RGB',(520*S,470*S),'#141310');d=ImageDraw.Draw(im)
def box(b,fill,outline=None):d.rounded_rectangle(tuple(int(v*S) for v in b),radius=7*S,fill=fill,outline=outline,width=S)
def txt(x,y,t,size,c):d.text((x*S,y*S),t,font=ImageFont.truetype('C:/Windows/Fonts/consola.ttf',size*S),fill=c)
txt(22,12,'AMBER / SYSTEM MONITOR',18,'#edc37d');txt(23,36,'VIRTUAL MACHINE TELEMETRY',8,'#907751')
box((14,60,204,225),'#1b1914','#66502e');box((216,60,506,225),'#0d100e','#51452d')
txt(32,72,'PROCESSOR LOAD',10,'#bda579');txt(230,72,'CPU HISTORY / 60 s',10,'#bda579')
for x in range(232,491,26):d.line((x*S,99*S,x*S,202*S),fill='#263126',width=S)
for y in range(100,203,25):d.line((232*S,y*S,492*S,y*S),fill='#263126',width=S)
for i in range(41):
a=math.radians(225+i*270/40)
x=109+math.sin(a)*70;y=153-math.cos(a)*70
xx=109+math.sin(a)*79;yy=153-math.cos(a)*79
d.line((int(x*S),int(y*S),int(xx*S),int(yy*S)),fill='#524024',width=3*S)
txt(40,204,'0',8,'#9c8258');txt(160,204,'100',8,'#9c8258')
box((14,237,506,325),'#1b1914','#66502e');txt(26,245,'CHIP RAM',10,'#bda579');txt(270,245,'FAST RAM',10,'#bda579')
box((14,337,506,456),'#10120f','#51452d');txt(26,345,'EXEC TASKS',10,'#bda579')
im=im.resize((520,470),Image.Resampling.LANCZOS)
base=[(20,19,16),(236,220,189),(255,183,66),(100,72,34),(48,35,18),(197,145,66),(113,212,135),(41,77,48),(235,102,57)]
pal=im.quantize(colors=55).getpalette()[:55*3];colors=base+[tuple(pal[i:i+3]) for i in range(0,len(pal),3)]
pi=Image.new('P',(1,1));pi.putpalette(sum(map(list,colors),[])+[0]*(768-len(colors)*3))
(p/'face.bin').write_bytes(im.quantize(palette=pi,dither=Image.Dither.NONE).tobytes())
(p/'colors.h').write_text('static UBYTE colors[][3]={'+','.join('{%d,%d,%d}'%c for c in colors)+'};\n')
im.save(p/'preview.png')
+26
View File
@@ -0,0 +1,26 @@
from PIL import Image,ImageDraw,ImageFont
from pathlib import Path
import math
p=Path(__file__).parent;S=2
im=Image.new('RGB',(520*S,336*S),'#141310');d=ImageDraw.Draw(im)
def box(b,fill,outline=None):d.rounded_rectangle(tuple(int(v*S) for v in b),radius=7*S,fill=fill,outline=outline,width=S)
def txt(x,y,t,size,c):d.text((x*S,y*S),t,font=ImageFont.truetype('C:/Windows/Fonts/consola.ttf',size*S),fill=c)
txt(22,12,'SYSTEM MONITOR',18,'#edc37d');txt(23,36,'VIRTUAL MACHINE TELEMETRY',8,'#907751')
box((14,60,204,225),'#1b1914','#66502e');box((216,60,506,225),'#0d100e','#51452d')
txt(230,72,'CPU HISTORY / 60 s',10,'#bda579')
for x in range(232,491,26):d.line((x*S,99*S,x*S,202*S),fill='#263126',width=S)
for y in range(100,203,25):d.line((232*S,y*S,492*S,y*S),fill='#263126',width=S)
points=[]
for i in range(271):
a=math.radians(225+i)
points.append((int((109+math.sin(a)*70)*S),int((148-math.cos(a)*70)*S)))
d.line(points,fill='#43331e',width=9*S)
txt(40,204,'0',8,'#9c8258');txt(160,204,'100',8,'#9c8258')
box((14,237,506,325),'#1b1914','#66502e');txt(26,245,'CHIP RAM',10,'#bda579');txt(270,245,'FAST RAM',10,'#bda579')
im=im.resize((520,336),Image.Resampling.LANCZOS)
base=[(20,19,16),(236,220,189),(255,183,66),(100,72,34),(48,35,18),(197,145,66),(113,212,135),(41,77,48),(235,102,57)]
pal=im.quantize(colors=55).getpalette()[:55*3];colors=base+[tuple(pal[i:i+3]) for i in range(0,len(pal),3)]
pi=Image.new('P',(1,1));pi.putpalette(sum(map(list,colors),[])+[0]*(768-len(colors)*3))
(p/'face.bin').write_bytes(im.quantize(palette=pi,dither=Image.Dither.NONE).tobytes())
(p/'colors.h').write_text('static UBYTE colors[][3]={'+','.join('{%d,%d,%d}'%c for c in colors)+'};\n')
im.save(p/'preview.png')
+22
View File
@@ -0,0 +1,22 @@
from pathlib import Path
from PIL import Image,ImageDraw,ImageFont
import struct
p=Path('C:/Amiga/HD0/Utilities/AmberMonitor')
h=bytearray(Path('C:/Amiga/HD0/System/Shell.info').read_bytes()[:78])
def u16(n):return struct.pack('>H',n)
def u32(n):return struct.pack('>I',n&0xffffffff)
h[12:16]=u16(48)+u16(40);h[16:18]=u16(6);h[48]=3
for off in (22,26):h[off:off+4]=u32(1)
for off in (44,50,54,66,70):h[off:off+4]=u32(0)
h[58:66]=u32(-1)+u32(-1);h[74:78]=u32(65536)
data=bytearray(h)
for selected in (False,True):
im=Image.new('P',(48,40),0);d=ImageDraw.Draw(im)
d.rounded_rectangle((2,1,45,35),radius=3,fill=2,outline=1 if selected else 3,width=2)
for x,height in [(8,6),(14,12),(20,9),(26,19),(32,14),(38,23)]:d.rectangle((x,30-height,x+3,30),fill=3 if height<20 else 1)
d.line((6,32,41,32),fill=1);d.rectangle((18,36,30,38),fill=3)
data+=u16(0)+u16(0)+u16(48)+u16(40)+u16(2)+u32(1)+bytes([3,0])+u32(0)
for plane in range(2):
for y in range(40):
for x in range(0,48,8):data.append(sum((128>>i) if im.getpixel((x+i,y))&(1<<plane) else 0 for i in range(8)))
(p/'Monitor.info').write_bytes(data)
+5
View File
@@ -0,0 +1,5 @@
#include <exec/types.h>
#include <dos/dos.h>
#include <proto/exec.h>
#include <proto/dos.h>
int main(void){struct DateStamp a,b;long start,now;SetTaskPri(FindTask(0),-5);DateStamp(&a);start=a.ds_Minute*3000+a.ds_Tick;do{DateStamp(&b);now=b.ds_Minute*3000+b.ds_Tick;}while(now-start<350);return 0;}
+78
View File
@@ -0,0 +1,78 @@
#include <exec/types.h>
#include <exec/execbase.h>
#include <exec/memory.h>
#include <exec/interrupts.h>
#include <hardware/intbits.h>
#include <intuition/intuition.h>
#include <graphics/gfxbase.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "colors.h"
#include "trig.h"
#define W 520
#define H 470
struct IntuitionBase *IntuitionBase;struct GfxBase *GfxBase;
extern struct ExecBase *SysBase;
static UBYTE *face,*frame,*out,*font;static LONG pens[64];
static volatile ULONG spin;
static int offset=0;
struct Sampling {struct ExecBase *base;struct Task *probe;volatile ULONG total,idle;};
static struct Sampling sample;
static void idleprobe(void){for(;;)spin++;}
static ULONG __saveds sampler(__reg("a1") struct Sampling *s){s->total++;if(s->base->ThisTask==s->probe)s->idle++;return 0;}
static void pixel(int x,int y,int c){if(x>=0&&x<W&&y>=0&&y<H)frame[y*W+x]=(UBYTE)pens[c];}
static void rect(int x,int y,int w,int h,int c){int a,b;for(b=0;b<h;b++)for(a=0;a<w;a++)pixel(x+a,y+b,c);}
static void line(int x0,int y0,int x1,int y1,int c){int dx=abs(x1-x0),sx=x0<x1?1:-1,dy=-abs(y1-y0),sy=y0<y1?1:-1,e=dx+dy,e2;for(;;){pixel(x0,y0,c);if(x0==x1&&y0==y1)break;e2=e*2;if(e2>=dy){e+=dy;x0+=sx;}if(e2<=dx){e+=dx;y0+=sy;}}}
static void text(int x,int y,char*s,int c,int scale){int a,b,k,z,ch;for(k=0;s[k];k++){ch=(unsigned char)s[k]-32;if(ch<0||ch>=96)continue;for(b=0;b<12;b++)for(a=0;a<8;a++)if(font[b*768+ch*8+a])for(z=0;z<scale;z++)rect(x+(k*8+a)*scale,y+b*scale+z,scale,1,c);}}
static int load(char*name,UBYTE*p,long n){FILE*f=fopen(name,"rb");int ok;if(!f)return 0;ok=fread(p,1,n,f)==n;fclose(f);return ok;}
struct Row {char name[37];int state,pri;};static struct Row rows[6];
static int tasks(struct Task*probe){struct Node*n;int count=0,r=0,k;struct Task*t;Forbid();
for(k=0;k<3;k++){
if(k==0)n=(struct Node*)SysBase->ThisTask;else n=(k==1?SysBase->TaskReady:SysBase->TaskWait).lh_Head;
while(n&&(k==0||n->ln_Succ)){
t=(struct Task*)n;if(t!=probe){count++;if(count>offset&&r<6){strncpy(rows[r].name,n->ln_Name?n->ln_Name:"(unnamed)",36);rows[r].name[36]=0;rows[r].state=t->tc_State;rows[r].pri=n->ln_Pri;r++;}}
if(k==0)break;n=n->ln_Succ;
}
}Permit();for(;r<6;r++)rows[r].name[0]=0;if(offset>=count)offset=0;return count;}
int main(void){struct Screen*sc=0;struct Window*w=0;struct IntuiMessage*m;struct Task*probe=0;UBYTE*stack=0;struct Interrupt irq;int irqon=0,taskon=0,got=0,done=0,i,x,y,iw,ih,rw,rh,ox,oy,loadpct=0,history[60],histn=0,nt=0,step=0;ULONG total,idle,cf,ct,ff,ft;char buf[100],cpu[24];int angle,a,xx,yy;ULONG cls;UWORD code;FILE*f;
SysBase=*(struct ExecBase**)4;
IntuitionBase=(struct IntuitionBase*)OpenLibrary("intuition.library",39);GfxBase=(struct GfxBase*)OpenLibrary("graphics.library",40);if(!IntuitionBase||!GfxBase)goto end;
sc=LockPubScreen(0);if(!sc)goto end;face=malloc(W*H);frame=malloc(W*H);font=malloc(768*12);out=malloc((ULONG)sc->Width*sc->Height);if(!face||!frame||!font||!out)goto end;
if(!load("PROGDIR:face.bin",face,W*H)||!load("PROGDIR:font.bin",font,768*12))goto end;
for(i=0;i<64;i++){pens[i]=ObtainBestPen(sc->ViewPort.ColorMap,colors[i][0]*0x01010101UL,colors[i][1]*0x01010101UL,colors[i][2]*0x01010101UL,TAG_DONE);if(pens[i]<0)goto end;got++;}for(i=0;i<W*H;i++)face[i]=(UBYTE)pens[face[i]];
strcpy(cpu,(SysBase->AttnFlags&AFF_68060)?"MOTOROLA 68060":(SysBase->AttnFlags&AFF_68040)?"MOTOROLA 68040":(SysBase->AttnFlags&AFF_68030)?"MOTOROLA 68030":(SysBase->AttnFlags&AFF_68020)?"MOTOROLA 68020":"MOTOROLA 68000");
probe=AllocMem(sizeof(struct Task),MEMF_PUBLIC|MEMF_CLEAR);stack=AllocMem(8192,MEMF_PUBLIC|MEMF_CLEAR);if(!probe||!stack)goto end;
probe->tc_Node.ln_Type=NT_TASK;probe->tc_Node.ln_Pri=-127;probe->tc_Node.ln_Name="AmberMonitor.idle";
probe->tc_SPLower=stack;probe->tc_SPUpper=stack+8192;probe->tc_SPReg=stack+8192;
probe->tc_MemEntry.lh_Head=(struct Node*)&probe->tc_MemEntry.lh_Tail;probe->tc_MemEntry.lh_TailPred=(struct Node*)&probe->tc_MemEntry.lh_Head;
sample.base=SysBase;sample.probe=probe;
memset(&irq,0,sizeof(irq));irq.is_Node.ln_Type=NT_INTERRUPT;irq.is_Node.ln_Name="AmberMonitor.sample";irq.is_Node.ln_Pri=0;irq.is_Data=&sample;irq.is_Code=(VOID(*)())sampler;
AddIntServer(INTB_VERTB,&irq);irqon=1;AddTask(probe,(APTR)idleprobe,0);taskon=1;
memset(history,0,sizeof(history));
w=OpenWindowTags(0,WA_PubScreen,(ULONG)sc,WA_Left,352,WA_Top,180,WA_InnerWidth,W,WA_InnerHeight,H,WA_Title,(ULONG)"Amber Monitor | CPU virtuale",WA_CloseGadget,TRUE,WA_DragBar,TRUE,WA_DepthGadget,TRUE,WA_SizeGadget,TRUE,WA_SizeBBottom,TRUE,WA_MinWidth,360,WA_MinHeight,330,WA_MaxWidth,sc->Width,WA_MaxHeight,sc->Height,WA_SimpleRefresh,TRUE,WA_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_RAWKEY|IDCMP_REFRESHWINDOW,TAG_DONE);if(!w)goto end;
while(!done){while((m=(struct IntuiMessage*)GetMsg(w->UserPort))!=0){cls=m->Class;code=m->Code;ReplyMsg((struct Message*)m);if(cls==IDCMP_CLOSEWINDOW||(cls==IDCMP_RAWKEY&&code==0x45))done=1;if(cls==IDCMP_RAWKEY&&code==0x4d)offset+=6;if(cls==IDCMP_RAWKEY&&code==0x4c){offset-=6;if(offset<0)offset=0;}if(cls==IDCMP_REFRESHWINDOW){BeginRefresh(w);EndRefresh(w,TRUE);}}
Disable();total=sample.total;idle=sample.idle;if(total>=50){sample.total=sample.idle=0;}Enable();
if(total>=50){loadpct=(int)((total-idle)*100/total);if(loadpct>100)loadpct=100;memmove(history,history+1,59*sizeof(int));history[59]=loadpct;if(histn<60)histn++;}
cf=AvailMem(MEMF_CHIP);ct=AvailMem(MEMF_CHIP|MEMF_TOTAL);ff=AvailMem(MEMF_FAST);ft=AvailMem(MEMF_FAST|MEMF_TOTAL);nt=tasks(probe);
memcpy(frame,face,W*H);text(26,51,cpu,1,1);text(272,51,"CLOCK: DINAMICO / MAX + JIT",5,1);
for(i=0;i<40;i++)if(i*100/40<loadpct){angle=2250+i*2700/40;a=(angle%3600)*2;xx=109+trig[a]*70/10000;yy=153+trig[a+1]*70/10000;for(x=-1;x<=1;x++)line(xx+x,yy,109+trig[a]*79/10000+x,153+trig[a+1]*79/10000,loadpct>85?8:2);}
sprintf(buf,"%3d%%",loadpct);text(76,141,buf,2,2);text(54,181,"CPU / STIMA",5,1);
for(i=1;i<60;i++)if(i>=60-histn){int x0=232+(i-1)*260/59,x1=232+i*260/59;line(x0,201-history[i-1],x1,201-history[i],6);line(x0,202-history[i-1],x1,202-history[i],6);}
text(232,209,"CAMPIONAMENTO EXEC / 50 Hz",5,1);
rect(26,268,218,10,4);rect(270,268,218,10,7);if(ct)rect(26,268,(ct-cf)/(ct/218+1),10,2);if(ft)rect(270,268,(ft-ff)/(ft/218+1),10,6);
sprintf(buf,"%lu / %lu KB",(ct-cf)/1024,ct/1024);text(26,284,buf,1,1);sprintf(buf,"%lu / %lu KB",(ft-ff)/1024,ft/1024);text(270,284,buf,1,1);
sprintf(buf,"LIBERA %lu KB",cf/1024);text(26,302,buf,5,1);sprintf(buf,"LIBERA %lu KB",ff/1024);text(270,302,buf,5,1);
sprintf(buf,"%d TASK %d-%d [UP/DN]",nt,offset+1,offset+6<nt?offset+6:nt);text(176,345,buf,5,1);
for(i=0;i<6;i++)if(rows[i].name[0]){text(26,363+i*14,rows[i].name,1,1);sprintf(buf,"%s %4d",rows[i].state==TS_RUN?"RUN ":rows[i].state==TS_READY?"READY":"WAIT ",rows[i].pri);text(382,363+i*14,buf,5,1);}
iw=w->Width-w->BorderLeft-w->BorderRight;ih=w->Height-w->BorderTop-w->BorderBottom;if(iw>0&&ih>0&&iw<=sc->Width&&ih<=sc->Height){rw=iw;rh=iw*H/W;if(rh>ih){rh=ih;rw=ih*W/H;}ox=(iw-rw)/2;oy=(ih-rh)/2;memset(out,(UBYTE)pens[0],(ULONG)iw*ih);for(y=0;y<rh;y++){int sy=(ULONG)y*H/rh;for(x=0;x<rw;x++)out[(ULONG)(oy+y)*iw+ox+x]=frame[sy*W+(ULONG)x*W/rw];}WriteChunkyPixels(w->RPort,w->BorderLeft,w->BorderTop,w->BorderLeft+iw-1,w->BorderTop+ih-1,out,iw);}
Delay(11+(step++%3));
}
end:
if(irqon)RemIntServer(INTB_VERTB,&irq);if(taskon)RemTask(probe);if(stack)FreeMem(stack,8192);if(probe)FreeMem(probe,sizeof(struct Task));
if(w)CloseWindow(w);if(sc){for(i=0;i<got;i++)ReleasePen(sc->ViewPort.ColorMap,pens[i]);UnlockPubScreen(0,sc);}free(face);free(frame);free(font);free(out);if(GfxBase)CloseLibrary((struct Library*)GfxBase);if(IntuitionBase)CloseLibrary((struct Library*)IntuitionBase);return 0;
}
+73
View File
@@ -0,0 +1,73 @@
#include <exec/types.h>
#include <exec/execbase.h>
#include <exec/memory.h>
#include <exec/interrupts.h>
#include <hardware/intbits.h>
#include <intuition/intuition.h>
#include <graphics/gfxbase.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "colors.h"
#include "trig.h"
#define W 520
#define H 336
struct IntuitionBase *IntuitionBase;struct GfxBase *GfxBase;
extern struct ExecBase *SysBase;
static UBYTE *face,*frame,*out,*font;static LONG pens[64];
static volatile ULONG spin;
static int offset=0;
struct Sampling {struct ExecBase *base;struct Task *probe;volatile ULONG total,idle;};
static struct Sampling sample;
static void idleprobe(void){for(;;)spin++;}
static ULONG __saveds sampler(__reg("a1") struct Sampling *s){struct Task*t=s->base->ThisTask;s->total++;if(!t||t->tc_State!=TS_RUN)s->idle++;return 0;}
static void pixel(int x,int y,int c){if(x>=0&&x<W&&y>=0&&y<H)frame[y*W+x]=(UBYTE)pens[c];}
static void rect(int x,int y,int w,int h,int c){int a,b;for(b=0;b<h;b++)for(a=0;a<w;a++)pixel(x+a,y+b,c);}
static void line(int x0,int y0,int x1,int y1,int c){int dx=abs(x1-x0),sx=x0<x1?1:-1,dy=-abs(y1-y0),sy=y0<y1?1:-1,e=dx+dy,e2;for(;;){pixel(x0,y0,c);if(x0==x1&&y0==y1)break;e2=e*2;if(e2>=dy){e+=dy;x0+=sx;}if(e2<=dx){e+=dx;y0+=sy;}}}
static void text(int x,int y,char*s,int c,int scale){int a,b,k,z,ch;for(k=0;s[k];k++){ch=(unsigned char)s[k]-32;if(ch<0||ch>=96)continue;for(b=0;b<12;b++)for(a=0;a<8;a++)if(font[b*768+ch*8+a])for(z=0;z<scale;z++)rect(x+(k*8+a)*scale,y+b*scale+z,scale,1,c);}}
static int load(char*name,UBYTE*p,long n){FILE*f=fopen(name,"rb");int ok;if(!f)return 0;ok=fread(p,1,n,f)==n;fclose(f);return ok;}
struct Row {char name[37];int state,pri;};static struct Row rows[6];
static int tasks(struct Task*probe){struct Node*n;int count=0,r=0,k;struct Task*t;Forbid();
for(k=0;k<3;k++){
if(k==0)n=(struct Node*)SysBase->ThisTask;else n=(k==1?SysBase->TaskReady:SysBase->TaskWait).lh_Head;
while(n&&(k==0||n->ln_Succ)){
t=(struct Task*)n;if(t!=probe){count++;if(count>offset&&r<6){strncpy(rows[r].name,n->ln_Name?n->ln_Name:"(unnamed)",36);rows[r].name[36]=0;rows[r].state=t->tc_State;rows[r].pri=n->ln_Pri;r++;}}
if(k==0)break;n=n->ln_Succ;
}
}Permit();for(;r<6;r++)rows[r].name[0]=0;if(offset>=count)offset=0;return count;}
int main(void){struct Screen*sc=0;struct Window*w=0;struct IntuiMessage*m;struct Task*probe=0;UBYTE*stack=0;struct Interrupt irq;int irqon=0,taskon=0,got=0,done=0,i,x,y,iw,ih,rw,rh,ox,oy,loadpct=0,history[60],histn=0,nt=0,step=0,display=0,diff=0;ULONG total,idle,cf,ct,ff,ft;char buf[100],cpu[24];int angle,a,xx,yy;ULONG cls;UWORD code;FILE*f;
SysBase=*(struct ExecBase**)4;
IntuitionBase=(struct IntuitionBase*)OpenLibrary("intuition.library",39);GfxBase=(struct GfxBase*)OpenLibrary("graphics.library",40);if(!IntuitionBase||!GfxBase)goto end;
sc=LockPubScreen(0);if(!sc)goto end;face=malloc(W*H);frame=malloc(W*H);font=malloc(768*12);out=malloc((ULONG)sc->Width*sc->Height);if(!face||!frame||!font||!out)goto end;
if(!load("PROGDIR:face.bin",face,W*H)||!load("PROGDIR:font.bin",font,768*12))goto end;
for(i=0;i<64;i++){pens[i]=ObtainBestPen(sc->ViewPort.ColorMap,colors[i][0]*0x01010101UL,colors[i][1]*0x01010101UL,colors[i][2]*0x01010101UL,TAG_DONE);if(pens[i]<0)goto end;got++;}for(i=0;i<W*H;i++)face[i]=(UBYTE)pens[face[i]];
strcpy(cpu,(SysBase->AttnFlags&AFF_68060)?"MOTOROLA 68060":(SysBase->AttnFlags&AFF_68040)?"MOTOROLA 68040":(SysBase->AttnFlags&AFF_68030)?"MOTOROLA 68030":(SysBase->AttnFlags&AFF_68020)?"MOTOROLA 68020":"MOTOROLA 68000");
sample.base=SysBase;sample.probe=probe;
memset(&irq,0,sizeof(irq));irq.is_Node.ln_Type=NT_INTERRUPT;irq.is_Node.ln_Name="AmberMonitor.sample";irq.is_Node.ln_Pri=0;irq.is_Data=&sample;irq.is_Code=(VOID(*)())sampler;
AddIntServer(INTB_VERTB,&irq);irqon=1;
memset(history,0,sizeof(history));
w=OpenWindowTags(0,WA_PubScreen,(ULONG)sc,WA_Left,352,WA_Top,180,WA_InnerWidth,W,WA_InnerHeight,H,WA_Title,(ULONG)"System Monitor",WA_CloseGadget,TRUE,WA_DragBar,TRUE,WA_DepthGadget,TRUE,WA_SizeGadget,TRUE,WA_SizeBBottom,TRUE,WA_MinWidth,360,WA_MinHeight,240,WA_MaxWidth,sc->Width,WA_MaxHeight,sc->Height,WA_SimpleRefresh,TRUE,WA_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_RAWKEY|IDCMP_REFRESHWINDOW,TAG_DONE);if(!w)goto end;
while(!done){while((m=(struct IntuiMessage*)GetMsg(w->UserPort))!=0){cls=m->Class;code=m->Code;ReplyMsg((struct Message*)m);if(cls==IDCMP_CLOSEWINDOW||(cls==IDCMP_RAWKEY&&code==0x45))done=1;if(cls==IDCMP_RAWKEY&&code==0x4d)offset+=6;if(cls==IDCMP_RAWKEY&&code==0x4c){offset-=6;if(offset<0)offset=0;}if(cls==IDCMP_REFRESHWINDOW){BeginRefresh(w);EndRefresh(w,TRUE);}}
Disable();total=sample.total;idle=sample.idle;if(total>=50){sample.total=sample.idle=0;}Enable();
if(total>=50){loadpct=(int)((total-idle)*100/total);if(loadpct>100)loadpct=100;memmove(history,history+1,59*sizeof(int));history[59]=loadpct;if(histn<60)histn++;}
cf=AvailMem(MEMF_CHIP);ct=AvailMem(MEMF_CHIP|MEMF_TOTAL);ff=AvailMem(MEMF_FAST);ft=AvailMem(MEMF_FAST|MEMF_TOTAL);
memcpy(frame,face,W*H);text(26,47,cpu,1,1);text(272,47,"CLOCK: DINAMICO / MAX + JIT",5,1);
diff=loadpct*16-display;if(diff){int delta=diff/8;if(!delta)delta=diff>0?1:-1;display+=delta;}
for(angle=2250;angle<=2250+(LONG)display*2700/1600;angle+=3){a=(angle%3600)*2;for(i=66;i<=74;i++){xx=109+trig[a]*i/10000;yy=148+trig[a+1]*i/10000;pixel(xx,yy,display>1360?8:2);}}
sprintf(buf,"%d%%",(display+8)/16);text(109-strlen(buf)*8,132,buf,2,2);text(97,166,"CPU",1,1);
for(i=1;i<60;i++)if(i>=60-histn){int x0=232+(i-1)*260/59,x1=232+i*260/59;line(x0,201-history[i-1],x1,201-history[i],6);line(x0,202-history[i-1],x1,202-history[i],6);}
rect(26,268,218,10,4);rect(270,268,218,10,7);if(ct)rect(26,268,(ct-cf)/(ct/218+1),10,2);if(ft)rect(270,268,(ft-ff)/(ft/218+1),10,6);
sprintf(buf,"%lu / %lu KB",(ct-cf)/1024,ct/1024);text(26,284,buf,1,1);sprintf(buf,"%lu / %lu KB",(ft-ff)/1024,ft/1024);text(270,284,buf,1,1);
sprintf(buf,"LIBERA %lu KB",cf/1024);text(26,302,buf,5,1);sprintf(buf,"LIBERA %lu KB",ff/1024);text(270,302,buf,5,1);
iw=w->Width-w->BorderLeft-w->BorderRight;ih=w->Height-w->BorderTop-w->BorderBottom;if(iw>0&&ih>0&&iw<=sc->Width&&ih<=sc->Height){rw=iw;rh=iw*H/W;if(rh>ih){rh=ih;rw=ih*W/H;}ox=(iw-rw)/2;oy=(ih-rh)/2;memset(out,(UBYTE)pens[0],(ULONG)iw*ih);for(y=0;y<rh;y++){int sy=(ULONG)y*H/rh;for(x=0;x<rw;x++)out[(ULONG)(oy+y)*iw+ox+x]=frame[sy*W+(ULONG)x*W/rw];}WriteChunkyPixels(w->RPort,w->BorderLeft,w->BorderTop,w->BorderLeft+iw-1,w->BorderTop+ih-1,out,iw);}
Delay(2+(step++%2));
}
end:
if(irqon)RemIntServer(INTB_VERTB,&irq);if(taskon)RemTask(probe);if(stack)FreeMem(stack,8192);if(probe)FreeMem(probe,sizeof(struct Task));
if(w)CloseWindow(w);if(sc){for(i=0;i<got;i++)ReleasePen(sc->ViewPort.ColorMap,pens[i]);UnlockPubScreen(0,sc);}free(face);free(frame);free(font);free(out);if(GfxBase)CloseLibrary((struct Library*)GfxBase);if(IntuitionBase)CloseLibrary((struct Library*)IntuitionBase);return 0;
}
+1
View File
@@ -0,0 +1 @@
static short trig[7200]={0,-10000,17,-10000,35,-10000,52,-10000,70,-10000,87,-10000,105,-9999,122,-9999,140,-9999,157,-9999,175,-9998,192,-9998,209,-9998,227,-9997,244,-9997,262,-9997,279,-9996,297,-9996,314,-9995,332,-9995,349,-9994,366,-9993,384,-9993,401,-9992,419,-9991,436,-9990,454,-9990,471,-9989,488,-9988,506,-9987,523,-9986,541,-9985,558,-9984,576,-9983,593,-9982,610,-9981,628,-9980,645,-9979,663,-9978,680,-9977,698,-9976,715,-9974,732,-9973,750,-9972,767,-9971,785,-9969,802,-9968,819,-9966,837,-9965,854,-9963,872,-9962,889,-9960,906,-9959,924,-9957,941,-9956,958,-9954,976,-9952,993,-9951,1011,-9949,1028,-9947,1045,-9945,1063,-9943,1080,-9942,1097,-9940,1115,-9938,1132,-9936,1149,-9934,1167,-9932,1184,-9930,1201,-9928,1219,-9925,1236,-9923,1253,-9921,1271,-9919,1288,-9917,1305,-9914,1323,-9912,1340,-9910,1357,-9907,1374,-9905,1392,-9903,1409,-9900,1426,-9898,1444,-9895,1461,-9893,1478,-9890,1495,-9888,1513,-9885,1530,-9882,1547,-9880,1564,-9877,1582,-9874,1599,-9871,1616,-9869,1633,-9866,1650,-9863,1668,-9860,1685,-9857,1702,-9854,1719,-9851,1736,-9848,1754,-9845,1771,-9842,1788,-9839,1805,-9836,1822,-9833,1840,-9829,1857,-9826,1874,-9823,1891,-9820,1908,-9816,1925,-9813,1942,-9810,1959,-9806,1977,-9803,1994,-9799,2011,-9796,2028,-9792,2045,-9789,2062,-9785,2079,-9781,2096,-9778,2113,-9774,2130,-9770,2147,-9767,2164,-9763,2181,-9759,2198,-9755,2215,-9751,2233,-9748,2250,-9744,2267,-9740,2284,-9736,2300,-9732,2317,-9728,2334,-9724,2351,-9720,2368,-9715,2385,-9711,2402,-9707,2419,-9703,2436,-9699,2453,-9694,2470,-9690,2487,-9686,2504,-9681,2521,-9677,2538,-9673,2554,-9668,2571,-9664,2588,-9659,2605,-9655,2622,-9650,2639,-9646,2656,-9641,2672,-9636,2689,-9632,2706,-9627,2723,-9622,2740,-9617,2756,-9613,2773,-9608,2790,-9603,2807,-9598,2823,-9593,2840,-9588,2857,-9583,2874,-9578,2890,-9573,2907,-9568,2924,-9563,2940,-9558,2957,-9553,2974,-9548,2990,-9542,3007,-9537,3024,-9532,3040,-9527,3057,-9521,3074,-9516,3090,-9511,3107,-9505,3123,-9500,3140,-9494,3156,-9489,3173,-9483,3190,-9478,3206,-9472,3223,-9466,3239,-9461,3256,-9455,3272,-9449,3289,-9444,3305,-9438,3322,-9432,3338,-9426,3355,-9421,3371,-9415,3387,-9409,3404,-9403,3420,-9397,3437,-9391,3453,-9385,3469,-9379,3486,-9373,3502,-9367,3518,-9361,3535,-9354,3551,-9348,3567,-9342,3584,-9336,3600,-9330,3616,-9323,3633,-9317,3649,-9311,3665,-9304,3681,-9298,3697,-9291,3714,-9285,3730,-9278,3746,-9272,3762,-9265,3778,-9259,3795,-9252,3811,-9245,3827,-9239,3843,-9232,3859,-9225,3875,-9219,3891,-9212,3907,-9205,3923,-9198,3939,-9191,3955,-9184,3971,-9178,3987,-9171,4003,-9164,4019,-9157,4035,-9150,4051,-9143,4067,-9135,4083,-9128,4099,-9121,4115,-9114,4131,-9107,4147,-9100,4163,-9092,4179,-9085,4195,-9078,4210,-9070,4226,-9063,4242,-9056,4258,-9048,4274,-9041,4289,-9033,4305,-9026,4321,-9018,4337,-9011,4352,-9003,4368,-8996,4384,-8988,4399,-8980,4415,-8973,4431,-8965,4446,-8957,4462,-8949,4478,-8942,4493,-8934,4509,-8926,4524,-8918,4540,-8910,4555,-8902,4571,-8894,4586,-8886,4602,-8878,4617,-8870,4633,-8862,4648,-8854,4664,-8846,4679,-8838,4695,-8829,4710,-8821,4726,-8813,4741,-8805,4756,-8796,4772,-8788,4787,-8780,4802,-8771,4818,-8763,4833,-8755,4848,-8746,4863,-8738,4879,-8729,4894,-8721,4909,-8712,4924,-8704,4939,-8695,4955,-8686,4970,-8678,4985,-8669,5000,-8660,5015,-8652,5030,-8643,5045,-8634,5060,-8625,5075,-8616,5090,-8607,5105,-8599,5120,-8590,5135,-8581,5150,-8572,5165,-8563,5180,-8554,5195,-8545,5210,-8536,5225,-8526,5240,-8517,5255,-8508,5270,-8499,5284,-8490,5299,-8480,5314,-8471,5329,-8462,5344,-8453,5358,-8443,5373,-8434,5388,-8425,5402,-8415,5417,-8406,5432,-8396,5446,-8387,5461,-8377,5476,-8368,5490,-8358,5505,-8348,5519,-8339,5534,-8329,5548,-8320,5563,-8310,5577,-8300,5592,-8290,5606,-8281,5621,-8271,5635,-8261,5650,-8251,5664,-8241,5678,-8231,5693,-8221,5707,-8211,5721,-8202,5736,-8192,5750,-8181,5764,-8171,5779,-8161,5793,-8151,5807,-8141,5821,-8131,5835,-8121,5850,-8111,5864,-8100,5878,-8090,5892,-8080,5906,-8070,5920,-8059,5934,-8049,5948,-8039,5962,-8028,5976,-8018,5990,-8007,6004,-7997,6018,-7986,6032,-7976,6046,-7965,6060,-7955,6074,-7944,6088,-7934,6101,-7923,6115,-7912,6129,-7902,6143,-7891,6157,-7880,6170,-7869,6184,-7859,6198,-7848,6211,-7837,6225,-7826,6239,-7815,6252,-7804,6266,-7793,6280,-7782,6293,-7771,6307,-7760,6320,-7749,6334,-7738,6347,-7727,6361,-7716,6374,-7705,6388,-7694,6401,-7683,6414,-7672,6428,-7660,6441,-7649,6455,-7638,6468,-7627,6481,-7615,6494,-7604,6508,-7593,6521,-7581,6534,-7570,6547,-7559,6561,-7547,6574,-7536,6587,-7524,6600,-7513,6613,-7501,6626,-7490,6639,-7478,6652,-7466,6665,-7455,6678,-7443,6691,-7431,6704,-7420,6717,-7408,6730,-7396,6743,-7385,6756,-7373,6769,-7361,6782,-7349,6794,-7337,6807,-7325,6820,-7314,6833,-7302,6845,-7290,6858,-7278,6871,-7266,6884,-7254,6896,-7242,6909,-7230,6921,-7218,6934,-7206,6947,-7193,6959,-7181,6972,-7169,6984,-7157,6997,-7145,7009,-7133,7022,-7120,7034,-7108,7046,-7096,7059,-7083,7071,-7071,7083,-7059,7096,-7046,7108,-7034,7120,-7022,7133,-7009,7145,-6997,7157,-Line truncated
+12
View File
@@ -0,0 +1,12 @@
-cc=vbccm68k -quiet -hunkdebug %s -o= %s %s -O=%ld -I"@TARGET@/include" -I"@TARGET@/ndk/include_h" -I"@TARGET@/netinclude"
-ccv=vbccm68k -hunkdebug %s -o= %s %s -O=%ld -I"@TARGET@/include" -I"@TARGET@/ndk/include_h" -I"@TARGET@/netinclude"
-as=vasmm68k_mot -quiet -Fhunk -phxass -opt-fconst -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fhunk -phxass -opt-fconst -nowarn=62 %s -o %s
-ld=vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib "@TARGET@/lib/startup.o" %s %s -L"@TARGET@/lib" -lvc -o %s
-l2=vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib %s %s -L"@TARGET@/lib" -o %s
-ldv=vlink -bamigahunk -t -x -Bstatic -Cvbcc -nostdlib "@TARGET@/lib/startup.o" %s %s -L"@TARGET@/lib" -lvc -o %s
-l2v=vlink -bamigahunk -t -x -Bstatic -Cvbcc -nostdlib %s %s -L"@TARGET@/lib" -o %s
-ldnodb=-s -Rshort
-ul=-l%s
-cf=-F%s
-ml=500