Skip to content

Commit

Permalink
Added frotz-like debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
johanberntsson committed May 27, 2018
1 parent 6fded90 commit 27271ba
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 8 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ X64 := /usr/bin/x64 -warp -autostart-delay-random

#all: dejavu
#all: dragon
all: minform
#all: testz3
#all: testz5
#all: minform
#all: czechz3
#all: czechz5
#all: strictz3
all: strictz5

d64.czechz3:
acme -DZ3=1 $(DEBUGFLAGS) $(VMFLAGS) --cpu 6510 --format cbm -l acme_labels.txt --outfile ozmoo ozmoo.asm
Expand Down
54 changes: 52 additions & 2 deletions objecttable.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
;TRACE_OBJ = 1 ; trace remove_obj, jin, insert_obj
;TRACE_ATTR = 1 ; trace find_attr, set_attr, clear_attr
;TRACE_PROP = 1 ; trace get_prop_len, get_next_prop
;TRACE_FROTZ = 1 ; give Frotz-style messages

; globals
num_default_properties !byte 0
Expand All @@ -25,6 +26,14 @@ z_ins_get_sibling

z_ins_get_child
; get_child object -> (result) ?(label)
!ifdef TRACE_FROTZ {
jsr print_following_string
!pet "@get_child ",0
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
jsr print_obj
jsr newline
}
!ifdef TRACE_TREE {
jsr print_following_string
!pet "get_child obj: ",0
Expand Down Expand Up @@ -78,6 +87,14 @@ z_ins_get_child

z_ins_get_parent
; get_parent object -> (result)
!ifdef TRACE_FROTZ {
jsr print_following_string
!pet "@get_parent ",0
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
jsr print_obj
jsr newline
}
!ifdef TRACE_TREE {
jsr print_following_string
!pet "get_parent obj: ",0
Expand Down Expand Up @@ -501,6 +518,17 @@ z_ins_jin

z_ins_test_attr
; test_attr object attribute ?(label)
!ifdef TRACE_FROTZ {
jsr print_following_string
!pet "@test_attr ",0
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
jsr print_obj
jsr space
ldx z_operand_value_low_arr + 1
jsr printx
jsr newline
}
!ifdef TRACE_ATTR {
jsr print_following_string
!pet "test_attr obj attr: ",0
Expand Down Expand Up @@ -529,6 +557,17 @@ z_ins_test_attr
z_ins_set_attr
; set_attr object attribute
jsr find_attr
!ifdef TRACE_FROTZ {
jsr print_following_string
!pet "@set_attr ", 0
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
jsr print_obj
jsr space
ldx z_operand_value_low_arr + 1
jsr printx
jsr newline
}
!ifdef TRACE_ATTR {
jsr print_following_string
!pet "set_attr object attr: ", 0
Expand All @@ -548,7 +587,7 @@ z_ins_set_attr
; don't continue if object = 0
ldx z_operand_value_low_arr
bne .do_set_attr
ldx z_operand_value_low_arr + 1
ldx z_operand_value_high_arr
bne .do_set_attr
!ifdef TRACE_ATTR {
jsr newline
Expand Down Expand Up @@ -577,6 +616,17 @@ z_ins_set_attr
z_ins_clear_attr
; clear_attr object attribute
jsr find_attr
!ifdef TRACE_FROTZ {
jsr print_following_string
!pet "@clear_attr object ", 0
ldx z_operand_value_low_arr
lda z_operand_value_high_arr
jsr print_obj
jsr space
ldx z_operand_value_low_arr + 1
jsr printx
jsr newline
}
!ifdef TRACE_ATTR {
jsr print_following_string
!pet "clear_attr object attr: ", 0
Expand All @@ -596,7 +646,7 @@ z_ins_clear_attr
; don't continue if object = 0
ldx z_operand_value_low_arr
bne .do_clear_attr
ldx z_operand_value_low_arr + 1
ldx z_operand_value_high_arr
bne .do_clear_attr
!ifdef TRACE_ATTR {
jsr newline
Expand Down
2 changes: 1 addition & 1 deletion screen.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ printchar
bne .printchar_exit
inc .num_rows
lda .num_rows
cmp #14
cmp #12 ; zp_screencolumn can be 1-2 rows on the screen, so assume the worst
bcc .printchar_exit
jsr clear_num_rows
ldx #0
Expand Down
6 changes: 4 additions & 2 deletions text.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
;TRACE_READTEXT = 1
;TRACE_TOKENISE = 1
;TRACE_SHOW_DICT_ENTRIES = 1
;TRACE_PRINT_ARRAYS = 1

z_ins_print_addr
ldx z_operand_value_low_arr
Expand Down Expand Up @@ -180,7 +181,7 @@ z_ins_aread
}
.aread_done
; debug - print parsearray
!ifdef DEBUG {
!ifdef TRACE_PRINT_ARRAYS {
ldy #0
- lda (string_array),y
tax
Expand Down Expand Up @@ -605,11 +606,12 @@ read_text
; output: string_array
; side effects: zp_screencolumn, zp_screenline, .read_text_jiffy
; used registers: a,x,y
jsr clear_num_rows ; clear [More] counter
stx string_array
clc
adc #>story_start
sta string_array + 1
; clear [More] counter
jsr clear_num_rows
; check timer usage
lda .read_text_time
sta .read_text_time_jiffy
Expand Down

0 comments on commit 27271ba

Please sign in to comment.