This commit is contained in:
paolo.iocco
2023-03-09 10:26:44 +00:00
parent 6dc53fa937
commit 5131902586
19 changed files with 490 additions and 0 deletions

View File

@@ -0,0 +1 @@
unamos.exe --> converts AMOS to ASCII

BIN
trunk/Amiga/AMOS/jAMOS.jar Normal file

Binary file not shown.

View File

@@ -0,0 +1,34 @@
' Simple Hello World demo in jAMOS
Bob Off : Sprite Off : Rainbow Del
Screen Open 0,720,576,16777216,Hires+Laced
Screen 0
Load Iff "resources/back.jpg",0
A$="Hello"+" "+"World"
Print A$+"!"
Print "2+2*2 = "+(2+2*2)
Print "Counting down:"
N=10
While N>0
Print N
N=N-1
Wend
Print "Blast off!"
AMAL Environment
' AMAL Environment Generator
Bob Off : Sprite Off : Rainbow Del
Screen 0
Screen Open 0,720,576,16777216,Hires+Laced
Load "resources/sprites", 1
Load Iff "resources/back.jpg", 0
AMAL Channel 0

View File

@@ -0,0 +1,11 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop4=31,Amiga C Tutorial
Prop3=19,2
[{A7AF692E-098D-4C08-A225-D433CA835ED0}]
Prop5=3,0
Prop9=19,0
[InternetShortcut]
URL=http://www.pjhutchison.org/tutorial/amiga_c.html
IDList=
[{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}]
Prop5=8,Microsoft.Website.27491368.BB2E9312

BIN
trunk/Amiga/Math.info Normal file

Binary file not shown.

17
trunk/Amiga/Math/makefile Normal file
View File

@@ -0,0 +1,17 @@
# standard makefile
SRC = math
ifeq ($(OS),Windows_NT)
TARGET = $(SRC).exe
else
TARGET = $(SRC)
endif
all: $(SRC).c
gcc -Wall $(SRC).c -lm -o $(TARGET)
program:
vc +amiga -D_AMIGA -o $(SRC) $(SRC).c
clean:
rm -f $(SRC).o $(SRC) $(SRC).exe $(SRC).prg

BIN
trunk/Amiga/Math/math Normal file

Binary file not shown.

373
trunk/Amiga/Math/math.c Normal file
View File

