DEMO -> Other
© Arkos (2011)
Alcatraz Bars

Last Update : Friday 17 April 2015 at 23 h 00

Manual n° 1

; 256 bytes Alcatraz Bars by Grim/Arkos^Semilanceata (June 2011) ; ; The effect picks pseudo random parameters. If it looks like crap, run the ; intro again and cross your fingers =) ; ; Should work on any CRTC except type 2. Hmm... might fit into 128 bytes... org &1001 run _exec ; AY3 register values _data_ay3 db 8, 2,4, 5,8, 0, %00111000, 16+12,16+12,16+12, &00,&20, &A _exec xor a call &BC0E ; Init AY3 (with Firmware) ld hl,_data_ay3 + 13 _init_AY3 ld a,l ld c,(hl) call &BD34 dec l jr nz,_init_AY3 di ; SinGen - Parabolic approximation, bitch _slut EQU &8000 AND &FC00 LET _slut_h = _slut/256 LET _slut_q3 = _slut_h+2 LET _slut_q4 = _slut_h+3 xor a ld bc, _slut_q3*256 + _slut_q4 ld l,a ld e,l exx ld b,a ; 256 ld d,b _slut_loop ld c,b dec b ld e,b ld h,d ld l,d _slut_square add hl,de djnz _slut_square ld a,h exx rra 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 _slut_loop ; Init intro constants ld h,&C0 ld bc,170*256+65 ; masks odd ld de, 85*256+40 ; masks even exx ld h,_slut / 256 ld d,h ; Wait for an active VSync call _wait_vsync ; Make sure the VSync goes off djnz $ ; Pick random sinus steps ld a,l and &F ld b,a ld a,r xor l and &F ld c,a ld (_var_sin1_step_display),bc ; Init CRTC & Set the next VSync at VCC=1 ld bc,&BC01 ld a,50 call _setRx dec b inc c call _setRx ; Wait, again, for a VSync call _wait_vsync ; Set VSync position ld bc,&BC07 out (c),c ld bc,&BD01 out (c),c ;*** Main 50Hz loop (19968us) *** _50Hz_loop ; Start line splitting (VCC=VLC=0) xor a ; R4=R9=0 call _setR4R9 ; Update the sinus wave pointers _var_sin1_step_frame equ $+1 _var_sin2_step_frame equ $+2 ld bc,&0910 call _nextStep ; Save the pointers push hl push de ; Bars display loop ld bc,274 _bar_loop ; Update the sinus wave pointers push bc _var_sin1_step_display equ $+1 _var_sin2_step_display equ $+2 ld bc,&0B12 call _nextStep pop bc ; Sum the two sinus values ld a,(de) add a,(hl) ; and get the vram address rra srl a exx ld l,a ; Display one bar jr c,_plot_odd _plot_even ld (hl),147:inc l ; 2 pixels ld (hl),36:inc l ; 2 pixels ld a,(hl) ; 1 pixel (masked) and d or e ld (hl),a jr _bar_continue _plot_odd ld a,(hl) ; 1 pixel (masked) and b or c ld (hl),a inc hl:ld (hl),50 ; 2 pixels + 1us malus inc hl:ld (hl),28 ; 2 pixels + 1us malus _bar_continue exx dec bc ld a,b or c jr nz,_bar_loop ; Restore the sinus wave pointers pop de pop hl ; Clear all the mess we've just plotted ; BC=0 ; 405us / ~6.25 rasterlines ld sp,&C000+100 ld a,51 _clear push bc dec a jr nz,_clear ; Change the CRTC settings to produce a VSync ; R4=R9=1 inc a call _setR4R9 ; Waste some cycles ld b,16*4 -3 djnz $ pop af ; Allo? jr _50Hz_loop _setR4R9 ld bc,&BC04 call _setRx ld bc,&BC09 _setRx out (c),c inc b out (c),a ret _nextStep ld a,b ld b,0 add hl,bc ld c,a ex de,hl add hl,bc ex de,hl res 2,h res 2,d ret _wait_vsync ld b,&F5 inc l in a,(c) rra jr nc,_wait_vsync + 2 ret

Goto Top
CPC-POWER/CPCSOFTS, programming by Kukulcan © 2007-2021 all rights reserved.
Reproduction forbidden without any express authorization. All the game titles used belong to their respective owners.
Hébergement Web, Mail et serveurs de jeux haute performance