Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. I want to do some more stuff with Apricot graphics.

I want to do some more stuff with Apricot graphics.

Scheduled Pinned Locked Moved Uncategorized
aprilcot
36 Posts 9 Posters 3 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tursilion@furries.clubT tursilion@furries.club

    @bytex64 What if you used the old Apple2 trick of XORing the sprites instead. Gives you draw and erase without destroying the background (at the cost of some corruption, but it's generally ignorable 🙂 )

    bytex64@awesome.gardenB This user is from outside of this forum
    bytex64@awesome.gardenB This user is from outside of this forum
    bytex64@awesome.garden
    wrote last edited by
    #19

    @tursilion That’s what I did initially in the naive version. It does work, but it also can’t take advantage of REP STOSW for fast copies, so it’ll be slower.

    1 Reply Last reply
    0
    • bytex64@awesome.gardenB bytex64@awesome.garden

      17, and no trails!

      poetaster@mastodon.gamedev.placeP This user is from outside of this forum
      poetaster@mastodon.gamedev.placeP This user is from outside of this forum
      poetaster@mastodon.gamedev.place
      wrote last edited by
      #20

      @bytex64 exceedingky cute axoloinvaders!

      1 Reply Last reply
      0
      • bytex64@awesome.gardenB bytex64@awesome.garden

        This has the pointer table optimization (every shifted version of the sprite is pointed to from a table instead of being calculated via MUL). I created a whole second routine to blank sprites, which is the same thing except it does STOSW instead MOVSW. It took me longer to get that working than the sprite draw routine because I misunderstood the documentation. I thought it referenced DS for the target and not ES because Intel's manual didn't specify either.

        This is still a very bad draw routine because it just overwrites the entire 16-pixel word instead of doing proper masking. That'll probably drop the performance by 30% because it can't use the 8086's fast string instructions.

        bytex64@awesome.gardenB This user is from outside of this forum
        bytex64@awesome.gardenB This user is from outside of this forum
        bytex64@awesome.garden
        wrote last edited by
        #21

        We've maxed out the CPU, but the Apricot has another trick - the 8089. It's a dedicated I/O coprocessor, and theoretically it can push bytes even faster than the CPU. If... I can get it working.

        I've discovered the hard way that Turbo Pascal is really picky about what it can link with. It _only_ wants to link with external functions. If the OBJ file you're linking with has _any_ data segment symbols, it flat out refuses to deal with it. At first I thought this was a subtle bug in how asm89 generates OMF files, but it does the same with a C file compiled with Turbo C. And since asm89 defines the 8089 machine code symbols as data (which I think is correct from the POV of the CPU), it just doesn't work. 😕

        So I guess I'll just have to copy the machine code into the Pascal source as raw data. That sucks.

        #Aprilcot

        bytex64@awesome.gardenB 1 Reply Last reply
        0
        • bytex64@awesome.gardenB bytex64@awesome.garden

          We've maxed out the CPU, but the Apricot has another trick - the 8089. It's a dedicated I/O coprocessor, and theoretically it can push bytes even faster than the CPU. If... I can get it working.

          I've discovered the hard way that Turbo Pascal is really picky about what it can link with. It _only_ wants to link with external functions. If the OBJ file you're linking with has _any_ data segment symbols, it flat out refuses to deal with it. At first I thought this was a subtle bug in how asm89 generates OMF files, but it does the same with a C file compiled with Turbo C. And since asm89 defines the 8089 machine code symbols as data (which I think is correct from the POV of the CPU), it just doesn't work. 😕

          So I guess I'll just have to copy the machine code into the Pascal source as raw data. That sucks.

          #Aprilcot

          bytex64@awesome.gardenB This user is from outside of this forum
          bytex64@awesome.gardenB This user is from outside of this forum
          bytex64@awesome.garden
          wrote last edited by
          #22

          But anyway, with that worked around, invoking the 8089 from Pascal seems to work. The code here is very simple:

          MOVI GA, 1
          ADD [PP].4, GA
          HLT

          It just adds 1 to the word at offset 4 in the parameter block. The first two words point to the code itself, so the third one is where parameters live. The Pascal code that invokes it just sets that to 0, and the output below shows that it has been changed, and then dumps the state of the 8089 Channel Control Block.

          #Aprilcot

          Link Preview Image
          bytex64@awesome.gardenB 1 Reply Last reply
          0
          • bytex64@awesome.gardenB bytex64@awesome.garden

            But anyway, with that worked around, invoking the 8089 from Pascal seems to work. The code here is very simple:

            MOVI GA, 1
            ADD [PP].4, GA
            HLT

            It just adds 1 to the word at offset 4 in the parameter block. The first two words point to the code itself, so the third one is where parameters live. The Pascal code that invokes it just sets that to 0, and the output below shows that it has been changed, and then dumps the state of the 8089 Channel Control Block.

            #Aprilcot

            Link Preview Image
            bytex64@awesome.gardenB This user is from outside of this forum
            bytex64@awesome.gardenB This user is from outside of this forum
            bytex64@awesome.garden
            wrote last edited by
            #23

            I should probably explain a little bit about the interface to the 8089. Early in the system initialization, the CPU tells the IOP to read the address of a System Configuration Block from the top of ROM. That address is right next to the 8086 reset location at FFFF8h, so if you've ever wondered what those unused bytes were, that's what they're for! This sets up the Channel Control Block, which defines the locations and parameters for executing Channel Parameter Blocks, which define a pointer to the 8089 machine code and parameters to the task. When the 8089 gets a "channel attention" (on the Apricot connected to I/O ports 70h and 72h), it re-reads the CCB for the signaled channel and starts/stops any tasks defined there.

            #Aprilcot

            Link Preview Image
            bytex64@awesome.gardenB 1 Reply Last reply
            0
            • bytex64@awesome.gardenB bytex64@awesome.garden

              I should probably explain a little bit about the interface to the 8089. Early in the system initialization, the CPU tells the IOP to read the address of a System Configuration Block from the top of ROM. That address is right next to the 8086 reset location at FFFF8h, so if you've ever wondered what those unused bytes were, that's what they're for! This sets up the Channel Control Block, which defines the locations and parameters for executing Channel Parameter Blocks, which define a pointer to the 8089 machine code and parameters to the task. When the 8089 gets a "channel attention" (on the Apricot connected to I/O ports 70h and 72h), it re-reads the CCB for the signaled channel and starts/stops any tasks defined there.

              #Aprilcot

              Link Preview Image
              bytex64@awesome.gardenB This user is from outside of this forum
              bytex64@awesome.gardenB This user is from outside of this forum
              bytex64@awesome.garden
              wrote last edited by
              #24

              So it's a little convoluted, but it does make it simple to interleave lots of 8089 programs running under the supervision of different parts of the system. You just wait for a channel to not be busy, load the CCB with the address of your own CPB, and let 'er rip. If a higher priority task needs a channel but one is not available, it can pause a running task, save the CCB info, swap in its own task, run that, swap the old one back in, and continue it. AFAIK nothing in the Apricot system does this, and it's probably moot anyway since the way the 8089 is implemented shares the bus with the CPU, so the 8086 can't make much progress while the 8089 is running, anyway.

              Apricot typically uses channel 1 for the floppy drive controller. I've read somewhere that channel 2 is used by the Winchester controller, but as far as I've seen in the emulated system, that's not the case. I've also read that the system will run without an 8089, so probably there are some Apricots out there without them.

              #Aprilcot

              bytex64@awesome.gardenB drj@typo.socialD 2 Replies Last reply
              0
              • bytex64@awesome.gardenB bytex64@awesome.garden

                So it's a little convoluted, but it does make it simple to interleave lots of 8089 programs running under the supervision of different parts of the system. You just wait for a channel to not be busy, load the CCB with the address of your own CPB, and let 'er rip. If a higher priority task needs a channel but one is not available, it can pause a running task, save the CCB info, swap in its own task, run that, swap the old one back in, and continue it. AFAIK nothing in the Apricot system does this, and it's probably moot anyway since the way the 8089 is implemented shares the bus with the CPU, so the 8086 can't make much progress while the 8089 is running, anyway.

                Apricot typically uses channel 1 for the floppy drive controller. I've read somewhere that channel 2 is used by the Winchester controller, but as far as I've seen in the emulated system, that's not the case. I've also read that the system will run without an 8089, so probably there are some Apricots out there without them.

                #Aprilcot

                bytex64@awesome.gardenB This user is from outside of this forum
                bytex64@awesome.gardenB This user is from outside of this forum
                bytex64@awesome.garden
                wrote last edited by
                #25

                Part of the magic of what's happening in the assembly above is upon task start, the address of the Channel Parameter Block gets loaded into the PP register in the 8089. It makes it very handy to reference any of those parameters, and the 8089 code doesn't need to know ahead of time where your parameters are. IIRC all the call/jump instructions are signed displacement, so the code is fairly naturally position-independent as well.

                bytex64@awesome.gardenB 1 Reply Last reply
                0
                • elithebearded@fed.qaz.redE elithebearded@fed.qaz.red

                  @bytex64

                  Is it really a sprite if it's not in hardware? Otherwise it's just sparkling pixels

                  drj@typo.socialD This user is from outside of this forum
                  drj@typo.socialD This user is from outside of this forum
                  drj@typo.social
                  wrote last edited by
                  #26

                  @elithebearded @bytex64 "hardware sprites" is a term of art, so i'm gonna go with Yes.

                  1 Reply Last reply
                  0
                  • bytex64@awesome.gardenB bytex64@awesome.garden

                    So it's a little convoluted, but it does make it simple to interleave lots of 8089 programs running under the supervision of different parts of the system. You just wait for a channel to not be busy, load the CCB with the address of your own CPB, and let 'er rip. If a higher priority task needs a channel but one is not available, it can pause a running task, save the CCB info, swap in its own task, run that, swap the old one back in, and continue it. AFAIK nothing in the Apricot system does this, and it's probably moot anyway since the way the 8089 is implemented shares the bus with the CPU, so the 8086 can't make much progress while the 8089 is running, anyway.

                    Apricot typically uses channel 1 for the floppy drive controller. I've read somewhere that channel 2 is used by the Winchester controller, but as far as I've seen in the emulated system, that's not the case. I've also read that the system will run without an 8089, so probably there are some Apricots out there without them.

                    #Aprilcot

                    drj@typo.socialD This user is from outside of this forum
                    drj@typo.socialD This user is from outside of this forum
                    drj@typo.social
                    wrote last edited by
                    #27

                    @bytex64 as i understand it, this is quite similar to how the DSP in the N64 gets shared between pixel rasterising of triangles and mixing sound samples: every 5ms (that is, more than once a frame) the regular "pixel blatting" microcode in the DSP gets replaced with "audio mixing" and run.

                    bytex64@awesome.gardenB 1 Reply Last reply
                    0
                    • bytex64@awesome.gardenB bytex64@awesome.garden

                      I want to do some more stuff with Apricot graphics. See, the thing is, these computers don't really _have_ graphics. What they have is a character mode with 16x16 pixel cells. Every pixel is addressable, but every pixel exists inside redefinable character memory, so you have to know where the particular character is in memory to modify its pixels. Which means there's different ways you can map the "characters" to the screen.

                      I had originally set this up in the usual way, with each cell following the next in rows and columns. But I realized much later that if you arrange the character cells in columns, every column becomes a contiguous region of 16-bit words. The math becomes simpler, and the whole thing runs faster.

                      #Aprilcot

                      sverx@mastodon.gamedev.placeS This user is from outside of this forum
                      sverx@mastodon.gamedev.placeS This user is from outside of this forum
                      sverx@mastodon.gamedev.place
                      wrote last edited by
                      #28

                      @bytex64 is there some place where I can read the operations you're doing? or the source code? thanks! 😄

                      bytex64@awesome.gardenB 1 Reply Last reply
                      0
                      • elithebearded@fed.qaz.redE elithebearded@fed.qaz.red

                        @bytex64

                        Is it really a sprite if it's not in hardware? Otherwise it's just sparkling pixels

                        menos@todon.euM This user is from outside of this forum
                        menos@todon.euM This user is from outside of this forum
                        menos@todon.eu
                        wrote last edited by
                        #29

                        @elithebearded Sparkling sugar water or pixels, that's the question.
                        @bytex64

                        1 Reply Last reply
                        0
                        • bytex64@awesome.gardenB bytex64@awesome.garden

                          I want to do some more stuff with Apricot graphics. See, the thing is, these computers don't really _have_ graphics. What they have is a character mode with 16x16 pixel cells. Every pixel is addressable, but every pixel exists inside redefinable character memory, so you have to know where the particular character is in memory to modify its pixels. Which means there's different ways you can map the "characters" to the screen.

                          I had originally set this up in the usual way, with each cell following the next in rows and columns. But I realized much later that if you arrange the character cells in columns, every column becomes a contiguous region of 16-bit words. The math becomes simpler, and the whole thing runs faster.

                          #Aprilcot

                          spodlife@sunny.gardenS This user is from outside of this forum
                          spodlife@sunny.gardenS This user is from outside of this forum
                          spodlife@sunny.garden
                          wrote last edited by
                          #30

                          @bytex64
                          I am always tickled when column graphics, like wallpaper, are rediscovered.

                          1 Reply Last reply
                          0
                          • drj@typo.socialD drj@typo.social

                            @bytex64 as i understand it, this is quite similar to how the DSP in the N64 gets shared between pixel rasterising of triangles and mixing sound samples: every 5ms (that is, more than once a frame) the regular "pixel blatting" microcode in the DSP gets replaced with "audio mixing" and run.

                            bytex64@awesome.gardenB This user is from outside of this forum
                            bytex64@awesome.gardenB This user is from outside of this forum
                            bytex64@awesome.garden
                            wrote last edited by
                            #31

                            @drj Oh that’s interesting. 🙂

                            1 Reply Last reply
                            0
                            • sverx@mastodon.gamedev.placeS sverx@mastodon.gamedev.place

                              @bytex64 is there some place where I can read the operations you're doing? or the source code? thanks! 😄

                              bytex64@awesome.gardenB This user is from outside of this forum
                              bytex64@awesome.gardenB This user is from outside of this forum
                              bytex64@awesome.garden
                              wrote last edited by
                              #32

                              @sverx Not at the moment, but I’ll try to publish the source at the end of the month.

                              bytex64@awesome.gardenB 1 Reply Last reply
                              0
                              • bytex64@awesome.gardenB bytex64@awesome.garden

                                @sverx Not at the moment, but I’ll try to publish the source at the end of the month.

                                bytex64@awesome.gardenB This user is from outside of this forum
                                bytex64@awesome.gardenB This user is from outside of this forum
                                bytex64@awesome.garden
                                wrote last edited by
                                #33

                                @sverx Oh, I do also have some code up for the game I made last year: https://git.bytex64.net/where-is-owl/

                                No sprites or complex graphics, though. That one’s just character cell manipulation.

                                1 Reply Last reply
                                0
                                • bytex64@awesome.gardenB bytex64@awesome.garden

                                  I want to do some more stuff with Apricot graphics. See, the thing is, these computers don't really _have_ graphics. What they have is a character mode with 16x16 pixel cells. Every pixel is addressable, but every pixel exists inside redefinable character memory, so you have to know where the particular character is in memory to modify its pixels. Which means there's different ways you can map the "characters" to the screen.

                                  I had originally set this up in the usual way, with each cell following the next in rows and columns. But I realized much later that if you arrange the character cells in columns, every column becomes a contiguous region of 16-bit words. The math becomes simpler, and the whole thing runs faster.

                                  #Aprilcot

                                  davbucci@mastodon.sdf.orgD This user is from outside of this forum
                                  davbucci@mastodon.sdf.orgD This user is from outside of this forum
                                  davbucci@mastodon.sdf.org
                                  wrote last edited by
                                  #34

                                  @bytex64 nice! It kind of reminds me of the VIC20 hires mode.

                                  1 Reply Last reply
                                  0
                                  • bytex64@awesome.gardenB bytex64@awesome.garden

                                    Part of the magic of what's happening in the assembly above is upon task start, the address of the Channel Parameter Block gets loaded into the PP register in the 8089. It makes it very handy to reference any of those parameters, and the 8089 code doesn't need to know ahead of time where your parameters are. IIRC all the call/jump instructions are signed displacement, so the code is fairly naturally position-independent as well.

                                    bytex64@awesome.gardenB This user is from outside of this forum
                                    bytex64@awesome.gardenB This user is from outside of this forum
                                    bytex64@awesome.garden
                                    wrote last edited by
                                    #35

                                    Guess who found a bug in MAME? Getting my ducks in a row here, this is just doing a pointer load so I can get the address of the pixels I want to copy, then copying something from that memory to the X and Y parameters.

                                    lpd ga, [pp].8
                                    mov gb, [ga].4
                                    mov [pp].4, gb
                                    mov [pp].6, [ga].6
                                    hlt

                                    The first one is done by MOVing into the GB register first, then from GB to memory. The second one uses the 8089's memory-to-memory MOV. And it turns out MAME's 8089 core doesn't implement mem-mem MOV correctly, leaving zero in the Y parameter instead of 7. I thought I was going mad!

                                    #Aprilcot

                                    bytex64@awesome.gardenB 1 Reply Last reply
                                    0
                                    • bytex64@awesome.gardenB bytex64@awesome.garden

                                      Guess who found a bug in MAME? Getting my ducks in a row here, this is just doing a pointer load so I can get the address of the pixels I want to copy, then copying something from that memory to the X and Y parameters.

                                      lpd ga, [pp].8
                                      mov gb, [ga].4
                                      mov [pp].4, gb
                                      mov [pp].6, [ga].6
                                      hlt

                                      The first one is done by MOVing into the GB register first, then from GB to memory. The second one uses the 8089's memory-to-memory MOV. And it turns out MAME's 8089 core doesn't implement mem-mem MOV correctly, leaving zero in the Y parameter instead of 7. I thought I was going mad!

                                      #Aprilcot

                                      bytex64@awesome.gardenB This user is from outside of this forum
                                      bytex64@awesome.gardenB This user is from outside of this forum
                                      bytex64@awesome.garden
                                      wrote last edited by
                                      #36

                                      It's honestly kind of weird that this doesn't work, because MAME also includes an emulation for the iSBC 215 disk controller, which also uses the 8089. Maybe it doesn't work either. 😐

                                      1 Reply Last reply
                                      0
                                      • R relay@relay.infosec.exchange shared this topic
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • World
                                      • Users
                                      • Groups