0 Members and 1 Guest are viewing this topic.
p_ToHex: .db __ToHexEnd-$-1 ld b,4 ld de,vx_SptBuff push de__ToHexLoop: ld a,$1F__ToHexShift: add hl,hl rla jr nc,__ToHexShift daa add a,$A0 adc a,$40 ld (de),a inc de djnz __ToHexLoop xor a ld (de),a pop hl ret__ToHexEnd:
p_ToHex: .db __ToHexEnd-$-1 ld bc,4<<8+$1F ld de,vx_SptBuff__ToHexLoop: ld a,c__ToHexShift: add hl,hl rla jr nc,__ToHexShift daa add a,$A0 adc a,$40 ld (de),a inc e djnz __ToHexLoop ex de,hl ld (hl),b ld l,vx_SptBuff&$FF ret__ToHexEnd:
p_ShiftLeft: .db __ShiftLeftEnd-1-$ ld hl,plotSScreen+767 ld c,64__ShiftLeftLoop: ld b,12 or a__ShiftLeftShift: rl (hl) dec hl djnz __ShiftLeftShift dec c jr nz,__ShiftLeftLoop ret__ShiftLeftEnd:
p_ShiftLeft: .db __ShiftLeftEnd-1-$ ld hl,plotSScreen+767 xor a__ShiftLeftLoop: ld b,12__ShiftLeftShift: rl (hl) dec hl djnz __ShiftLeftShift add a,4 jr nz,__ShiftLeftLoop ret__ShiftLeftEnd:
p_ShiftRight: .db __ShiftRightEnd-1-$ ld hl,plotSScreen ld c,64__ShiftRightLoop: ld b,12 or a__ShiftRightShift: rr (hl) inc hl djnz __ShiftRightShift dec c jr nz,__ShiftRightLoop ret__ShiftRightEnd:
p_ShiftRight: .db __ShiftRightEnd-1-$ ld hl,plotSScreen xor a__ShiftRightLoop: ld b,12__ShiftRightShift: rr (hl) inc hl djnz __ShiftRightShift add a,4 jr nz,__ShiftRightLoop ret__ShiftRightEnd:
p_FreqOut: .db __FreqOutEnd-1-$ xor a__FreqOutLoop1: push bc ld e,a__FreqOutLoop2: ld a,h or l jr z,__FreqOutDone dec hl dec bc ld a,b or c jr nz,__FreqOutLoop2 ld a,e xor %00000011 scf__FreqOutDone: pop bc out ($00),a ret nc jr __FreqOutLoop1__FreqOutEnd:
p_FreqOut: .db __FreqOutEnd-1-$ xor a__FreqOutLoop1: push bc ld e,a__FreqOutLoop2: ld a,h or l jr z,__FreqOutDone cpd jp pe,__FreqOutLoop2 ld a,e xor %00000011 scf__FreqOutDone: pop bc out ($00),a ret nc jr __FreqOutLoop1__FreqOutEnd:
p_IntSetup: .db __IntEnd-p_IntSetup-1 di ld de,$8B01 ld a,d ld i,a ld a,l ld hl,$8B00 ld b,e ld c,l ld (hl),$8A ldir and %00000110 out (4),a ld a,%00001000 out (3),a ld a,(hl) out (3),a ld d,a ld e,a ld c,__IntDataEnd-__IntData ld hl,$0000 ldir in a,(6) ld ($8A8A+__IntDataSMC-__IntData+1),a__IntEnd: .db rp_Ans,9
p_IntSetup: .db __IntEnd-p_IntSetup-1 di ld a,l ld hl,$8C06 ld de,$8C05 ld bc,$8C05-$8A8A and l out (4),a ld a,h out (3),a dec a ld i,a dec a out (3),a ld (hl),a lddr ld hl,$0000 ld c,__IntDataEnd-__IntData ldir in a,(6) ld ($8A8A+__IntDataSMC-__IntData+1),a__IntEnd: .db rp_Ans,11
p_DtoF: .db 13 ex (sp),hl B_CALL(_SetXXXXOP2) ld hl,OP2 pop de ld bc,9 ldir
p_DtoF: .db 11 ex (sp),hl B_CALL(_SetXXXXOP2) ld hl,OP2 pop de B_CALL(_Mov9B)
p_Length: .db __LengthEnd-$-1 xor a ld b,a ld c,a cpir ld hl,-1 sbc hl,bc ret__LengthEnd:
p_Length: .db __LengthEnd-$-1 xor a ld b,h ld d,h ld e,l cpir scf sbc hl,de ret__LengthEnd:
p_CheckSum: .db __CheckSumEnd-$-1 ld b,h ld c,l pop af pop hl push af xor a ld d,a__CheckSumLoop: add a,(hl) ld e,a jr nc,$+3 inc d cpi ex de,hl ret po ex de,hl jr __CheckSumLoop__CheckSumEnd:
p_CheckSum: .db __CheckSumEnd-$-1 ld b,h ld c,l pop af pop hl push af xor a ld d,a__CheckSumLoop: add a,(hl) jr nc,$+3 inc d cpi jp pe,__CheckSumLoop ld h,d ld l,a ret__CheckSumEnd:
p_CheckSum: .db __CheckSumEnd-$-1 ld b,h ld c,l pop hl ex (sp),hl xor a ld d,a__CheckSumLoop: add a,(hl) jr nc,$+3 inc d cpi jp pe,__CheckSumLoop ld h,d ld l,a ret__CheckSumEnd:
Thanks I think I learned it from you folks EDIT: It does use 2 more cycles though, right?
p_EzSprite: .db 7 pop de ld a,e pop de ld d,a B_CALL(_DisplayImage)
p_EzSprite: .db 6 pop bc pop de ld d,c B_CALL(_DisplayImage)
p_DecWord: .db 7 ld a,(hl) dec (hl) or a jr nz,$+4 inc hl dec (hl)
p_DecWord: .db 6 ld a,(hl) dec (hl) or a ret nz inc hl dec (hl)
p_Input: .db __InputEnd-$-1 res 6,(iy+$1C) set 7,(iy+$09) xor a ld (ioPrompt),a B_CALL(_GetStringInput) B_CALL(_ZeroOP1) ld hl,$2D04 ld (OP1),hl B_CALL(_ChkFindSym) inc de inc de ex de,hl ret__InputEnd:
p_Input: .db __InputEnd-$-1 res 6,(iy+$1C) set 7,(iy+$09) xor a ld (ioPrompt),a B_CALL(_GetStringInput) B_CALL(_ZeroOP1) ld a,$2D ld (OP1+1),a rst rFindSym inc de inc de ex de,hl ret__InputEnd: