keen: update story generation

This commit is contained in:
Vince Weaver 2024-05-09 16:45:11 -04:00
parent 320dd047df
commit 16ae738044
2 changed files with 30 additions and 2 deletions

View File

@ -9,6 +9,8 @@
story_data = $7000 story_data = $7000
story_end = $83A0
keen_story_start: keen_story_start:
;=================== ;===================
; init screen ; init screen
@ -303,11 +305,11 @@ up_done:
do_down: do_down:
lda START_LINE_H ; 3 lda START_LINE_H ; 3
cmp #$82 ; 2 cmp #>story_end ; 2
bne down_ok ; 2/3 bne down_ok ; 2/3
lda START_LINE_L ; 3 lda START_LINE_L ; 3
cmp #$48 ; 2 cmp #<story_end ; 2
beq done_key ; 2/3 beq done_key ; 2/3
down_ok: down_ok:

View File

@ -1,6 +1,10 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
/* If doing cycle-counted code we don't want to cross pages */
/* in that case, skip bytes from 240-256 */
static int dont_page_cross=1;
int main(int argc, char **argv) { int main(int argc, char **argv) {
char string[BUFSIZ]; char string[BUFSIZ];
@ -8,6 +12,7 @@ int main(int argc, char **argv) {
int inverse=0; int inverse=0;
int count,i,length; int count,i,length;
int offset=0;
while(1) { while(1) {
@ -26,9 +31,11 @@ int main(int argc, char **argv) {
if (inverse) { if (inverse) {
putchar(' '&0x3f); putchar(' '&0x3f);
offset++;
} }
else { else {
putchar(' '|0x80); putchar(' '|0x80);
offset++;
} }
for(i=0;i<length;i++) { for(i=0;i<length;i++) {
@ -37,21 +44,40 @@ int main(int argc, char **argv) {
if (inverse) { if (inverse) {
putchar(string[i]&0x3f); putchar(string[i]&0x3f);
offset++;
} }
else { else {
putchar(string[i]|0x80); putchar(string[i]|0x80);
offset++;
} }
} }
for(i=0;i<(40-length);i++) { for(i=0;i<(40-length);i++) {
if (inverse) { if (inverse) {
putchar(' '&0x3f); putchar(' '&0x3f);
offset++;
} }
else { else {
putchar(' '|0x80); putchar(' '|0x80);
offset++;
} }
} }
if ((dont_page_cross) && ((offset%256)==240)) {
for(i=0;i<16;i++) {
if (inverse) {
putchar(' '&0x3f);
offset++;
}
else {
putchar(' '|0x80);
offset++;
}
}
}
} }
return 0; return 0;