stack_machine.git
4 years agoUnroll slightly to avoid an inner loop jump to loop end on zero crossing master
Nick Downing [Tue, 25 Jun 2019 11:43:29 +0000 (21:43 +1000)]
Unroll slightly to avoid an inner loop jump to loop end on zero crossing

4 years agoImplement hi bit set divisor for long division, fix long negative dividend bug
Nick Downing [Tue, 25 Jun 2019 11:38:42 +0000 (21:38 +1000)]
Implement hi bit set divisor for long division, fix long negative dividend bug

4 years agoFix hi bit set divisor issue for word division
Nick Downing [Tue, 25 Jun 2019 11:12:47 +0000 (21:12 +1000)]
Fix hi bit set divisor issue for word division

4 years agoTemporarily de-optimize the inner divide routine as must add another branch
Nick Downing [Tue, 25 Jun 2019 11:05:55 +0000 (21:05 +1000)]
Temporarily de-optimize the inner divide routine as must add another branch

4 years agoAdd division test, fix multiply bug, still a bug on hi bit set unsigned divisor
Nick Downing [Tue, 25 Jun 2019 10:34:18 +0000 (20:34 +1000)]
Add division test, fix multiply bug, still a bug on hi bit set unsigned divisor

4 years agoImplement signed 16x16 to 32 bit multiplication
Nick Downing [Mon, 24 Jun 2019 11:34:38 +0000 (21:34 +1000)]
Implement signed 16x16 to 32 bit multiplication

4 years agoCorrect unsigned 16x16 to 32 bit multiply, need to add corrections for signed version
Nick Downing [Mon, 24 Jun 2019 05:08:20 +0000 (15:08 +1000)]
Correct unsigned 16x16 to 32 bit multiply, need to add corrections for signed version

4 years agoChange long division to use bc register and to do 64 by 32 bit division
Nick Downing [Sat, 22 Jun 2019 03:45:44 +0000 (13:45 +1000)]
Change long division to use bc register and to do 64 by 32 bit division

4 years agoChange word division to use bc register and to do 32 by 16 bit division
Nick Downing [Sat, 22 Jun 2019 02:54:46 +0000 (12:54 +1000)]
Change word division to use bc register and to do 32 by 16 bit division

4 years agoMake word and long multiplication use bc register
Nick Downing [Sat, 22 Jun 2019 02:16:29 +0000 (12:16 +1000)]
Make word and long multiplication use bc register

4 years agoFor longs swap alternate register usage so that low word is in main registers
Nick Downing [Sat, 22 Jun 2019 02:07:11 +0000 (12:07 +1000)]
For longs swap alternate register usage so that low word is in main registers

4 years agoRemove rst 0x30, sometimes inline code, sometimes moving it to prefix a routine
Nick Downing [Fri, 21 Jun 2019 14:28:12 +0000 (00:28 +1000)]
Remove rst 0x30, sometimes inline code, sometimes moving it to prefix a routine

4 years agoChange call to jmp and ret to dispatcher for the shorter math subroutines
Nick Downing [Fri, 21 Jun 2019 12:59:51 +0000 (22:59 +1000)]
Change call to jmp and ret to dispatcher for the shorter math subroutines

4 years agoGet longs working, add a second 10-digit printout that can print up to 12!
Nick Downing [Thu, 20 Jun 2019 08:39:22 +0000 (18:39 +1000)]
Get longs working, add a second 10-digit printout that can print up to 12!

4 years agoFix the result storage and dispatching after long add, mul and div
Nick Downing [Wed, 19 Jun 2019 07:18:40 +0000 (17:18 +1000)]
Fix the result storage and dispatching after long add, mul and div

4 years agoFix all relative jumps to be in range, debug multiply and divide calling stuff
Nick Downing [Wed, 19 Jun 2019 00:50:55 +0000 (10:50 +1000)]
Fix all relative jumps to be in range, debug multiply and divide calling stuff

4 years agoRevamp register usage in math package for shifts, multiplies and divides to remove...
Nick Downing [Tue, 18 Jun 2019 14:23:09 +0000 (00:23 +1000)]
Revamp register usage in math package for shifts, multiplies and divides to remove redundant register swappage and reduce the number of routines to be provided, implement long divide, need to update interpreter pages for new conventions

4 years agoFirst cut at page 2 for long maths, makes everything too large
Nick Downing [Tue, 18 Jun 2019 11:27:21 +0000 (21:27 +1000)]
First cut at page 2 for long maths, makes everything too large

4 years agoRevert sm2.asm to commit 557827e, reimplement in sm3.asm with a less optimal approach...
Nick Downing [Tue, 18 Jun 2019 08:22:37 +0000 (18:22 +1000)]
Revert sm2.asm to commit 557827e, reimplement in sm3.asm with a less optimal approach with better separation between stack machine and math package, includes a first cut at the long math package but not the long page or long division yet

4 years agoImplement first part of page2 (redirections to page0 for load/store operations)
Nick Downing [Mon, 17 Jun 2019 00:23:17 +0000 (10:23 +1000)]
Implement first part of page2 (redirections to page0 for load/store operations)

4 years agoInfrastructure for long math using a new page 2, fills up page 0, no page 2 yet
Nick Downing [Sun, 16 Jun 2019 13:40:12 +0000 (23:40 +1000)]
Infrastructure for long math using a new page 2, fills up page 0, no page 2 yet

4 years agoRemove unused stack addressing modes
Nick Downing [Sun, 16 Jun 2019 12:52:55 +0000 (22:52 +1000)]
Remove unused stack addressing modes

