SymbOS MSX multitasking operating system - help needed!

Page 327/396
320 | 321 | 322 | 323 | 324 | 325 | 326 | | 328 | 329 | 330 | 331 | 332

By Grauw

Ascended (10180)

Grauw's picture

05-06-2014, 17:57

110 seconds in MSX basic (openMSX, emulated Philips NMS8245)

7.65 seconds in Basic-kun (openMSX, emulated Sanyo 70FD)

A goto-based version without for loop took 222 seconds in MSX basic and 7.5 seconds in Basic-kun.

By Trebmint2

Master (242)

Trebmint2's picture

05-06-2014, 18:07

Ok I've optomised the INC & DEC +1 -1 for special states now, so its a little quicker.

Wow, so nearly x100 times quicker than MSXBasic Smile I'm pleased with that. Basic Kun seems to be pretty quick though. Im struggling to see if I can get it quicker though

By PingPong

Prophet (3793)

PingPong's picture

05-06-2014, 21:25

Prodatron]
Trebmint2
wrote:

[code wrote:

1,3 seconds is crazy, as even a quite optimized pure-assembler version of this still takes more than 0,5 seconds!
I really wonder how long this would take in MSX-Basic?

an age.....

By Grauw

Ascended (10180)

Grauw's picture

06-06-2014, 13:51

Poltergeist wrote:
10 f=0
20 if f>9 then 40 else for rew=0 to 1999:if rew=390 then f=f+1
30 next rew:goto 20
40 end

Ah, there’s an important optimisation we forgot:

1 DEFINT A-Z

Otherwise all variable math is done in double precision in MSX Basic, and 4.5-precision in Basic-kun. Running the test again with this:

69 seconds in MSX Basic
1.23 seconds in Basic-kun

Also replacing NEXT REW by just NEXT reduces the MSX Basic running time to 60 seconds.

By Prodatron

Paragon (1801)

Prodatron's picture

06-06-2014, 15:00

This example takes 39 seconds in Amstrad CPC Basic (Locomotive).
I wonder if this way of for/if/next would be faster in SymBasic, too?

By Trebmint2

Master (242)

Trebmint2's picture

06-06-2014, 15:59

Wow, its would appear basic Kun is exceptionally good. I have a feeling the code produced is byte for byte identical. Is it possible to do a dissassembly of the compiled Basic Kun code Grauw??

By NYYRIKKI

Enlighted (5889)

NYYRIKKI's picture

06-06-2014, 16:30

1 DEFINT A-Z
10 f=0
20 if f>9 then 40 else for rew=0 to 1999:if rew=390 then f=f+1
30 next rew:goto 20
40 end

X-BASIC (aka BASIC kun) code output:

;805EH-80C0H
	LD	HL,0000H
	LD	(X80C2H),HL
X8064H:	LD	HL,(X80C2H)
	LD	DE,0009H
	EX	DE,HL
	LD	A,H
	XOR	80H
	LD	H,A
	LD	A,D
	XOR	80H
	LD	D,A
	SBC	HL,DE
	SBC	HL,HL
	LD	A,L
	OR	H
	JP	Z,X8082H
	JP	X80BAH
	JP	X80A3H
X8082H:	LD	HL,0000H
	LD	(X80C0H),HL
X8088H:	LD	HL,(X80C0H)
	LD	DE,0186H
	AND	A
	SBC	HL,DE
	LD	HL,0FFFFH
	JR	Z,X8097H
	INC	HL
X8097H:	LD	A,L
	OR	H
	JP	Z,X80A3H
	LD	HL,(X80C2H)
	INC	HL
	LD	(X80C2H),HL
X80A3H:	LD	HL,(X80C0H)
	INC	HL
	LD	(X80C0H),HL
	LD	A,H
	XOR	80H
	LD	H,A
	EX	DE,HL
	LD	HL,87CFH
	SBC	HL,DE
	JP	NC,X8088H
	JP	X8064H
X80BAH:	JP	4DFAH
	JP	4DFAH
X80C0H:	DW      0
X80C2H:	DW      0

By edoz

Prophet (2400)

edoz's picture

06-06-2014, 16:37

Cool to see all those differents between basic versions ! .. It's cool that Symbasic is a compiled basic Big smile Like VB.NET Big smile and to have it on the MSX!

By NYYRIKKI

Enlighted (5889)

NYYRIKKI's picture

06-06-2014, 17:09

I think this would be more close to your original code (1.64 SEC)

10 DEFINT A-Z
20 F=0
30 IF F<10 THEN REW=0 ELSE END
40 IFREW<2000 THEN REW=REW+1:IFREW=390THENF=F+1:GOTO 40 ELSE 40
70 GOTO 30

X-BASIC (aka BASIC kun) code output:

;807BH-80ECH
	LD	HL,0000H
	LD	(X80EEH),HL
X8081H:	LD	HL,(X80EEH)
	LD	DE,000AH
	LD	A,H
	XOR	80H
	LD	H,A
	LD	A,D
	XOR	80H
	LD	D,A
	SBC	HL,DE
	SBC	HL,HL
	LD	A,L
	OR	H
	JP	Z,X80A1H
	LD	HL,0000H
	LD	(X80ECH),HL
	JP	X80A4H
X80A1H:	JP	4DFAH
X80A4H:	LD	HL,(X80ECH)
	LD	DE,07D0H
	LD	A,H
	XOR	80H
	LD	H,A
	LD	A,D
	XOR	80H
	LD	D,A
	SBC	HL,DE
	SBC	HL,HL
	LD	A,L
	OR	H
	JP	Z,X80E6H
	LD	HL,(X80ECH)
	INC	HL
	LD	(X80ECH),HL
	LD	HL,(X80ECH)
	LD	DE,0186H
	AND	A
	SBC	HL,DE
	LD	HL,0FFFFH
	JR	Z,X80D1H
	INC	HL
X80D1H:	LD	A,L
	OR	H
	JP	Z,X80E3H
	LD	HL,(X80EEH)
	INC	HL
	LD	(X80EEH),HL
	JP	X80A4H
	JP	X80E6H
X80E3H:	JP	X80A4H
X80E6H:	JP	X8081H
	JP	4DFAH
X80ECH:	DW      0
X80EEH: DW      0

By Trebmint2

Master (242)

Trebmint2's picture

06-06-2014, 17:31

Cheers. Wow Basic Kun is very impressive considering its compiled on the MSX. This output gives me something to study and try and better... cool stuff

Page 327/396
320 | 321 | 322 | 323 | 324 | 325 | 326 | | 328 | 329 | 330 | 331 | 332