mirror of
https://github.com/KarolS/millfork.git
synced 2025-02-15 14:30:51 +00:00
CoCo: encconv support
This commit is contained in:
parent
2c9a3f7cbd
commit
d77ecba518
@ -151,6 +151,7 @@ The exact value of `{nullchar}` is encoding-dependent:
|
||||
* in the `petscr` and `petscrjp` encodings it's `{xe0}`,
|
||||
* in the `atasciiscr` encoding it's `{xdb}`,
|
||||
* in the `pokemon1*` encodings it's `{x50}`,
|
||||
* in the `cocoscr` encoding it's exceptionally two bytes: `{xd0}`
|
||||
* in the `utf16be` and `utf16le` encodings it's exceptionally two bytes: `{x00}{x00}`
|
||||
* in other encodings it's `{x00}` (this may be a subject to change in future versions).
|
||||
|
||||
|
@ -31,6 +31,8 @@ Available only if one of the following is true:
|
||||
|
||||
* the default encoding is `atascii`, the screen encoding is `atasciiscr`, and the platform is 6502-based
|
||||
|
||||
* the default encoding is `coco`, the screen encoding is `cococsr`, and the platform is 6809-based
|
||||
|
||||
You can test for the availability of this function using the `ENCCONV_SUPPORTED` preprocessor feature.
|
||||
|
||||
#### byte from_screencode(byte)
|
||||
@ -98,3 +100,17 @@ Reverse characters are interpreted as non-reverse characters.
|
||||
|
||||
Available only on 6502-based platforms.
|
||||
|
||||
#### byte coco_to_cocoscr(byte)
|
||||
|
||||
Converts a byte from Color Computer pseudo-ASCII to a Color Computer screencode.
|
||||
Control characters <$20 are converted inverted punctuation.
|
||||
|
||||
Available only on 6809-based platforms.
|
||||
|
||||
#### byte cocoscr_to_coco(byte)
|
||||
|
||||
Converts a byte from a Color Computer screencode to Color Computer pseudo-ASCII.
|
||||
Inverted punctuation is converted to control characters.
|
||||
|
||||
Available only on 6809-based platforms.
|
||||
|
||||
|
@ -83,6 +83,8 @@ void strz_to_screencode(pointer p) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void pstr_from_screencode(pointer p) {
|
||||
byte i, l
|
||||
l = p[0]
|
||||
@ -98,8 +100,6 @@ void pstr_to_screencode(pointer p) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // ENCODING_SAME/ENCCONV_SUPPORTED
|
||||
|
||||
|
||||
@ -199,4 +199,52 @@ __atascii_to_atasciiscr_end:
|
||||
rts
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ARCH_6809
|
||||
|
||||
asm byte coco_to_cocoscr(byte register(b) char) {
|
||||
cmpb #$20
|
||||
bcc __coco_to_cocoscr_40
|
||||
eorb #$20
|
||||
rts
|
||||
__coco_to_cocoscr_40:
|
||||
cmpb #$40
|
||||
bcc __coco_to_cocoscr_60
|
||||
eorb #$40
|
||||
rts
|
||||
__coco_to_cocoscr_60:
|
||||
cmpb #$60
|
||||
bcc __coco_to_cocoscr_80
|
||||
rts
|
||||
__coco_to_cocoscr_80:
|
||||
cmpb #$80
|
||||
bcc __coco_to_cocoscr_end
|
||||
eorb #$60
|
||||
__coco_to_cocoscr_end:
|
||||
rts
|
||||
}
|
||||
|
||||
asm byte cocoscr_to_coco(byte register(b) char) {
|
||||
cmpb #$20
|
||||
bcc __cocoscr_to_coco_40
|
||||
eorb #$60
|
||||
rts
|
||||
__cocoscr_to_coco_40:
|
||||
cmpb #$40
|
||||
bcc __cocoscr_to_coco_60
|
||||
eorb #$20
|
||||
rts
|
||||
__cocoscr_to_coco_60:
|
||||
cmpb #$60
|
||||
bcc __cocoscr_to_coco_80
|
||||
rts
|
||||
__cocoscr_to_coco_80:
|
||||
cmpb #$80
|
||||
bcc __coco_to_cocoscr_end
|
||||
eorb #$40
|
||||
__cocoscr_to_coco_end:
|
||||
rts
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -2,7 +2,6 @@
|
||||
; VERY EXPERIMENTAL
|
||||
[compilation]
|
||||
arch=6809
|
||||
; todo: is it ascii?
|
||||
encoding=coco
|
||||
screen_encoding=cocoscr
|
||||
modules=default_panic,stdlib,coco/kernal
|
||||
|
@ -329,6 +329,8 @@ object Platform {
|
||||
("PETSCII-JP", "CBM-Screen-JP") |
|
||||
("ATASCII", "ATASCII-Screen") =>
|
||||
CpuFamily.forType(cpu) == CpuFamily.M6502
|
||||
case ("Color-Computer", "Color-Computer-Screen") =>
|
||||
CpuFamily.forType(cpu) == CpuFamily.M6809
|
||||
case _ => codec.name == srcCodec.name
|
||||
}),
|
||||
"NULLCHAR_SAME" -> toLong(codec.stringTerminator == srcCodec.stringTerminator)
|
||||
|
@ -33,6 +33,9 @@ abstract class AbstractSourceLoadingQueue[T](val initialFilenames: List[String],
|
||||
case ("ATASCII", "ATASCII-Screen") =>
|
||||
List(AliasDefinitionStatement("__from_screencode", "atasciiscr_to_atascii", important = false),
|
||||
AliasDefinitionStatement("__to_screencode", "atascii_to_atasciiscr", important = false))
|
||||
case ("Color-Computer", "Color-Computer-Screen") =>
|
||||
List(AliasDefinitionStatement("__from_screencode", "cocoscr_to_coco", important = false),
|
||||
AliasDefinitionStatement("__to_screencode", "coco_to_cocoscr", important = false))
|
||||
case _ => Nil
|
||||
}
|
||||
encodingConversionAliases
|
||||
|
Loading…
x
Reference in New Issue
Block a user