PMode vs PMode E.O.S.

I’m talking here about Tran’s PMODE in version 2.51, which I’d been using until recently, and a completely new kernel from the Eclipse group, i.e. E.O.S 2.06! Well, I don’t want to describe protect mode here, but I want to point out the pluses and minuses of both kernels — actually the pluses of the second one in comparison to the first :)! It somehow happened weirdly that Tran’s kernel is very well known among the coder scene, is respected and used by many to this day. The Pmode that Astra sent me (thanx pal) differs a bit in versatility from Tran’s. It’s the kernel of the well-known French group Eclipse (probably everyone associates them with the intro Teddy Bear’s Revenge that won Saturne 96 party)!

At first glance everyone will say — oh, just some new environment, so why should I throw away what I’ve been using and what works for something completely new :) — for something you have to dig into from scratch! But the more you dig into the !short but sufficient! documentation, the more you discover essentially nothing but pluses for this kernel! For a long time I wondered whether to actually ditch Tran’s pmode 2.51, and after deeper (over a shot:) thought I decided I will do it — why?

  • fully 32-bit code (okay, in Tran’s pmode 2.51 too)
  • bundled mod-player supporting the more well-known cards like Shit Blaster and GUSs (of coz 32-bit)
  • ready-made library for screen handling — reasonably fast
  • what I liked best here is the option to pack data with DIET using the -d flag (compress as data file) and the kernel automatically takes care of allocating memory and decompressing the data back from the linear address returned in eax!
  • debugger (actually I never use debuggers, but this option compared to Tran’s is a big plus)
  • bundled llink32.exe lets you link our packed data into one big .exe — only 44 bytes overhead per file!
  • in the registered version you also get SVGA support (in VESA linear mode), joystick, FLC & FLI animations

At first I thought switching over would take me at least two days — but already after 5 minutes I had phong running, slightly reworked from the one I had on Tran’s kernel… only small things changed: selectors, interrupt calls, etc :) and so for example:

     mov v86r_ax,13h
     mov al,10h
     int 33h

became:

     mov ax,13h
     DosInt 10h

screen addressing

     mov edi,0a0000h
     sub edi,_code32a

became:

     mov edi,[_0A0000h]

Actually the rest stayed the same — there’s nothing to think about — 5 minutes on the new pmode :) then my attempts at taming the music began, which turned out to be incredibly simple:

  • detect the best possible existing card (no, it doesn’t detect the PC speaker:)
     mov ah,Detect_Sound_Card
     xor bx,bx
     mov cx,1
     Int_EOS
  • load a mod into memory:
     mov ah,Load_Module
     mov al,1
     mov bx,44000
     mov edx,o module_name
     Int_EOS
  • and play it
     mov ah,Play_Module
     Int_EOS

I just remembered another convenience, one that bugged me fairly often in that other kernel — namely, the wonderfully developed handling of critical errors! Here for example when a division-by-zero occurs, the kernel takes care of releasing all previously initialized memory, then even drops back to the text mode you were in before the call and prints out a fully informative message! You don’t need to worry about anything, you can just code, code and code…

I won’t write on about this any more, because you could write a whole book on it — I just wanted to make you aware that something like this is already on the scene… I invite to a discussion all those who want to or already use this kernel…

That’s it for today — I’m off to do some coding!

warlock / absence


Dated Jul 1, 1997 and part of E.O.S. 3.05: my code contribution to the framework to provide text displaying capability for live debugging or just displaying information. Code is below:

.386
CODE32 SEGMENT PUBLIC PARA USE32 'CODE'
ASSUME  CS:CODE32,DS:CODE32,ES:CODE32

INCLUDE ..\resource\eos.inc
INCLUDE font.inc

Start32:
	mov ax,13h
	DosInt 10h
	textcolor 15
	writeLn 'WARLOCK''S FONT SYSTEM V1.0 FOR EOS :)'
	textcolor 14
	write 'AND NOW DA NEXT LINE IN YELLOW - WOW !!!'
	writeLn ' - AND DEMONSTRATING: CROSS X MAXIMUM VALUE....'
	textcolor 10
	write 'SEE IN CODE: "abc" = always "ABC" only letters-in-low'
    writeln ' '
	textcolor 11
	write 'i can do GOTOXY, too...see: 10,10'
	gotoxy 10,10
 	textcolor 15
	write 'AND WRITE HEX AL=12H VALUE: '
	textcolor 12
	mov al,12h ;write 12h to screen
	write8h
	gotoxy 0,15
	writeln 'my coordinates :) 0,15'
	textcolor 15
	write 'write hex ax value (for exp.4321h): '
	mov ax,4321h
	write16h
    writeln ' '
	write 'and yellow eax'' value coz my hex phone: '
	textcolor 14
	mov eax,0422011h
	write32h
	gotoxy 10,23
	write 'press ESC'
 EscKey:
	in al,60h
	cmp al,1
	jne EscKey
	mov ax,04c00h
	int 21h

CODE32 ENDS
END

and font.inc file:

gotoXY MACRO amithesonyouvebeenwaitingfor,aty
	mov xfont,amithesonyouvebeenwaitingfor
	mov yfont,aty
ENDM

textColor MACRO jajkonatwardo
	mov fontcolor,jajkonatwardo
ENDM

write MACRO tekknosuxx
 local metalrulez,kamizelka
	jmp metalrulez
	kamizelka db tekknosuxx,'$'
 metalrulez:
	lea edx,kamizelka
	call fooont
ENDM

writeLn MACRO tekknosuxx
 local metalrulez,kamizelka
	jmp metalrulez
	kamizelka db tekknosuxx,'$'
 metalrulez:
	lea edx,kamizelka
	call fooont
	mov xfont,0
	inc yfont
