NOTICE TEXTE n° 1 (5.3 Ko)
org &8000
bits:
db %10001000
db %01000100
db %00100010
db %00010001
;write direct
;run start
start:
datmar EQU &53
data EQU &5000
sinf EQU &51
;$5F00
ld a,1
call #bc0e
di
LD BC,&7F03;pen number (and Gate Array function)
OUT (C),c ;Send pen number
ld a,&5B;42;Pen colour (and Gate Array function)
OUT (C),a
LD BC,&7F01
OUT (C),c
ld a,&53
OUT (C),a
LD BC,&7F02
OUT (C),c
ld a,&46
OUT (C),a
;ld bc,&7f10;select border
;out (c),c
;
;ld bc,&7f54;set border colour to black
;out (c),c
;--------------prepare lookup
ld hl,&4000;clear memory
push hl
clm:
ld (hl),0
inc hl
bit 7,h
jr nz,clm
;&4000,&4100 - Y, adresses
pop hl;ld hl,&4000
ld de,&C000
ld b,200
lut1:
ld (hl),e
inc h
ld (hl),d
dec h
ex de,hl
call nline
ex de,hl
inc l
djnz lut1
;X (0,0,0,0)...(1,1,1,1)
ld hl,&4200;inc h?
ld e,l
ld d,l;ld de,0
ld c,80
lut3;
push bc;?
ld b,4
lut4;
ld (hl),e
inc hl
ld (hl),d
inc hl
djnz lut4
inc de
pop bc
dec c
jr nz,lut3
;--------------------------------- here is Trefi code
sin LD HL,sinf*256+256;#e600
LD DE,sinf*256+64;#e540
EXX
LD BC,15
LD L,B
LD H,B
LD E,B
LD D,B
sinmklp ADD HL,DE
LD A,H
SUB 120
EX DE,HL
JR NC,sinmk0
ADD HL,BC
JR sinmk1
sinmk0 SBC HL,BC
sinmk1 EX DE,HL
EXX
LD (DE),A
INC E
LD (HL),A
INC L
EXX
JR NZ,sinmklp
;------------------------------init brunch----------
begin LD HL,begdata
LD DE,data
LD BC,8
LDIR
LD HL,data+8
INC E
LD (HL),C
LD C,248
LDIR
LD HL,datmar*256
LD A,8
b1 LD (HL),A
INC L
ADD A,8
JR NZ,b1
LD H,A; H=0
LD (marker),HL
loop
CALL cls
CALL risui
JP loop
;begdata DB #ff,1,1,#47,#00,#80,#00,#60
begdata DB #ff,1,1,#47,#00,#A0,#00,#64;ff=A0
; old format is:
;+0 length of branch
;+1 ?
;+2 delta angle
;+3 angle to turn
;+4 low X
;+5 high X
;+6 low Y
;+7 high Y
risui LD IX,data
LD IY, &5F00
CALL risu1
LD D,(IY+0)
LD E,(IX+5)
LD L,(IX+7)
INC DE;E
CALL plot ;E=X,L=Y
INC DE;E
CALL plot;E=X,L=Y
rri2
LD A,IXL;LX
ADD A,8
ld iyl,a;LD LY,A pasmo
LD IXL,A;LX,A
RET Z
LD A,(IX)
OR A
CALL NZ,risu
JR rri2
cls LD HL,#4000
LD BC,#8001
LD DE,13
ADD HL,BC
;l11 LD A,%11110000
l11 LD A,%11101101
JR NC,l0
RRCA
LD (l11+1),A
l0 LD C,A
LD A,L
CP E
JR C,cl0
LD L,D
cl0 LD (cls+1),HL
ld a,h
or &C0
ld h,a
cl1
LD A,(HL)
AND C
LD (HL),A
ADD HL,DE
; LD A,H
; CP B
JP NC,cl1
RET
risu DEC (IX)
JR NZ,risu1
LD HL,marker
LD E,(HL)
INC (HL)
LD D,datmar
LD A,IXL;LX
LD (DE),A
risu1 DEC (IX+1)
JR NZ,ri0
CALL rnd
AND 15
ADD A,5
LD (IX+1),A
CALL rnd
AND 7
RRA
JR NC,ri00
NEG
ri00 LD (IX+2),A
ri0 LD A,(IX+3)
ADD A,(IX+2)
LD E,A
LD (IX+3),A
LD D,sinf
LD H,(IX+5);high X
LD L,(IX+4);low X
LD A,(DE)
LD C,A
RLA
SBC A,A
LD B,A
;ld b,0
ld a,(iy+0)
or a
ADD HL,BC
adc a,b
ld (iy+0),a
call check_hl
ld a,(iy+0)
or a
ADD HL,BC
adc a,b
ld (iy+0),a
call check_hl
LD (IX+5),H
LD (IX+4),L
INC D
LD A,(DE)
LD E,H
LD H,(IX+7)
LD L,(IX+6)
LD C,A
RLA
SBC A,A
LD B,A
ADD HL,BC
ADD HL,BC
LD (IX+6),L
LD A,H
CP 192+7
JR C,ri2
RRA
SBC A,A
AND 191+8
ri2 LD L,A
LD (IX+7),A
ld d,(iy+0)
LD E,(IX+5)
CALL plot
CALL rnd
CP 40
RET NC
newotr LD HL,marker
LD A,(HL)
INC HL
CP (HL)
RET Z
LD BC,8
LD A,(HL)
INC (HL)
LD H,datmar
LD L,A
LD E,(HL)
LD (HL),B
LD D,data/256
new2 PUSH IX
POP HL
LD A,E
LDIR
LD E,A
CALL rnd
AND 3
ADD A,5
LD (DE),A
INC E
LD A,1
LD (DE),A
RET
marker DW 0
xx DW #A000
yy DW #6400
rnd
r1
LD A,200
PUSH DE
LD D,A
r2
LD A,71
LD (r1+1),A
ADD A,D
LD D,A
r3
LD A,153
LD (r2+1),A
ADD A,D
RLCA
LD (r3+1),A
POP DE
RET
nline:
ld a,8
add a,h
ld h,a
and 64
ret nz
push bc
ld bc,16304
sbc hl,bc
pop bc
ret
plot:
;E=X,L=Y
push hl
push de
push bc
ld h,&40
ld c,(hl)
inc h
ld b,(hl)
inc h
ld l,0
add hl,de
add hl,de
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
add hl,bc;hl=Address
ld d,bits/256
ld a,e
and 3
ld e,a
ld a,(de)
or (hl)
ld (hl),a
pop bc
pop de
pop hl
ret
check_hl
ld a,(iy+0)
or a
jp p,plus
ld (iy+0),1
ld h,&3F
ret
plus
push hl
push bc
ld l,h
ld h,(iy+0)
ld bc,&140
or a
sbc hl,bc
pop bc
pop hl
ret c;?<320
ld h,1
ld (iy+0),0
ret