Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EQU $ASAM.PASS.ERROR=2
- ORG 25000
- CreateImage "%$ASAM.Compile.FileName%.TRD"
- COLA EQU 2
- COLB EQU 7
- COPA EQU COLA
- COPB EQU COLB
- POSX EQU 23296
- START EQU $
- DI
- LD A,INT.VEC
- LD I,A
- IM 2
- LD SP,$
- ; CALL MakeScreenVerB
- CALL EFGENERATOR
- XOR A
- LD (POSX),A
- EI
- CALL TackFourFix
- LD HL,EFFECT
- LD (IORQ.EFFECT),HL
- CALL IORQ.FIXLOOP
- MLOOP DS 120;HALT
- JR MLOOP
- MakeScreenVerB:
- LD HL,22528
- LD DE,22529
- LD BC,767
- LD (HL),COPA*8+COPB
- LDIR
- RET
- MakeScreenVerA:
- LD HL,22528
- LD DE,22529
- PUSH HL
- PUSH HL
- LD (HL),COPA*8+COPA
- LDI
- LDI
- LDI
- LDI
- PUSH HL
- LD (HL),COPB*8+COPB
- LDI
- LDI
- LDI
- POP BC
- POP HL
- PUSH BC
- LD BC,32-8+32*3
- LDIR
- POP HL
- PUSH DE
- LD BC,32
- LDIR
- POP HL
- LD BC,32*3
- LDIR
- POP HL
- LD BC,32*4*4
- LDIR
- RET
- ;INT.VECADDR EQU 0
- ;IORQ.EFFECT EQU 0
- ;IORQ.STOPEFFECT EQU 0
- .MAC_POS_COL ,,,,,,,
- DB COP@.0+COP@.1*8
- DB COP@.2+COP@.3*8
- DB COP@.4+COP@.5*8
- DB COP@.6+COP@.7*8
- ..
- .MAC_POSTB ,(),(),,
- DB @.0 ;BYTE FILL
- DB @.3*2 ;OFFSET EFSPLIST
- .%@.4==2%
- MAC_POS_COL @.1
- MAC_POS_COL @.2
- ..
- .%@.4==1%
- MAC_POS_COL @.2
- MAC_POS_COL @.1
- ..
- ..
- EFPOSTBL .2
- MAC_POSTB 00000000B, (B,A,A,A,A,A,A,A), (A,B,B,B,B,B,B,B), 0, @.C
- MAC_POSTB 11000000B, (B,A,A,A,A,A,A,A), (A,B,B,B,B,B,B,B), 0, @.C
- MAC_POSTB 11110000B, (B,A,A,A,A,A,A,A), (A,B,B,B,B,B,B,B), 0, @.C
- MAC_POSTB 11111100B, (B,A,A,A,A,A,A,A), (A,B,B,B,B,B,B,B), 0, @.C
- MAC_POSTB 00000000B, (B,B,B,A,A,A,A,A), (A,A,A,B,B,B,B,B), 1, @.C
- MAC_POSTB 11000000B, (B,B,B,A,A,A,A,A), (A,A,A,B,B,B,B,B), 1, @.C
- MAC_POSTB 11110000B, (B,B,B,A,A,A,A,A), (A,A,A,B,B,B,B,B), 1, @.C
- MAC_POSTB 11111100B, (B,B,B,A,A,A,A,A), (A,A,A,B,B,B,B,B), 1, @.C
- MAC_POSTB 00000000B, (B,B,B,B,B,A,A,A), (A,A,A,A,A,B,B,B), 2, @.C
- MAC_POSTB 11000000B, (B,B,B,B,B,A,A,A), (A,A,A,A,A,B,B,B), 2, @.C
- MAC_POSTB 11110000B, (B,B,B,B,B,A,A,A), (A,A,A,A,A,B,B,B), 2, @.C
- MAC_POSTB 11111100B, (B,B,B,B,B,A,A,A), (A,A,A,A,A,B,B,B), 2, @.C
- MAC_POSTB 00000000B, (B,B,B,B,B,B,B,A), (A,A,A,A,A,A,A,B), 3, @.C
- MAC_POSTB 11000000B, (B,B,B,B,B,B,B,A), (A,A,A,A,A,A,A,B), 3, @.C
- MAC_POSTB 11110000B, (B,B,B,B,B,B,B,A), (A,A,A,A,A,A,A,B), 3, @.C
- MAC_POSTB 11111100B, (B,B,B,B,B,B,B,A), (A,A,A,A,A,A,A,B), 3, @.C
- ..
- ;-----------------------------------------------------------------------------
- EFFECT:
- LD A,1
- OUT (254),A
- ; LD HL,224*(78-32)+2+16+16
- ; CALL DelayTik
- ; CALL EFCLS
- LD HL,224*25+4*30+16*3 + 4-2+2 +1-10-10-9
- LD A,(POSX)
- AND 15
- LD E,A
- LD D,0
- ADD HL,DE
- CALL DelayTik
- LD (EFSP+1),SP
- ;---
- LD A,(POSX)
- AND 31
- RLCA
- LD L,A
- RLCA
- RLCA
- ADD A,L
- LD L,A
- LD A,0
- ADC A,0
- LD H,A
- LD SP,EFPOSTBL
- ADD HL,SP
- LD SP,HL
- POP BC
- LD A,C
- LD (EF2+1),A
- LD L,B
- LD H,0
- LD DE,EFSPLIST
- ADD HL,DE
- LD (EF1+2),HL
- POP HL DE BC AF
- ;LHEDCBFA
- LD SP,22528+768
- .3
- .4
- PUSH AF BC DE HL AF BC DE HL AF BC DE HL AF BC DE HL
- ..
- .4
- PUSH DE HL AF BC DE HL AF BC DE HL AF BC DE HL AF BC
- ..
- ..
- ;---
- LD HL,EFSPCOLT
- LD A,(POSX)
- AND 31
- LD E,A
- LD D,0
- ADD HL,DE
- LD A,(HL)
- AND 7
- LD E,A
- LD A,(HL)
- RRCA
- RRCA
- RRCA
- AND 7
- LD D,A
- LD BC,254
- ;LD DE,COLB*256+COLA
- LD HL,16384
- EF2 LD A,0
- EF1 LD SP,(EFSPLIST+2*0)
- RET
- EFSP LD SP,0
- LD A,6
- OUT (254),A
- .10
- EX (SP),HL ;19
- ..
- NOP
- OUT (C),B
- LD HL,224+10+7-1-2-2+2-2
- LD A,(POSX)
- AND 3
- LD E,A
- LD D,0
- SBC HL,DE
- CALL DelayTik
- XOR A
- OUT (254),A
- RET
- EFSPCOLT .16
- DB COLB*8+COLA
- ..
- .16
- DB COLA*8+COLB
- ..
- EFSPLIST DW 0,0,0,0
- ;---
- EFLA JP $+3
- .7
- OUT (C),E
- NOP
- OUT (C),D
- NOP
- ..
- ORG $-3-1
- RET ;10
- EFLB JP $+3
- .7
- OUT (C),D
- NOP
- OUT (C),E
- NOP
- ..
- ORG $-3-1
- RET ;10
- ;-----------------------------------------------------------------------------
- INT.CYCLES EQU 6122
- ;-----------------------------------------------------------------------------
- ORG $/256
- INT.Vec EQU $
- ORG $*256+255
- INT.VecAddr EQU $
- DW INT
- INT: PUSHA
- IORQ.EFFECT EQU $+1
- CALL INT.RET
- POPA
- EI
- INT.ISP RET;INC SP
- INC SP
- JP MLOOP
- INT.RET EQU $
- RET
- IORQ.FIXLOOP:
- LD A,(INT.ISP+1)
- LD (INT.ISP+0),A
- RET
- IORQ.STOPEFFECT:
- PUSH HL
- LD HL,INT.RET
- LD (IORQ.EFFECT),HL
- POP HL
- RET
- ;-----------------------------------------------------------------------------
- TackFourFix:
- LD HL,(INT.VECADDR)
- PUSH HL
- LD HL,(IORQ.EFFECT)
- PUSH HL
- CALL IORQ.STOPEFFECT
- HALT
- LD (TFF6+1),SP
- LD HL,TackFFINT
- LD (INT.VECADDR),HL
- LD B,0;YL,0
- LD C,00001111B
- LD D,C
- LD E,C
- HALT
- DI
- HALT
- TackFFINT:
- CALL INT
- LD A,LOW(INT.CYCLES)
- CPL
- LD H,1
- ADD A,B
- AND 7
- LD L,A
- CALL DelayTik
- LD A,D ;8
- CP E ;4
- LD E,A ;4
- PUSH AF
- POP HL
- LD A,L
- RLCA
- RLCA
- RL C
- LD A,C
- AND 00000111B
- RLCA
- OR LOW(TFFPRTB)
- LD L,A
- LD H,HIGH(TFFPRTB)
- LD SP,HL
- POP HL
- TFF6 LD SP,0 ;10
- JP (HL)
- TFFPR0: POP HL
- LD (IORQ.EFFECT),HL
- POP HL
- LD (INT.VECADDR),HL
- RET
- TFFPR1: DEC B ;4
- JP TFF0 ;10
- TFFPR2: DS 1 ;4
- JP TFF0 ;10
- TFFPR3: INC B ;4
- JP TFF0 ;10
- TFF0 LD A,R ;9
- LD HL,TFF1-1 ;10
- INC HL ;6
- LD D,L ;4
- TFF1 .3
- INC D ;4
- ..
- JP (HL) ;4
- ALIGN 16
- TFFPRTB DW TFFPR0;TFFPR0
- DW TFFPR1;TFFPR1
- DW TFFPR2;TFFPR2
- DW TFFPR3;TFFPR3
- DW TFFPR2;TFFPR2
- DW TFFPR1;TFFPR1
- DW TFFPR2;TFFPR2
- DW TFFPR3;TFFPR3
- ;-----------------------------------------------------------------------------
- ;HL=TIKS-((11+10+15+10+11+11+10+7+6+7+4+4+10)=116)
- DelayTik:
- PUSH BC ;11
- LD BC,0-21 ;10
- DETIx1 ADD HL,BC ;11
- JP C,DETIx1 ;10
- SBC HL,BC ;15
- LD BC,DETIxTB ;10
- ADD HL,HL ;11
- ADD HL,BC ;11
- POP BC ;10
- LD A,(HL) ;7
- INC HL ;6
- LD H,(HL) ;7
- LD L,A ;4
- JP (HL) ;4 + 10(RET)
- DETIx00:INC HL ;6
- RET
- DETIx01:LD A,(HL) ;7
- RET
- DETIx02:DS 2 ;8
- RET
- DETIx03:LD A,R ;9
- RET
- DETIx04:LD HL,0 ;10
- RET
- DETIx05:ADD HL,HL ;11
- RET
- DETIx06:DS 3 ;12
- RET
- DETIx07:LD (0),A ;13
- RET
- DETIx08:INC HL:DS 2 ;14
- RET
- DETIx09:ADC HL,HL ;15
- RET
- DETIx10:JP DETIx00 ;16
- DETIx11:JP DETIx01 ;17
- DETIx12:JR DETIx00 ;18
- DETIx13:JR DETIx01 ;19
- DETIx14:JR DETIx02 ;20
- DETIx15:JR DETIx03 ;21
- DETIx16:JR DETIx04 ;22
- DETIx17:JR DETIx05 ;23
- DETIx18:JR DETIx06 ;24
- DETIx19:JR DETIx07 ;25
- DETIx20:JR DETIx08 ;26
- DETIxTB DW DETIx00,DETIx01,DETIx02,DETIx03,DETIx04
- DW DETIx05,DETIx06,DETIx07,DETIx08,DETIx09
- DW DETIx10,DETIx11,DETIx12,DETIx13,DETIx14
- DW DETIx15,DETIx16,DETIx17,DETIx18,DETIx19
- DW DETIx20
- ;-----------------------------------------------------------------------------
- ;
- ; + + + +
- ; 0000111100001111 x
- ; 0001111000011110 0
- ; 0011110000111100 1
- ; 0111100001111000 ?
- ;
- ; + +
- ; 00000000 x
- ; 00000011 0
- ; 00001111 1
- ; 00111111 ?
- ;
- ;
- ;
- ;
- ;
- ;EFCLS: LD (ECLxSP+1),SP
- ;
- ;
- ; LD SP,22528+768
- ; LD C,COPA*8+COPB
- ; LD B,C
- ; LD E,COPB*8+COPA
- ; LD D,E
- ;
- ;
- ; LD A,24
- ;ECLx2
- ; .4
- ; PUSH BC
- ; PUSH BC
- ; PUSH DE
- ; PUSH DE
- ; ..
- ; DEC A
- ; JP NZ,ECLx2
- ;ECLxSP LD SP,0
- ; RET
- ;
- ;
- ;ECLx0: PUSH HL
- ; .8
- ; .24
- ; LD (HL),A ;7 .. 11
- ; INC H ;4
- ; ..
- ; ORG $-1
- ; ADD HL,DE
- ; ..
- ; ORG $-1
- ; POP HL
- ; ADD HL,BC
- ; RET
- ; PUSH DE ;11 .. 22
- ; PUSH DE ;11
- ;
- ;
- ; LD (0),A ;13 !!!!!!!!!
- ;
- ; ADD HL,BC ;11
- ;
- ; CALL 0 ;17
- ;
- ;
- ; POP HL ;10 .. 17
- ; LD (HL),A ;7
- ;
- ;
- ; LD (HL),A
- ; LD (DE),A
- ; LD (BC),A
- ;
- ; LD (IX+0),A ;19
- ;
- ; SET 7,(HL) ;15
- ;-----------------------------------------------------------------------------
- EFGENERATOR:
- LD HL,FREE
- CALL EFGEy00 ;GENERATE FUTURE CODE
- CALL EFGEy01 ;GENERATE FUTURE CODE
- LD IY,EFSPLIST
- LD IX,EFSPTBL
- LD DE,16384
- CALL EFGEx0
- CALL EFGEx0
- CALL EFGEx0
- CALL EFGEx0
- RET
- EFGEx0: PUSH IX
- POP BC
- LD (IY),C
- INC IY
- LD (IY),B
- INC IY
- PUSH DE
- CALL EFGEz00
- LD BC,EFLA
- LD A,31
- CALL EFGExSAVEBCA
- ; LD B,3
- ;EFGEx1 PUSH BC
- CALL EFGEz00_32
- CALL EFGEz01_32
- CALL EFGEz00_32
- CALL EFGEz01_32
- CALL EFGEz00_32
- CALL EFGEz01_31
- ; POP BC
- ; DJNZ EFGEx1
- LD BC,EFLA
- CALL EFGExSAVEBC
- LD BC,EFLB
- LD A,32
- CALL EFGExSAVEBCA
- LD BC,EFSP
- CALL EFGExSAVEBC
- POP DE
- INC E
- RET
- ;IX=POS TABLE
- ;BC=PROC EXECUTE IN TABLE
- EFGExSAVEBC:
- LD (IX),C
- INC IX
- LD (IX),B
- INC IX
- RET
- EFGExSAVEBCA:
- CALL EFGExSAVEBC
- DEC A
- JR NZ,EFGExSAVEBCA
- RET
- ;IX=POS TABLE
- ;DE=PROC EXECUTE IN TABLE
- EFGExSAVEDE:
- LD (IX),E
- INC IX
- LD (IX),D
- INC IX
- RET
- ;IX=POS TABLE
- ;HL=PROC EXECUTE IN TABLE
- EFGExSAVEHL:
- LD (IX),L
- INC IX
- LD (IX),H
- INC IX
- RET
- EFGExSAVEPOS:
- LD (IX),L
- INC IX
- LD (IX),H
- INC IX
- RET
- EFGEy00PTR DW 0
- ;HL=SAVE DATA
- EFGEy00:LD (EFGEy00PTR),HL
- CALL EFGExBLxPOPHL ;10
- LD BC,EBLK_OD0 ;16
- CALL EFGExBL
- LD BC,EBLK_OE0 ;16
- CALL EFGExBL
- LD BC,EBLK_OD0 ;16
- CALL EFGExBL
- ;CALL EFGExHO0_DE ;112
- CALL EFGExHP0_DE ;112
- LD BC,EBLK_OD0 ;16
- CALL EFGExBL
- LD BC,EBLK_OE0 ;16
- CALL EFGExBL
- LD BC,EBLK_OD1 ;12
- CALL EFGExBL
- CALL EFGExBLxRET ;10
- RET
- EFGEx00_32: CALL EFGEx00_16
- EFGEx00_16: CALL EFGEx00_8
- EFGEx00_8: CALL EFGEx00_4
- EFGEx00_4: CALL EFGEx00_2
- EFGEx00_2: CALL EFGEx00
- ;IX=POS TABLE
- ;HL=SAVE DATA
- ;DE=SCR POS
- EFGEx00:CALL EFGExSAVEHL
- CALL EFGExSAVEDE
- CALL EFGEy00
- CALL INCD
- RET
- EFGEz00_31: CALL EFGEz00_16
- CALL EFGEz00_8
- CALL EFGEz00_4
- CALL EFGEz00_2
- JR EFGEz00
- EFGEz00_32: CALL EFGEz00_16
- EFGEz00_16: CALL EFGEz00_8
- EFGEz00_8: CALL EFGEz00_4
- EFGEz00_4: CALL EFGEz00_2
- EFGEz00_2: CALL EFGEz00
- ;IX=POS TABLE
- ;DE=SCR POS
- EFGEz00:LD BC,(EFGEy00PTR)
- CALL EFGExSAVEBC
- CALL EFGExSAVEDE
- CALL INCD
- RET
- EFGEy01PTR DW 0
- ;HL=SAVE DATA
- EFGEy01:LD (EFGEy01PTR),HL
- CALL EFGExBLxPOPHL ;10
- LD BC,EBLK_OE0 ;16
- CALL EFGExBL
- LD BC,EBLK_OD0 ;16
- CALL EFGExBL
- LD BC,EBLK_OE0 ;16
- CALL EFGExBL
- ;CALL EFGExHO0_DE ;112
- CALL EFGExHP0_DE ;112
- LD BC,EBLK_OE0 ;16
- CALL EFGExBL
- LD BC,EBLK_OD0 ;16
- CALL EFGExBL
- LD BC,EBLK_OE1 ;12
- CALL EFGExBL
- CALL EFGExBLxRET ;10
- RET
- EFGEx01_32: CALL EFGEx01_16
- EFGEx01_16: CALL EFGEx01_8
- EFGEx01_8: CALL EFGEx01_4
- EFGEx01_4: CALL EFGEx01_2
- EFGEx01_2: CALL EFGEx01
- ;IX=POS TABLE
- ;HL=SAVE DATA
- ;DE=SCR POS
- EFGEx01:CALL EFGExSAVEHL
- CALL EFGExSAVEDE
- CALL EFGEy01
- CALL INCD
- RET
- EFGEz01_31: CALL EFGEz01_16
- CALL EFGEz01_8
- CALL EFGEz01_4
- CALL EFGEz01_2
- JR EFGEz01
- EFGEz01_32: CALL EFGEz01_16
- EFGEz01_16: CALL EFGEz01_8
- EFGEz01_8: CALL EFGEz01_4
- EFGEz01_4: CALL EFGEz01_2
- EFGEz01_2: CALL EFGEz01
- ;IX=POS TABLE
- ;DE=SCR POS
- EFGEz01:LD BC,(EFGEy01PTR)
- CALL EFGExSAVEBC
- CALL EFGExSAVEDE
- CALL INCD
- RET
- ;HL=SAVE DATA
- EFGExBLxJPCUR:
- PUSH BC
- LD (HL),195
- INC HL
- LD C,L
- LD B,H
- INC BC
- INC BC
- LD (HL),C
- INC HL
- LD (HL),B
- INC HL
- POP BC
- RET
- ;HL=SAVE DATA
- EFGExBLxPOPHL:
- LD (HL),0E1H
- INC HL
- RET
- ;HL=SAVE DATA
- EFGExBLxRET:
- LD (HL),201
- INC HL
- RET
- ;HL=SAVE DATA
- ;BC=BLOCK ADDR
- EFGExBL:LD A,(BC)
- INC BC
- EFGEx2 PUSH AF
- LD A,(BC)
- INC BC
- LD (HL),A
- INC HL
- POP AF
- DEC A
- JR NZ,EFGEx2
- RET
- .MAC_EBLK_START
- EQU EBLK_ADDR=$
- DB 0
- ..
- .MAC_EBLK_END
- EQU EBLK_SIZE=$-EBLK_ADDR-1
- ORG EBLK_ADDR
- DB EBLK_SIZE
- ORG @.
- ..
- ;---16
- EBLK_OE0 MAC_EBLK_START
- OUT (C),E
- NOP
- MAC_EBLK_END
- ;---16
- EBLK_OD0 MAC_EBLK_START
- OUT (C),D
- NOP
- MAC_EBLK_END
- ;---16
- EBLK_OB0 MAC_EBLK_START
- OUT (C),B
- NOP
- MAC_EBLK_END
- ;---12
- EBLK_OE1 MAC_EBLK_START
- OUT (C),E
- MAC_EBLK_END
- ;---12
- EBLK_OD1 MAC_EBLK_START
- OUT (C),D
- MAC_EBLK_END
- ;---112
- EBLK_HO0 MAC_EBLK_START
- EBLK_HOP LD (0),A ;13
- LD (0),A ;13
- LD (0),A ;13
- LD (0),A ;13
- LD (0),A ;13
- LD (0),A ;13
- LD (0),A ;13
- LD (0),A ;13
- NOP ;4
- NOP ;4
- MAC_EBLK_END
- ;---
- EFGExHO0_DE:
- PUSH HL DE
- LD HL,EBLK_HOP+1
- LD B,8
- EFGEHx1 LD (HL),E
- INC HL
- LD (HL),D
- INC HL
- INC HL
- INC DE
- INC DE
- INC DE
- INC DE
- DJNZ EFGEHx1
- POP DE HL
- LD BC,EBLK_HO0 ;112
- CALL EFGExBL
- RET
- ; 432
- ; 000XXX00B
- ; 000
- ; 001 S2
- ; 011 S3
- ; 111 S4
- ; 101 R3
- ; 100 R2
- ; 110 S3
- ; 010 R4
- ; 000 R3
- ;---112
- EBLK_HP0 MAC_EBLK_START
- LD (HL),A ;7
- SET 2,L ;8
- LD (HL),A ;7
- SET 3,L ;8
- LD (HL),A ;7
- SET 4,L ;8
- LD (HL),A ;7
- RES 3,L ;8
- LD (HL),A ;7
- RES 2,L ;8
- LD (HL),A ;7
- SET 3,L ;8
- LD (HL),A ;7
- RES 4,L ;8
- LD (HL),A ;7 .. 112 less 16
- MAC_EBLK_END
- ;---
- EFGExHP0_DE:
- ; LD (EBLK_HPP+1),DE
- ; CALL EFGExSAVEDE
- LD BC,EBLK_HP0 ;128
- CALL EFGExBL
- RET
- ;---
- INCD: INC D
- LD A,D
- AND 7
- RET NZ
- LD A,E
- ADD A,32
- LD E,A
- RET C
- LD A,D
- SUB 8
- LD D,A
- RET
- ;-----------------------------------------------------------------------------
- SIZE EQU $-START
- EFSPTBL_SIZE EQU 2+(32+192*2+32+16)*2
- EFSPTBL EQU $
- ORG $+EFSPTBL_SIZE*4
- FREE EQU $
- SaveTRD "%$ASAM.Compile.FileName%.TRD","1.C",START,SIZE
- SaveBIN "%$ASAM.Compile.FileName%.BIN",START,SIZE
- SaveLabels "%$ASAM.Compile.FileName%.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement