Shop OBEX P1 Docs P2 Docs Learn Events
A DE2-115 Propeller retromachine - 1920x1080 enabled — Parallax Forums

A DE2-115 Propeller retromachine - 1920x1080 enabled

pik33pik33 Posts: 2,347
edited 2015-03-18 13:43 in Propeller 1
The post #56 contains new version 0.98b

Changes: P14..P17 connected to UART which enables RS232 port on DE2-115.


Edit: the post #55 contains new version 0.98a.

Changes: Amiga-like Hold-and-Modify (HAM) graphics modes added

Edit: the post #54 contains new version 0.98. Added 3 new registers to make blitting easier with hardware supported shl/shr write operation which is very hard to do with the Propeller and slows things down


Edit: the post #50 contains new version 0.97b

Changes:
Display resolution selectable at boot with SW17 - 0: 1920x1200, 1: 1920x1080
So if you have a 1920x1080 monitor you can now try it. The demos in spin are written for 1920x1200 but if the machine will be started with SW17 on, they will work @ 1920x1080 too; the down part of the screen will be of course cropped.
Two new registers added to make possible hiding the sprites under the playfield and signalling playfield/sprite collisions. Now writing a game like Arkanoid or other oldschool type games will be much simpler
Post #29 updated to add definitions of these registers.

You can program the Propeller on the retromachine with the Propplug as in the original p1v; if you generate an eeprom file from your program, rename it to boot.sys and place on the SD card, the machine will boot it.
The p1v used has disabled video circuits and mul instruction added.


Edit: the post #37 contains new version 0.97a


Edit: the post #29 contains the memory map of the retromachine



Edit: version 0.96 added (post #26)
Change: added sound input port $8E000. Now you can record the sound or make a filters/dsp/denoising with the retromachine :).
Samples are 16bit signed @ 44100 Hz. Sample ready interrupt input is at ina[6].


