11605
DEMO -> Graphics
© _Public_Domain_ (2015)
 
 
 
FOReVER 2015 - Ivy
cpc
 
 

Last Update : Tuesday 17 March 2015 at 20 h 50

Manual n° 1

;source come from: ; Just Another Grass ; 512 bytes intro for ; Chaos Constructions 2004 ; (C)2004, psb^hlw^triumph ; Pentagon rulez !!! ;thanks to psb for sharing one ORG #6000 write "ivy.bin" ;write direct run start start: ld sp,#5FFF ; set the screen mode ld a,0 call #bc0e di ;-setup colors and border ; select border ld bc,&7f10 out (c),c ; set border colour to black ld bc,&7f54;54-black,4B-white out (c),c ld de,#0054 call pencol;D.E=pen#.firmware color ;42-green ;4B white ld de,#0F42 call pencol;D.E=pen#.firmware color ;---generate limit limx equ #5200 ld hl,limx ld b,160-1 g1: ld (hl),l inc l:djnz g1 ld b,80 g2:ld (hl),0 inc l:djnz g2 g3: ld (hl),159 inc l:jr nz,g3 ;----------------------- ;prepare adresses plotad equ #5000 ld hl,plotad ld de,#C000 ld a,200 mkadr1 ex af,af' ld (hl),e inc h ld (hl),d dec h ex de,hl call nline ex de,hl inc l ex af,af' dec a jr nz,mkadr1 ; mkadr2 ld (hl),#00 inc h ld (hl),#C0 dec h inc l jr nz,mkadr2 ;----------------------- SINADR EQU #8000 PLOTADR EQU #0000;C000 FLOWER EQU SINADR+#017F FLOWERL EQU 12 ; MAKE SINUS TABLE LD HL,#00BF+SINADR LD DE,#00C0+SINADR SINL LD A,E ADD A,A ADD A,A EXX LD D,0 LD E,A LD H,D LD L,D ADD HL,DE:DEC A:JR NZ,$-2 LD A,H:SCF:RRA EXX LD (DE),A LD (HL),A RES 7,L RES 7,E CPL LD (DE),A LD (HL),A SET 7,L SET 7,E DEC L INC E JR NZ,SINL ; CLR RAM INC H:LD (HL),#B0:INC L LD (HL),E:INC HL LD A,H CP #50 JR NZ,$-5 MLOOP ld b,#f5 .l7003 in a,(c) rra jr nc,l7003 ; ...MUZ... LD DE,#0D04 MUS LD A,1:DEC A:JR NZ,MUSe OUT (#FE),A ; mus (A) MUS_A LD HL,MTAB LD B,8 LD A,%01000001:CALL PTRL1 RLCA:CALL PTRL1 RLCA:RLCA LD (AYBUF+7),A SUB #38:JR Z,MUS_Ae LD A,#10 MUS_Ae LD (AYBUF+4),A ; tsss (B) MUS_B DEC HL:RRC (HL) JR NC,MUS_Be EXX LD A,16 LD (AYBUF+5),A LD HL,FLOWER+FLOWERL*5 CALL PARENT0 EXX MUS_Be MPOS LD HL,#FFFF INC HL LD (MPOS+1),HL ADD HL,HL LD A,L:OR A:JR NZ,$+3 INC D ; drum (C) MUS_C LD A,H:AND 3:JR Z,MUS_Ce LD B,1:DEC A JR NZ,MUS_C1 LD B,4 MUS_C1 XOR A LD HL,DRUMTAB CALL PTRL1 ADD A,A:JR Z,MUS_Ce LD (AYBUF+1),A LD A,16 LD (AYBUF+6),A LD E,#47 EXX LD A,48 LD HL,FLOWER+FLOWERL CALL PARENT0 EXX MUS_Ce LD A,5 MUSe LD (MUS+1),A LD HL,AYBUF+5; tsss (B) RRCA:CALL NC,DEC_HL INC HL; drum (C) CALL DEC_HL LD A,(HL) RRCA:RRCA:AND 3:INC A ex af,af';EXA LD HL,AYBUF+1:INC (HL) DEC HL ;D=0E ld a,4 outlp: push af ;------------------------------------------------ ; Write to a AY-3-8912 register ; Entry conditions: ; C = register number ; A = data ; PPI port A is assumed to be set to output. ; PSG operation is assumed to be "inactive" ; Exit conditions: ; BC corrupt ; This function is compatible with the CPC+. ; step 1 - select register ; write register index to PPI port A ld c,a ld b,&f4 out (c),c ; set PSG operation - "select register" ld bc,&f6c0 out (c),c ; set PSG operation - "inactive" ld bc,&f600 out (c),c ld a,(hl):inc hl ; step 2 - write data to register ; write data to PPI port A ld b,&f4 out (c),a ; set PSG operation - "write data to register" ld bc,&f680 out (c),c ; set PSG operation - "inactive" ld bc,&f600 out (c),c pop af inc a cp #0E jr nz,outlp ; ...GFX... ;42-green ;4B white ;4-green,47-white ld a,e ld de,#0F59 cp 4:jr z,set_col cp #47:jr nz,set_col ld e,#4B set_col: call pencol;D.E=pen#.firmware color ; LD HL,#5800 ; LD (HL),E ; LD DE,#5801 ; LD BC,#02FF ; LDIR ;skip_s ex af,af';EXA LD C,A; C=loopz FL1 LD B,6 LD HL,FLOWER FL2 PUSH BC LD A,(HL):INC L PUSH HL RLCA:JR NC,FL_NEXT ;DEC cnt RLCA:DEC (HL) JR NZ,NO_STOP JR NC,NO_STOP XOR A DEC L:LD (HL),A:INC L NO_STOP INC L ;RANDOM dda LD DE,0 LD BC,RAND1:CALL ADDINHL ;da=da+dda LD BC,LIMDA:CALL ADDINHL ;a=a+da ex af,af';EXA CALL ADDINH1 PUSH DE ;X=X+SIN LD A,D:CALL SIN ; CALL ADDINH1 call addx ;Y=Y+COS POP AF:PUSH DE ADD A,64:CALL SIN LD BC,CORRY:CALL ADDINHL POP BC CALL PLOT; D=Y B=X ;MAKE RANDOM PARENT ex af,af';EXA RLCA:JR NC,NO_PAR CALL RAND CP #F0:JR C,NO_PAR LD B,4 LD HL,FLOWER+FLOWERL LD DE,FLOWERL FLPAR1 BIT 7,(HL):JR NZ,FLPAR2 POP DE:PUSH DE LD A,(DE):DEC E CALL PARENT ;; JR NO_PAR INC B FLPAR2 ADD HL,DE DJNZ FLPAR1 NO_PAR FL_NEXT POP HL LD BC,FLOWERL-1:ADD HL,BC POP BC:DJNZ FL2 DEC C:JR NZ,FL1 JP MLOOP addx LD C,(HL):INC L LD B,(HL):DEC L EX DE,HL:ADD HL,BC:EX DE,HL ;check X push hl ld h,limx/256 ld l,d ld d,(hl) pop hl ; jr no_r ; ld a,d ;cp 160 ;jr c,no_l ; ld d,0 ;no_l ; ld a,d ;cp 255 ;jr c,no_r ; ld d,160 ;no_r ; LD (HL),E:INC L LD (HL),D:INC L RET ;----------------------------------------------- ; Routines PLOT LD HL,PLOTADR; D=Y B=X LD E,B LD C,(HL);C=X LD(HL),E INC L LD A,(HL);A=Y LD (HL),D INC HL RES 3,H;3 no_lp: LD (PLOT+1),HL LD H,0 CALL PLOT_; clr jr plo2 push bc ld l,a;Y ; ld c,b;X ld a,h ld (rest+1),a ld h,plotad/256 ld a,(hl) inc h ld h,(hl) ld l,a ld b,0; and X or a srl c add hl,bc ld (hl),0 ; inc hl ; ld (hl),0 pop bc or a call LIMDA plo2: ;--------------------------------------------- LD A,D;A=Y LD C,E;E=X ;LD HL,#B600; set ld h,#FF PLOT_ ;LD (PLOT_1),HL push bc ld l,a;Y ; ld c,b;X ld a,h ld (rest+1),a ld h,plotad/256 ld a,(hl) inc h ld h,(hl) ld l,a ld b,0; and X ld a,85;bit mask ld ixl,%10101010 or a srl c jr nc,pos_1 ld ixl,%01010101 cpl pos_1 add hl,bc and (hl) ld (hl),a ld a,ixl rest:and 0 or (hl) ld (hl),a pop bc or a ; CALL 8880;A=Y,C=X ;LIMIT da LIMDA RET NC LD A,D RLCA SBC A,A XOR D AND %11111110 XOR D LD D,A RET ;LIMIT 0<Y<191 CORRY ld a,d cp 199 jr c,ri3 rra sbc a,a and 199 ri3 ld d,a ret ;; LD A,D:CP 192:RET C ;; RRCA:SBC A,A:AND 191;#BF ;; LD D,A ;; RET ;; ;; LD A,H ;; CP 192+7 ;; JR C,ri2 ;; RRA ;; SBC A,A ;; AND 191+8 ;;ri2 LD L,A ;BC=ADR OF SUBPROG ADDINH1 LD BC,RETURN ADDINHL LD (ADDINhll+1),BC LD C,(HL):INC L LD B,(HL):DEC L EX DE,HL:ADD HL,BC:EX DE,HL RLCA:PUSH AF ADDINhll CALL RETURN POP AF ADDIN_ LD (HL),E:INC L LD (HL),D:INC L RETURN RET ;RANDOM dda RAND1 RET NC RAND LD DE,#1710:INC DE RES 5,D:LD (RAND+1),DE ; JR SIN0 ld a,e ;A=alfa (0..255) SIN LD D,SINADR/256;[ LD E,A SIN0 LD A,(DE) SIN1 RLCA:LD E,A SBC A,A:LD D,A LD A,E RET ;DE=SRC, HL=TO, A=cnt PARENT0 LD DE,FLOWER PARENT PUSH HL:EX DE,HL LD BC,FLOWERL:LDIR POP HL LD (HL),#C8:INC L LD (HL),A INC L CALL RAND JR ADDIN_ DEC_HL LD A,(HL):DEC A:RET M DEC (HL):RET ; FXes ) TSSTAB DB %01000100 MTAB DB %00001010,%01100110 DB %10100000,%00000000 DB %11110111,%01110111 DB %11110111,%11111111 DRUMTAB DB %00010001,%00010001 DB %00010100,%01000001 AYBUF DW 479 DB 0,%00101011 DB 0,0,0,0,0,#0E ;HL=PATT,B=PAT_LEN ;A=NUM PTRL1 PUSH BC PUSH HL LD C,(HL) RR (HL):INC L:DJNZ $-3 POP HL PUSH AF RR C:LD (HL),C POP AF POP BC RLA RET ;--------------pen select colour pencol;D.E=pen#.firmware color LD B,&7F;pen number (and Gate Array function) OUT (C),d ;Send pen number ;Pen colour (and Gate Array function) OUT (C),e ret .nline ld a,8 add h ld h,a and 64 ret nz ld bc,16304 sbc hl,bc ret EE


Goto Top
CPC-POWER/CPCSOFTS, programming by Kukulcan © 2007-2019 all rights reserved.
Reproduction forbidden without any express authorization. All the game titles used belong to their respective owners.