Skip to content

Commit

Permalink
Optimisation to avoid searching vmap in vmem when accessing same page…
Browse files Browse the repository at this point in the history
… again
  • Loading branch information
johanberntsson committed Jun 14, 2018
1 parent d4e0979 commit a70fd2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEBUGFLAGS = -DDEBUG=1
#DEBUGFLAGS = -DDEBUG=1
VMFLAGS = -DUSEVM=1
C1541 := /usr/bin/c1541
#X64 := /usr/bin/x64 -autostart-delay-random
Expand Down
14 changes: 13 additions & 1 deletion vmem.asm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ vmap_c64 = vmap_z_l + vmap_max_length
vmap_index !byte 0 ; current vmap index matching the z pointer
vmem_buffer_index !byte 0 ; buffer currently contains this vmap index

current_zp

!ifdef DEBUG {
!ifdef TRACE_VM {
Expand Down Expand Up @@ -235,6 +236,9 @@ prepare_static_high_memory
bne -
lda #$00
sta vmem_buffer_index
lda #$ff
sta zp_pc_h
sta zp_pc_l
!ifdef TRACE_VM {
;jsr print_vm_map
}
Expand All @@ -245,9 +249,17 @@ read_byte_at_z_address
; Subroutine: Read the contents of a byte address in the Z-machine
; a,x,y (high, mid, low) contains address.
; Returns: value in a
sty mempointer ; low byte unchanged
; same page as before?
cmp zp_pc_h
bne .read_new_byte
cpx zp_pc_l
bne .read_new_byte
; same 256 byte segment, just return
jmp .return_result
.read_new_byte
sta zp_pc_h
stx zp_pc_l
sty mempointer ; low byte unchanged
!ifdef TRACE_VM_PC {
lda zp_pc_l
cmp #$10
Expand Down

0 comments on commit a70fd2b

Please sign in to comment.