title ROLLER RAM Test name ('ROLLTEST') ; Dieses PCW-spezifische Programm speichert eine Adresstabelle ; der Bildschirmzeilen fuer zwei unterschiedliche Berechnungsmethoden. ; Also, eigentlich nur ein Test, ob beide Verfahren das gleiche Resultat liefern. OS equ 0000h BDOS equ 0005h .string equ 9 ROLLER equ 0b600h COMRAM equ 0c000h USERF equ 30 SCR_RUN equ 00e9h MAXLIN equ 32 lf equ 0ah cr equ 0dh eot equ '$' ld sp,LocStk ; Eigenen Stack holen ; ld hl,Comstrt ld de,COMRAM ld bc,Comlen ldir ; Routine in das COMMON MEMORY verschieben ; ld hl,(OS+1) ; BIOS Vektor holen ld de,3*(USERF-1) add hl,de ld (XBIOS+1),hl ; XBIOS Vektor eintragen ; ; Teil 1: Adressen sammeln ; ld a,0 ; Start mit Zeile 0 ld hl,ZTab ; Tabellenadresse laden ZLoop: push af push hl ld bc,COMRAM call XBIOS ; Zwei Adressen berechnen dw SCR_RUN pop hl ld de,2*2 add hl,de ; Neue Adresse pop af inc a cp MAXLIN ; Test, ob fertig jr nz,ZLoop ; ; Teil 2: Adressen ausgeben ; ld a,0 ; Start mit Zeile 0 ld hl,ZTab ; Tabellenadresse laden DLoop: push af ; ld c,(hl) ; Erste Adresse holen inc hl ld b,(hl) inc hl ld de,$ADR1 call ASCwrd ; In Hex wandeln ; ld c,(hl) ; Zweite Adresse holen inc hl ld b,(hl) inc hl ld de,$ADR2 call ASCwrd ; In Hex wandeln ; ld de,$ZEILE call String ; Text ausgeben push hl ld hl,$ZEILNUM+1 call IncASC ; Zeilennummer erhoehen pop hl ; pop af inc a cp MAXLIN ; Test, ob fertig jr nz,DLoop ; jp OS ; ; Zeichenkette in ^DE ausgeben ; String: push hl ld c,.string call BDOS ; Ausgabe pop hl ret ; ; Hex-Wort in BC speichern in ^DE ; ASCwrd: ex de,hl ld a,b ; Oberes Byte wandeln call ASCbyt ld a,c ; Unteres Byte wandeln call ASCbyt ex de,hl ret ; ; Hex-Byte in Akku speichern in ^HL ; ASCbyt: push af rrca ; Oberen Bits wandeln rrca rrca rrca call ASCnib pop af ; Untere Bits wandeln ASCnib: and 00001111b ; Bits extrahieren add a,090h ; Wandlung durchfuehren daa adc a,'0'+16 daa ld (hl),a ; Zeichen speichern inc hl ret ; ; ASCII-Zeilennummer in ^HL erhoehen ; Inc1: ld (hl),'0' ; Stelle zuruecksetzen dec hl ld a,(hl) ; Vorige Ziffer holen cp '0' ; Test ob 0..9 jr c,Inc2 cp '9'+1 jr c,IncASC Inc2: ld (hl),'0' ; Stelle initiieren IncASC: inc (hl) ; Ziffer erhoehen ld a,(hl) ; Ziffer holen cp '9'+1 ; Test Ueberlauf jr z,Inc1 ret ; Ende wenn nicht ; $ZEILE: db 'Zeile ' $ZEILNUM: db ' 1: (1) ' $ADR1: db 'xxxx - (2) ' $ADR2: db 'xxxx',cr,lf,eot ; ; ################### ROUTINE IN COMMON MEMORY ################### Comstrt equ $ .phase COMRAM ; ; Start der Berechnung ; Akku haelt Zeilennummer ; Register HL zeigt auf Zeilentabelle ; ld e,a ; Zeile umpacken push hl pop ix ; Adresse kopieren ; ; Berechnung 1 ; ld h,0 ld l,e ; HL=E add hl,hl ; HL=2*E add hl,hl ; HL=4*E add hl,hl ; HL=8*E add hl,hl ; Hl=16*E ld bc,ROLLER ; Adresse fuer Roller RAM add hl,bc ; HL=ROLLER+16*E ; ld c,(hl) inc hl ld b,(hl) ; BC=Adresse aus Roller RAM ; ld a,c ; Wilde Adresskalkulation and 00000111b ld l,a ld a,c rla ld c,a ld a,b rla ld b,a ld a,c and 11110000b or l ld c,a ; ld (ix+0),c ; Erstes Paar speichern ld (ix+1),b ; ; Berechnung 2 ; ld h,0 ld l,e ; HL=Zeile add hl,hl add hl,hl add hl,hl add hl,hl ; Zeile = Zeile * 16 ex de,hl ld iy,ROLLER add iy,de ; Rolleradresse = $B600 + Zeile in IY ld l,(iy+0) ld h,(iy+1) ; Inhalt der Rolleradr. in HL add hl,hl ; ... * 2 ; ld (ix+2),l ; Zweites Paar speichern ld (ix+3),h ; ret ; XBIOS: jp $-$ ZTab: ds 32*2*2 ; 32 Zeilen, je Zeile zwei Adressen ; .dephase Comlen equ $-Comstrt ; ################################################################ ; ds 2*32 LocStk equ $ end