Hello,
while searching the net for informations on how to program for the SuperCPU I ran into this site http://ftp.giga.or.at/pub/c64/supercpu/superprog.html (http://ftp.giga.or.at/pub/c64/supercpu/superprog.html). The last paragraph says that there was a SuperCPU Programmers Kit announced . Is this kit real? Are there copies available? Are there any other publications dealing with the SuperCPU native-mode available? Even a code snipped which shows how to move code and data into the SuperCPU and start it from there is welcome.
Thanks in advance
Quote from: orinoco on August 18, 2010, 10:10 PMThe last paragraph says that there was a SuperCPU Programmers Kit announced . Is this kit real?
I've never heard of a release for it. It may have been vaporware.
Truly,
Robert Bernardo
Fresno Commodore User Group
http://videocam.net.au/fcug
The Other Group of Amigoids
http://www.calweb.com/~rabel1/
Southern California Commodore & Amiga Network
http://www.sccaners.org
There are some examples of moving memory around on the web somewhere, but what you need is the MOVE opcodes. I think you set some perameters and then tell the processor to move the RAM (or am I thinking of the REU???), for each byte moved takes 7 cycles, which may seem a lot, but looking at it though how many free cycles you have anyway above a normal 64 or 128 is quite significant. If I find the examples, I'll post them.
Regards,
Shaun.
Western Design Center has a very helpful manual which you can download for free. It covers programming the 65816 from the assembly level, and is completely applicable to the SuperCPU.
http://www.westerndesigncenter.com/wdc/documentation/Programmanual.pdf (http://www.westerndesigncenter.com/wdc/documentation/Programmanual.pdf)
The block moves you are interested in are covered in chapter six.
You don't need a "kit" as far as I'm concerned. You need a good assembler written for the SCPU.
http://www.protovision-online.de/apps/appsstart.htm (http://www.protovision-online.de/apps/appsstart.htm)
Virtual Assembler requires a SuperCPU equipped with a SuperRAM card and populated with some memory. It's somewhat similar to TurboAssembler.
I thought there was something like a SuperCPU programmers guide included. How to program a 65816 is only a part of the question. I have no clue how to move code and data into the SuperRAM and start it.
My idea is that I have to move startup-code (maybe like REU) into the SuperRAM to take control (by storing the startadress into the SuperCPU registers) on the whole system. But thats just an idea. As I mentioned before, some code snippets would be fine for the beginning.
Here's an example of what you're looking for. I used Virtual Assembler, but you could also use Stephen Judd's Sirius Assembler. The code is in three chunks--one chunk is assembled at *=$080d; a second chunk uses &=$024000 to assemble to bank 2 but the code is stored at the end of the first chunk and later moved with mvn; the third chunk is just a message in bank 3.
*= $00080d ;set program counter
main clc
xce ;switch to native mode
rep #$30 ;16 bits on all registers
.al ;tell assembler accumulator is 16 bits
.rl ;tell assembler x & y registers are 16 bits
lda #end-test-1 ;size of memory move
ldx #here ;lo 16 bits of start address
ldy #test&$ffff ;hi 16 bits of start address
.as ;tell assembler accumlator is 8 bits
.rs ;tell assembler x & y registers are 8 bits
phb ;save data bank register
mvn 0,2 ;do the block move
plb ;restore data bank register
sep #$30 ;8 bits on all registers
jsl test ;long call to test in bank 2
sec
xce ;switch to emulation mode
jmp $d3f0 ;return to virtual assembler
chrout0 sec
xce ;emulation mode
jsr $ffd2 ;call kernal chrout
php ;save status register
clc
xce ;native mode
plp ;restore status register
rtl ;long return
getin0 sec
xce
jsr $ffe4
php
clc
xce
plp
rtl
stop0 sec
xce
jsr $ffe1
php
clc
xce
plp
rtl
;------------------------------------------------------------
here &= $024000 ;use bank 2, but assemble in bank 0
test ldx #0
loop1 phb ;save data bank register (DBR)
phk ;push program bank register (PBR)
plb ;pull PBR into DBR
lda message0,x ;use message data from this bank
plb ;restore bank 0 as our DBR
cmp #0
beq loop2
jsl chrout0
inx
bpl loop1
loop2 jsl getin0
cmp #" " ;wait for spacebar
bne loop2
ldy #0
rep #$10 ;x & y registers 16 bits
.rl ;let assembler know x & y are 16 bits
loop3 ldx #0
loop4 lda message2,x ;get bank 3 message data
beq loop3
and #$3f ;cheap way to get screen code
sta $0400,y ;store message in normal VIC screen
tya
sta $d800,y ;add some color to the message
inx
iny
cpy #1000 ;do the whole screen
bcc loop4
sep #$10 ;x & y registers back to 8 bits
.rs ;let assembler know x & y are 8 bits
loop5 inc $d020
jsl stop0 ;wait for stop key
bne loop5
rtl ;long return to bank 0
message0 .tx "[RETURN]hello, world!"
.by 0
end
;------------------------------------------------------------
*= $035000
message2 .tx "bye "
.by 0
When doing a block move, usually you need to save the data bank register, do the move, then restore it afterward.
You can't just jsl $ffd2 from bank 2 to the kernal in bank 0 because the kernal does an rts, not an rtl. Also, when making a kernal call, it's a good idea to switch to emulation mode before the call.
Notice that I stay in native mode when making my long jsl test call. This is so that interrupts can continue normally. Jumping to another bank while in emulation mode will crash your computer, unless interrupts are disabled, or you have written your own interrupt service routine to handle the program bank register.
Thank you very much, Wagner. Your post gives me an idea on how to start. I will come back if I've a question.
And here are the first two questions. (:
If I want to load data from disk into the upper banks, I have to buffer them in bank0 (the c64 memory)?
Are there any development tools for the c128 out there? Virtual- and Sirius Assembler seems to be designed for the c64.
Quote from: orinoco on August 21, 2010, 07:13 AM
If I want to load data from disk into the upper banks, I have to buffer them in bank0 (the c64 memory)?
Not necessarily--SuperRAM is directly accessible to the microprocesor, so you can get a byte from disk into the accumulator and then store it where you want it.
loop1 jsl getin0
sta [2],y ;long addressing to any bank
;or maybe sta $300000,y
;or phb phk plb sta (2),y plb plb
iny
bne skip1
inc 3
bne skip1
inc 4
skip1 lda $90
beq loop1
If you want to use the kernal
load routine, then yes, you will have to buffer it. But the kernal
load routine is basically doing the equivalent of the above code, just with bank0.
QuoteAre there any development tools for the c128 out there? Virtual- and Sirius Assembler seems to be designed for the c64.
None that I know of, but others may know of tools I'm not aware of. However, the VDC registers are still accessible from the C64 side.
Any progress with this?
Nothing showable yet. I'm still reading the 65816 documentation.