ENDM

writeXY MACRO samael,burzum,tekknosuxx
 local metalrulez,kamizelka
	jmp metalrulez
	kamizelka db tekknosuxx,'$'
 metalrulez:
	mov xfont,samael
	mov yfont,burzum
	lea edx,kamizelka
	call fooont
ENDM
 
write8h MACRO 
	call makeH8table
	lea edx,___vhex
	call fooont
ENDM

write16h MACRO 
	call makeH16table
	lea edx,___vhex
	call fooont
ENDM

write32h MACRO 
	call makeH32table
	lea edx,___vhex
	call fooont
ENDM

makeh32table:
	call misiujoginiemaogona
	mov d [___VHex+4],edx
	rol eax,16
	call misiujoginiemaogona
	mov d [___VHex],edx
ret

makeh16table:
	call misiujoginiemaogona
	mov d [___VHeX],edx
	mov b [___VHex+4],'$'
ret

___Vhex db '########$'
hexTable db '0123456789ABCDEF' 

makeh8table:
	call wodaluksusowa
	mov w [___VHeX],dx
	mov b [___VHex+2],'$'
	ret

misiujoginiemaogona:
	call wodaluksusowa
	rol edx,16
	xchg ah,al
	call wodaluksusowa
	ret

wodaluksusowa:
	movzx ebx,al
	and ebx,1111b
	mov dh,[hexTable+ebx]
	movzx ebx,al
	and ebx,11110000b
	ror ebx,4
	mov dl,[hexTable+ebx]
	ret

xfont dd 0
yfont dd 0
fontcolor db 15
; IN: EDX = OFFSET TO TEXT
fooont:
	mov edi,[_0a0000h]
	mov eax,xfonieodt
	lea eax,[eax*2+eax]
	shl eax,1
	add edi,eax
	mov eax,yfonieodejmowact
	cmp eax,24
	ja endNap ;fatamorgana ;)
	lea eax,[eax*4+eax]
	shl eax,9
	add edi,eax
 font1:
	mov al,[edx]
	inc edx
	cmp al,'$'
	je endNap
	cmp al,97
	jb nieodejmowacbo
	sub al,32
 nieodejmowacbo:
	sub al,32
	movzx eax,al
	shl eax,3
	lea esi,font
	add esi,eax
	mov ebx,8
 lupYfont:
	lodsb
	mov ecx,5
 lupXfont:	
	test al,1
	jz nodrawfont
	mov ah,fontcolor
	mov [edi],ah
 nodrawfont:
	ror al,1
	inc edi
	dec ecx
	jnz lupXfont
	add edi,320-5
	dec ebx
	jnz lupYfont
	inc Xfont
	cmp Xfont,53
	jb okefontxjestdobrykurwa
	mov xfont,0
	inc yfont
	jmp fooont
 okefontxjestdobrykurwa:
	sub edi,320*8-6
	jmp font1
 endNap:
	ret

Font label BYTE
     DB 00,00,00,00,00,00,00,00,12,12,12,12,00,12,00,00,27,27,09,00
     DB 00,00,00,00,10,31,10,31,10,00,00,00,30,05,14,20,15,04,00,00
     DB 19,11,04,26,25,00,00,00,06,11,06,23,11,22,00,00,12,12,06,00
     DB 00,00,00,00,12,06,06,06,12,00,00,00,06,12,12,12,06,00,00,00
     DB 18,12,30,12,18,00,00,00,04,04,31,04,04,00,00,00,12,12,06,00
     DB 00,00,00,00,00,00,30,00,00,00,00,00,00,00,00,12,12,00,00,00
     DB 24,12,06,03,01,00,00,00,14,25,21,19,14,00,00,00,08,12,08,08
     DB 08,00,00,00,15,16,14,01,31,00,00,00,15,16,14,16,15,00,00,00
     DB 12,10,09,31,08,00,00,00,15,01,15,16,15,00,00,00,14,01,15,17
     DB 14,00,00,00,31,16,08,04,04,00,00,00,14,17,14,17,14,00,00,00
     DB 14,17,30,16,14,00,00,00,12,12,00,12,12,00,00,00,12,12,00,12
     DB 08,04,00,00,24,12,06,12,24,00,00,00,00,30,00,30,00,00,00,00
     DB 06,12,24,12,06,00,00,00,14,25,12,12,00,12,00,00,14,17,29,13
     DB 01,30,00,00,14,17,31,17,17,00,00,00,15,17,15,17,15,00,00,00
     DB 30,01,01,01,30,00,00,00,15,17,17,17,15,00,00,00,31,01,15,01
     DB 31,00,00,00,31,01,15,01,01,00,00,00,30,01,25,17,30,00,00,00
     DB 17,17,31,17,17,00,00,00,14,04,04,04,14,00,00,00,16,16,16,17
     DB 14,00,00,00,18,10,06,10,18,00,00,00,02,02,02,02,30,00,00,00
     DB 17,27,21,17,17,00,00,00,17,19,21,25,17,00,00,00,14,17,17,17
     DB 14,00,00,00,15,17,15,01,01,00,00,00,14,17,17,17,14,24,00,00
     DB 15,17,15,05,25,00,00,00,30,01,14,16,15,00,00,00,31,04,04,04
     DB 04,00,00,00,17,17,17,17,30,00,00,00,17,17,17,10,04,00,00,00
     DB 17,17,21,27,17,00,00,00,17,10,04,10,17,00,00,00,17,17,10,04
     DB 04,00,00,00,31,08,04,02,31,00,00,00



Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • EPICentre at UNSW
  • My Demoscene
  • Restoring the Amiga 1200 to Like-New Condition
  • How to Build a Research Proposal
  • Economy of Scale, Crowdsourcing and Moral Dilemmas