Programming:Storing and Retrieving Screens from the extra 64kb

From CPCWiki - THE Amstrad CPC encyclopedia!
Revision as of 04:34, 11 August 2018 by CPM User (Talk | contribs)

Jump to: navigation, search

Overview

This routine comes from the Push-Pop program which was published in Issue 57 of Amstrad Action, however while that program is useful for Storing and Retrieving Screens in the 6128s extra 64k, it's only going to work on the 6128, so other computers with memory expansions won't be able to use it, this updated routine will work on all systems (as long as they have 128kb minimum).

The Program

org &a500

ld bc,table
ld hl,workspace
call &bcd1
ret

.workspace
defb 0,0,0,0

.table
defw table2
jp push
jp pop

.table2
defb "PUS"
defb "H"+&80
defb "PO"
defb "P"+&80
defb 0

.push
cp &01
ret nz
ld a,(ix+&00)
cp &05
ret nc
add &c3
ld c,a
ld b,&7f
out (c),c
ld de,&4000
ld hl,&c000
ld bc,&3fff
ldir
ld bc,&7fc0
out (c),c
ret

.pop
cp &01
ret nz
ld a,(ix+&00)
cp &05
ret nc
add &c3
ld c,a
ld b,&7f
out (c),c
ld de,&c000
ld hl,&4000
ld bc,&3fff
ldir
ld bc,&7fc0
out (c),c
ret