;Dots, 07.07.2014
org &6000
;nolist;-winAPE assembler no showtext
;write direct
;run start
start:
; set the screen mode
ld a,1
call #bc0e
di
;--------------------generate sinus
ld hl, unk_63A6
ld de, #7c00*0
ld c, e
ld ixl, #10
loc_600F:
ld b, 4
loc_6011:
xor a
rl (hl)
rla
rl (hl)
rla
add a, c
ld c, a
ld (de), a
inc e
djnz loc_6011
inc hl
dec ixl
jr nz, loc_600F
ld h, d
ld l, e
loc_6027:
;- add a,a
ld (de), a
inc e
dec l
ld a, (hl)
jr nz, loc_6027
loc_602D:
ld a, (hl)
add a,a
ld (hl),a
neg
ld (de), a
inc l;de
inc e;l
jr nz, loc_602D
nd:
;hl=0
ld l,h;ld hl,0
;--2nd table
;; exx
; ld hl,0
;; ld bc,#0080
;; ld h,b
;; ld l,b
;; exx
sin2lp:
push hl
ld a,l
ld d,a
add a,a
add a,a
ld l,a
ld e,(hl)
;; exx
;; add hl,bc
;; ld a,h
;; exx
;; ld l,a
srl d
ld l,d
ld d,(hl)
;-------- A=E*D -------------
LD A,E
XOR D
AND #80
PUSH AF
ld a,e
call abs
ld e,a
ld a,d
call abs
ld d,a
xor a
ld b,8
mul8:
RR E
JR NC,next8;$+3
ADD A,D
next8:
RRA
djnz mul8
ex af,af';EXA
POP AF
JR Z,ALLPL
ex af,af';EXA
NEG
ex af,af';EXA
ALLPL
ex af,af';EXA
pop hl
inc h
ld (hl),a
dec h
inc l
jr nz,sin2lp
;--------------------------------------let's build lookup for plot
lutplot equ 0+256*2
;lsb Y
;msb Y
;dispx -X
;bitweightL -X
;bitweightR -X
ld h,2;ld hl,lutplot
ld de,#C000+16-8
luty:
ld (hl),d
inc h
ld (hl),e
dec h
;nextline
ex de,hl
; call nline
ld a,8
add a,h
ld h,a
and 64
jr nz,next_l;ret nz
ld bc,16304
sbc hl,bc
next_l:
ex de,hl
inc l
; ld a,l
; cp 200
jr nz,luty
;----------now X value
ld h,4;ld hl,lutplot+512
ld b,l;ld b,0
lutx:
ld d,#80;;ld de,#8000
ld a,4
lutx1:
ld (hl),b
inc h
ld (hl),d
; inc h
; ld (hl),e;we do not need in E?
; dec h
dec h
inc l
;or a
rrc d
dec a
jr nz,lutx1
inc b
ld a,l
or a
jr nz,lutx
;--roll lines-------
;DE=Y.X
loop:
ld b,#f5
wait:
in a,(c)
rra
jr nc,wait
v1:ld a,64
inc a
ld (v1+1),a
ld hl,#00B6
call plot_p
v2:ld a,64-4
inc a
ld (v2+1),a
;cpl;$2F
; and (hl);$A6
ld hl,#A62F
call plot_p
jr loop
plot_p:
ld (opcode),hl
; ld h,1
ld hl,0+256
ld b,a;64
plot:
push bc
push hl
ld a,(hl)
add a,64*2
ld e,a
ld l,b
ld a,(hl)
add a,64
ld l,a;;d,a
inc h;ld h,lutplot/256
;ld l,d
ld b,(hl)
inc h
ld a,(hl)
inc h
ld l,e
add a,(hl);dispX
jr nc,noh
inc b
noh:
ld c,a
inc h
ld d,(hl);get bit
;-inc h
;-ld e,(hl)
ld h,b
ld l,c
putpix:
ld a,d
opcode: or (hl);$b6
nop;00
ld (hl),a
pop hl
pop bc
inc b
inc l
jr nz,plot
;ret
;wa
;jr wa
abs:
or a
ret p
neg
ret
;.nline ld a,8
; add h
; ld h,a
; and 64
; ret nz
; ld bc,16304
; sbc hl,bc
; ret
unk_63A6:
db #026
db #066
db #066
db #066
db #065
db #096
db #059
db #055
db #095
db #055
db #015
db #045
db #011
db #010
db #041
; db 0