Welcome, Guest. Please login or register.


Author Topic: IRQ-loading - would this be possible on the EP? (Read 10418 times)

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14721
  • Country: hu
    • http://enterprise.iko.hu/
Re: IRQ-loading - would this be possible on the EP?
« Reply #15 on: 2016.September.12. 10:32:56 »
While programming my demo "First Contact", I was limited to what I could fit into a single tape-load (48kb) since loading from tape via audio-port from PC is the only way I can load things into my Enterprise.
Ask SzörG about SD adapter. But there is a long wait list :-(
Another idea: ask Pear or the spanish team about EXDOS clone.

Quote
I think I could have fit a bit more in if I loaded a smaller .com file, and then did file-loading from EXOS? Still, the limiting factor is still what fits into memory.
Yes. Many demos using multi parts mode, for example the Small Demo are about 640K total, but running on 128 machine.

Quote
One solution would be to simply rely on a memory expansion being installed, but that seems like a "cheating" solution, and also not in the spirit of using what was available at the time (mid 80ies) when the computer was out.
It is true. But - for probably later projects: many expanded machine waiting for a programs which realy use the more memory :-) And there are also a turbo machines... will be interesting to see waht the Enterprise can do on 6-7.12-10Mhz with 512K-1M memory :-)

Quote
However, if I understand correctly, the EXDOS expansion which allowed you to connect diskdrives was actually available back in those days?
Yes, EXDOS system used with real floppy drives, or hard disk/SD card. On software side no difference (just the drive letter like as the PC), EXDOS originally designed for handling disk expansions.

Offline ergoGnomik

  • EP addict
  • *
  • Posts: 1291
  • Country: hu
  • Stray cat from Commodore alley
Re: IRQ-loading - would this be possible on the EP?
« Reply #16 on: 2016.September.12. 10:39:20 »
EXDOS + Lotharek's floppy emulator?

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: IRQ-loading - would this be possible on the EP?
« Reply #17 on: 2016.September.12. 10:53:53 »
I already proposed something similar (based on Gotek), but Zozo said that it makes no sense.
And rightly so.

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: IRQ-loading - would this be possible on the EP?
« Reply #18 on: 2016.September.12. 11:30:19 »
This is true, but it  can change soon when almost all of them get SD-adapters. The same people that build the clone Exdos are now eager of getting the most modern and easy approach of the SD-cartridge. Soon, if Pear doesn't remedies it(joke...), Szorg's will be THE STANDARD on most EPs.

Well, yes, I wanted to say this more or less too, that it seems, everybody uses SD card soon :) Well not literally, but ... kind of the "new standard" ... It seems for *me* at least! And not even counting the filesystem issue, what will happen, if EXDOS ROM (for SD, for example) will have FAT16 support ... then even, if some can do direct hw access, must deal with the filesystem. Even sticking with FAT12, on SD you have partitions, on floppy you don't have ... On C64 it's "easier" as the 1541/SD2IEC/whatever are "smart" devices as well, they are really computer at its own too (SD2IEC is maybe not a fair example but it's that too, just an Atmel AVR ... but the real 1541 is a better example).

That's interesting though, if low level (DISKIO?) routines can be used directly in the OS, bypassing the large amount of EXDOS etc code ...

Offline Sdw

  • User
  • *
  • Posts: 50
Re: IRQ-loading - would this be possible on the EP?
« Reply #19 on: 2017.April.14. 17:31:04 »
I've been thinking a bit more about this. Now that I have a SD-card reader, it would be cool to make something that works with that, but that also works for older storage solutions.

If the SD-card reading is fast enough, could you do something like this?

Code: [Select]
1) Load N bytes, where N is a number that you know is going to take less than one frame to read from SD card
2) Wait for VBL (to keep timing for music correct)
3) Call music player
4) Goto 1 until all data is loaded

That way if you run the demo on something that is slower than the target, the only thing that happens is that the music will slow down considerably while loading (step 1 will take more than one frame). Music will still be in sync when next part starts, since the number of calls to the music player is always the same.

Would this work? Or does the EXDOS disk routine not give you that kind of control (ie. that you can tell it to load exactly N bytes from a file)

