Welcome, Guest. Please login or register.


Author Topic: How to begin assembly on Enterprise (Read 29177 times)

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
How to begin assembly on Enterprise
« on: 2014.June.08. 21:52:15 »
Hi, I wanted to try to play around with some programming on the Enterprise 128 computer (using an emulator)... I'm currently programming a bit for Amstrad CPC using WinApe emulator's built in assembler, but don't know any cross-dev tools that I could use for programming on an Enterpise...
Actually I never knew about the existence of Enterprise computers... I read some discussion about it on cpcwiki forum two days ago (about Star Sabre conversion) and wanted to check a few things with nick's flexible graphic capabilities... Unfortunately I don't know how to start... Please help... 

What tools are you using?

Offline jltursan

  • User
  • *
  • Posts: 69
  • Country: es
    • JLTurSan's MSX page - My little MSX corner
Re: How to begin assembly on Enterprise
« Reply #1 on: 2014.June.08. 23:25:35 »
I suppose a good programmer's editor with Z80 syntax highlighting (ConTEXT) and a Z80 cross compiler (sjASM, pasmo) is a good starting point; but I'm also curious about Enterprise development: good documentation sources, code examples or even ready to use IDEs...

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: How to begin assembly on Enterprise
« Reply #2 on: 2014.June.09. 15:49:45 »
Thank you.
Ok, I installed ConTEXT, downloaded pasmo, but how do I transfer the code into an emulator (and which of the two (?) should be better for this) to execute?

It seems that it's really hard to find info about programming the enterprise (other than the official tech documentation)...
« Last Edit: 2014.June.09. 15:57:01 by ssr86 »

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: How to begin assembly on Enterprise
« Reply #3 on: 2014.June.09. 16:27:36 »
I using Programmer's Notepad for editing, and Sjasm 0.396 for compile.
Ep128emu built in debugger are very powerful with many options, and with LUA scripts you can done very advanced debugging.

In ep128emu if FileIO config loaded, then you can LOAD/SAVE files from your PC drive directly. Just select Work directory in the emulator menu, and put your Enterprise files to this directory.

For running your code need a loader program in a EXOS compatible file format, which are allocate memory, set up screen, etc
Once I uploaded one example there.

If you want to run existing CPC code, then needed in the loader program set up similar enviromement as the CPC. I think ask forum member: geco and IstvanV who are masters of converting CPC programs to Enterprise.
At source code level will be very easy.

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: How to begin assembly on Enterprise
« Reply #4 on: 2014.June.09. 16:50:14 »
Welcome here :)
I suggest to you also what Zozo mentioned, if you need any help, or hint please do not hesitate.
If you want to test only small code, you can do it in 2 ways: The 1st is what mentioned by Zozo, and the sample is very good, it contains a lot of useful stuff. If you do not need any additional allocated memory, then you can create an EXOS 5 header program, it can be loaded directly to the Enterprise, these programs are loaded into 0100h, so you can set a breakpoint to 0100h and the debugger window will appear when the program is loaded.

Code: [Select]
        org 00f0h
db 00,05
dw fillen
db 00,00,00,00,00,00,00,00,00,00,00,00
startpr
         (code)

fillen   equ $-startpr

The 2nd:
you can load the code directly to EP128emu in debugger window PAGE2, by typing L "file name" 0 xxxx (load address) into top left box, if the code is loaded then with ;xxxx you can give an execution address. ( in this case be aware, if you did not change memory settings, then in most cases at Page 0 first memory segment of EP (in a normal EP128 setup it is 0F8h) ,page 1,2 mostly contains 0ffh segment, which is system segment, and page 3 mostly  contains ROM)

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: How to begin assembly on Enterprise
« Reply #5 on: 2014.June.09. 18:23:07 »
I managed to assemble the given sample.asm to com file using pasmo. Loaded it using the ep128emu. 
...I have a question...
Where does the video memory start? The pointer VIDCIM1 is equal to &0000... but I doubt that the vmem is at &0000, because I'd see some random pixels on screen. Changed the border color to see that 'something' is going on...

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: How to begin assembly on Enterprise
« Reply #6 on: 2014.June.09. 19:04:26 »
VIDCIM1 are video (Nick) address of the video memory. It is deppend about which video segment allocated. In the standard configurations will be 0000h at Ep128 and 4000h at EP64.

