nedoPC.org

Electronics hobbyists community established in 2002
Atom Feed | View unanswered posts | View active topics It is currently 19 Mar 2024 04:28



Reply to topic  [ 273 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 19  Next
Tunguska the ternary emulator 
Author Message
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
Here is code for my first simple program for Tunguska :lol: It just fills screen with pixels of different colors, kind of simple colours test table.

Code:
; Kind of color table test for Tunguska
;
;  Assemble into demo.ternobj
;  Run 'tunguska image.ternobj -F demo.ternobj'
;  Type 'LOADSUB'
;

@ORG    %DDD000
        ; Bootstrap function
        ;
        ; Read page 2 from disk into page 2 in memory
        LDA     #2
        LDY     #2
        JSR     (jumpvector.fl_read_block)
        JMP     colortable

; These won't be copied. They are also present in the host at the same
; memory location.

@ORG    %001000
jumpvector:
.getstring:     @DW     0
.feedscreen:    @DW     0
.putchar:       @DW     0
.putnon:        @DW     0
.puts:          @DW     0
.strcmp:        @DW     0
.strlen:        @DW     0
.index:         @DW     0
.strspn:        @DW     0
.strcspn:       @DW     0
.memset6:       @DW     0
.random:        @DW     0
.between:       @DW     0
.repaint:       @DW     0
.fl_read_block: @DW     0
.fl_write_block: @DW    0

@ORG    %002000
colortable:
                ; Enable raster mode
                LDA     #%00C
                STA     %DDDDDB

                ; Load screen buffer address
                LDX     #%DDB
                LDY     #%DDD
.mainloop:      
      LDA   .colornum
      INC   .colornum
      STA   X,Y
      INY
      JVC   .pass
      INX
.pass:         
      TXA
      CMP   #%CAB
      JNE   .mainloop
.idleloop:
      JMP   .idleloop

.colornum:
      @DW   %444


P.S. Raster mode isn't so fast :-(


29 Feb 2008 16:52
Profile
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
Could you please add something to redirect text mode output to a regular text file ? Will be very useful for testing arithmetics functions.


29 Feb 2008 16:55
Profile
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
--edit-- browser crashed and made two identical posts.


01 Mar 2008 03:36
Profile
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Mac Buster wrote:
Here is code for my first simple program for Tunguska :lol: It just fills screen with pixels of different colors, kind of simple colours test table.


Glad you got it working...

Mac Buster wrote:
P.S. Raster mode isn't so fast :-(


Yeah, I know. It would be possible to add more raster modes at the same resolution but with fewer colors (I'm thinking three and nine colors, 18 and 36 memory pages respectively). This would probably amp up the drawing speed quite significantly (at those modes, anyways). For the nine color mode, it would probably be possible to use some sort of palette mechanism to allow for a wider range of colors.

Mac Buster wrote:
Could you please add something to redirect text mode output to a regular text file ? Will be very useful for testing arithmetics functions.


I guess I could add functionality to the Print Screen button, so that it when it is pressed, the screen contents are written to the terminal (much like the original functionality of Print Screen button)


01 Mar 2008 03:39
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22383
Location: Silicon Valley
Reply with quote
eudoxie wrote:
That's peculiar. Could you try compile some other automake-based package and see if it does the same? It attempts to install to /usr/local/bin on my system.

--edit--

I just released version 0.0.2.


This version uses /usr/local/bin

In CYGWIN it's configured, but not compiled - can't find SDL includes...


01 Mar 2008 05:51
Profile WWW
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Cygwin is a special case I guess. For now, if you want to build ports, just use the CVS makefile (it seems to work, no?)

I added two new instructions to the CVS: BLS and BLT. They do page manipulation, so you can copy or set entire pages with one instruction. (Which is very useful in raster mode, since basically all the "slowness" isn't so much the screen drawing functions, but Tunguska itself not being able to process instructions fast enough)

I also added 3 color monochrome graphics as I discussed earlier.


--

I'm working on an experimental bitmap-based UI for tunguska to make it a little more inviting and easy to use. The light gray bars around the screen indicate where the raster-mode screen ends.


It's not in CVS yet, because I can't decide if I like it or not. There's something off about it, but I can't quite put my finger on it...

Image


01 Mar 2008 06:36
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22383
Location: Silicon Valley
Reply with quote
eudoxie wrote:
Cygwin is a special case I guess. For now, if you want to build ports, just use the CVS makefile (it seems to work, no?)


Yes, it works. Another "unofficial" build for Windows is ready:

http://nedopc.org/ternary/tunguska/tung ... _1-win.zip (1.3M)

It includes colors.asm with bat-files for compilation and launching


Last edited by Shaos on 11 Nov 2012 17:40, edited 1 time in total.



01 Mar 2008 16:24
Profile WWW
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
I wrote yet another variation of color test for Tunguska. This one cyclicaly fill raster lines with a color. Looks like animation :)

Code:
; Yet another color table for Tunguska, works in raster mode with 729 colors
;
;  Assemble into demo.ternobj
;  Run 'tunguska image.ternobj -F demo.ternobj'
;  Type 'LOADSUB'
;

@ORG    %DDD000
        ; Bootstrap function
        ;
        ; Read page 2 from disk into page 2 in memory
        LDA     #2
        LDY     #2
        JSR     (jumpvector.fl_read_block)
        JMP     colortable

; These won't be copied. They are also present in the host at the same
; memory location.

@ORG    %001000
jumpvector:
.getstring:     @DW     0
.feedscreen:    @DW     0
.putchar:       @DW     0
.putnon:        @DW     0
.puts:          @DW     0
.strcmp:        @DW     0
.strlen:        @DW     0
.index:         @DW     0
.strspn:        @DW     0
.strcspn:       @DW     0
.memset6:       @DW     0
.random:        @DW     0
.between:       @DW     0
.repaint:       @DW     0
.fl_read_block: @DW     0
.fl_write_block: @DW    0

@ORG    %002000
colortable:
; Enable raster mode
                LDA     #%00C
                STA     %DDDDDB

; Load screen buffer address
.idleloop:
                LDX     #%DDB
                LDY     #%DDD

; Fill screen buffer with a color
      LDA   #0
      STA   .x
      STA   .y
.mainloop:      
      LDA      .c
      STA   X,Y
      INY
      JVC   .bypass
      INX
.bypass:
      INC   .x
      LDA   #324
      CMP   .x
      JNE   .mainloop
      INC   .c
      LDA   #0
      STA   .x
      INC   .y
      LDA   #243
      CMP   .y
      JNE   .mainloop
      LDA   #0
      STA   .y
      JMP   .idleloop
.x:
      @DW   0
.y:
      @DW   0
.c:
      @DW   0


02 Mar 2008 15:20
Profile
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
Quote:
I added two new instructions to the CVS: BLS and BLT. They do page manipulation, so you can copy or set entire pages with one instruction.

What about raster graphics oriented instructions ? These ones might be very useful:

- copy to and from a raster line
- fill a raster line with a color
- perform logical operation with whole or part of raster line and data in general memory


02 Mar 2008 15:26
Profile
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Mac Buster wrote:
Quote:
I added two new instructions to the CVS: BLS and BLT. They do page manipulation, so you can copy or set entire pages with one instruction.

What about raster graphics oriented instructions ? These ones might be very useful:

- copy to and from a raster line
- fill a raster line with a color
- perform logical operation with whole or part of raster line and data in general memory


I don't think it's doable with the current addressing modes. It requires more arguments than operations can handle.

It could possibly be doable through hardware pseudo-instructions, like how the floppy-disk interface is implemented.


03 Mar 2008 05:22
Profile
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
Quote:
It could possibly be doable through hardware pseudo-instructions, like how the floppy-disk interface is implemented.

Well, it can be command or hardware feature as well.

P.S. In case of hardware feature it will reming me Amiga Copper custom chip that used to fill screen buffer according to data from special area called "copper list" ;)


03 Mar 2008 05:33
Profile
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
I'm thinking it might be possible to design something like an auxiliary "coprocessor" to handle more advanced instructions, with 3 12 trit wide I/O "registers" in system memory.

Something like this:

DDD:DD0 OP
DDD:DD1/2 R1
DDD:DD3/4 R2
DDD:DCD/C R3

Then you set R1-R3 with appropriate values, and OP to the relevant operation code. You could have it do half-precision floating point arithmetics, advanced memory block operations, etc. Yeah, I'm liking the idea...


--edit--

I implemented part of this idea, and it seems to work pretty fine. Only implemented floating point arithmetics so far, but it seems to work pretty good.


03 Mar 2008 07:56
Profile
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
Quote:
I'm thinking it might be possible to design something like an auxiliary "coprocessor" to handle more advanced instructions, with 3 12 trit wide I/O "registers" in system memory.

Great thing! So now you probably have to move BLS and BLT from CPU command set to commands of that GPU (assuming auxiliary "coprocessor" as General data Processing Unit), right ?


03 Mar 2008 16:05
Profile
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
I don't know, I might rename them to "PGS" and "PGT". They'll have significantly less overhead than the coprocoessor operations.

Compare:
LDA #0
STA R1+1
STA R2+1
LDA #page1
STX R1
LDA #page2
STX R2
LDA #0
STA R3
LDA #%444
STA R3+1
LDA #operation
STA COOP

With

LDA #page2
PGT #page1

--edit--

Just found a way of optimizing tunguska so that it runs almost twice as fast. Before I got about 500,000 operations per second, now I get just south of 1,000,000 8-)


04 Mar 2008 15:34
Profile
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
eudoxie wrote:
Just found a way of optimizing tunguska so that it runs almost twice as fast. Before I got about 500,000 operations per second, now I get just south of 1,000,000 8-)

Wow! Very impressive :)


05 Mar 2008 15:32
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 273 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 19  Next

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.