A compilation of methodes known to me to access the screen of the PCW machine.
- On entry register
E holds the line number in the range of 0..31
- On exit the screen address is held in register
HL
- All routines must be in common memory (
C000H-FFFFH )
- They will be invoked by the well known function
SCR RUN ROUTINE .
Exception: The Method 09 and Method 10 attaches the screen memory by using I/O ports.
Common constants
ROLLER equ 0b600h
_SCBNK equ 81h ; Screen bank
_TPBNK equ 85h ; TPA bank
_SEL1 equ 0f1h ; Select memory bank 4000H-7FFFH
_SEL2 equ 0f2h ; Select memory bank 8000H-BFFFH
LOWBITS equ 00000111b
HIGBITS equ 11111000b
UPPBITS equ 11110000b
Method 1
:
(By Cliff Lawson, 1986 Amstrad)
Method01:
ld h,0
ld l,e ; Hl=line num
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 de,ROLLER
add hl,de ; Hl=ROLLER+16*line num
ld e,(hl)
inc hl
ld d,(hl) ; De=encoded address
ld a,e ; Hold on to bottom few bits
ex de,hl ; Hl=encoded address
add hl,hl ; Hl=(encoded address)*2
and LOWBITS ; A=botton 3 bits of original encoded addr.
or l ; Combine with bottom of doubled encoded addr.
ld l,a ; Put this back into hl.
ret
Method 2
:
(Own experience)
Method02:
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 ; Address o Roller RAM
add hl,bc ; HL=ROLLER+16*E
ld c,(hl)
inc hl
ld b,(hl) ; BC=Address from Roller RAM
ld a,c
and LOWBITS
ld l,a
ld a,c
rla
ld c,a
ld a,b
rla
ld h,a
ld a,c
and UPPBITS
or l
ld l,a
ret
Method 3
:
(Own experience)
Method03:
ld h,0
ld l,e ; HL=Line
add hl,hl
add hl,hl
add hl,hl
add hl,hl ; Line = Line * 16
ex de,hl
ld iy,ROLLER
add iy,de ; Roller address = $B600 + Line in IY
ld l,(iy+0)
ld h,(iy+1) ; Content of Roller address in HL
add hl,hl ; ... * 2
ret
Method 4
:
(Published in Superscript)
Method04:
ld a,e ; Row
ld d,0
rlca ; Row * 16
rla
rla
rla
ld l,a
ld a,d
adc a,HIGH ROLLER
ld h,a ; hl = b600+Row*16
ld a,(hl) ; Entry from Roller RAM
inc hl
ld h,(hl)
ld l,a
add hl,hl ; * 2 = Screen address
ret
Method 5
:
(Published in Screeny)
Method05:
ld a,e
rlca ; Row * 8
rla
rla
ld e,a
and LOWBITS
ld c,a
ld d,0
ex de,hl
add hl,hl
ld a,h
add a,HIGH ROLLER
ld h,a
ld e,(hl)
inc hl
ld d,(hl)
ex de,hl
add hl,hl
ld b,0
or a
sbc hl,bc
ret
Method 6
:
(Published in Die Grafik rollt)
Method06:
ld l,e
ld h,0 ;HL = Row
ld de,roller
add hl,hl
add hl,hl
add hl,hl
add hl,hl ;Row * 16
add hl,de ;Row + roller addr
ld a,(hl) ;HL = Roller adsress of Row
inc hl
ld h,(hl)
ld l,a ;Content of Roller Ram into HL
add hl,hl ;...* 2
ret
Method 7
:
(Published in Drawing Package,
Plot Routine and
Surfaces)
Method07:
ld l,e
ld h,0
add hl,hl ; Times two
add hl,hl
add hl,hl
add hl,hl
ld de,ROLLER
add hl,de ; Position in roller RAM
ld e,(hl) ; Get value from roller
inc hl
ld d,(hl)
ld a,e ; Build real address
and HIGBITS
sla a
rl d
ld b,a
ld a,e
and LOWBITS
or b
ld e,a
ex de,hl
ret
Method 8
:
(Published in Turbo-Grafik für den JOYCE)
Method08:
ld h,0
ld l,e
add hl,hl
add hl,hl
add hl,hl
add hl,hl
ld bc,ROLLER
add hl,bc
ld c,(hl)
inc hl
ld b,(hl)
ld a,c
and HIGBITS
ld l,a
ld h,b
add hl,hl
add hl,de
ld a,l
and HIGBITS
ld l,a
ld a,c
and LOWBITS
or l
ld l,a
ret
Method 9
:
(Published in Spirographix)
Method09:
ld l,e ; Get row
ld h,0
add hl,hl ; *16
add hl,hl
add hl,hl
add hl,hl
ld de,ROLLER
add hl,de ; Position in roller RAM
call RollAddr ; Fetch address of current line
ex de,hl
ld a,l
and LOWBITS ; Mask bits
ld e,a
add hl,hl
ld a,l
and HIGBITS
or e
ld l,a
ret
RollAddr:
di
ld a,_SCBNK2
out (_SEL2),a ; Select screen bank
ld e,(hl)
inc hl
ld d,(hl)
ld a,_TPBNK2
out (_SEL2),a ; Select TPA bank
ei
ret
Method 10
:
(Published in Plot, Draw and Circle Routine)
Method10:
di
ld a,_SCBNK
out (_SEL1),a ; Select video bank
inc a
out (_SEL2),a
add hl,hl
ld de,ROLLER
add hl,de ; Position in roller RAM
ld e,(hl) ; Fetch address of current line
inc hl
ld d,(hl)
ex de,hl
ld a,l
and LOWBITS ; Mask bits
ld e,a
add hl,hl
ld a,l
and UPPBITS
or e
ld l,a
ld a,_TPBNK
out (_SEL1),a ; Reset TPA bank
inc a
out (_SEL2),a
ei
ret
Method 11
:
(From BasiCode)
Method11:
ld a,e
and LOWBITS ; Get bits
ld d,0
ex de,hl
add hl,hl
ld a,h
add a,HIGH ROLLER ; Build entry into roller RAM
ld h,a
ld e,(hl)
inc hl
ld d,(hl)
ex de,hl
add hl,hl
ret
|