Prev: A38A Up: Map Next: A3FB
A3B8: open up a space in the memory, set the end of arrays
Used by the routines at A49C and B08B.
A3B8 20 08 A4 JSR $A408 check available memory, do out of memory error if no room
A3BB 85 31 STA $31 set end of arrays low byte
A3BD 84 32 STY $32 set end of arrays high byte
This entry point is used by the routine at B526.
open up a space in the memory, don't set the array end
A3BF 38 SEC set carry for subtract
A3C0 A5 5A LDA $5A get block end low byte
A3C2 E5 5F SBC $5F subtract block start low byte
A3C4 85 22 STA $22 save MOD(block length/$100) byte
A3C6 A8 TAY copy MOD(block length/$100) byte to Y
A3C7 A5 5B LDA $5B get block end high byte
A3C9 E5 60 SBC $60 subtract block start high byte
A3CB AA TAX copy block length high byte to X
A3CC E8 INX +1 to allow for count=0 exit
A3CD 98 TYA copy block length low byte to A
A3CE F0 23 BEQ $A3F3 branch if length low byte=0
block is (X-1)*256+Y bytes, do the Y bytes first
A3D0 A5 5A LDA $5A get block end low byte
A3D2 38 SEC set carry for subtract
A3D3 E5 22 SBC $22 subtract MOD(block length/$100) byte
A3D5 85 5A STA $5A save corrected old block end low byte
A3D7 B0 03 BCS $A3DC branch if no underflow
A3D9 C6 5B DEC $5B else decrement block end high byte
A3DB 38 SEC set carry for subtract
A3DC A5 58 LDA $58 get destination end low byte
A3DE E5 22 SBC $22 subtract MOD(block length/$100) byte
A3E0 85 58 STA $58 save modified new block end low byte
A3E2 B0 08 BCS $A3EC branch if no underflow
A3E4 C6 59 DEC $59 else decrement block end high byte
A3E6 90 04 BCC $A3EC branch always
A3E8 B1 5A LDA ($5A),Y get byte from source
A3EA 91 58 STA ($58),Y copy byte to destination
A3EC 88 DEY decrement index
A3ED D0 F9 BNE $A3E8 loop until Y=0
now do Y=0 indexed byte
A3EF B1 5A LDA ($5A),Y get byte from source
A3F1 91 58 STA ($58),Y save byte to destination
A3F3 C6 5B DEC $5B decrement source pointer high byte
A3F5 C6 59 DEC $59 decrement destination pointer high byte
A3F7 CA DEX decrement block count
A3F8 D0 F2 BNE $A3EC loop until count = $0
A3FA 60 RTS
Prev: A38A Up: Map Next: A3FB