Enterprise Forever
:UK => Programming => Topic started by: nitrofurano on 2012.August.29. 19:48:07
-
hi! since last year i were using Boriel's zxbasic-compiler regularly for creating stuff for zx-spectrum (like for csscgc contest) -
meanwhile most people saw that this cross-compiler has a huge potential far beyond just zx-spectrum - versions for sms (sega mastersystem) and mc1000 (a gem1000 clone) started successfully, and amstrad-cpc and msx versions are on the way -
i started to collect information about a relatively good amount of hardware, Enterprise included - http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Other_architectures
the conversations at the forum there is also very interesting: http://www.boriel.com/forum/zx-basic-compiler/?sid=476c31303133666603d7668cd3966617
can we have something for Enterprise starting from this?
-
It is a very interesting idea!
Very old dream of the users, easy programming in BASIC and enjoying the machnie code speed!
For the Enterprise is exist a compiler (http://ep.homeserver.hu/PDF/Zzzip_Compiler.pdf), but with many limitations.
The Enterprise is have a very flexible programable hw, easy to simulate other computers enviroment such as ZX Spectrum or Amstrad CPC.
I think the first easy step add to the ZX compiler "EP-ZX" mode, it is add a startup code to the program which is set up the ZX like enviroment for the program. Then main code can be very similar as the ZX compiled version, only some little things (for example IO port numbers) are different.
With this version the existing (and future) ZX BASIC programs also can be compiled to run on Enterprise.
Disadvantage of this version the Enterprise used only as ZX Spectrum...
More enhanced version is a IS-BASIC compiler, which is can compile the existing Enterprise BASIC (IS-BASIC (http://enterprise.iko.hu/books/EnterpriseProgrammingGuide.pdf)) programs, using the Enterprise operating system (EXOS) capatibilities.
And in the "dream" version some new functions added for direct handling the hw, accessing all capatibilities of the machine.
-
after getting some help (thanks, Noel Persa!) i could reach the point of the attachment i’m sharing in this comment - it is still not working as expected, but it shows the process i’m trying for that
and the "dream" version is actually the first objective i have in mind - for example, i really want to firstly cover all screen modes, and try to do what i made, for example, for Amstrad-CPC (GX4000)
ZX-Spectrum simulation from Enterprise wasn’t a goal i had in mind, but i’m also curious about
-
Here is an example to build a simple 320x200 screen on Enterprise:
macro exos n
rst 030h
defb n
endm
org 00f0h
db 00,05
dw fillen
db 00,00,00,00,00,00,00,00,00,00,00,00
startpr ld sp,0100h
ld hl,error ;store error and soft reset routine
ld (0bff8h),hl
ld bc,011bh
ld d,00h
exos 16 ;set border to 0 via EXOS
call vid ;get a video segment
out (0b3h),a ;page into page 3
call memaddr ;get Nick address of the video segment
ld (vlpb+04h),hl ;store Nick address of video memory to the LPT
ld a,h
ld hl,vlpb ;copy LPT into video memory (now it's z80 address is 0ff00h)
ld de,0ff00h
ld bc,0070h
ldir
or 3fh ;this part activate copied LPT, 1st calculate value for port (83h,82h)
rrca ;Address of LPT/16 or 0c000h is written to ports 83h,82h
rrca
rrca
rrca
or 0c0h
ld c,a
ld a,0f0h
out (82h),a ;low value of LPT/16 or 0c000h
ld a,c
out (83h),a ;high value of LPT/16 or 0c000h
;after this 2 port writes Nick starts to display the new screen, which is a 320x200 screen with 16 colours and it can be used 0c000h-0fe7fh
;by changing VLPB+1 you can change colours: 0f2h 256 colour, 0d2h 16 colour, 0b2h 4 colour, 92h 2 colour mode
vid ld hl,endprg ;request a Video RAM from EXOS
ld (hl),0
req_seg exos 24
jr z,whatsup
cp 7fh
jp nz,error
whatsup ex af,af'
ld a,c
cp 0fch
jr nc,dontask
inc hl
ld (hl),c
jr req_seg
dontask ex af,af'
push bc
push af
back ld c,(hl)
exos 25
dec hl
jr z,back
pop af
pop bc
or a
jp nz,error
ld a,c
ret
memaddr ld hl,0000h
rra
rr h
rra
rr h
ret
error di
ld sp,0100h
ld a,0ffh
out (0b2h),a
ld c,40h
exos 0
ld a,01h
out (0b3h), a
ld a,06h
jp 0c00dh
; number of lines, 100h-38h
; 0d2h: b7: video interrupt will occur after this line, b6,b5: now 16 colour, b4: if it is 0 then Nick takes graphics data from the same place for each scan line defined in this LPB, b3,b2,b1: 001 - PIXEL mode
; 0bh: left margin at 0bh
; 33h: right margin at 33h
; video address1
; video address2
; colour 1-8
vlpb db 038h,0d2h,0bh,33h,00h,00h,00,00,00h,0dfh,09h,04h,34h,3fh,00h,66h ;video lpb 200
vsync db 0d2h,02h,3fh,00h,00h,00h,00,00,00,00,00,00,00,00,00,00 ;sync 46
db 0fdh,00h,3fh,00h,00h,00h,00,00,00,00,00,00,00,00,00,00 ; 3
db 0feh,00h,06h,3fh,00h,00h,00,00,00,00,00,00,00,00,00,00 ; 2
db 0ffh,00h,3fh,20h,00h,00h,00,00,00,00,00,00,00,00,00,00 ; 1
db 0f0h,02h,06h,3fh,00h,00h,00,00,00,00,00,00,00,00,00,00 ; 16
db 0d4h,03h,3fh,00h,00h,00h,00,00,00,00,00,00,00,00,00,00 ; 44
endprg
fillen equ $-startpr
-
excellent help. @geko ! sharing the ZX-Basic Compiler version, including a version based on this .asm you shared here! :)
-
finally, some examples available in the Boriel’s ZX-Basic Compiler wikipage: http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_Enterprise
-
Wow! Great work!
-
I hope somebody will convert cool games with this. As I remember there are many cool game in Boriel Basic.
Here you can list Boriel games (Main Programming language drowdown menu):
https://sites.google.com/site/speccy21/home