| Routines

61838: Cycle a character buffer group forwards and scroll the screen right 8 columns

Used by the routines at 30822 and 60539. Cycles one of the character buffer groups in pages 215-221 forwards depending on the current leftmost column of the play area that is on screen (X=(32766)):
X | Character buffer group
--- | ---
8, 64, 120, 176 | 215
16, 72, 128, 184 | 216
24, 80, 136, 192 | 217
32, 88, 144, 200 | 218
40, 96, 152, 208 | 219
48, 104, 160, 216 | 220
56, 112, 168, 224 | 221
61838 | LD A,(32766) | 32766 holds X, the x-coordinate of the leftmost column of the play area on screen
61841 | SUB 8 | A=0, 8, 16, 24, 32, 40 or 48 (depending on the value of X)
61843 | SUB 56
61845 | JR NC,61843
61847 | ADD A,56
61849 | RRCA | A=215-221
61850 | RRCA
61851 | RRCA
61852 | ADD A,215
61854 | LD H,A | Point HL at the last byte of the last buffer in the group
61855 | LD L,124
61857 | LD DE,32632 | Copy the last buffer in the group (buffer 5) to 32608 temporarily
61860 | LD BC,25
61863 | LDDR
61865 | LD E,124 | Point DE at the last byte of the last buffer in the group
61867 | LD D,H
61868 | LD C,100 | Move buffers 1-4 up into slots 2-5 (thus overwriting buffer 5)
61870 | LDDR
61872 | LD HL,32632 | Copy buffer 5 from its temporary storage location into slot 1
61875 | LD C,25
61877 | LDDR
61879 | JP 59461 | Scroll the screen right 8 columns (the routine at 30822 replaces this instruction with a RET)