Welcome to Schneider / Amstrad CPC Forum. Please login or sign up.

28. March 2024, 16:11:41

Login with username, password and session length

Shoutbox

TFM

2024-01-15, 17:06:57
Momentan billige Farbbänder auf Ebay für PCW

Devilmarkus

2023-07-09, 10:37:40
Zweiter 👋😂🤣

TFM

2023-06-13, 14:21:49
Sommerloch!

TFM

2023-05-30, 17:00:20
Erster ;-)

Recent

Members
Stats
  • Total Posts: 11,654
  • Total Topics: 1,328
  • Online today: 93
  • Online ever: 1,724
  • (16. January 2020, 00:18:45)
Users Online
Users: 0
Guests: 80
Total: 80

80 Guests, 0 Users

Schnelle Kopierroutine von #4000 nach #c000 (16kb)?

Started by cpcman, 09. November 2018, 22:09:02

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cpcman

Hallo, guten Tag.

Ich suche eine sehr schnelle Kopierroutine von #4000 nach #c000 (16kb) ?

Die hab ich mir angefertigt:

public static void copy_40_c0()
  asm inline (Indirections.Values())
  {
    ld de,#c000
    ld hl,#4000
    ld bc,#4000
    ldir
  }


Gibt es eine schnellere?

danke.
Gruss

TFM

Die einzige schnellere ist F_MOVE in FutureOS. Spart pro Byte 1 us (5 us anstatt 6 us pro Byte). Das sind aber nur 16,7%.

Wenn es nur darum geht ein Byte zu schreiben, dann kann man mit 2 us pro Byte arbeiten (F_FILL).
TFM of FutureSoft
http://www.futureos.de --> Das Betriebssystem FutureOS (Update: 20.12.2023)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> RSX ROM für LambdaSpeak (Update: 26.12.2021)

cpcman

Danke.
Wie sehen deine Lösungen bitte aus in ASM.

Gruss

TFM

Schreibe ich Dir gerne, aber wie gesagt, das ist unter FutureOS. Willst Du damit was machen?
TFM of FutureSoft
http://www.futureos.de --> Das Betriebssystem FutureOS (Update: 20.12.2023)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> RSX ROM für LambdaSpeak (Update: 26.12.2021)

cpcman

Ja, ich möchte einen Speicherbereich schnell umsetzen.

Weiterhin interessiert mit jede Neuigkeit in ASM.

Danke.
Gruss

cpcman

Hallo TFM, könnstest du mir mal bitte eine schnelle Kopierroutine zukommen lassen ?

Danke.
Gruss

TFM

Gerne!

- Welches OS (natives OS, CP/M, SymbOS, FutureOS)?
- Welche Sprache? (ASM, BASIC)?
TFM of FutureSoft
http://www.futureos.de --> Das Betriebssystem FutureOS (Update: 20.12.2023)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> RSX ROM für LambdaSpeak (Update: 26.12.2021)

cpcman


TFM

Wenn sich die Blöcke nicht überschneiden:

LD HL,Quelle
LD DE,Ziel
LD BC,Länge
LDIR

Bei Überschneidungen von Quell- und Ziel-Block ist eventuell LDDR anstatt LDIR zu benutzen. Aber dann bitte auch HL und DE anpassen - spricht auf's Bockende setzen.
TFM of FutureSoft
http://www.futureos.de --> Das Betriebssystem FutureOS (Update: 20.12.2023)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> RSX ROM für LambdaSpeak (Update: 26.12.2021)

cpcman

Danke, die Routine habe ich schon im Einsatz.
Ist noch zu langsam.

Wie machst du das das eigentlich in FutureOS ?
F_MOVE......

Danke.
Gruss

Devilmarkus

#10
Was hast du denn mit der Routine vor?
Möchtest du Animationen spielen, oder wofür ist es gedacht?
Problem wird vermutlich hier dann weniger die Geschwindigkeit sein, sondern dass sich das Bild Scheibchenweise aufbaut, kann das sein?

Schau dir mal die 4 SNA im JavaCPC an: (Wichtig: 4mb Erweiterung benötigt)
https://cpcwiki.de
Dein Deutsches CPCWiki!

cpcman

Ich möchte bei einer Animation den Bereich von $4000 nach $c000 kopieren.

Danke.
Gruss.

Devilmarkus

Ja genau das mache ich hier auch, allerdings muss man die Bilder vorher auch speziell nach &4000 kopieren, da der Aufbau eben nicht Scheibchenweise ist...
Die Routine (Eine komplette RSX Erweiterung, mit Sprites usw...) ist noch nicht fertig, da fehlen noch ein paar Dinge, wenn sie fertig ist, poste ich sie hier...
https://cpcwiki.de
Dein Deutsches CPCWiki!

cpcman

Danke.

RSX mache ich nicht.
Ich spiele mit dem CCZ80++-Compiler.
Brauche den Code in ASM.

Gruss

Devilmarkus

#14
Die Routine ist ja in Assembler...
Ich such dir grad mal die Ausschnitte aus, die du brauchst...

Einige Sachen, wie Bankswitching, habe ich hier nicht berücksichtigt, das wirst du bestimmt selber wissen, das musst du hier also abändern

Falls dein Compiler "repeat" und "rend" nicht kennt: Du benötigst hier 80x LDI


;
; SCRCOPY - Copy the Screen line by Line for Re-Rendering
;
ScreenCopy:
or a      ; Has any Parameter Been Passed?
jp z,BankOutOfRange   ; Check we are in Range of Memory Banks Available
call bank     ; Switch in the Selected bank.
ld de,#4000
call PreCalculateScreenAddress; Ensuire not corrupted
DI ; Disable Interrupts

ScreenCopy1:
ld (RestoreSP1),sp   ; Save Stack Pointer
ld sp,scrAddrTable+2  ; Point to the Bottom of the Pre-Calculated Stack
ld a,200     ; 200 Lines of Screen
ScreenCopyLoop:
pop HL
;
; LDI Stack - Quicker at loading memory at fixed 16 T-States per insturction
;
LDI80
repeat 80
LDI
rend

dec a      ; decrease counter
jp nz,ScreenCopyLoop

ld sp,0000     ; Restore Stack Pointer
RestoreSP1 equ $-2
EI ; Enable interrupts again.
ret

;
; Paste the Screen with data from the buffer at #4000
;
ScreenPaste:
or a      ; Has any Parameter Been Passed?
jp z,BankOutOfRange
ld hl,ScreenPasteLoop
cp 1      ; One Paramater Passed?
jr z,ScreenPaste1   ; Increment IX
ld hl,ScreenPasteLoopSync ; Which Routine?
inc ix
inc ix
ScreenPaste1
ld (PasteWithFlyback),hl ; Set Proper Routine
call Bank     ; Set the correct bank to paste from
call PreCalculateScreenAddress ; Gets Corrupts
DI
ld HL,#4000
ld (RestoreSP2),sp   ; Save Stack Pointer
ld sp,scrAddrTable+2  ; Point to the Bottom of the Pre-Calculated Stack
ld a,200     ; 200 Lines of Screen
ScreenPasteLoopSync:
PUSH AF
call frameFly
pop AF

ScreenPasteLoop:
pop DE

;
; LDI Stack - Quicker at loading memory at fixed 16 T-States per insturction
;
LDI80b
repeat 80
LDI
rend
dec a      ; decrease counter
jp nz,ScreenPasteLoop
PasteWithFlyback equ $-2
ld sp,0000     ; Restore Stack Pointer
RestoreSP2 equ $-2
EI ; Enable interrupts again.
ret
https://cpcwiki.de
Dein Deutsches CPCWiki!