For the Z80 access it is paged to Page 3 and can be accessed from C000h-... But you can page to any other page.

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: How to begin assembly on Enterprise
« Reply #7 on: 2014.June.09. 21:39:14 »
It seems that the Line Parameter Table can be max 256 bytes long... is there really such limitation? If so, then maybe it can be overcome someway (interrupts?)?...
I thought that I read that there can be "infinitely many" modelines... And also read that the enterprise can repeat display lines (VRES=0). I thought that it would be pretty straightforward to obtain a 160x128 16color and 80x64 256 color blocky resolutions (especially the first would be fun as a kind of "handheld console" resolution)... But if there's this limit on the size of LPT then it seems not so easy to do (impossible?). Can somebody help?

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: How to begin assembly on Enterprise
« Reply #8 on: 2014.June.09. 21:53:07 »
The 256 bytes limit only in this example. No limit for LPT size, can be up to 64K :-) ok practically good idea left some video memory for the pixel data :-D
Most of EP programs use a separate video segment for the LPT table.

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: How to begin assembly on Enterprise
« Reply #9 on: 2014.June.10. 04:21:58 »
That's great! I should think and check more before I write here...
I'll try and finish the code once I get back from work then.

The same "double height pixels" mode (160x128x16) on the amstrad costs cpu time (drawing every line twice), no save of vmem, but saves memory for stored gfx (sprites, tiles, etc. take up half the memory). Or one can display a 160x128 screen but with a border line between every scanline of gfx screen... This saves both time and vmem memory...but doesn't look that good because of the blank lines.

And enterprise should (is) able to do the "real" 160x128x16 mode with a "simple" Line Parameter Table (but quite long one - 16 bytes for every line of the "new mode" + what's needed for vsync... so a bit above 2048 bytes I guess). Great!

And after "feeding" Nick with values from the LPT, that memory can be used for other stuff, right?
« Last Edit: 2014.June.10. 04:41:42 by ssr86 »

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: How to begin assembly on Enterprise
« Reply #10 on: 2014.June.10. 09:27:27 »
Quote
And after "feeding" Nick with values from the LPT, that memory can be used for other stuff, right?

I guess you mean that you think LPT is read only once from the VRAM and then it's not used at all (from VRAM, I mean). That's not true, Nick always read LPBs of LPT at every first 8 slots of each scanline (I am not sure though what happens if an LPB is for multiple scanlines: is the LPB re-read anyway on each scanline, or not?). Nick does not have enough internal memory to store the LPT, it only stores a single LPB until the next one is read, as far as I know. So, for example in theory you can modify the already used LPT in the memory and of course Nick will use that even without new LPT address set (it's another question that it can be risky to do, Nick may read the one LPB of the LPT while you are modifying etc etc). So, I think the correct answer is: Nick is always fed with LPBs on every scanlines, you can't reuse that memory for something other (of course unless you set another LPT up, then the memory area of the old one is not used anymore).

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: How to begin assembly on Enterprise
« Reply #11 on: 2014.June.10. 10:14:42 »
Quote from: ssr86
And after "feeding" Nick with values from the LPT, that memory can be used for other stuff, right?
No, Nick continously reading it. But you can page out, and page in other memory segment for the Z80 if your program need a lot of memory.

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: How to begin assembly on Enterprise
« Reply #12 on: 2014.June.13. 15:47:29 »
Sorry, it's a little offtopic, but I didn't want to create another topic...
It's about the "Converting Spectrum programs to run on the Enterprise" document. It seems that a few pages before the last one are missing...
True?

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: How to begin assembly on Enterprise
« Reply #13 on: 2014.June.13. 16:26:44 »
Yes, it seems one, or more pages are missing, but the source code what Zozo linked (also used for converted speccy programs) to you is better than that what you could see on this document.

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: How to begin assembly on Enterprise
« Reply #14 on: 2014.June.13. 20:22:28 »
Quote
the source code what Zozo linked (also used for converted speccy programs) to you is better than that what you could see on this document.

You mean the "sample.asm"? Yes, it's better, but it's also harder to for me to understand (just a newbie), because of all the exos calls :oops:... 
I'm just looking through the available source codes.