title 'Zeilenlayout auf JOYCE-Matriylayout kopieren' page 64 ; Copyright (C) Werner Cirsovius ; Hohe Weide 44 ; D-2000 Hamburg 20 ; Tel.:040/4223247 ; Version 1.0, November 1986 ; ===== Konstanten ===== frmfix equ 719 vidcop: ; Zeile nach Matrix kopieren ; Berechnet nach: ; Matrix=(Zeile*8) mod 719 fuer Zeile=0..718 ; Matrix=Zeile fuer Zeile=719 ; EIN HL zeigt auf Zeile - Quelle ; DE zeigt auf Matrix - Ziel push b lxi b,frmfix dad b ; Auf Ende zeigen push h push d lxi d,frmfix jmp coplop coop: mov h,b ; Aktuelle Adresse holen mov l,c dad h dad h dad h push b xchg lxi h,frmfix call divide ; Rest berechnen pop b coplop: pop h ; Ziel holen shld tx ; Abspeichern pop h ; Aktuelle Quelle laden mov a,m ; Byte aus Quelle laden dcx h push h lhld tx push h dad d ; Ziel bestimmen mov m,a ; Byte speichern dcx b mov a,b ora a jp coop ; Test ob alle Reihen angefasst pop d pop h pop b ret divide: ; Division vorzeichenloser Zahlen ; ENTRY DE haelt Dividenden ; HL haelt Divisor ; EXIT HL haelt Quotienten ; DE haelt Rest ; Carry gesetzt wenn Divisor Null ist mov a,h ; Test ob Divisor Null ist ora l stc rz mov b,d ; Komplement vom Divisor mov c,e inx b ; Dividend + 1 call negde dcx d xra a ; Quotientenpuffer loeschen sta t? sta t?+1 jmp d? restor: dad b ; Wieder addieren d?: inr a ; Zaehler erhoehen push h dad h ; Divisor verdoppeln jc c? dad d ; Vergleich jnc restor c?: mov b,a ; Neuer Zaehler subtrc: pop h ; Halben Divisor holen dad d jc s? xchg s?: cmc lda t? ral ; Bits des Quotienten schieben sta t? lda t?+1 ral sta t?+1 dcr b ; Fertig ? jnz subtrc lhld t? ; Quotienten holen call negde ; Rest negieren dcx d ret negde: ; 16 Bit Zahl negieren ; ENTRY DE haelt Hex-Zahl ; EXIT DE haelt 2er Komplement der Hex-Zahl mov a,d cma ; Negieren mov d,a mov a,e cma mov e,a inx d ; Komplement ret t? ds 2 tx ds 2 end