Offline geco

  • EP addict
  • *
  • Posts: 7081
  • Country: hu
    • Támogató Támogató
Re: IRQ-loading - would this be possible on the EP?
« Reply #20 on: 2017.April.14. 20:27:10 »
You can tell to EXDOS also to load N byte, but if you use EXOS you can tell there also to load N byte, EXOS fill 1st a buffer, and if it is filled then N byte is read from there, I do not know what is the size of this buffer for DISC, I guess it is 256 or 512 bytes, I do not know if EXDOS works in the same way, or there you can load directly smaller portions, but I think your plan works, the main question is how fast, within 1-4 frames?
I think it will be loaded within 1 frame by SD.
Even your method works with tape also, the tape loads a 4K block to the buffer, your program reads n byte, wait video IRQ, call music player loop until ends, just who uses tape have to wait 16 sec between 4K blocks ;)
I made a test program, file buffer is 512 bytes if floppy is used, my SD card config does not work in the emulator :(
« Last Edit: 2017.April.14. 21:42:35 by geco »

Offline Sdw

  • User
  • *
  • Posts: 50
Re: IRQ-loading - would this be possible on the EP?
« Reply #21 on: 2017.April.14. 23:19:09 »
Thanks for looking into this!

I must admit that I'm not quite sure about the differences between EXOS (which I assume is the built in Enterprise ROM OS) and EXDOS.

Something I did think about though is that in addition to the loading, there must be some kidn of file-seek/setup operation, and that might be a big problem as well.

So in essence, what would happen would be something like:

1 ) Effect 1 has finished
2 ) Time to load
3 ) Seek file "PART2.BIN"
4 ) WaitVBL
5 ) Play music
6 ) Load 512 bytes from PART2.bin
7 ) WaitVBL
8 ) Play music
9 ) Load next 512 bytes from PART2.BIN
etc.

The thing is, step 3 must also not take more than one frame, otherwise the music will skip.

Also I did some calculations, and loading 512 bytes per frame might ot sound much, but that is actually 25600 bytes per second! That's quite a lot for an old 8-bit system, I'm not sure if even the SD-card solution can keep up with that?

-edit-

I found some interesting stuff here:
http://ep.homeserver.hu/Dokumentacio/Konyvek/EXOS_2.1_technikal_information/exos/kernel/Ch4.html#4.1
Are these the calls that could be used?
« Last Edit: 2017.April.15. 00:16:10 by Sdw »

Offline geco

  • EP addict
  • *
  • Posts: 7081
  • Country: hu
    • Támogató Támogató
Re: IRQ-loading - would this be possible on the EP?
« Reply #22 on: 2017.April.15. 09:15:57 »
Yes, file seeking can, and if the floppy head is in wrong position when the program wants to read next block can cause delay in sound playback, but file seeking can be done once, you can make extremely big files on enterprise if you need.
EXDOS is the disc operating system, EXOS is the operating system of ep :-)
Yes, EXOS n calls (rst 30h n) can be used for loading:
  LD A,channel number
  LD DE,file nam address
  EXOS 1            ;open file
  LD A,channel number
  LD BC,load length
  LD DE,load address
  EXOS 6           ;load data (this can be repeated before closing the file)
  LD A,channel number
  EXOS 3           ;close file

If EXOS call successful, A register is zero, and Z flag set, otherwise Z clear, and A contains án error code.

back to sound playback, you need to create an own interrupt before loading, because EXOS interrupt would overwrite Dave sound registers, and after loading Restore EXOS interrupt, if you do not use another custom interrupt.

Offline Sdw

  • User
  • *
  • Posts: 50
Re: IRQ-loading - would this be possible on the EP?
« Reply #23 on: 2017.April.15. 13:14:45 »
I am taking the first steps in trying to test this, but I am getting stuck right away. The first thing I wanted to try was to simply load a file.
My code is essentially this:

Code: [Select]
        ld a,0
ld de,filename
EXOS 1
ld a,0
ld bc,4096
ld de,data
EXOS 6
ld a,0
EXOS 3

filename:
db "FILE.BIN"
db 0

data:
block 4096,0

