Jeśli chcesz wziąć udział w dyskusjach na forum - zaloguj się. Jeżeli nie masz loginu - poproś o członkostwo.
Vanilla 1.1.4 jest produktem Lussumo. Więcej informacji: Dokumentacja, Forum.
#include<atari.h>
#include<stdio.h>
#include<peekpoke.h>
int main(void) {
unsigned char loop;
unsigned char loop2;
unsigned char *video_ptr;
unsigned *dli_ptr;
unsigned row;
_graphics(15);
video_ptr=(unsigned char*)(PEEKW( PEEKW(560)+4));
dli_ptr=(unsigned*)(PEEKW(560));
POKEW(dli_ptr[4],0x3000);
for (loop2=0;loop2<160;loop2+=1) {
row = loop2*40;
for(loop=0;loop<40;loop++)
video_ptr[row+loop]=108;
}
POKEW(dli_ptr[4],video_ptr);
//printf(", %d",video_ptr[0]);
return 0;
}
#include<atari.h>
#include<stdio.h>
#include<peekpoke.h>
int main(void) {
unsigned row;
unsigned char loop;
unsigned char loop2;
unsigned char *video_ptr;
unsigned dl_addr;
_graphics(15);
video_ptr=(unsigned char*)(PEEKW( PEEKW(560)+4));
//POKE(559,0); //turn ANTIC off, screen goes black
dl_addr=(unsigned)(PEEKW(560));
POKEW(dl_addr+4,0x3000);
for (loop2=0;loop2<160;loop2++) {
row = loop2*40;
for(loop=0;loop<40;loop++){
video_ptr[row+loop]=108;
}
}
//POKE(559,34); //turn ANTIC ON, and display graphics
POKEW(dl_addr+4,(unsigned)video_ptr);
return 0;
}
row = loop2*40;
row=loop2<<5;
row+=loop2<<3;
row= loop2<<5 + loop2<<3;
bocianu:
To że druga wersja nie działa, to może być wina kolejności działan w kompilatorze.row= loop2<<5 + loop2<<3;
row= loop2<<(5 + loop2)<<3;
//plik: myLib.h
#ifndef __MY_LIB_H
#define __MY_LIB_H
unsigned char var;
unsigned char setVar(unsigned char v);
#endif
//plik: myLib.c
#include "myLib.h"
unsigned char setVar(unsigned char v) {
var=v;
return var;
}
//plik: main.c
#include "myLib.h"
#include <stdio.h>
int main(void) {
printf("value: %d",setVar(3));
return 0;
}
cl65 -t atari -c myLib.c
cl65 -t atari -c main.c
cl65 -O -t atari -o main.xex myLib.o main.o
pause
ld65.exe: Warning: Duplicate external identifier: `_var'
extern unsigned char var;
unsigned char var;
#include <peekpoke.h>
#include <stdio.h>
#include <atari.h>
#include <tgi.h>
extern char atrx15;
char c[30];
int main(void) {
unsigned char errCode;
_graphics(15);
tgi_install(&atrx15);
errCode = tgi_geterror();
printf("error code: %d, message: %s \n",errCode, tgi_geterrormsg(errCode));
gets(c);
tgi_init();
errCode = tgi_geterror();
printf("error code: %d, message: %s \n",errCode, tgi_geterrormsg(errCode));
gets(c);
tgi_setcolor(COLOR_BLACK);
tgi_clear();
tgi_outtext("Ala spirala");
tgi_line (1, 1, 20, 20);
printf("%u",tgi_getmaxx());
return 0;
}
co65 --code-label _atrx15 atrx15.tgi
ca65 atrx15.s
cl65 -C atarixl.cfg -O -t atarixl tgi_test.c atrx15.s -o tgi_test.xex
pause
FEATURES {
STARTADDRESS: default = $3000;
}
#include "peekpoke.h"
#include "stdio.h"
#include "atari.h"
#include "tgi.h"
extern char atrx15;
char c[30];
int main(void) {
unsigned char errCode;
tgi_install(&atrx15);
tgi_init();
_graphics(15);
errCode = tgi_geterror();
printf("error code: %d, message: %s \n",errCode, tgi_geterrormsg(errCode));
gets(c);
tgi_clear();
tgi_gotoxy(40,40);
tgi_outtext("Ala spirala");
tgi_line (1, 1, 20, 20);
printf("tgi_getmax()=%u",tgi_getmaxx());
for(;;);
return 0;
}
bocianu:
tak, zwykle numerację zaczyna się od 1{
Program : 3D Starfield by Thomas Havemeister (converted to Mad Pascal)
Original date : 07 Mar 2002
Source : ->link<-
}
uses crt, graph;
procedure StarField;
begin
asm {
PHA
TXA
PHA
LDX $D1
DEX
LDA #0400,X
STA $D40A ; WSYNC
CPX #$00
BNE $0612
LDX #$04
STA $D018 ; BGCLR
STX $D1
PLA
TAX
PLA
RTI
};
end;
begin
InitGraph(0); CursorOff;
gotoxy(4, 5); writeln('3D Starfield by Thomas Havemeister');
gotoxy(4, 6); writeln('Original date: 07 Mar 2002');
gotoxy(4, 7); writeln('Converted to Mad Pascal');
StarField;
end.
Mad Pascal Compiler version 1.5.8 [2018/10/27] for 6502
Compiling hoppe.pas
hoppe.pas (11) Note: Local const 'FRAME0' not used
195 lines compiled, 1.03 sec, 7235 tokens, 713 idents, 208 blocks, 4 types
1 note(s) issued
ZPFREE: $0000..$007F
ZPFREE: $00D8..$00FF
SYSTEM: $2095..$2147
CRT: $2148..$216C
B_PMG: $216D..$224B
B_DL: $224C..$2312
JOYSTICK: $2313..$2316
CODE: $2000..$281E
DATA: $281F..$2859
Writing listing file...
Writing object file...
8568 lines of source assembled in 5 pass
2141 bytes written to the object file
var zmienna: byte absolute $6000;
pmg: array [0..0] of byte absolute $8000;
pmg[5]:=12;
program test;
uses crt;
var
i: byte;
begin
writeln('adres zmiennej i: ', word(@i));
Readkey;
end.
uses crt, atari;
var
i: byte;
tab, add: array [0..255] of byte;
begin
for i:=0 to 255 do begin
tab[i]:=random(0);
add[i]:=random(0) and 3 + 1;
end;
sizep0:=0;
grafp0:=1;
repeat
i:=vcount;
hposp0:=tab[i];
inc(tab[i], add[i]);
wsync:=0;
until keypressed;
end.
uses crt, graph;
var
savmsc : word absolute 88;
i,j : byte;
dl4, dl4Temp: word;
dlStart: word = $8000;
lmsStart: word = $8100;
offset: byte = 80;
scrPtr: word;
procedure populateDL2;
Begin
Poke(dlStart,112);
Poke(dlStart+1,112);
Poke(dlStart+2,112);
for i:=1 to 24 do
begin
Poke(dlStart+3*i,66);
DPoke(dlStart+3*i+1,lmsStart);
lmsStart:=lmsStart+offset;
end;
Poke(dlStart+3*25,65);
DPoke(dlStart+3*25+1,dlStart);
End;
procedure scroll;
begin
for j:=1 to 80 do
begin
dl4Temp:=dl4;
for i:=1 to 24 do
begin
scrPtr:=DPeek(dl4Temp);
DPoke(dl4Temp,scrPtr+1);
dl4Temp:=dl4Temp+3;
end;
//savmsc := $8100+j;
delay(120);
end;
end;
begin
PopulateDl2;
DPoke(560,dlStart);
savmsc := $8100;
dl4:= dlStart + 4;
for i:=0 to 77 do begin
writeln(Peek(dlStart+i));
end;
//scroll;
repeat until keypressed;
end.
uses crt, atari;
const
dlist = $be00;
scroll = $bf00; // bufor na scroll ma 256 bajtow
dl: array [0..8] of byte = (
$70,$70,$70, // 0,1,2 bajt
$42+$30, // 3 bajt
lo(scroll), // 4 bajt - mlodszy adres wiersza obrazu
hi(scroll), // 5 bajt - starszy adres wiersza obrazu
$41,lo(dlist),hi(dlist)
);
var
hsc: byte = 3;
cnt: byte = 1;
idx: byte;
txt: string = ' to jest przykladowy tekst w kodach ANTIC-a '~;
begin
move(dl, pointer(dlist), sizeof(dl));
dpoke($230, dlist);
repeat
pause;
if hsc=$ff then begin
idx:=cnt+44;
poke(scroll+idx, ord(txt[cnt]));
inc(cnt);
if cnt > length(txt) then begin
cnt:=1; // od nowa
poke(dlist+4, 0);
end;
poke(dlist+4, peek(dlist+4)+1);
hsc:=3;
end;
hscrol:=hsc;
dec(hsc);
until keypressed;
end.