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.
// MAD Assembler
LZ4_SRC = $00+$80 // ; 25:10 (size=7c)
LZ4_DST = $02+$80 // ; 0c:00
LZ4_END = $04+$80 // ; 25:8c
COUNT = $06+$80
DELTA = $08+$80
Licznik = $0a+$80
Licznik2 = 10
//; Autostart header
org $2e0
dta <start, >start
//; Start of program
org $1000
start:
sei // Stop Interrupt
InitHW
BeepOFF
WaitForKbd
lda #Licznik2 // Test counter
sta Licznik
BeepON
//Main loop
Main_Loop
//LZ4 init
lda #<LZ4_DataC64 // LZ4 Source Start
sta LZ4_SRC
lda #>LZ4_DataC64
sta LZ4_SRC+1
lda #<LZ4_Data_EndC64 // LZ4 Source End
sta LZ4_END
lda #>LZ4_Data_EndC64
sta LZ4_END+1
lda #<ScreenData // Destination
sta LZ4_DST
lda #>ScreenData
sta LZ4_DST+1
//LZ4 go
jsr lz4_decode
dec Licznik
beq Neverending_Loop
//LZ4 init
lda #<LZ4_Data
sta LZ4_SRC
lda #>LZ4_Data
sta LZ4_SRC+1
lda #<LZ4_Data_End
sta LZ4_END
lda #>LZ4_Data_End
sta LZ4_END+1
lda #<ScreenData
sta LZ4_DST
lda #>ScreenData
sta LZ4_DST+1
//LZ4 go
jsr lz4_decode
dec Licznik
beq Main_Loop_End
jmp Main_Loop
Main_Loop_End:
BeepOFF
Neverending_Loop:
nop
jmp Neverending_Loop
icl "A8_LZ4_macro.asm"
icl "lz4_decode_CK.s"
//Data
DisplayList
dta $70,$70,$30 ; 20 blank lines
dta $4F,<ScreenData,>ScreenData ; mode F @ Bitmapa
:99 dta $0f ; x99 mode F
dta $4F,<(ScreenData+4000),>(ScreenData+4000) ; mode F @ Bitmapa+4000
:99 dta $0f ; x99 mode F
dta $41,<DisplayList,>DisplayList ; waitvbl
//; Bitmap data location
org $2060
ScreenData:
ins "A8_IMAGE.RAW"
//; LZ4 data location
org $4000
LZ4_Data:
ins "A8_IMAGE_STRIP.LZ4"
LZ4_Data_End:
LZ4_DataC64:
ins "C64_IMAGE_STRIP.LZ4"
LZ4_Data_EndC64:
.macro InitHW
// lda #0
// sta $D400 // ANTIC OFF
lda #<DisplayList
sta $D402
lda #>DisplayList
sta $D402+1
.endm
.macro BeepON
lda #$1F
sta $D201 // Pokey AUDC1 volume
.endm
.macro BeepOFF
lda #$10
sta $D201 // Pokey AUDC1 volume
.endm
.macro WaitForKbd
WaitForKbd_Loop:
lda $D209 // KBCODE
cmp #33 // Space
bne WaitForKbd_Loop // wait until SPACE
.endm
WaitforKbd_loop:
lda $D20F ;SKSTAT
and #4 ;czekaj na wciśnięcie klawisza
bne WaitforKbd_loop
lda $d209 ;KBCODE
cmp #33
bne WaitforKbd_loop
MP
fillchar(flags, sizeof(flags), true);
CC65
memset(flags, true, sizeof(flags));
Action
SETBLOCK(FLAGS,8190,'T)
BYTE RTCLOCK2=20 ; sys timer
BYTE RTCLOCK1=19
CARD COUNT=$F4,PRIME=$F6,STOP
PROC sieve()
BYTE ARRAY FLAGS(8190)
CARD I=$F0,K=$F2
PRIME=0
COUNT=0 ; init count
SETBLOCK(FLAGS,8190,'T)
FOR I=0 TO 8190 ; and flags
DO
IF FLAGS(I)='T THEN
PRIME=I+I+3
K=I+PRIME
WHILE K<=8190
DO
FLAGS(K)='F
K==+PRIME
OD
COUNT==+1
FI
OD
RETURN
PROC main()
BYTE I=[0]
RTCLOCK1=0
RTCLOCK2=0
WHILE I<10
DO
sieve()
I==+1
OD
STOP=RTCLOCK1 * 256 + RTCLOCK2
PRINTF("%E %U PRIMES IN",COUNT)
PRINTF("%E %U JIFFIES",STOP)
PRINTF("%E %U iterations",I)
RETURN
Millfork Chessboard: 79 iterations in 150 ticks
CC65 Chessboard: 76 iterations in 150 ticks
Mad Pascal Chessboard: 55 iterations in 150 ticks
program chessboard;
uses crt, graph;
var i, stop : byte;
rtClock : byte absolute 20;
col1 : byte absolute 709;
col2 : byte absolute 710;
colB : byte absolute 712;
bmpAdr : word absolute 88;
procedure drawBoard;
var i1b, i2b, i3b, x, color : byte;
p : PByte absolute $e0;
begin
p := pointer(bmpAdr);
for i3b := 1 to 8 do begin
for i2b := 1 to 24 do begin
for i1b := 1 to 4 do begin
p[0]:= 255;
p[1]:= 255;
p[2]:= 255;
Inc(p,6);
end;
Inc(p,16);
end;
if (i3b and %1) = 0 then Dec(p,3) else Inc(p,3);
end;
end;
begin
InitGraph(8 + 16);
col1 := 1;
col2 := 11;
colB := 12;
pause;
rtClock := 0;
while rtClock < 150 do begin
drawBoard;
inc(i);
end;
stop:=rtClock;
InitGraph(0);
writeln('Drawing iterations: ', i);
ReadKey;
end.
Millfork Chessboard: 79 iterations in 150 ticks
CC65 Chessboard: 76 iterations in 150 ticks
Mad Pascal Chessboard: 73 iterations in 150 ticks
program chessboard;
uses crt, graph;
{$define FAST}
var stop : byte;
rtClock : byte absolute 20;
col1 : byte absolute 709;
col2 : byte absolute 710;
colB : byte absolute 712;
bmpAdr : word absolute 88;
{$ifdef FAST}
i : byte absolute $e0;
{$else}
i : byte;
{$endif}
procedure drawBoard;
var
{$ifdef FAST}
i1b : byte absolute $e1;
i2b : byte absolute $e2;
i3b : byte absolute $e3;
p : PByte absolute $e4;
{$else}
i1b, i2b, i3b : byte;
p : PByte;
{$endif}
begin
p := pointer(bmpAdr);
for i3b := 1 to 8 do begin
for i2b := 1 to 24 do begin
for i1b := 1 to 4 do begin
p[0]:= 255;
p[1]:= 255;
p[2]:= 255;
Inc(p,6);
end;
Inc(p,16);
end;
if (i3b and %1) = 0 then Dec(p,3) else Inc(p,3);
end;
end;
begin
InitGraph(8 + 16);
col1 := 1;
col2 := 11;
colB := 12;
pause;
rtClock := 0;
while rtClock < 150 do begin
drawBoard;
inc(i);
end;
stop:=rtClock;
InitGraph(0);
{$ifdef FAST}
writeln('ZERO Page Drawing iterations: ', i);
{$else}
writeln('Drawing iterations: ', i);
{$endif}
ReadKey;
end.