Skip to content

Commit

Permalink
Added support for custom fonts on X16
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikr committed Apr 2, 2024
1 parent 99f5a59 commit c43ee23
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
34 changes: 33 additions & 1 deletion asm/ozmoo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ game_id !byte 0,0,0,0
cld
cli
!ifdef TARGET_X16 {
jsr x16_backup_basic_zp
jsr x16_backup_basic_zp
}
!ifdef TARGET_C128 {
lda #$f0 ; Background colour
Expand Down Expand Up @@ -1597,9 +1597,41 @@ vmem_cache_count = vmem_cache_size / 256

stack_start

!ifdef TARGET_X16 {
!ifdef CUSTOM_FONT {
fontfile_name !pet "zfont"
fontfile_name_len = * - fontfile_name

font_read_error
lda #ERROR_FLOPPY_READ_ERROR
jmp fatalerror
}
}

deletable_screen_init_1
; start text output from bottom of the screen

!ifdef TARGET_X16 {
!ifdef CUSTOM_FONT {
lda #fontfile_name_len
ldx #<fontfile_name
ldy #>fontfile_name
jsr kernal_setnam ; call SETNAM
lda #2 ; file number 2
ldx #8
ldy #2 ; secondary address
jsr kernal_setlfs ; call SETLFS
lda #3 ; Load into VRAM, bank 1
ldx #$00
ldy #$f0
jsr kernal_load
php
jsr close_io
plp
bcs font_read_error
}
}

!ifndef Z4PLUS {
!ifdef TARGET_C128 {
bit COLS_40_80
Expand Down
8 changes: 6 additions & 2 deletions make.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ def build_specific_boot_file(vmem_preload_blocks, vmem_contents)
font_clause = ""
asm_clause = ""
decrunch_effect = ""
if $font_filename
if $font_filename and $target != 'x16'
font_clause = " \"#{$font_filename}\"@#{$font_address}"
end
exo_target = ""
Expand Down Expand Up @@ -2101,8 +2101,9 @@ def build_zip(storyname, diskimage_filename, config_data, vmem_data,

# Add terp and story file
FileUtils.cp($ozmoo_file, foldername+"/"+$file_name.upcase)
# FileUtils.cp($story_file, foldername+"/ZCODE")
IO.binwrite(foldername+"/ZCODE", $story_file_data);
# Add font, if any
FileUtils.cp($font_filename, foldername+"/ZFONT") if $font_filename

# Create the zip file
command = "#{$ZIP} #{foldername}.zip #{foldername}"
Expand Down Expand Up @@ -2614,6 +2615,9 @@ def print_usage
elsif $target == 'plus4'
$font_address = 0x1000
$start_address = 0x1800
elsif $target == 'x16'
$font_address = 0xf000
# $start_address = 0x1800
else
puts "ERROR: Custom fonts are currently not supported for this target platform."
exit 1
Expand Down
1 change: 1 addition & 0 deletions releasenotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ New/changed features:
- Made restart fast on X16 (don't reload statmem after restart)
- Enabled scroll speed control and tear-free scrolling on X16
- Made Z-machine beeps work on X16
- Added support for custom fonts on X16

Optimizations:
- Moved print_buffer, print_buffer2, memory_buffer and directory_buffer to leave more continuous space for future use.
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.6
14.7

0 comments on commit c43ee23

Please sign in to comment.