4 years agoImplement new calling convention with automatic C-style stack cleanup
Nick Downing [Sun, 16 Jun 2019 11:34:43 +0000 (21:34 +1000)]
Implement new calling convention with automatic C-style stack cleanup

4 years agoSave space and implement page1_imm_call, page1_call, page0_ret (not used yet)
Nick Downing [Sun, 16 Jun 2019 11:29:10 +0000 (21:29 +1000)]
Save space and implement page1_imm_call, page1_call, page0_ret (not used yet)

4 years agoAdd imm_xchg_w and xchg_w commands, change XXXrev to xchg_XXX, tidy up slightly
Nick Downing [Sun, 16 Jun 2019 11:08:35 +0000 (21:08 +1000)]
Add imm_xchg_w and xchg_w commands, change XXXrev to xchg_XXX, tidy up slightly

4 years agoWorking factorial program with the new stack machine
Nick Downing [Sun, 16 Jun 2019 10:55:31 +0000 (20:55 +1000)]
Working factorial program with the new stack machine

4 years agoFirst cut at more efficient smodal stack machine using several interpreter pages
Nick Downing [Sun, 16 Jun 2019 06:20:13 +0000 (16:20 +1000)]
First cut at more efficient smodal stack machine using several interpreter pages

4 years agoAdd CORDIC demo code from Peter Knoppers (DDJ article)
Nick Downing [Thu, 13 Jun 2019 16:32:49 +0000 (02:32 +1000)]
Add CORDIC demo code from Peter Knoppers (DDJ article)

4 years agoUnroll the multiply, reinstate the state machine test code
Nick Downing [Thu, 13 Jun 2019 16:24:33 +0000 (02:24 +1000)]
Unroll the multiply, reinstate the state machine test code

4 years agoMinor optimization due to unrolled loop not using b anymore
Nick Downing [Thu, 13 Jun 2019 16:12:01 +0000 (02:12 +1000)]
Minor optimization due to unrolled loop not using b anymore

4 years agoUnroll 8 bits division inner loop (2 versions, 4 entry points for 4 quadrants)
Nick Downing [Thu, 13 Jun 2019 16:07:13 +0000 (02:07 +1000)]
Unroll 8 bits division inner loop (2 versions, 4 entry points for 4 quadrants)

4 years agoOptimize layout of division code
Nick Downing [Thu, 13 Jun 2019 15:47:15 +0000 (01:47 +1000)]
Optimize layout of division code

4 years agoFix bugs, working signed division
Nick Downing [Thu, 13 Jun 2019 15:36:13 +0000 (01:36 +1000)]
Fix bugs, working signed division

4 years agoFirst cut at the full signed division with separate code for each quadrant, some...
Nick Downing [Thu, 13 Jun 2019 14:22:25 +0000 (00:22 +1000)]
First cut at the full signed division with separate code for each quadrant, some quadrants do not work yet, an issue is needing to clear cf before sbc hl,de

4 years agoFurther minor optimizations
Nick Downing [Thu, 13 Jun 2019 12:36:10 +0000 (22:36 +1000)]
Further minor optimizations

4 years agoMake division routine only do inc/dec on zero crossing, and other improvements
Nick Downing [Thu, 13 Jun 2019 12:09:08 +0000 (22:09 +1000)]
Make division routine only do inc/dec on zero crossing, and other improvements

4 years agoNew non-restoring division routine, sub-optimal but justified to always work
Nick Downing [Wed, 12 Jun 2019 12:39:26 +0000 (22:39 +1000)]
New non-restoring division routine, sub-optimal but justified to always work

4 years agoImprove loops and fallthru
Nick Downing [Mon, 10 Jun 2019 11:09:51 +0000 (21:09 +1000)]
Improve loops and fallthru

4 years agoImproved way that uses cf to do most of the adjustment needed for zero crossing
Nick Downing [Mon, 10 Jun 2019 10:05:44 +0000 (20:05 +1000)]
Improved way that uses cf to do most of the adjustment needed for zero crossing

4 years agoFirst cut at non-restoring division
Nick Downing [Mon, 10 Jun 2019 09:59:47 +0000 (19:59 +1000)]
First cut at non-restoring division

4 years agoAdd decimal factorial result printing using the division routines
Nick Downing [Mon, 10 Jun 2019 04:02:50 +0000 (14:02 +1000)]
Add decimal factorial result printing using the division routines

4 years agoImprove trace, add unsigned division
Nick Downing [Mon, 10 Jun 2019 03:47:46 +0000 (13:47 +1000)]
Improve trace, add unsigned division

4 years agoOptimize lower dispatcher used for control transfers, that takes pc in hl
Nick Downing [Mon, 10 Jun 2019 00:34:14 +0000 (10:34 +1000)]
Optimize lower dispatcher used for control transfers, that takes pc in hl

4 years agoOptimize rst 8 routine, ld hl,(bc)+
Nick Downing [Mon, 10 Jun 2019 00:27:03 +0000 (10:27 +1000)]
Optimize rst 8 routine, ld hl,(bc)+

4 years agoExchange roles of bc and de, adjust interface to math package which doesn't use excha...
Nick Downing [Mon, 10 Jun 2019 00:18:50 +0000 (10:18 +1000)]
Exchange roles of bc and de, adjust interface to math package which doesn't use exchanged bc and de, move some routines around to allow for slightly larger math opcodes, fix a bug which caused return to BDOS not to work

4 years agoInitial commit, can calculate a factorial recursively with C calling convetion
Nick Downing [Sun, 9 Jun 2019 23:28:05 +0000 (09:28 +1000)]
Initial commit, can calculate a factorial recursively with C calling convetion