simpler format for pages of text

This commit is contained in:
4am 2021-10-17 21:12:04 -04:00
parent 52142a0e20
commit 983f5f9b06
4 changed files with 24 additions and 33 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh
tr "\*\~\<\>\$\%" "\020\021\010\025\016\017" < "$1" | sed '/^\[/d' > "$2"
dd if=/dev/zero bs=1 count=1 2>/dev/null >> "$2"
tr "\*\~\<\>\$\%" "\020\021\010\025\016\017" < "$1" | \
awk '!/^\[/ { printf "%c%s", length, $0 } END { printf "\xFF" }' > "$2"

View File

@ -11,7 +11,7 @@ FX.ALL=Type(06),AuxType(6000),Access(C3)
DFX.IDX=Type(06),AuxType(6000),Access(C3)
DFX.ALL=Type(06),AuxType(6000),Access(C3)
GAMEHELP.IDX=Type(06),AuxType(6000),Access(C3)
GAMEHELP.ALL=Type(04),AuxType(6000),Access(C3)
GAMEHELP.ALL=Type(06),AuxType(6000),Access(C3)
SLIDESHOW.IDX=Type(06),AuxType(4000),Access(C3)
SLIDESHOW.ALL=Type(06),AuxType(0800),Access(C3)
PRELAUNCH.IDX=Type(06),AuxType(6000),Access(C3)
@ -19,8 +19,8 @@ PRELAUNCH.ALL=Type(06),AuxType(0106),Access(C3)
COVER=Type(06),AuxType(2000),Access(C3)
TITLE=Type(06),AuxType(2000),Access(C3)
HELP=Type(06),AuxType(2000),Access(C3)
CREDITS=Type(04),AuxType(6000),Access(C3)
HELPTEXT=Type(04),AuxType(6000),Access(C3)
CREDITS=Type(06),AuxType(6000),Access(C3)
HELPTEXT=Type(06),AuxType(6000),Access(C3)
DECRUNCH=Type(06),AuxType(0200),Access(C3)
JOYSTICK=Type(06),AuxType(0800),Access(C3)
Finder.Data=Type(C9),AuxType(0000),Access(E7)

View File

@ -17,7 +17,7 @@
; D000..D3FF - ProRWTS data
; D400..D66F - ProRWTS code
; D670..DB91 - HGR font code & ProRWTS glue code
; DB72..DB81 - backup of stack (during gameplay and self-running demos)
; DB61..DB70 - backup of stack (during gameplay and self-running demos)
; ...unused...
; DBB4..DBFF - (de)acceleration function
; DC00..DFFF - HGR font data

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2018-2020 by 4am
;(c) 2018-2021 by 4am
;
; hi-res font drawing routines
;
@ -9,7 +9,8 @@
;
DrawPageInternal
; A/Y contains address of character buffer
; A/Y contains address of array of length-prefixed strings
; length #$FF terminates
; X contains 0-indexed left margin (HTAB)
; carry bit clear -> draw on page 1
; carry bit set -> draw on page 2
@ -18,7 +19,7 @@ DrawPageInternal
; clobbers PTR
; clobbers $FF
; clobbers A/X/Y
; preserves all flags, by a quirk of implementation
; preserves all flags
php
stx $FF
ldx #0
@ -28,32 +29,22 @@ DrawPageInternal
lda $FF
sta HTAB
ldy #0
@parseLine
lda (PTR), y
beq @donePage
cmp #$0A
beq @doneParsingLine
iny
bne @parseLine
@doneParsingLine
sty SAVE
tya
beq @skip
ldx SAVE
+LD16 PTR
lda (PTR), y ; A = length of line, or #$FF
bmi PLP_AND_RTS ; if #$FF then we're done
tax ; X = length of line
plp
php
jsr DrawBufferInternal
@skip inc SAVE ; skip carriage return
lda SAVE ; advance PTR to start of next line
clc
php ; C = whatever was passed in
pha ; save length
jsr DrawStringSuperInternal
pla ; A = length of line
clc ; advance PTR to start of next line
adc PTR
sta PTR
bcc +
inc PTR+1
+ inc VTAB ; this will print 255 lines if you give it
bne @drawLine ; 255 lines, so don't do that
@donePage
+ inc VTAB ; this will print 255 lines if you give
bne @drawLine ; it 255 lines, because this is assembly
PLP_AND_RTS
plp
rts
@ -82,7 +73,6 @@ DrawCenteredStringInternal
; clobbers A/X/Y
; clobbers PTR/PTR+1
+ST16 PTR
ldy #0
php
lda #40
@ -102,10 +92,10 @@ DrawStringInternal
; clobbers A/X/Y
; clobbers PTR/PTR+1
+ST16 PTR
ldy #0
+ lda (PTR),y
tax
DrawStringSuperInternal
inc PTR
bne +
inc PTR+1
@ -115,7 +105,7 @@ DrawStringInternal
DrawBufferInternal
; A/Y contains address of character buffer
; X contains buffer length (1..40)
; X contains buffer length (0..40)
; carry bit clear -> draw on page 1
; carry bit set -> draw on page 2
; characters MUST have high bit off (0x00..0x7F)
@ -129,6 +119,7 @@ DrawBufferInternal
+ST16 DBISrc+1
php
dex
bmi PLP_AND_RTS ; empty string
lda VTAB
asl
asl