Spider Posted September 23, 2022 Report Share Posted September 23, 2022 As the original JSW (and MM) both keep some data in lower memory (contended memory to be exact) such as the attribute and screen buffer data, assuming one relocated this to uncontended memory, that being > 32768 would there be any noticeable speed increase in the game itself ? I'm only basing this on the assumption that contended memory might be slower, although with interrupts disabled I'm not sure. Sorry. I suspect any increase would not be noted, I do realise that the change to LDI vs LDIR would and does offer a bit of a boost though. Quote Link to comment Share on other sites More sharing options...
Norman Sword Posted September 23, 2022 Report Share Posted September 23, 2022 (edited) Contended memory stretches timing cycles. It has a big impact. Note this code is designed to waste time - it rotates a block of memory and then copies the block of memory to the screen. Most of the work is done by the rotate part, but be aware that if it is displayed on the screen then a large chunk of the routine that is moving data into contended memory is being hampered by the contended memory problem. The routine starts by changing the border colour (at the top of the video screen) and when finished changes the border again (bottom of the screen). On my pc the border colour change is aligned with the bottom of the screen for both parts. The routine running in contended memory, loops and rotates 625 bytes. (border BLUE - ends when the border turns RED) The 2nd routine running in uncontended memory, loops and rotates 625+88=713 bytes E.G it loops 713 times (Border MAGENTA, ends on GREEN) The timing of both routines is near enough exactly the same. Yet one has managed 625 loops and the other 713 loops. The difference is very measuarable. org #7fA0 amount equ 625 high_amount equ 625+88 low_s equ #7000 high_s equ #9000 start: LD HL,#4000 LD (HL),0 LD DE,#4001 LD BC,192*32 ldir ld bc,24*32-1 ld (hl),7 LDIR ld sp,#ffff part1 ld hl,low_s ld bc,amount ld a,1 call init loopy push bc halt ld a,1 out (254),a ;<<<< set the border BLUE ld bc,amount ld hl,low_s push hl push bc loop rlc (hl) inc hl dec bc ld a,b or c jr nz,loop pop bc ld de,#4000 pop hl ldir ld a,2 out (254),a ; Set the border RED pop bc djnz loopy jp part2 init ld e,l ld d,h inc de ld (hl),a ldir ret org #8000 part2: ld hl,high_s ld bc,high_amount ld a,254 call init high_loopy: push bc halt ld a,3 out (254),a ; set the border MAGENTA ld bc,high_amount ld hl,high_s push hl push bc high_loop: rlc (hl) inc hl dec bc ld a,b or c jr nz,high_loop pop bc ld de,#4000 pop hl ldir ld a,4 out (254),a ; set the border GREEN pop bc djnz high_loopy jp part1 end start Contended memory the upper border is BLUE, when the routine finishes it turns RED Uncontended memory the upper border is MAGENTA when the routine finishes the border turns GREEN The 2nd file - sets the loop counter to be the same (in contended and uncontended) (e.g. it loops 625 times in contended and loops 625 times in uncontended) , the amount of time saved is shown by the movement of the border change. CONTEN~1.tap Contend_same amount.tap Edited September 26, 2022 by Norman Sword Spider and jetsetdanny 1 1 Quote Link to comment Share on other sites More sharing options...
Spider Posted September 25, 2022 Author Report Share Posted September 25, 2022 Thank you for the detailed explanation and the attached examples, allowing it to be seen "in action" as such. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.