text overflow fix

This commit is contained in:
2022-08-20 16:28:39 -04:00
parent 9108c7c857
commit 0967ffbe19
3 changed files with 8 additions and 6 deletions
+1
View File
@@ -1,4 +1,5 @@
.proc talk .proc talk
; Maximum text length is 63 characters!!!
L0 dta d"IN TIMES OF TROUBLE, GO WITH WHAT YOU KNOW." L0 dta d"IN TIMES OF TROUBLE, GO WITH WHAT YOU KNOW."
L1 dta d"DIE!" L1 dta d"DIE!"
L2 dta d"EAT MY SHORTS!" L2 dta d"EAT MY SHORTS!"
BIN
View File
Binary file not shown.
+7 -6
View File
@@ -1419,18 +1419,19 @@ displayloop1
lda xtankstableH,y lda xtankstableH,y
sta temp+1 sta temp+1
;now we should substract length of the text-1 ;now we should substract length of the text-1
;temp2 = (fx-1)*2
ldy fx ldy fx
dey dey
tya tya
asl asl
sta temp2 sta temp2
mva #0 temp2+1 mva #0 temp2+1
;here we assume max length of text
;to display is 127 chars!
;now we have HALF length in pixels ;now we have HALF length in pixels
;stored in temp2 ;stored in temp2
;here we assume max length of text
;to display is 127 chars, but later it turns out it must be max 63!
sbw temp temp2 ; here begin of the text is in TEMP !!!! sbw temp temp2 ; here begin of the text is in TEMP !!!!
;now we should check overflows ;now we should check overflows
;lda temp+1 ; opty ;lda temp+1 ; opty
@@ -1460,14 +1461,14 @@ DOTNnotLessThanZero
;so check if not greater than screenwitdth ;so check if not greater than screenwitdth
cpw temp2 #screenwidth cpw temp2 #screenwidth
bcc DOTNnoOverflow bcc DOTNnoOverflow
;if end is greater than screenwidth ;if end is greater than screenwidth
;then screenwidth - length is fine ;then screenwidth - length is fine
lda fx lda fx
asl asl
asl asl
sta temp sta temp
mva #0 temp+1
sec sec
lda #<(screenwidth-1) lda #<(screenwidth-1)