@@ -0,0 +1,373 @@
/* *************************************************************** *
* ATARI ST VBCC Math Trainer *
* (c) 05.05.2018 Paolo Iocco *
* *
***************************************************************** */
/*
* ESC J Erase from the cursor to the end of the screen.
* ESC K Erase from the cursor to the end of the line.
*
* https://en.wikipedia.org/wiki/VT52 (ATARI)
* http://ascii-table.com/ansi-escape-sequences-vt-100.php (VT100)
*/
/*
* #define _ATARI // resolved in makefile
* make program => AMIGA
* make all => .exe
*
*/
#ifdef _ATARI
#define cls() printf("\33E") /* ESC E Clear Home (not standard) */
#define home() printf("\33H") /* ESC H Move the cursor to the home position. */
#define cur_up() printf("\33A") /* ESC A Cursor up. */
#define cur_down() printf("\33B") /* ESC B Cursor down. */
#define cur_right() printf("\33C") /* ESC C Cursor right. */
#define cur_left() printf("\33D") /* ESC D Cursor left. */
#define gotoxy(x,y) printf("\33Y%c%c",32+y,32+x) /* ESC Yrc Move the cursor to given row and column. (not standard) */
#define cur_ins() printf("\33L") /* ESC L Insert Line at cursor (not standard) */
#define rev_on printf("\33p") /* ESC p Reverse mode on */
#define rev_off printf("\33q") /* ESC q Reverse mode off */
#define cur_on printf("\33e") /* ESC e Cursor visible */
#define cur_off printf("\33f") /* ESC f Cursor not visible */
#define color(c) printf("\33b%c",32+c) /* ESC b#color foreground color (low nybble) (not standard) */
#define backc(c) printf("\33c%c",32+c) /* ESC c#color background color (low nibble) (not standard) */
int cWHITE=0;
int cRED=1;
int cGREEN=2;
int cBLACK=3;
#include <tos.h>
#elseif _AMIGA
#define cls() printf("\33E") /* ESC E Clear Home (not standard) */
#define home() printf("\33H") /* ESC H Move the cursor to the home position. */
#define cur_up() printf("\33A") /* ESC A Cursor up. */
#define cur_down() printf("\33B") /* ESC B Cursor down. */
#define cur_right() printf("\33C") /* ESC C Cursor right. */
#define cur_left() printf("\33D") /* ESC D Cursor left. */
#define gotoxy(x,y) printf("\33Y%c%c",32+y,32+x) /* ESC Yrc Move the cursor to given row and column. (not standard) */
#define cur_ins() printf("\33L") /* ESC L Insert Line at cursor (not standard) */
#define rev_on printf("\33p") /* ESC p Reverse mode on */
#define rev_off printf("\33q") /* ESC q Reverse mode off */
#define cur_on printf("\33e") /* ESC e Cursor visible */
#define cur_off printf("\33f") /* ESC f Cursor not visible */
#define color(c) printf("\33b%c",32+c) /* ESC b#color foreground color (low nybble) (not standard) */
#define backc(c) printf("\33c%c",32+c) /* ESC c#color background color (low nibble) (not standard) */
int cWHITE=0;
int cRED=1;
int cGREEN=2;
int cBLACK=3;
#else
#define cls() printf("\33[2J") /* printf("\33[34mHello \33[31mWorld\33[0m") */
#define home() printf("\33[H")
#define cur_up() printf("\33[1A")
#define cur_down() printf("\33[1B")
#define cur_right() printf("\33[1C")
#define cur_left() printf("\33[1D")
#define gotoxy(x,y) printf("\33[%d;%dH",y+1,x+1)
#define cur_ins()
#define rev_on printf("\33[7m")
#define rev_off printf("\33[27m")
#define cur_on /* printf("\33[e") */
#define cur_off /* printf("\33[f") */
#define color(c) printf("\33[%dm",c+30)
#define backc(c) printf("\33[%dm",c+40)
#define cWHITE 0 /* black... */
#define cRED 1 /* */
#define cGREEN 2 /* */
#define cBLACK 7 /* white... */
#endif
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <math.h>
typedef int bool;
int PuntiTot=0;
const int MAX_VAL_SS=100+1;
const int MAX_VAL_M=10+1;
const int MAX_VAL_EURO=1000; /* 10.00€ */
bool isEqual(double x, double y) {
const double epsilon = 1e-1;
return (abs(x - y) <= epsilon);
}
float stof(const char* s){
int point_seen;
int d;
float rez = 0, fact = 1;
if (*s == '-'){
s++;
fact = -1;
};
for (point_seen = 0; *s; s++){
if (*s == '.'){
point_seen = 1;
continue;
};
d = *s - '0';
if (d >= 0 && d <= 9){
if (point_seen) fact /= 10.0f;
rez = rez * 10.0f + (float)d;
};
};
return (rez * fact);
}
void Print_OK(){
color(cGREEN);
printf("OK");
color(cBLACK);
}
void Print_ERROR(){
rev_on;
color(cRED);
printf("Errore!");
color(cBLACK);
rev_off;
}
int SumSub(char volte){
int punti=0, primo=0, secondo=0, swap=0, risultato=0, volta=0;
int a;
char b[20];
char segno='+';
cls();
home();
printf("- Somme e Sottrazioni -\n");
printf("-----------------------\n");
while ( volte-- ) {
volta++;
primo = rand() % MAX_VAL_SS;
secondo = rand() % MAX_VAL_SS;
while (primo+secondo>100){
secondo = rand() % MAX_VAL_SS;
}
if((rand() % 2)==1){
segno='+';
risultato=primo+secondo;
}
else {
segno='-';
if (secondo>primo){
swap=primo;
primo=secondo;
secondo=swap;
}
risultato=primo-secondo;
}
printf("\n\nQuanto fa %d %c %d ? ", primo, segno, secondo);
gets(b);
a=atoi(b);
gotoxy(27,volta*2+2);
if (a==risultato){
Print_OK();
punti++;
}
else {
Print_ERROR();
}
}
printf("\n\n");
printf("Premi un tasto per continure...");
getchar();
return(punti);
}
int Platzhalter(char volte){
int punti=0;
printf("- Platzhalter -\n");
printf("---------------\n\n");
while ( volte-- ) {
printf("%2d\n",volte);
}
printf("\n");
return(punti);
}
int ZahlenMauer(char volte){
int punti=0;
printf("- Zahlenmauer -\n");
printf("---------------\n\n");
while ( volte-- ) {
printf("%2d\n",volte);
}
printf("\n");
return(punti);
}
int MalRechnen(char volte){
int punti=0, primo=0, secondo=0, risultato=0, volta=0;
int a;
char b[20];
char segno='*';
cls();
home();
printf("- Moltiplicazioni e divisioni -\n");
printf("-------------------------------\n");
while ( volte-- ){
volta++;
primo = rand() % MAX_VAL_M;
secondo = rand() % MAX_VAL_M;
if((rand() % 2)==1){
segno='*';
risultato=primo*secondo;
}
else {
segno=':';
if (primo==0)
primo=1;
if (secondo==0)
secondo=1;
risultato=primo;
primo=primo*secondo;
}
printf("\n\nQuanto fa %d %c %d ? ",primo,segno,secondo);
gets(b);
a=atoi(b);
gotoxy(27,volta*2+2);
if (a==risultato){
Print_OK();
punti++;
}
else {
Print_ERROR();
}
}
printf("\n\n");
printf("Premi un tasto per continure...");
getchar();
return(punti);
}
int Sachaufgaben(char volte){
int punti=0;
printf("- Problemi -\n");
printf("------------\n\n");
while ( volte-- ) {
printf("%2d\n",volte);
}
printf("\n");
return(punti);
}
int EuroRechnen(char volte){
int punti=0, primo=0, secondo=0, risultato=0, volta=0;
float a=0;
char b[20];
char segno='+';
cls();
home();
printf("- Euro e Monete -\n");
printf("-----------------\n");
while ( volte-- ) {
volta++;
primo = rand() % MAX_VAL_EURO;
secondo = rand() % MAX_VAL_EURO;
while (primo+secondo>MAX_VAL_EURO){
secondo = rand() % MAX_VAL_EURO;
}
if((rand() % 2)==1){
segno='+';
risultato=primo+secondo;
}
else {
segno='-';
primo=((primo+secondo)/100)*100+100;
risultato=primo-secondo;
}
printf("\n\nQuanto fa %d.%02d Euro %c %d.%02d Euro ? ", primo/100, primo % 100 , segno, secondo/100, secondo % 100);
gets(b);
a=stof(b);
gotoxy(43,volta*2+2);
if (isEqual(risultato,a*100)){
Print_OK();
punti++;
}
else {
Print_ERROR();
}
}
printf("\n\n");
printf("Premi un tasto per continure...");
getchar();
return(punti);
}
int main(void){
int r1=0, r2=0, r3=0, r4=0, r5=0, rt=0, voto=0;
int v1=10, v2=0, v3=10, v4=10, v5=0, vt=0;
int passo=1;
#ifdef _ATARI
if (Getrez()==2) {
cGREEN=1;
}
#endif
cls();
home();
cur_on;
srand(time(NULL));
printf("- Benvenuto nel programma Matematicone 3000 -\n");
printf("---------------------------------------------\n\n");
r1=SumSub(v1);
r2=Platzhalter(v2);
r3=MalRechnen(v3);
r4=EuroRechnen(v4);
r5=Sachaufgaben(v5);
rt=r1+r2+r3+r4+r5;
vt=v1+v2+v3+v4+v5;
passo=vt/10;
voto=(vt-rt)/passo+1;
if (voto>6)
voto=6;
cls();
home();
printf("---------------------------------------------\n");
printf("- Risultati -\n");
printf("---------------------------------------------\n");
printf("- -\n");
printf("- Somme e sottrazioni: %2d/%2d -\n",r1,v1);
printf("- Platzhalter: %2d/%2d -\n",r2,v2);
printf("- Moltiplicazioni: %2d/%2d -\n",r3,v3);
printf("- Euro e monete: %2d/%2d -\n",r4,v4);
printf("- Problemi: %2d/%2d -\n",r5,v5);
printf("- -\n");
printf("- In totale hai raggiunto: %2d/%2d punti -\n",rt,vt);
printf("- corrispondente al voto: %2d -\n",voto);
printf("- -\n");
printf("---------------------------------------------\n");
gotoxy(0,23);
printf("Premi un tasto per uscire...");
getchar();
return(0);
}

