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.
require 'RMagick'
img = Magick::Image.read('test.gif').first
w = img.columns
raw = img.dispatch(0, 0, w, img.rows, 'I')
coords = []
raw.each_index { |i| coords.push(i % w, i / w) if raw[i] > 128 }
puts coords.inspect
;XXL Benchmark
idx:0..63
px,py:array(idx)
x,y:0..255
const
OFFSET = 10
XSPACE = 20
YSPACE = 20
y = 0
idx = 0
for line:0..7
x = 0
if line mod 2 <> 0 then x = OFFSET
for row:0..7
py(idx) = y
px(idx) = x
x = x + XSPACE
inc idx
y = y + YSPACE
;Print the result
for idx
x = px(idx)
y = py(idx)
"[idx] [x] [y]"
on__vbi__x equ 128
idx equ 130
x equ 131
y equ 132
root__OFFSET equ 10
root__XSPACE equ 20
root__YSPACE equ 20
_s0__line equ 133
_s0___3 equ 134
_s1__row equ 135
org $2e0
dta a($2000)
org $2000
;### xxlb.atl(12) y = 0
lda #0
sta y
;### xxlb.atl(13) idx = 0
sta idx
;### xxlb.atl(26) for idx
sta _s0__line
_lbl5:
;### xxlb.atl(15) x = 0
lda #0
sta x
;### xxlb.atl(16) if line mod 2 <> 0 then x = OFFSET
lda _s0__line
and #1
sta _s0___3
cmp #0
jeq _lbl2
lda #root__OFFSET
sta x
;### xxlb.atl(17) for row:0..7
_lbl2:
;### xxlb.atl(22) y = y + YSPACE
lda #0
sta _s1__row
ldx idx
tay
_lbl4:
;### xxlb.atl(18) py(idx) = y
lda y
sta py,x
;### xxlb.atl(19) px(idx) = x
lda x
sta px,x
;### xxlb.atl(20) x = x + XSPACE
clc
adc #root__XSPACE
sta x
;### xxlb.atl(21) inc idx
inx
iny
tya
cpy #8
jne _lbl4
sty _s1__row
stx idx
lda y
clc
adc #root__YSPACE
sta y
inc _s0__line
lda _s0__line
cmp #8
jne _lbl5
;### xxlb.atl(30) "[idx] [x] [y]"
lda #0
sta idx
;### xxlb.atl(30) "[idx] [x] [y]"
_lbl7:
;### xxlb.atl(27) x = px(idx)
ldx idx
lda px,x
sta x
;### xxlb.atl(28) y = py(idx)
lda py,x
sta y
;### xxlb.atl(29) "[idx] [x] [y]"
jsr _std_print_out
dta b(129),a(idx)
dta b(1),c' '
dta b(129),a(x)
dta b(1),c' '
dta b(129),a(y)
dta b(128)
dta b(0)
;### xxlb.atl(30) "[idx] [x] [y]"
inc idx
;### xxlb.atl(30) "[idx] [x] [y]"
lda idx
cmp #64
jne _lbl7
_lbl8:
jmp _lbl8
px:
.ds 64
py:
.ds 64
icl 'C:\Users\Rudla\Projects\atalan\src\platform\atari\atari.asm'
// cc65 -Cl -T -Osir --cpu 6502 -t atari main.c
#define OFFSET 10
#define XSPACE 20
#define YSPACE 20
unsigned char px[64];
unsigned char py[64];
unsigned char idx,line,row,x,y;
void main(void)
{
for (line=0;line<8;++line)
{
x=0;
if (line%2!=0)
x=OFFSET;
for (row=0;row<8;++row)
{
px[idx]=y;
py[idx]=x;
++idx;
x+=XSPACE;
}
y+=YSPACE;
}
}
.segment "BSS"
_px:
.res 64,$00
_py:
.res 64,$00
_idx:
.res 1,$00
_line:
.res 1,$00
_row:
.res 1,$00
_x:
.res 1,$00
_y:
.res 1,$00
; ---------------------------------------------------------------
; void __near__ main (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _main: near
.segment "CODE"
;
; for (line=0;line<8;++line)
;
lda #$00
sta _line
L0005: lda _line
cmp #$08
bcs L0006
;
; x=0;
;
lda #$00
sta _x
;
; if (line%2!=0)
;
lda _line
and #$01
beq L000F
;
; x=OFFSET;
;
lda #$0A
sta _x
;
; for (row=0;row<8;++row)
;
L000F: lda #$00
sta _row
L0014: lda _row
cmp #$08
bcs L0015
;
; px[idx]=y;
;
ldy _idx
lda _y
sta _px,y
;
; py[idx]=x;
;
ldy _idx
lda _x
sta _py,y
;
; ++idx;
;
inc _idx
;
; x+=XSPACE;
;
lda #$14
clc
adc _x
sta _x
;
; for (row=0;row<8;++row)
;
inc _row
jmp L0014
;
; y+=YSPACE;
;
L0015: lda #$14
clc
adc _y
sta _y
;
; for (line=0;line<8;++line)
;
inc _line
jmp L0005
;
; }
;
L0006: rts
.endproc
xxl:
na 14 bajtow 4 sa niepotrzebneproc main()
byte idx=[$00],my=[$f8],mx=[$05]
,xmargin=[34],ymargin=[24]
,x=[5],y=[4]
,i
byte array tab=$600
do
for i=0 to 7 do
tab[idx]=x
idx==+1
tab[idx]=y
idx==+1
my==*-1
y==+my
x==+xmargin
od
y==+ymargin
if idx&$80 then exit fi
mx==!9
x=mx
od
return
xxl:
stawiam na wielkosc liter - action! lyka tylko duze.idx equ 128
x equ 129
y equ 130
root__OFFSET equ 10
root__XSPACE equ 20
root__YSPACE equ 20
_s0__line equ 131
org $2e0
dta a($2000)
org $2000
;### xxlb.atl(12) y = 0
lda #0
sta y
;### xxlb.atl(13) idx = 0
sta idx
;### xxlb.atl(14) for line:0..7
sta _s0__line
_lbl5:
;### xxlb.atl(15) x = 0
lda #0
sta x
;### xxlb.atl(16) if line mod 2 <> 0 then x = OFFSET
lda _s0__line
and #1
cmp #0
jeq _lbl2
lda #root__OFFSET
sta x
_lbl2:
;### xxlb.atl(17) for row:0..7
lda #0
ldx idx
tay
_lbl4:
;### xxlb.atl(18) py(idx) = y
lda y
sta py,x
;### xxlb.atl(19) px(idx) = x
lda x
sta px,x
;### xxlb.atl(20) x = x + XSPACE
clc
adc #root__XSPACE
sta x
;### xxlb.atl(21) inc idx
inx
iny
cpy #8
jne _lbl4
stx idx
;### xxlb.atl(22) y = y + YSPACE
lda y
clc
adc #root__YSPACE
sta y
inc _s0__line
lda _s0__line
cmp #8
jne _lbl5
;### xxlb.atl(26) for idx
lda #0
sta idx
_lbl7:
;### xxlb.atl(27) x = px(idx)
ldx idx
lda px,x
sta x
;### xxlb.atl(28) y = py(idx)
lda py,x
sta y
;### xxlb.atl(29) "[idx] [x] [y]"
jsr _std_print_out
dta b(129),a(idx)
dta b(1),c' '
dta b(129),a(x)
dta b(1),c' '
dta b(129),a(y)
dta b(128)
dta b(0)
inc idx
lda idx
cmp #64
jne _lbl7
_lbl8:
jmp _lbl8
px:
.ds 64
py:
.ds 64
icl 'C:\Users\Rudla\Projects\atalan\src\platform\atari\atari.asm'
Od 1 do 41 z 41