Skip to content

Commit

Permalink
Fixed bug in translate_zscii_to_petscii causing y register to change …
Browse files Browse the repository at this point in the history
…value when character is not legal. Minor optimizations.
  • Loading branch information
fredrikramsberg committed Mar 4, 2020
1 parent 7595d88 commit 636f2b3
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 41 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Written by Johan Berntsson and Fredrik Ramsberg in 2018

## Status

Update 2020-03-04: Release 3 is here. Many bugfixes. Darkmode and splash screen added. Support for four new languages.

Update 2019-06-04: We have created a new release, with several new features, many bugfixes, better docs and other improvements.

Update 2018-12-27: We now consider Ozmoo ready for production use. A few minor features are missing, like output to printer and the ability to save and restore arbitrary parts of memory, and chances are they won't be added.
Expand Down
2 changes: 1 addition & 1 deletion asm/ozmoo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ z_init
!ifdef Z4PLUS {
lda #8
sta story_start + header_interpreter_number ; Interpreter number (8 = C64)
lda #66 ; "B" = release 2
lda #67 ; "C" = release 3
sta story_start + header_interpreter_version ; Interpreter version. Usually ASCII code for a capital letter
lda #25
sta story_start + header_screen_height_lines
Expand Down
3 changes: 2 additions & 1 deletion asm/screen.asm
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ z_ins_print_table
ldy .pt_width
- jsr read_next_byte
jsr translate_zscii_to_petscii
bcs + ; Illegal char
jsr printchar_buffered
dey
+ dey
bne -
rts
}
Expand Down
20 changes: 17 additions & 3 deletions asm/stack.asm
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,25 @@ stack_return_from_routine
bit stack_tmp
bmi +
rts
+ +read_next_byte_at_z_pc
tay
+
; +read_next_byte_at_z_pc
; tay
lda zp_temp
ldx zp_temp + 1
jmp z_set_variable
; jmp z_set_variable ; Code is followed by z_store_result which will set the variable

!zone {
z_store_result
; input: a,x hold result
; affected: a,x,y
pha
+read_next_byte_at_z_pc
tay
pla
jmp z_set_variable
}



stack_push
; Push a,x onto stack
Expand Down
2 changes: 1 addition & 1 deletion asm/streams.asm
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ translate_zscii_to_petscii
dey
bpl -
.no_match
ldy .streams_tmp + 1
; Check if legal
cmp #13
beq .case_conversion_done
Expand All @@ -628,7 +629,6 @@ translate_zscii_to_petscii
rts
.is_legal
; .case_conversion
ldy .streams_tmp + 1
cmp #$41
bcc .case_conversion_done
cmp #$5b
Expand Down
63 changes: 29 additions & 34 deletions asm/zmachine.asm
Original file line number Diff line number Diff line change
Expand Up @@ -969,26 +969,26 @@ z_set_variable
rts
}

!zone {
!ifdef Z5PLUS {
check_for_routine_0
; If value in argument 0 is 0, set status flag Z to 1, otherwise set to 0, and return.
lda z_operand_value_high_arr
ora z_operand_value_low_arr
rts
}
check_for_routine_0_and_store
; If value in argument 0 is 0, store 0 in the variable in byte at Z_PC, then set status flag Z to 1 and return
lda z_operand_value_high_arr
ora z_operand_value_low_arr
bne .not_0
lda #0
tax
jsr z_store_result
lda #0
.not_0
rts
}
;!zone {
; !ifdef Z5PLUS {
; check_for_routine_0
; ; If value in argument 0 is 0, set status flag Z to 1, otherwise set to 0, and return.
; lda z_operand_value_high_arr
; ora z_operand_value_low_arr
; rts
; }
; check_for_routine_0_and_store
; ; If value in argument 0 is 0, store 0 in the variable in byte at Z_PC, then set status flag Z to 1 and return
; lda z_operand_value_high_arr
; ora z_operand_value_low_arr
; bne .not_0
; lda #0
; tax
; jsr z_store_result
; lda #0
; .not_0
; rts
;}

!zone {
z_ins_not_supported
Expand All @@ -1000,17 +1000,6 @@ z_ins_not_supported
rts
}

!zone {
z_store_result
; input: a,x hold result
; affected: a,x,y
+ pha
+read_next_byte_at_z_pc
tay
pla
jmp z_set_variable
}

!zone z_division {
z_divide
; input: Dividend in arg 0, divisor in arg 1, y = signed? 0 = unsigned, $ff = signed
Expand Down Expand Up @@ -1700,7 +1689,9 @@ z_ins_mod
!ifdef Z5PLUS {
z_ins_call_xn
jsr check_for_routine_0
; If value in argument 0 is 0, set status flag Z to 1, otherwise set to 0
lda z_operand_value_high_arr
ora z_operand_value_low_arr
bne +
rts
+ ldx z_operand_count
Expand All @@ -1718,9 +1709,13 @@ z_ins_call_xn
; VAR instructions
z_ins_call_xs
jsr check_for_routine_0_and_store
; jsr check_for_routine_0_and_store
lda z_operand_value_high_arr
ora z_operand_value_low_arr
bne +
rts
lda #0
tax
jmp z_store_result
+ ldx z_operand_count
dex
ldy #1 ; Store result = 1
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.54
3.0

0 comments on commit 636f2b3

Please sign in to comment.