And I get an error immediately on the very first EXOS call 1, the return code in A is 0xFD which the documentation says is  "Invalid EXOS string"

My test setup is simply in ep128emu so far, TapeFILE_IO config, I have a working directory where both the binary exe I start and the FILE.BIN is located.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: IRQ-loading - would this be possible on the EP?
« Reply #24 on: 2017.April.15. 13:27:51 »
An  Enterprise string, for example a file name, is made of two parts, the first byte is the length of the string without this count byte, then it follows the string itself:

filename:
             db 8,"FILE.BIN"

You don't need to put a "0" as "End of String".

But on some other calls, the length of a string is put on b register.

Please, read the EXOS Specifications. Kernel section. EXOS calls.
« Last Edit: 2017.April.15. 13:37:00 by gflorez »

Offline Sdw

  • User
  • *
  • Posts: 50
Re: IRQ-loading - would this be possible on the EP?
« Reply #25 on: 2017.April.16. 01:33:14 »
Thank you, that solved it. Now I have "normal" loading working. Will be very interesting to test what happens when I start to split it up and try to play music inbetween 512-byte loads. I'll report back with my findings! :)

Offline Sdw

  • User
  • *
  • Posts: 50
Re: IRQ-loading - would this be possible on the EP?
« Reply #26 on: 2017.April.17. 19:14:07 »
OK, here's a first attempt at something!
This test is kind of a simple slideshow, with music running (same as I used in "First Contact", just because then it was easier for me to determine if something sounded off or not!) and loading different 256-col pictures from disk while music is playing.
It seems to work OK in emulator (though once I had some slowdowns while loading, never able to reproduce it) and on my SD-card-interface.
I would be really grateful if some of you could also try it on your SD-card readers and other loading methods (diskdrives, HD, ?).
Note though that even though I only used the standard EXOS-calls this is very experimental and could perhaps destroy the contents of your disk/HD so don't run it on something where you have valuable data!
Please report what you have tried it on, and if it works (music keeps playing without corruption, pictures keep showing) or not!

The whole solution turned out kind of strange. Exactly as geco had predicted, the EXOS calls does something weird with the sound registers if I ran without any IRQs (don't understand why though!)
So now I have my own IRQ set up instead, that really doesn't do anything but increment a counter every frame so I can know when an IRQ has completed.
The my code is essentially like this:

Code: [Select]
* Check counter that is in IRQ to know when it has run and finished
* Call music player
* Load 512 bytes
* Repeat

The really weird thing is that I thought since I just wait for the IRQ to be finished, then call the music player directly, I might as well call it from within the IRQ, right?
Nope, when I do that, the machine simply resets when trying to load at the same time.
Really weird, as I make sure to push/pop all registers in the IRQ.

Oh well, at least the method I have now seems to work (at least on my machine) - and I'm really eager to get some input on how it works for everyone else.
Keeping fingers crossed that we have found a method that would allow demos with tons of parts and data and continuous music!

Offline geco

  • EP addict
  • *
  • Posts: 7081
  • Country: hu
    • Támogató Támogató
Re: IRQ-loading - would this be possible on the EP?
« Reply #27 on: 2017.April.17. 21:19:19 »
Looks good :), sorry I checked it only on emulator with FILE I/O config.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: IRQ-loading - would this be possible on the EP?
« Reply #28 on: 2017.April.17. 22:26:16 »
I have checked it only on SD-reader, sorry not EXDOS controller.

But it works perfectly on 4Mhz and also on 10Mhz....

Offline BruceTanner

  • EP lover
  • *
  • Posts: 607
  • Country: gb
Re: IRQ-loading - would this be possible on the EP?
« Reply #29 on: 2017.April.18. 15:19:20 »
Please report what you have tried it on, and if it works (music keeps playing without corruption, pictures keep showing) or not!

It doesn't work with a real EXDOS card and a real floppy disk (EP128), perhaps not surprising as it takes a while to find/load sectors. The effect is that the music notes change very slowly when the disk is accessed, with the odd crackle, but there is sound (mostly a continuous note) throughout.

The reason I was doing it was to try it with my upcoming EPNET network card, but it crashed when it started to load pictures, I suspect my fault, will investigate further!