Sintimus / Arkos

Sintimus, a 256 bytes intro by Arkos Sintimus is a 256 bytes intro displaying 256 sinus dots at full frame rate (50Hz).

» Sintimus executable in a .DSK file.

Source code

Note that there's no screen mode or palette initialization. We save some bytes by using the fact that when this program will be executed by the firmware (with the MC BOOT PROGRAM after a RUN”file from BASIC), the screen will be cleared and set with the default graphic mode and palette (amongs others things).
Written in WinAPE's Maxam assembler.

						org &400
 
wav_lib_gen_sinref_adr				equ 0
 
						di
						ld hl,sinusdot_data_crtc
sinusdot_crtc
						ld a,(hl)
						ld b,&BC+1
						outi
						ld b,&BD+1
						outi
						or a
						jp p,sinusdot_crtc
 
						; **********************************
						; * GENERATE 1024Bytes SINUS CURVE *
						; **********************************
 
						; Address must be (and will be forced) at any &400 boundary.
						LET sinref_store	= wav_lib_gen_sinref_adr AND &FC00
 
						; autoconfig / do not change anything below
						LET sinref_lenght 	= 1024
						LET sinref_store_h	= sinref_store/256
						LET sinref_and_mask	= &03
						LET sinref_or_mask	= sinref_store_h AND &FC
						LET sinref_store_q3	= sinref_store_h+2
						LET sinref_store_q4	= sinref_store_h+3
 
						; Parabolic approximation:
						; sin(a) = ( (a-1)^2 ) - 1 @a[0, pi/2]
 
						; used here :
						; sin(a) = a^2 @ a[0,pi/2]
 
						; [0, 2pi] => [0, 1024]
 
						; 39 bytes / 6405 NOPs
 
						xor a
 
						ld bc, sinref_store_q3*256 + sinref_store_q4
						ld l,a
						ld e,l
						exx
 
						ld b,a ; 256
						ld d,b
wavlib_gen_sinref_loop		
						ld c,b
						dec b
						ld e,b
						ld h,d
						ld l,d
wavlib_gen_sinref_square			add hl,de
						djnz wavlib_gen_sinref_square
 
						ld a,h
						exx
 
						rra
						;sub 128
 
						ld d,b
						ld h,c
 
						dec l
 
						ld (de),a ; 3rd Quad
						ld (hl),a ; 4th Quad
 
						cpl
						res 1,d
						res 1,h
 
						ld (de),a ; 1st Quad
						ld (hl),a ; 2nd Quad
 
						inc e
 
						exx
 
						ld b,c
						djnz wavlib_gen_sinref_loop
 
						ld hl,&1000
						ld de,&1001
						ld (hl),&80
						ld bc,&1000
						ldir
 
						ld hl,&30C0
						ld de,&10C3
						exx
sinusdot_mainloop
						ld b,&F5
						in a,(c)
						rra
						jr nc,sinusdot_mainloop+2
 
 
						; Clear dots
sinusdot_sp					ld sp,&1000
						xor a
						ld b,64
sinusdot_clear
						pop hl
						ld (hl),a
						pop hl
						ld (hl),a
						pop hl
						ld (hl),a
						pop hl
						ld (hl),a
						djnz sinusdot_clear
 
						; Plot dots
sinusdot_sin1_ptr				ld ix,0		
						ld de,9
						add ix,de
						ld (sinusdot_sin1_ptr+2),ix
 
sinusdot_sin2_ptr				ld iy,0		
						ld de,7
						add iy,de
						ld (sinusdot_sin2_ptr+2),iy
 
						ld bc,3
sinusdot_plot					db &DD:ld a,h
						and %11
						db &DD:ld h,a
						db &FD:ld a,h
						and %11
						db &FD:ld h,a
 
						ld a,(iy+0)
						rrca
						rrca
						rrca
						ld h,a
						ld l,(ix+0)
						ld a,%1000
 
						scf		; &4000 vram bit %01
						rr h
						rr l
						jr nc,$+5
						srl a ;add a,a	; shift pixel
 
						or a		; &4000 vram bit
						rr h
						rr l
						jr nc,$+7
						srl a ;add a,a	; shift pixel
						srl a ;add a,a
 
						or (hl)
						ld (hl),a
 
						push hl
 
						ld de,15
						add ix,de
						ld de,9
						add iy,de
 
						djnz sinusdot_plot
 
						; flipping
						exx
						ex de,hl
						ld b,&BD
						out (c),h
						ld b,&7F
						out (c),l
						exx
						ld a,(sinusdot_sp+2)
						xor %00001000
						ld (sinusdot_sp+2),a
						jp sinusdot_mainloop
 
sinusdot_data_crtc
						db 7,34
						db 1,32
						db 2,42
						db 6,32
						db 12+128,&30
sources/sintimus.txt · Last modified: 2009/10/27 03:02 by grim