Posts: 366
Threads: 186
Joined: Sep 2011
Reputation:
0
hi everyone!
based on the information i found at <!-- m --><a class="postlink" href="http://www.worldofspectrum.org/faq/reference/128kreference.htm">http://www.worldofspectrum.org/faq/refe ... erence.htm</a><!-- m -->
i tried this one:
Code: cls
page1=0
a=(((peek($5B5C))band $F8)bor (page1 band 7))
poke $5B5C,a:out $7FFD,a
poke $C123,80
page1=1
a=(((peek($5B5C))band $F8)bor (page1 band 7))
poke $5B5C,a:out $7FFD,a
poke $C123,81
page1=0
a=(((peek($5B5C))band $F8)bor (page1 band 7))
poke $5B5C,a:out $7FFD,a
print peek($C123)
page1=1
a=(((peek($5B5C))band $F8)bor (page1 band 7))
poke $5B5C,a:out $7FFD,a
print peek($C123)
pause 0
and i can't figure out what is going wrong there...- any clue? :S
Posts: 366
Threads: 186
Joined: Sep 2011
Reputation:
0
now it seems weird why
Code: cls
poke 23388,16:out 32765,16:poke 50000,16
poke 23388,17:out 32765,17:poke 50000,17
poke 23388,19:out 32765,19:poke 50000,19
poke 23388,20:out 32765,20:poke 50000,20
poke 23388,22:out 32765,22:poke 50000,22
poke 23388,23:out 32765,23:poke 50000,23
poke 23388,16:out 32765,16:print peek (50000)
poke 23388,17:out 32765,17:print peek (50000)
poke 23388,19:out 32765,19:print peek (50000)
poke 23388,20:out 32765,20:print peek (50000)
poke 23388,22:out 32765,22:print peek (50000)
poke 23388,23:out 32765,23:print peek (50000)
pause 0
works, and
Code: sub setmemorypage(ta as ubyte)
dim tb as ubyte
tb=(ta band 7)bor 8
poke 23388,tb:out 32765,tb
end sub
cls
setmemorypage(0):poke 50000,80
setmemorypage(1):poke 50000,81
setmemorypage(3):poke 50000,83
setmemorypage(4):poke 50000,84
setmemorypage(6):poke 50000,86
setmemorypage(7):poke 50000,87
setmemorypage(0):print peek(50000)
setmemorypage(1):print peek(50000)
setmemorypage(3):print peek(50000)
setmemorypage(4):print peek(50000)
setmemorypage(6):print peek(50000)
setmemorypage(7):print peek(50000)
pause 0
isn't... :S
Posts: 366
Threads: 186
Joined: Sep 2011
Reputation:
0
fixed (i think...)
Code: sub setmemorypage(ta as uinteger)
tb=(ta band 7)bor 16
poke 23388,tb:out 32765,tb
end sub
cls
setmemorypage(0):poke 50000,80
setmemorypage(1):poke 50000,81
setmemorypage(3):poke 50000,83
setmemorypage(4):poke 50000,84
setmemorypage(6):poke 50000,86
setmemorypage(7):poke 50000,87
setmemorypage(0):print peek(50000)
setmemorypage(1):print peek(50000)
setmemorypage(3):print peek(50000)
setmemorypage(4):print peek(50000)
setmemorypage(6):print peek(50000)
setmemorypage(7):print peek(50000)
pause 0
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
nitrofurano Wrote:fixed (i think...)
Code: sub setmemorypage(ta as uinteger)
tb=(ta band 7)bor 16
poke 23388,tb:out 32765,tb
end sub
cls
setmemorypage(0):poke 50000,80
setmemorypage(1):poke 50000,81
setmemorypage(3):poke 50000,83
setmemorypage(4):poke 50000,84
setmemorypage(6):poke 50000,86
setmemorypage(7):poke 50000,87
setmemorypage(0):print peek(50000)
setmemorypage(1):print peek(50000)
setmemorypage(3):print peek(50000)
setmemorypage(4):print peek(50000)
setmemorypage(6):print peek(50000)
setmemorypage(7):print peek(50000)
pause 0
For what I read in the speccy.org forum, you need to disable interruptions (DI) before bankswitching. If an interrupt enters during bankswitching, the computer might hang, or have unpredictable results. :?: :?:
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
Why not use inline ASM? Not tested:
Code: sub setmemorypage(ta as ubyte)
ASM
di
ld a,(ix+5)
and 7
or 8
ld bc,32765
out (c),a
ld (23388),a
ei
END ASM
end sub
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
LCD Wrote:Why not use inline ASM? Not tested:
Code: sub setmemorypage(ta as ubyte)
ASM
di
ld a,(ix+5)
and 7
or 8
ld bc,32765
out (c),a
ld (23388),a
ei
END ASM
end sub
This is a perfect case for FASTCALL
Code: sub FASTCALL setmemorypage(ta as ubyte)
ASM
di
; ld a,(ix+5) ; Not needed already in A
and 7
or 8
ld bc,32765
out (c),a
ld (23388),a
ei
END ASM
end sub
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
boriel Wrote:LCD Wrote:Why not use inline ASM? Not tested:
Code: sub setmemorypage(ta as ubyte)
ASM
di
ld a,(ix+5)
and 7
or 8
ld bc,32765
out (c),a
ld (23388),a
ei
END ASM
end sub
This is a perfect case for FASTCALL ![Tongue Tongue](https://www.boriel.com/forum/images/smilies/tongue.png)
Code: sub FASTCALL setmemorypage(ta as ubyte)
ASM
di
; ld a,(ix+5) ; Not needed already in A
and 7
or 8
ld bc,32765
out (c),a
ld (23388),a
ei
END ASM
end sub
Ooops, you are right, I overseen it. Thanks! Generally I prefer 128K USR0 mode because interrupts are not harmful in this mode.
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
LCD Wrote:Ooops, you are right, I overseen it. Thanks! Generally I prefer 128K USR0 mode because interrupts are not harmful in this mode. 128K USR0 :?: What is this mode?
(I'm still learning this ![Tongue Tongue](https://www.boriel.com/forum/images/smilies/tongue.png) maybe I can do something for it in the compiler).
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
boriel Wrote:LCD Wrote:Ooops, you are right, I overseen it. Thanks! Generally I prefer 128K USR0 mode because interrupts are not harmful in this mode. 128K USR0 :?: What is this mode?
(I'm still learning this maybe I can do something for it in the compiler). USR0 mode is if you enter in 128 BASIC the command USR0. This resets the machine into 48K ROM but with enabled 128K features like AY or bank switching+second screen.
You cannot use +3 DOS or RAMDISC commands, but you also don't need to POKE 23388 to switch banks, OUT 32765 is enough. DivIDE also works in this mode on Spectrum 128K machines.
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
LCD Wrote:boriel Wrote:LCD Wrote:Ooops, you are right, I overseen it. Thanks! Generally I prefer 128K USR0 mode because interrupts are not harmful in this mode. 128K USR0 :?: What is this mode?
(I'm still learning this maybe I can do something for it in the compiler). USR0 mode is if you enter in 128 BASIC the command USR0. This resets the machine into 48K ROM but with enabled 128K features like AY or bank switching+second screen.
You cannot use +3 DOS or RAMDISC commands, but you also don't need to POKE 23388 to switch banks, OUT 32765 is enough. DivIDE also works in this mode on Spectrum 128K machines. Interesting!!!!
Could it be possible to start this mode without resetting the RAM? I mean: Executing a program in 128K mode in ZXBASIC and the program manages in some way to enter that mode an continue execution? Seems a good start.
Another question: I guess +2 ROM won't be available. Will it be?
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
boriel Wrote:Interesting!!!!
Could it be possible to start this mode without resetting the RAM? I mean: Executing a program in 128K mode in ZXBASIC and the program manages in some way to enter that mode an continue execution? Seems a good start. Maybe switching to the 48K ROM and jumping in the 48K Editor routine will do the job... I think, the topic was discussed on WOS before.
boriel Wrote:Another q#uestion: I guess +2 ROM won't be available. Will it be? It won't be available unless you page it in.
Posts: 65
Threads: 19
Joined: Feb 2021
Reputation:
0
So it's 2021 and I wonder ifÂ
1) The below worked ?
2) If there is any further news on opening up ZXB to 128K ?
ThanksÂ
Ken
|