A new modular version of the Open81 assembly file is now available

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
aowen

A new modular version of the Open81 assembly file is now available

Post by aowen »

https://github.com/cheveron/open81

This generates the standard version 2 ROM. I've created a static branch for that version in case anyone wants to create pull requests for merging into the master branch.
McKlaud
Posts: 337
Joined: Tue Dec 19, 2017 10:02 pm
Location: St Albans, UK

Re: A new modular version of the Open81 assembly file is now available

Post by McKlaud »

Good job and thanks for sharing :)
Claudius
----------
aowen

Re: A new modular version of the Open81 assembly file is now available

Post by aowen »

McKlaud wrote: Wed Jun 10, 2020 11:33 am Good job and thanks for sharing :)
You're welcome! I'm currently back-porting some of the improvements and comments from SE Basic IV (which is based on the ZX81 ROM). I'm aware of the ZX81X2 project and I'm hoping to include some of those improvements, although the square root function in SE Basic IV is shorter and faster (it's from the SAM Coupe ROM by Andy Wright).
aowen

Re: A new modular version of the Open81 assembly file is now available

Post by aowen »

I've been through the code and I've now created version 2.5. This retains all the entry points prior to calculate. It's roughly equivalent to sg81.rom but it fixes an additional bug in division (1/4<>0.25) and includes the super-fast square root and faster stack pointers routines from SE Basic IV. There are now 19 spare bytes before the font. More details in the changelog.
User avatar
zsolt
Posts: 214
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: A new modular version of the Open81 assembly file is now available

Post by zsolt »

Hi,
This implementation of the Babylonian (or Heron's) square root method is very cool. 8-)
I built a new variant of the X2 ROM with it, and the test results are fantastic: this is ~2x :!: faster than the Newton-Raphson iteration in the latest "BigBang" ROM.
Thank you for sharing. :D

About the "stack pointers" routine - i have a shorter/faster one:

Code: Select all

;
; ---------------------------------------
; THE original 'STACK POINTERS' ROUTINE (10B/72Ts)
; ---------------------------------------
;   Register DE is set to STKEND and HL, the result pointer, is set to five
;   locations below this - the 'last value'.
;   This routine is used when it is inconvenient to save these values at the
;   time the calculator stack is manipulated due to other activity on the
;   machine stack.
;   This routine is also used to terminate the VAL routine for
;   the same reason and to initialize the calculator stack at the start of
;   the CALCULATE routine.
;
;; STK-PNTRS
L1B85:  LD      HL,($401C)      ; fetch STKEND value from system variable.
        LD      DE,$FFFB        ; the value -5
        PUSH    HL              ; push STKEND value.

        ADD     HL,DE           ; subtract 5 from HL.

        POP     DE              ; pop STKEND to DE.
        RET                     ; return.

;
; ---------------------------------------------
; THE 'STK_PNTRS' SUBROUTINE from open81 v2.5 (11B/68Ts)
; ---------------------------------------------

stk_pntrs:

	ld hl,(stkend)		; stack end to HL

stk_pntrs_2:

	ld e,l			; DE points to second
	ld d,h			; operand
	dec hl			; make
	dec hl			; HL
	dec hl			; point
	dec hl			; to first
	dec hl			; operand

	ret			; end of subroutine
;
; ----------------------------------
; THE new 'STACK POINTERS' ROUTINE (9B/55Ts)
; ----------------------------------
;
STK_PNTRS
	LD HL,($401C)		; fetch STKEND value from system variable.

stk_pntrs_2:

	ex de,hl		; switch pointers: DE = STKEND
	ld hl,$FFFB		; the value -5

	ADD HL,DE		; HL = STKEND - 5
	ret 			; return.
Both routines will be included in the next X2 ROM variant (coming soon). ;)
Thanks again,
Zsolt
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: A new modular version of the Open81 assembly file is now available

Post by Moggy »

kiváló!

My EPROM burner is ready!
Post Reply