Here's some stuff for you...
ORG 0
DUMP 1,0
start: DI
LD A,33 ; you've hardcoded your screen, so assume you're
putting your code at 32768
OUT (LMPR),A
JP jumpdown
jumpdown:
LD BC,&FEFE
loop: IN A,(C)
BIT 0,A
JP Z, green; you had the sign the other way around; keys
are Z (0) when pressed, NZ (1) when released
LD A,2
OUT (&FE),A
JP loop
green: LD A,4
OUT (&FE),A
JP loop
... this should do it. While you're testing, you may want to do this
instead:
ORG 0
DUMP 1,0
start: DI
IN A,(VMPR)
LD (vmpr.sto+&8001),A
IN A,(LMPR)
LD (lmpr.sto+&8001),A
LD (sp.sto + &8001),SP
IN A,(HMPR)
AND 31
OR 32
OUT (LMPR),A
JP down
down:
LD A,SCREENPAGE
OUT (HMPR),A
OR 96 // mode 4
OUT (VMPR),A
LD SP,alt.stack
EI // if you have an interrupt routine
JP main
ret.to.basic:
DI
LD A,1
OUT (HMPR),A
JP up+&8000
up:
lmpr.sto: LD A,&00
OUT (LMPR),A
sp.sto LD SP,&0000
vmpr.sto: LD A,&00
OUT (VMPR),A
EI
RET
main:
LD BC,&FEFE
loop: IN A,(C)
RRA
JP NC, ret.to.basic
RRA
JP NC,green
LD A,2
OUT (&FE),A
JP loop
green:
LD A,4
OUT (&FE),A
JP loop
----- Original Message -----
From: Thomas Harte <[EMAIL PROTECTED]>
To: SAM Mailing List <[email protected]>
Sent: Thursday, September 09, 1999 10:18 AM
Subject: Spot the error
> I've been persuaded that rather than messing about with mode 2 interrupts,
> since I can on the SAM, it would be better to put the screen into 32768+,
get
> rid of the ROM and use the low 32kb for program and data. Though Andrew
> Collier did post some example to do this ages ago when I asked some other
> questions, I lost it similarly ages ago, but came up with this :
>
> code
> org 0
>
> di
>
> ; now, to load the current ram page into the bottom half of memory
>
> in a, (251)
> and 31
> or 32
> out (250), a
>
> jp tophalf
>
> ; load page 0 into the top half (pc is now in the bottom half thanks to
jp)
>
> tophalf ld a, 4
> out (251), a
>
> ; put the screen at page 4, and switch to mode 4
>
> ld a, 100
> out (252), a
>
> ; do some stuff to check if I did it all right
>
> lstart ld bc, $fefe
> in a, (c)
> bit 0, a
> jp nz, bgreen
>
> ld a, 2
> out (254), a
> jp lstart
>
> bgreen ld a, 4
> out (254), a
> jp lstart
>
> Which as far as I'm concerned should be turning the border green, but
> changing it to red (using the default palette) whenever shift is held
down.
> What it actually does it change the border to green and then do nothing.
I've
> tried some other stuff after the init code including writing r register
> rubbish to the screen, and it seems that the code functions for a very
short
> while but then just stops.
>
> So then . . . what stupid mistake am I making? And I'll assume for now
with
> an example this easy that it isn't 'only testing on SIM Coupé'.
>
> -Thomas
>