Changes
Return to [[ACU Type Ins|ACU Type-Ins]]
__TOC__
=Downloads=
[[media:Acu_march_1985acu8503.zip|Disk Image]] =Cover Imageimage=[[image:Acu_march_1985_coveracu8503.png]]
=Boolean operations demonstration=
RUN"BOOLEAN"<br/>
[[image:Acu_Boolean1acu8503boolean1.png|192px384px]][[image:Acu_Boolean2acu8503boolean2.png|192px384px]]
=Electric Eddy=
RUN"EDDY"<br/>
[[image:Acu_Eddy1acu8503eddy1.png|192px384px]][[image:Acu_Eddy2acu8503eddy2.png|192px384px]]<br/><br/>[[image:Acu_Eddy3acu8503eddy3.png|192px384px]][[image:Acu_Eddy4acu8503eddy4.png|192px384px]]<br/><br/>[[image:Acu_Eddy5acu8503eddy5.png|192px384px]][[image:Acu_Eddy6acu8503eddy6.png|192px384px]]<br/><br/>[[image:Acu_Eddy7acu8503eddy7.png|192px384px]][[image:Acu_Eddy8acu8503eddy8.png|192px384px]]
=Electric Fencing=
RUN"FENCING"<br/>
[[image:Acu_Fencing1acu8503fencing1.png|192px384px]][[image:Acu_Fencing2acu8503fencing2.png|192px384px]]<br/><br/>[[image:Acu_Fencing3acu8503fencing3.png|192px384px]][[image:Acu_Fencing4acu8503fencing4.png|192px384px]]
=Flashman=
RUN"FLASHMAN"<br/>
[[image:Acu_Flash1acu8503flash1.png|192px384px]][[image:Acu_Flash2acu8503flash2.png|192px384px]]<br/><br/>[[image:Acu_Flash3acu8503flash3.png|192px384px]][[image:Acu_Flash4acu8503flash4.png|192px384px]]<br/><br/>[[image:Acu_Flash5acu8503flash5.png|192px384px]][[image:Acu_Flash6acu8503flash6.png|192px384px]]
=Jeremy Vine's music routine=
=Machine code fill routine and demonstration=
RUN"MCFILL"<br/>
[[image:Acu_Mcfill1acu8503mcfill1.png|192px384px]][[image:Acu_Mcfill2acu8503mcfill2.png|192px384px]]<br/><br/>[[image:Acu_Mcfill3acu8503mcfill3.png|192px384px]][[image:Acu_Mcfill4acu8503mcfill4.png|192px384px]]
=Manipulating the Amstrad CPC464 Screen Display=
=Number Sort routine=
RUN"SORT"<br/>
[[image:Acu_Sort1acu8503sort1.png|192px384px]][[image:Acu_Sort2acu8503sort2.png|192px384px]]<br/><br/>[[image:Acu_Sort3acu8503sort3.png|192px384px]][[image:Acu_Sort4acu8503sort4.png|192px384px]]
=Prime Numbers (1)=
RUN"PASCAL3"<br/>
[[image:Acu_Pascal3_1acu8503pascal1.png|192px384px]][[image:Acu_Pascal3_2acu8503pascal2.png|192px384px]]
=Prime Numbers (2)=
RUN"PASCAL4"<br/>
[[image:Acu_Pascal4_1acu8503pascal3.png|192px384px]][[image:Acu_Pascal4_2acu8503pascal4.png|192px384px]] =Screen Dump =File(DMP1s)=The Z80 assembler code for the DMP1 Screen Dump program.associated with this article:<br/>The machine code can be loaded in BASIC using DMPLIST2.BAS and DMPLIST4.BAS- DMPDMP1.ASM<br/>See Amstrad Computer User, March 1985 for more details- DMPEPSON.ASM<prebr/> ORG &8000 .entry EQU $ LD HL,&E9E1 ; Start RELOCATOR LD (&30),HL RST &30 .this EX DE,HL LD HL,rel_table-this ADD HL,DE ; HL has absolute address of rel_table DMPDMP1.loop LD C,(HL)BIN<br/> INC HL LD B,(HL) ; BC has first entry in table LD A,C OR B JR Z,done ; entry was 0000 so exit loop PUSH HL ; stack current table pointer LD H,B LD L,C ADD HL,DE ; make table entry absolute PUSH HL ; and stack this value LD C,(HL) INC HL LD B,(HL) ; get contents pointed to by entry LD H,B LD L,C ADD HL,DE ; make this absolute LD B,H LD C,L POP HL ; retrieve absolute entry value LD (HL),C INC HL LD (HL),B ; store absolute value at this address POP HL ; get address of previous table entry INC HL ; make HL point at next JR loop .done EQU $ ; end of RELOCATOR KL_NEW_FRAME_FLY EQU &BCD7KM_TEST_KEY EQU &BB1ECOPY_key EQU 9CTRL_key EQU 23SHIFT_key EQU 21 .r01 LD HL,tick_block-this ; set-up EVENT LD B,%10000001 LD C,0 DMPEPSON.r02 LD DE,int_routine-this CALL KL_NEW_FRAME_FLY RET .int_routine EQU $ ; this is the interrupt routine PUSH BC PUSH DE PUSH HL PUSH AF LD A,COPY_key CALL KM_TEST_KEY JR Z,return LD A,CTRL_key CALL KM_TEST_KEY JR Z,return .r03 CALL scrndump-this .return POP AF POP HL POP DE POP BC RET .tick_block DEFS 9 .FRED DEFS 7 .scrndump EQU $ GRA_TEST_ABSOLUTE EQU &BBF0MC_PRINT_CHAR EQU &BD2BMC_BUSY_PRINTER EQU &BD2E ; DMP1DUMP.r04 LD IX,FRED-this LD (IX+1),0 ; x coord = 0 LD (IX+2),0 LD (IX+3),&90 ; y coord = 400 LD (IX+4),&01 LD (IX+5),0 ; line count = 0 LD (IX+0),0 ; byte out = 0 .MAIN CALL MC_BUSY_PRINTER JR C,MAIN LD A,&1B CALL MC_PRINT_CHAR ; ESC LD A,&4B CALL MC_PRINT_CHAR ; "K" LD A,&02 CALL MC_PRINT_CHAR LD A,&40 CALL MC_PRINT_CHAR ; &240 .LINE EQU $ LD (IX+0),0 ; byte out = 0 LD (IX+6),0 ; 7-bit count = 0 .BYTE SRA (IX+0) LD E,(IX+1) ; FRED + 1 - 2 = x coord LD D,(IX+2) LD L,(IX+3) ; FRED + 3 - 4 = y coord LD H,(IX+4) CALL GRA_TEST_ABSOLUTE OR A JR Z,NOSET SET 6,(IX+0) ; +0 is byte being built .NOSET INC (IX+6) ; increase bit count LD A,(IX+6) ; and get it CP 7 JR Z,PRINT ; if got 7 bits the print LD L,(IX+3) ; get y coord LD H,(IX+4) DEC HL ; use HL for simple 16 bit maths DEC HL ; move down by 2 (1 pixel) LD (IX+3),L ; then put it back LD (IX+4),H JR BYTE .MID_JMP JR MAIN ; to relative jump more than 128 .PRINT CALL MC_BUSY_PRINTER JR C,PRINT ; wait until it's free LD A,(IX+0) ; get byte output CALL MC_PRINT_CHAR ; and print it INC (IX+1) INC (IX+1) ; move x coord on by 2 JR NZ,NOHIGH INC (IX+2) ; handle high byte if necessary .NOHIGH LD A,(IX+1) SUB &82 JR NZ,RESETY LD A,(IX+2) CP 2 JR Z,ENDLIN ; x coord = &282 .RESETY LD L,(IX+3) LD H,(IX+4) LD DE,&000C ADD HL,DE LD (IX+3),L ; increase y coord by 12 LD (IX+4),H JR LINE .ENDLIN INC (IX+5) ; increment line count LD A,&0A ; Line Feed CALL MC_PRINT_CHAR LD A,&0D ; Carriage Return CALL MC_PRINT_CHAR LD A,SHIFT_key CALL KM_TEST_KEY ; check id SHIFT is pressed JR NZ,BYE LD (IX+1),0 ; set x coord to zero LD (IX+2),0 LD A,(IX+5) ; get line count CP &22 JR NZ,MID_JMP ; have we got 34 lines (7 high) .BYE EQU $ LD A,15 CALL MC_PRINT_CHAR LD A,13 CALL MC_PRINT_CHAR RET .rel_table EQU $ DEFW r01-this+1 DEFW r02-this+1 DEFW r03-this+1 DEFW r04-this+2 ; address in IX operator is 3 and 4 DEFW 0BIN<br/pre> =Screen Dump (Epson)=The Z80 assembler code for the Epson Screen Dump program- DMPLIST2.BAS<br/>The machine code can be loaded in BASIC using DMPLIST2.BAS and - DMPLIST4.BAS.<br/>See Amstrad Computer User, March 1985 for more details.<pre> ORG &8000 .entry EQU $ LD HL,&E9E1 ; Start RELOCATOR LD (&30),HL RST &30 .this EX DE,HL LD HL,rel_table-this ADD HL,DE ; HL has absolute address of rel_table .loop LD C,(HL) INC HL LD B,(HL) ; BC has first entry in table LD A,C OR B JR Z,done ; entry was 0000 so exit loop PUSH HL ; stack current table pointer LD H,B LD L,C ADD HL,DE ; make table entry absolute PUSH HL ; and stack this value LD C,(HL) INC HL LD B,(HL) ; get contents pointed to by entry LD H,B LD L,C ADD HL,DE ; make this absolute LD B,H LD C,L POP HL ; retrieve absolute entry value LD (HL),C INC HL LD (HL),B ; store absolute value at this address POP HL ; get address of previous table entry INC HL ; make HL point at next JR loop .done EQU $ ; end of RELOCATOR KL_NEW_FRAME_FLY EQU &BCD7KM_TEST_KEY EQU &BB1ECOPY_key EQU 9CTRL_key EQU 23SHIFT_key EQU 21 .r01 LD HL,tick_block-this ; set-up EVENT LD B,%10000001 LD C,0 .r02 LD DE,int_routine-this CALL KL_NEW_FRAME_FLY RET .int_routine EQU $ ; this is the interrupt routine PUSH BC PUSH DE PUSH HL PUSH AF LD A,COPY_key CALL KM_TEST_KEY JR Z,return LD A,CTRL_key CALL KM_TEST_KEY JR Z,return .r03 CALL scrndump-this .return POP AF POP HL POP DE POP BC RET .tick_block DEFS 9 .FRED DEFS 7 .scrndump EQU $ GRA_TEST_ABSOLUTE EQU &BBF0MC_PRINT_CHAR EQU &BD2BMC_BUSY_PRINTER EQU &BD2E ; EPSONDUMP.r04 LD IX,FRED-this LD (IX+1),0 ; x coord = 0 LD (IX+2),0 LD (IX+3),&page 90 ; y coord = 400 LD (IX+4),&01 LD (IX+5),0 ; line count = 0 LD (IX+0),0 ; byte out = 0 LD A,&1B CALL MC_PRINT_CHAR LD A,&41 CALL MC_PRINT_CHAR LD A,&06 CALL MC_PRINT_CHAR .MAIN CALL MC_BUSY_PRINTER JR C,MAIN LD A,&1B CALL MC_PRINT_CHAR ; ESC LD A,&4B CALL MC_PRINT_CHAR ; "K" LD A,&40 CALL MC_PRINT_CHAR LD A,&02 CALL MC_PRINT_CHAR ; &240 .LINE EQU $ LD (IX+0),0 ; byte out = 0 LD (IX+6),0 ; 7-bit count = 0 .BYTE SLA (IX+0) LD E,(IX+1) ; FRED + 1 - 2 = x coord LD D,(IX+2) LD L,(IX+3) ; FRED + 3 - 4 = y coord LD H,(IX+4) CALL GRA_TEST_ABSOLUTE OR A JR Z,NOSET SET 0,(IX+0) ; +0 is byte being built .NOSET INC (IX+6) ; increase bit count LD A,(IX+6) ; and get it CP 7 JR Z,PRINT ; if got 7 bits the print LD L,(IX+3) ; get y coord LD H,(IX+4) DEC HL ; use HL for simple 16 bit maths DEC HL ; move down by 2 (1 pixel) LD (IX+3),L ; then put it back LD (IX+4),H JR BYTE .MID_JMP JR MAIN ; to relative jump more than 128 details.PRINT CALL MC_BUSY_PRINTER JR C,PRINT ; wait until it's free LD A,(IX+0) ; get byte output CALL MC_PRINT_CHAR ; and print it INC (IX+1) INC (IX+1) ; move x coord on by 2 JR NZ,NOHIGH INC (IX+2) ; handle high byte if necessary .NOHIGH LD A,(IX+1) SUB &82 JR NZ,RESETY LD A,(IX+2) CP 2 JR Z,ENDLIN ; x coord = &282 .RESETY LD L,(IX+3) LD H,(IX+4) LD DE,&000C ADD HL,DE LD (IX+3),L ; increase y coord by 12 LD (IX+4),H JR LINE .ENDLIN INC (IX+5) ; increment line count LD A,&0A ; Line Feed CALL MC_PRINT_CHAR LD A,&0D ; Carriage Return CALL MC_PRINT_CHAR LD A,SHIFT_key CALL KM_TEST_KEY ; check id SHIFT is pressed JR NZ,BYE LD (IX+1),0 ; set x coord to zero LD (IX+2),0 LD A,(IX+5) ; get line count CP &22 JR NZ,MID_JMP ; have we got 34 lines (7 high) .BYE EQU $ LD A,15 CALL MC_PRINT_CHAR LD A,13 CALL MC_PRINT_CHAR RET .rel_table EQU $ DEFW r01-this+1 DEFW r02-this+1 DEFW r03-this+1 DEFW r04-this+2 ; address in IX operator is 3 and 4 DEFW 0</pre>
=Sum Numbers=
=Trench=
RUN"TRENCH"<br/>
=Unerase=
[[Category:Type Ins]]