BIN
trunk/Amiga/Math/math.info Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,6 @@
rem vc hello.c -o hello
rem pause
@cls
@set name=%~n1
vc +amiga -o %name% %name%.c
@IF %ERRORLEVEL% NEQ 0 pause

BIN
trunk/Amiga/hello.info Normal file

Binary file not shown.

BIN
trunk/Amiga/hello/hello Normal file

Binary file not shown.

12
trunk/Amiga/hello/hello.c Normal file
View File

@@ -0,0 +1,12 @@
/* *************************************************************** *
* AMIGA VBCC code example *
* (c) 01.05.2017 Paolo Iocco *
* *
***************************************************************** */
#include <stdio.h>
int main(void){
printf("Ciao mondo!\n\n");
return(0);
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,17 @@
# standard makefile
SRC = hello
ifeq ($(OS),Windows_NT)
TARGET = $(SRC).exe
else
TARGET = $(SRC)
endif
all: $(SRC).c
gcc -Wall $(SRC).c -lm -o $(TARGET)
program:
vc +amiga -D_AMIGA -o $(SRC) $(SRC).c
clean:
rm -f $(SRC).o $(SRC) $(SRC).exe $(SRC).prg

View File

@@ -0,0 +1,6 @@
rem vc hello.c -o hello
rem pause
@cls
@set name=%~n1
vc +amiga -o %name% %name%.c
@IF %ERRORLEVEL% NEQ 0 pause

View File

@@ -0,0 +1,13 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop4=31,vbcc manual
Prop3=19,2
[{A7AF692E-098D-4C08-A225-D433CA835ED0}]
Prop5=3,0
Prop9=19,0
[InternetShortcut]
URL=http://www.ibaug.de/vbcc/doc/vbcc.html
IDList=
IconFile=http://www.ibaug.de/favicon.ico
IconIndex=1
[{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}]
Prop5=8,Microsoft.Website.B43F513A.FAC56572