Edit: SD card booter added (post #21)
Now the retromachine will boot any program from boot.sys file on SD card


Edit: The 0.95 added (post #20)
It seems to have all planned features working. Now it needs debugging, cleaning, testing and making the software for it


This is work in progress which emerged from my VGA driver for P1V. Now, I have connected SD, keyboard, mouse, SDRAM and the sound chip. There is a sound buffer which can be used to play WAV files, but I started to implement Paula-like sound chip

So I started now a new topic for this.

Still to do:

- Paula (something based on it)
- 1920x1080 based graphics modes
- xmm machine and programming language to make this PC free :)

Attached a self starting demo pof/sof and a spin demo program - you can program the Propeller via Propplug and play with the system
The PS2-Y cable is needed to attach a mouse and a kbd to a single PS2 port available on DE2-115. Then you can draw on the high-res GUI simulation demo screen with the mouse.

The verilog sources I will add later; now there is too much chaos in them.
«13

Comments

  • David BetzDavid Betz Posts: 14,511
    edited 2014-10-19 12:44
    Looks cool! What do you mean by "xmm machine"? Are you talking about hub execution or some way of accelerating the existing XMM mechanism?
  • pik33pik33 Posts: 2,347
    edited 2014-10-19 12:48
    I have 128 MB easy accessible SDRAM now, so I need a way to execute from it.. Simply LMM like thing will be sufficient. To get a long from SDRAM I only need this:
      mov dirb,addr 
      (some nops or instructions here)
      mov data, inb
    
    
  • ColeyColey Posts: 1,108
    edited 2014-10-19 13:10
    This looks really great, I'm almost tempted to dust off my DE2 and give it a try.:cool:
  • David BetzDavid Betz Posts: 14,511
    edited 2014-10-19 14:11
    pik33 wrote: »
    I have 128 MB easy accessible SDRAM now, so I need a way to execute from it.. Simply LMM like thing will be sufficient. To get a long from SDRAM I only need this:
      mov dirb,addr 
      (some nops or instructions here)
      mov data, inb
    
    
    I wonder if that sort of interface could be supported on P2? While it seems good for an FPGA platform, is it practical in a real silicon implementation? Anyway, it shouldn't be too hard to adapt PropGCC XMM to make use of that.
  • ColeyColey Posts: 1,108
    edited 2014-10-19 14:45
    @pik33, there is a file 'mysz.def' missing from the spin archive, please can you post it.
  • Cluso99Cluso99 Posts: 18,066
    edited 2014-10-19 16:20
    Amazing work pik33!
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2014-10-19 16:32
    This is very impressive!

    What is the speed of the ram chip? More specifically, if you are running a cog with spin in a local 32k memory space, is there much of a time penalty to run from external memory?

    Fast external ram (and internal ram as well on these high performance FPGA chips) means more ram for video and more ram for code memory.

    Keep us posted - this is a great thread :)
  • potatoheadpotatohead Posts: 10,253
    edited 2014-10-19 20:58
    Reading with great interest. :)
  • pik33pik33 Posts: 2,347
    edited 2014-10-19 21:30
    Coley wrote: »
    @pik33, there is a file 'mysz.def' missing from the spin archive, please can you post it.

    Added to the first post. This is a mouse cursor shape definition file.
  • pik33pik33 Posts: 2,347
    edited 2014-10-19 21:38
    What is the speed of the ram chip? More specifically, if you are running a cog with spin in a local 32k memory space, is there much of a time penalty to run from external memory?

    When using 2 MB SRAM it is synchronized with the vga tming, so theoretical best is one access per 16 pixels=12 Propeller clock. The worst case is 25 pixels, 18..19 Propeller clock - 5 instructions.

    When using SDRAM i didn't try the maximum speed. I am using the same procedures for both sram and sdram.

    This is a fast blit procedure:
    
    blittosd      rdlong    addr1,colorptr
                  add       colorptr, #4
                  rdlong    addr2,colorptr
                  add       colorptr, #4
                  rdlong    count1,colorptr
                  sub       colorptr, #8
                  sub       addr2,#1
    
                  add       addr1,a4000
                  add       addr2,a8000
                  
                  mov       dirb,addr1
                  andn      dirb,a4000
    p112          waitpeq   aa2,aa2
                  nop
                  nop
                  
    p111          mov       dirb,addr1
                  andn      dirb,a4000
                  add       addr2,#1
                  add       addr1,#1
                  waitpeq   aa2,aa2       
                  mov       outb,inb
                  mov       dirb,addr2
                  andn      dirb,a8200
                  djnz      count1,#p111
                  
                  wrlong    ffff,ptr
                  jmp       #start2
    
    

    A main blitter loop starts from p111 doing one 32-bit memory to memory transfer with 9 Propeller instruction = 36 clocks=48 pixels. The waitpeq synchronizes it with ready signal from the vga driver. This is 2x slower than theoretical maximum ram speed.
  • 65816581 Posts: 132
    edited 2014-10-20 01:36
    Wow, nice work! I would love to run this, but I wasn't able to properly instantiate the DDR3 Hard Memory Controller
    on the BeMicroCV yet without an avalon bus.
  • pik33pik33 Posts: 2,347
    edited 2014-10-20 12:13
    A Paula-like thing made its first sound. Now there are 4 channels of 8 planned with no pan and volume - all still todo but it plays samples from SRAM with address, length and frequency given in the registers.
  • pik33pik33 Posts: 2,347
    edited 2014-10-21 06:46
    4-channel sound synth seems to work. I wanted 8 channels, but only 4 fit before display of the scanline starts. There is some time after display ends (border and porch) - maybe sometimes I will add second 4-channel "Paula" there. This is of course not an Amiga's Paula. It is a simple sound synthesizer that has registers for sample start address in SRAM, sample length, sample frequency and volume. The channels are 16-bit stereo and the volume is independent for left and right channels. And that is all for now. There is a place for adding some simple effects like sample loop address or auto volume decrease. There seems to be no place for things like real envelope reading from RAM. This has to be done via software, but then there is the Propeller onboard.

    To make a beep, place the beep samples in the SRAM, then set start, length and freq registers, and when the volume is non-zero, the channel will start play.

    If the volume is set to zero, then target synth addresses $83010-$83013 are not changed by the synth, so they can be written from the Propeller, making possible to make the sound with the software (SIDcog!)

    To play a wav, there is another mechanism: a 256 longs buffer at $84000. Put a wave samples here. There are two empty bits, for every half of the buffer, connected to P5..P4, so if the empty signal is set, you have to fill the half of the buffer, while the second half is playing. One half of the buffer is 128 longs=512bytes=one SD sector. I did a WAV player before with this mechanism, but now there is a better way: make a big buffer in SDRAM, then blit the bytes from there. The buffer should be working in the demo I added before.

    Now I need to do some testing and code cleaning... then make it available to the forum.
  • AleAle Posts: 2,363
    edited 2014-10-21 12:55
    @6581:

    Can you tell me why you couldn't instantiate the dd3 controller ?. I can instantiate it but did not configure the reset and pll correctly. I mean reset handling was not right.
  • 65816581 Posts: 132
    edited 2014-10-21 14:26
    Ale wrote: »
    @6581:

    Can you tell me why you couldn't instantiate the dd3 controller ?. I can instantiate it but did not configure the reset and pll correctly. I mean reset handling was not right.

    Which Altera IP were you using for that? The controlled I tried to use was avalon-only, so I had trouble
    making it work with anything else.
  • pik33pik33 Posts: 2,347
    edited 2014-10-21 21:02
    My SDRAM controller is also Avalon type, found on the DE2-115 CD. There were some error in it, for example CS was not used for anything, so I had to add some tristate buffers and d flipflops. Then I simply connected its datain to Prop's outb, dataout to inb, address to dirb, made a simple cs circuit which controls tristate buffers between the Propeller, SRAM and SDRAM. The reset pin of SDRAM controller I left free... or maybe connected to the Propeller reset, I don't have the project opened now. The clock is the vga pixel clock,~152 MHz.

    As it is now, my circuit is not stable; not every compilation works as expected. I hope I can make it stable today after some code cleaning; there are unused regs and interleaved fragments of code that doing different things. When it passes the tests I will put the project source here.
  • AleAle Posts: 2,363
    edited 2014-10-21 23:30
    The DDR3 controller is avalon only, as far as I could see. But the avalon interface is not a difficult one, as long as you don't use qsys (or you have a qsys compable "gegenst
  • pik33pik33 Posts: 2,347
    edited 2014-10-22 08:42
    The final 1.0 version of the hardware is near - I have a stable compilation.

    The VGA timings are now reconfigurable, so it should work in any resolution, where pixel count in display line is >=2080 and pixel clock is near 150 MHz. It seems to be possible to run @ 1600x1200, 1680x1050, 1920x1080 and 1920x1200. All of these resolutions have pixel clocks about 150 MHz, so this 152 MHz clock I am using now should be tolerated by most of monitors.

    The pixel clock for 1920x1200 should be 154 MHz but I had to synchronize this thing with an audio chip, so the pixel clock has to be 44100 Hz*384*9=152_409_600 Hz. The Cyclone 4 pll cannot do exactly this. It can do 152_380_952 Hz which gives 44091.7 Hz instead of 44100 Hz for the sound chip. It is 0.019% deviation and should be not hearable.

    The Propeller clock is 3/4 of this = 114_285_714 Hz

    I added the possibility to control hex and leds via memory mapped ports, there is also key/sw input port
  • pik33pik33 Posts: 2,347
    edited 2014-10-23 11:42
    Version 0.95 with sources.

    ****** Chaotic code warning ****

    The code needs cleaning, the wrong comments are now in wrong places - I put it simply "as it is and works now"

    The Propeller now has commented out video circuit to save some FPGA resources. It is mul-enabled and unscrambled. It can be reprogrammed in standard way (a Propplug in GPIO)

    The memory map: (I need to prepare a detailed documentation)

    0-$7FFFF - SRAM - "chip ram"
    $80000 - pallette, 1024 long entries
    $81000 - font definition, 2048 byte wide entries
    $82000 - sprite data, 1536 longs
    $84000 - sound buffer, 512 longs
    $8F000 - 12 VGA timing registers
    $83000 - register block:

    - $83000 frame counter
    - $83001 display start address
    - $83002 graphic mode
    - $83003 border color
    - $83004 - pallette bank
    - $83005 - pallette switch (you can change pallette bank in the middle of the screen :) with it )
    - $83006 - display list start
    - $83007 - fine horizontal scroll
    - $83008 - line length
    - $83009 - $8300E - sprite control
    - $8300F- collision register
    - $83010 - $83013 - current sound samples #1-4
    - $83014-$83017 - frequency
    - $83018-$830B - sample start
    - $8301C-$8301F - sample length
    - $83020-$83023 - sample volume
    - $83024-$83026 - LED and HEX
    - $83027-$83028 - SW/KEY anl cog led input
    - $83029 - cog led input disable

    To use these addersses, use vga.poke and vga.peek methods. Look at the demo code.
  • pik33pik33 Posts: 2,347
    edited 2014-10-24 03:37
    SD booter added.

    The hardware was not changed, but hardcoded software now is a booter instead of the demo. It looks for a file boot.sys on SD card, then run it.
    The attached boot.sys file contains the demo as it was yesterday.

    So now there is no need for a propplug or other kind of serial programming tool. Simply compile your program, make .eeprom file, save it on the SD root directory as boot.sys, insert the SD into DE2-115 and switch the system on :)
  • 65816581 Posts: 132
    edited 2014-10-24 07:16
    @pik33: Once again, great work!
    Are you willing to share your SD-Booter code so I can update my BeMicroCV version as well?
  • pik33pik33 Posts: 2,347
    edited 2014-10-24 07:57
    I lost the booter source :( ( how, can I switch on autosave function in the Propeller Tool ???) so I will have to recreate this from scratch. This is not a problem, the booter is a very simple thing based on Kye's FAT driver, which contains boot function. The simplest bootloader looks like this:

    Edit: I rewrote the booter:
    con
    
      _clkmode = xtal1+pll16x
      _clkfreq = 114_285_714
    
      _SD_DO = 20
      _SD_CLK = 21
      _SD_DI = 22
      _SD_CS = 23
      _SD_WP = -1 ' -1 ifnot installed.
      _SD_CD = -1 ' -1 ifnot installed.
    
    
    
    obj
      vga           : "vnfg092"
      fat           : "kyefat_lfn"
    
    
    pub boot   :i
    
    
    vga.start   
    
    fat.FATEngineStart(_SD_DO, _SD_CLK, _SD_DI, _SD_CS, _SD_WP, _SD_CD, -1, -1, -1)
    
    repeat i from $83000 to $83023     ' clear display and audio registers
      vga.poke(i,0)
    repeat i from $84000 to $84100     ' clear audio buffer
      vga.poke(i,0) 
    
    
    vga.poke($83000+36,0)              ' switch off leds and hex
    vga.poke($83000+37,$FFFFFFFF)
    vga.poke($83000+38,$FFFFFFFF)
    
    vga.poke ($83009,$80008000+2000)      'move sprites away
    vga.poke ($8300a,$80008000+2000)
    vga.poke ($8300b,$80008000+2000)
    vga.poke ($8300c,$80008000+2000)
    vga.poke ($8300d,$80008000+2000)     
    vga.poke ($8300e,$80008000+2000) 
    
    
    vga.graphics(5)
    vga.setataripallette(0)   
    vga.cls
    vga.poke($83004,7)
    vga.setcolor(112,0,0,0)
    vga.outtextxy(10,10,string("DE2-115 P1V retrocomputer system v. 0.95 - 2014.10.24"),120)
    waitcnt(cnt+clkfreq>>1)
    vga.outtextxy(10,30,string("Chip RAM: 2 MB"),120)
    waitcnt(cnt+clkfreq>>1)  
    vga.outtextxy(10,50,string("Fast RAM: 128 MB"),120)
    waitcnt(cnt+clkfreq>>1)
    vga.outtextxy(10,70,string("Booting from SD"),120)
    \fat.mountpartition(0)
    if fat.geterror<>0
      vga.outtextxy(10,90,string("SD card not found or unreadable. Insert a SD card and press Key 0"),120)
      repeat
    \fat.bootPartition(string("boot.sys"))
    if fat.geterror<>0
      vga.outtextxy(10,110,string("BOOT.SYS file not found or invalid. Insert a SD card with proper BOOT.SYS, then press Key 0"),120)
      repeat
    

    My booter inits the graphics 5, writes the invitation, then boots.
  • pik33pik33 Posts: 2,347
    edited 2014-10-24 10:16
    A little upgrade - I reconnected unused Propeller pins 17..8 again to GPIO pins 17..8 so they can now be used by the external devices connected to GPIO port

    All the rest is used now...

    - port B - system bus (all)
    - P0..P7 - "interrupt request"
    - P18..19 - i2c for sound chip
    - P20..23 - SD
    - P24..27 - PS2
    - P28..29 - reserved for eeprom (there is one onboard... too small :( I will replace it as soon as I can.. )
    - P30..31 - Propplug
  • pik33pik33 Posts: 2,347
    edited 2014-10-25 04:56
    A small fix (hardcoded sync polarity now can be set via $8F00C)

    Tested $8Fxxx registers and it seems they work, so you can change VGA timings.
    Some things are hardcoded in the verilog code, so the line can't be too short; the right border should start somewhere about 1953, then the line should not be shorter than 2080.

    If your monitor cannot display 1920x1200, try this. It sets 1680x1050 @ 63 Hz; it works with my monitor
    vga.poke($8F000,336+16)    
    vga.poke($8F001,399+16)   
    vga.poke($8F002,1953+16) 
    vga.poke($8F003,2016+16)
    vga.poke($8F004,2064+16)
    vga.poke($8F005,2240+16)
    vga.poke($8F006,30) 
    vga.poke($8F007,70)
    vga.poke($8F008,1040)
    vga.poke($8F009,1080) 
    vga.poke($8F00a,1083)
    vga.poke($8F00b,1089)
    vga.poke($8F00c,0) ' 2 lower bits -> h/v sync polarity.
    
    
  • pik33pik33 Posts: 2,347
    edited 2014-10-26 01:45
    New version - sound input added. You can read current sound sample from $8E000. When the sample is ready, ina[6]=1. Samples are stereo 16 bit 44.1 kHz.

    After the chip initialization (in the demo: pub initsound) this:
    repeat
      vga.blit1($8E000,$83010,1)
    

    A simple demo code:
    con
    
      _clkmode = xtal1+pll16x
      _clkfreq = 114_285_714
    
    
    
    obj
      vga           : "vnfg092"
      fat           : "kyefat_lfn"
      i2c           : "i2cdrv"     
    
    pub boot   |i
    
    
    vga.start   
    
    
    i2c.start(18)           'soundchip initializatin
    i2c.write(18,$34)
    i2c.write(18,$12)
    i2c.write(18,$0)
    i2c.stop(18)
    
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$1)
    i2c.write(18,$1f)
    i2c.stop(18)
    
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$8)
    i2c.write(18,$12)
    i2c.stop(18)
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$0a)
    i2c.write(18,$0)
    i2c.stop(18)
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$0c)
    i2c.write(18,$62)
    i2c.stop(18)
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$0e)
    i2c.write(18,$1b)
    i2c.stop(18)
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$10)
    i2c.write(18,$22)
    i2c.stop(18)
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$6)
    i2c.write(18,$78)
    i2c.stop(18)
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$4)
    i2c.write(18,$78)
    i2c.stop(18)
    
    i2c.start(18)
    i2c.write(18,$34)
    i2c.write(18,$12)
    i2c.write(18,$1)
    i2c.stop(18)
    
    
    repeat i from $83000 to $83023     ' clear display and audio registers
      vga.poke(i,0)
    repeat i from $84000 to $84100     ' clear audio buffer
      vga.poke(i,0) 
    
    
    vga.poke($83000+36,0)              ' switch off leds and hex
    vga.poke($83000+37,$FFFFFFFF)
    vga.poke($83000+38,$FFFFFFFF)
    vga.poke($83003,255)
    
    vga.poke ($83009,$80008000+2000)    'move sprites away 
    vga.poke ($8300a,$80008000+2000)
    vga.poke ($8300b,$80008000+2000)
    vga.poke ($8300c,$80008000+2000)
    vga.poke ($8300d,$80008000+2000)     
    vga.poke ($8300e,$80008000+2000) 
    
    
    vga.graphics(5)
    vga.setataripallette(0)   
    vga.cls
    vga.poke ($83003,$FFFFFF)
    vga.poke($83004,7)
    
    repeat
      vga.blit1($8E000,$83010,1)
    
    


    causes the machine to play the sound from its line in to line out :) using sound channel #0

    (Spin is too slow for this, so there may be audible distortions but what I can hear now is not so bad for a simple spin loop. This is a task for pasm procedure.).


    Edit: this pasm loop works good :) and the output sound is now clean.
    audio         mov       dirb,audioin '$8E000+$40000000 (read strobe)
                  andn      dirb,a4000
                  mov       outb,inb
                  mov       dirb,audioout '$83016+$80000000 (write strobe)
                  andn      dirb,a8000
                  jmp       #start2 ' entry point to command dispatcher so if the command was not changed it will return to the audio loop
    
    
  • pik33pik33 Posts: 2,347
    edited 2014-10-28 07:36
    Tested a SIDCog in the retromachine environment: works without problems. I found about 6 instances of mul procedure call in the SidCog code. Replacing them with a mul instruction can save several hundred cycles allowing (I hope) SidCog to run @ 64 kHz instead of 32 kHz. Hhis can give less aliasess - work in progress. Up to 4 sidcogs can be added.. or even 8 of them if one sidcog will be connected to one stereo channel - of course I haven't 8 free cogs. Now my simple demo runs in 4 cogs (main, vga, sidcog, fat).. so 4-sidcog environment seems to be possible (3 additional sidcogs+kbm)

    Edit: if you have programmed your DE2-115 with this retromachine and want to play with this simple demo, place attached boot.sys on the sd card. Add a file named "001.dmp" with your favourite sid dump file (50 Hz only). Insert a sd to the de2-115 and boot the retromachine - the sid will start playing and a simple visualisation can be visible on the screen:)
  • pik33pik33 Posts: 2,347
    edited 2014-10-30 04:20
    A new sid demo. Place boot.sys and 013.dmp in the SD card, then boot the retromachine v. 0.96

    The attached 013.dmp is original Ahle's sidcog-demo dump so it starts with the long silence and then famous two beeps.

    You can set playing speed with SW0..2. All off - 50 Hz, SW0 - 100 Hz, SW1 - 150 Hz, SW2 - 200 Hz This is needed when playing some parts of this file.
    The SID has 12 dB/oct filters and plays @ 64 kHz
    zip
    902K
    013.zip 902.2K
  • pik33pik33 Posts: 2,347
    edited 2014-11-04 07:41
    The retromachine v.0.97 memory and register map

    $0-$7FFFF - SRAM, 512kx32bit


    $80000-$803FF - pallette - 1024 color registers, $00RRGGBB
    $81000-$817FF - font definition. 2048 bytes, 128 characters, 16 bytes for one character. Default is ST mono font; you can redefine it by poking here
    $82000-$825FF - sprites definition, 6 sprites, 256 longs each


    $83000-$8302a - hardware registers:

    $83000 - frame counter
    $83001 - display start address; default 0
    $83002 - graphics mode
    -bits 1,0 - vertical zoom (00-x1,01-x2,10-x4,11-x8)
    - bits 3,2 - horizontal zoom/colors (00 - x1, 4 colors; 01 - x2,16 colors, 10 - x4, 256 colors, 11- not valid)

    $83003 - border color, 32 bit, 00RRGGBB
    $83004 - pallette bank. There are 1024 pallette entries, it gives 4 banks for 256 colors, 64 banks for 16 colors and 256 banks for 4 color modes
    $83005 - horizontal pallette selector.
    bit 31: selector on
    27..20: amount to add to $80004
    11:0 - pixel number to switch palette banj

    Example: 1_000___0000_0001___0000_0000___0001_0000_0000 will change pallette bank adding #1 when pixel# is 256 makes two areas on the screen with different pallettes

    $80006 - display list start address. Bit 31 set=display list active. The DL has 1200 entries, one for one line. The entry bits are:
    31- entry active
    30- generate interrupt signal
    29..22 palette index for the line (and next lines until next active DL entry)
    21..18 graphics mode for the line (and next lines until next active DL entry)
    17..0 display start address for the line >>1 (the address should be 19 bit and no place left in the entry)
    If the address is 11_1111_1111_1111_1111, the field is inactive

    $83007 - horizontal scroll right register. Amount is always in the high resolution pixels
    $83008 - line length in memory (in 16 bit words, default=224)

    $83009..$8300E - sprite 0..5 control
    bit 31..30 - y zoom, 00-x1, 01-x2, 10-x4, 11-not valid
    29..28 - pallette bank 0..3 select
    27..16 y position, always in hires pixels; visible area is from 66 to 1185, lhe position is left upper corner of the sprite
    15..14 - x zoom
    13..0 - x position, always in hires pixels; visible area is from 160 to 1951 (may be 159 to 1950, it depends on project version)

    $8300F - collision register

    bit 0 - sprite 0 and 1
    bit 1 - sprite 0 and 2
    bit 2 - sprite 0 and 3
    bit 3 - sprite 0 and 4
    bit 4 - sprite 0 and 5
    bit 5 - sprite 1 and 2
    bit 6 - sprite 1 and 3
    bit 7 - sprite 1 and 4
    bit 8 - sprite 1 and 5
    bit 9 - sprite 2 and 3
    bit 10 - sprite 2 and 4
    bit 11 - sprite 2 and 5
    bit 12 - sprite 3 and 4
    bit 13 - sprite 3 and 5
    bit 14 - sprite 4 and 5

    bits 15..20 - sprite 0..5 and playfield (from 0.97b)

    $83010..$83013 - synth 0..3 output registers. When these synths are not working, you can set the value of these registers from the Propeller (SIDcog, etc.)
    $83014..$83017 - synth 0..3 frequency
    $83018- $8301B - synth 0..3 sample start address
    $8300C-$8300F - synth 0..3 sample length (in longs). If bit 31 set, "one shot", the synth channel stops when reached sample end (from 0.97a)
    $83020-$83023 - synth 0..3 volume. Volume 0 - the synth channel is off and you can use its output register to output the sound from the Propeller

    The synth samples has to be stereo, 16 bit signed - one long=one stereo sample. The volume has to be in range 0-$7FFF - bits 30..16 left, 14..0 right

    $83024 - DE2-115 leds. Bits 31..24 - green leds 7..0; 18 - LEDG8, 17..0 - LEDR
    $83025 - HEX3..0; 8 bits for segment
    $83026 - HEX7..4
    $83027 - SW (bits 17..0) and KEYs (bits 31..28)
    $83028 - COG LEDs input
    $83029 - if bit 0 of this register is 0 then LEDGs will display COG LED state, else LEDG can be programmed with port $83024
    $8302A - (from v.0.97 hardware) sound input register dedicated for SIDCog sample output. without need to switch off synths.
    $8302B - (from v.0.97b hardware) - playfield priority color number. If the color is higher than this, the sprite will hide under the playfield
    $8302C - (from v.0.97b hardware) - playfield collision color number. If the playfield pixel color is higher than this, the sprite will collide with a playfield pixel setting 1 in the collision register
    $8302D - (from 0.98) - amount to shift data left (if bit 31==1) or right before writing
    $8302E - (from 0.98) - place for bits shifted out to use in the next write. This is RW register; you can set these bits with the Propeller too
    $8302F - (from 0.98) - amount to add to R/W address before reading/writing. This enables easier double/multi buffering without making changes in graphics procedures.
    $84000 - $840FF - audio buffer. UPDATE: from version 0.97a $84000-$843FF
    $8E000 - read only - current soundchip ADC sample

    $83F00-$83F0C - VGA timing registers

    $8F000 - left border start, default 96
    $8F001 - active display start -1, default 159
    $8F002 - right border start-1, default 1953
    $8F003 - horizontal front porch start, default 2016
    $8F004 - horizontal sync start, default 2064
    $8F005 - horizontal back porch start, default 2080

    $8F006 - upper border start, default 25
    $8F007 - active display start, default 65
    $8F008 - lower border start, default 1185
    $8F009 - vertical front porch start, default 1225
    $8F00A - vertical sync start, default 1228
    $8F00B - vertical back porch start, default 1234

    $8F00C, bits 0..1 - sync polarity, horizontal bit 0, vertical bit 1

    $1000000-$1FFFFFF - reserved for future I/O space

    $2000000-$3FFFFFF - SDRAM, 128 MB, 32Mx32 bit

    End of memory map

    To write a long to the memory:
                  mov       outb,data
                  mov       dirb,addr
                  or        dirb,a8000   ' a8000=$8000_0000 - write strobe bit #31
                  andn      dirb,a8000
    

    To read a long from the memory
                 mov       dirb,addr1
                 or        dirb,a4000 ' a4000=$4000_0000 - read strobe bit #30
                 andn      dirb,a4000
                 waitpeq   a8,a8 'a8=8; P3 is connected to ready output of the controller   
                 mov       data1,inb
    

    Propeller pin map

    P0 - vertical blank
    P1 - horizontal blank
    P2 - display list interrupt
    P3 - read data ready
    P4 - audio buffer flag; 0: you can write to upper half of the buffer ($84080-$840FF); 1: you can write to lower half of the buffer ($84000-$8407F)
    P5 - not connected
    P6 - sound chip interrupt (you have to get ADC sample and put DAC sample when 1)
    P7 - not connected
    P8..P17 - connected to GPIO8..GPIO17
    P18 - I2C_SCLK
    P19 - I2C_SDAT
    P20 - SD_DAT0
    P21 - SD_CLK
    P22 - SD_CMD
    P23 - SD_DAT3
    P24 - PS2_CLK
    P25 - PS2_DAT
    P26 - PS2_CLK2
    P27 - PS2_DAT2
    P28..29 - not connected
    P30..P31 - connected to GPIO for PropPlug
  • steddymansteddyman Posts: 91
    edited 2014-11-04 11:03
    Fascinating stuff Pik.

    It would be interesting to know what would be required besides a real Prop 2 when it ships to support this.
  • pik33pik33 Posts: 2,347
    edited 2014-11-05 01:03
    The retromachine memory map now is full and corrected. The read and write code added. The 0.96 version hasn't $8302A register; for SIDCog use $83010 instead (the synth channel 0 cannot be used then). The 0.97 has still bugs so I will publish it when these will be corrected; the only difference visible as memory map is this $8302A register.
Sign In or Register to comment.