2020-09-20 21:49:36 +00:00
|
|
|
%import textio
|
2020-10-23 18:56:10 +00:00
|
|
|
%import floats
|
2020-10-28 21:56:13 +00:00
|
|
|
%import syslib
|
2020-09-27 20:05:44 +00:00
|
|
|
%zeropage basicsafe
|
2020-08-27 17:47:50 +00:00
|
|
|
|
2020-10-28 21:56:13 +00:00
|
|
|
|
|
|
|
; Note: this program is compatible with C64 and CX16.
|
|
|
|
|
2020-09-24 17:26:07 +00:00
|
|
|
main {
|
2020-10-28 21:56:13 +00:00
|
|
|
sub start() {
|
|
|
|
|
2020-10-28 22:13:53 +00:00
|
|
|
uword ss
|
|
|
|
|
|
|
|
ss = %1000000110101010
|
|
|
|
ss <<= 8
|
|
|
|
txt.print_uwbin(ss, 1)
|
2020-10-28 21:56:13 +00:00
|
|
|
txt.chrout('\n')
|
|
|
|
|
2020-10-28 22:13:53 +00:00
|
|
|
ss = %1000000110101111
|
|
|
|
ss <<= 9
|
|
|
|
txt.print_uwbin(ss, 1)
|
2020-10-28 21:56:13 +00:00
|
|
|
txt.chrout('\n')
|
2020-10-28 22:13:53 +00:00
|
|
|
|
|
|
|
ss = %1000000110101111
|
|
|
|
ss <<= 14
|
|
|
|
txt.print_uwbin(ss, 1)
|
2020-10-28 21:56:13 +00:00
|
|
|
txt.chrout('\n')
|
2020-10-28 22:13:53 +00:00
|
|
|
|
|
|
|
ss = %1000000110101111
|
|
|
|
ss <<= 15
|
|
|
|
txt.print_uwbin(ss, 1)
|
2020-10-28 21:56:13 +00:00
|
|
|
txt.chrout('\n')
|
2020-10-28 22:13:53 +00:00
|
|
|
|
|
|
|
ss = %1000000110101111
|
|
|
|
ss <<= 16
|
|
|
|
txt.print_uwbin(ss, 1)
|
2020-10-28 21:56:13 +00:00
|
|
|
txt.chrout('\n')
|
2020-10-28 22:13:53 +00:00
|
|
|
|
|
|
|
ss = %1000000110101010
|
|
|
|
ss <<= 17
|
|
|
|
txt.print_uwbin(ss, 1)
|
2020-10-28 21:56:13 +00:00
|
|
|
txt.chrout('\n')
|
|
|
|
|
|
|
|
main22.testX()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
main22 {
|
2020-09-28 00:23:36 +00:00
|
|
|
|
2020-10-09 20:47:42 +00:00
|
|
|
sub start() {
|
2020-10-27 23:29:34 +00:00
|
|
|
ubyte char
|
|
|
|
uword ssss
|
|
|
|
float fl
|
2020-10-23 18:56:10 +00:00
|
|
|
|
2020-10-27 23:29:34 +00:00
|
|
|
;char = 1+(lsb(ssss) * 2)
|
|
|
|
;fl = 2.0*(abs(fl) + 1.0)
|
|
|
|
|
2020-10-28 21:56:13 +00:00
|
|
|
char = abs(char)
|
2020-10-27 23:29:34 +00:00
|
|
|
char = lsb(ssss)
|
|
|
|
char++
|
|
|
|
char = msb(ssss)
|
2020-10-23 18:56:10 +00:00
|
|
|
char++
|
2020-10-27 23:29:34 +00:00
|
|
|
char = c64.CHRIN()
|
|
|
|
|
|
|
|
txt.print_ub(char)
|
|
|
|
txt.chrout('\n')
|
|
|
|
|
|
|
|
char = chrin()
|
|
|
|
|
|
|
|
txt.print_ub(char)
|
|
|
|
txt.chrout('\n')
|
|
|
|
|
|
|
|
void getstr()
|
2020-10-28 22:13:53 +00:00
|
|
|
; TODO string assign ssss = getstr()
|
2020-10-27 23:29:34 +00:00
|
|
|
|
|
|
|
txt.print_uwhex(ssss, true)
|
|
|
|
txt.chrout('\n')
|
|
|
|
|
|
|
|
; fl = getfloat()
|
|
|
|
;
|
|
|
|
; floats.print_f(fl)
|
|
|
|
; txt.chrout('\n')
|
|
|
|
|
2020-10-18 16:00:24 +00:00
|
|
|
testX()
|
2020-10-23 18:56:10 +00:00
|
|
|
;char=strlen(ssss)
|
|
|
|
}
|
|
|
|
|
|
|
|
sub chrin() -> ubyte {
|
|
|
|
return 99
|
|
|
|
}
|
|
|
|
|
|
|
|
sub getstr() -> str {
|
2020-10-27 23:29:34 +00:00
|
|
|
@($d020)++
|
2020-10-23 18:56:10 +00:00
|
|
|
return "foo"
|
|
|
|
}
|
|
|
|
|
2020-10-27 23:29:34 +00:00
|
|
|
; sub getfloat() -> float {
|
|
|
|
; return 4.56789
|
|
|
|
; }
|
2020-10-11 11:31:45 +00:00
|
|
|
|
2020-10-22 21:41:16 +00:00
|
|
|
sub mcp(uword from, uword dest, ubyte length) {
|
|
|
|
txt.print_uw(from)
|
|
|
|
txt.print_uw(dest)
|
|
|
|
txt.print_ub(length)
|
|
|
|
}
|
|
|
|
|
2020-10-01 22:34:12 +00:00
|
|
|
asmsub testX() {
|
|
|
|
%asm {{
|
|
|
|
stx _saveX
|
|
|
|
lda #13
|
|
|
|
jsr txt.chrout
|
|
|
|
lda _saveX
|
|
|
|
jsr txt.print_ub
|
|
|
|
lda #13
|
|
|
|
jsr txt.chrout
|
|
|
|
ldx _saveX
|
|
|
|
rts
|
|
|
|
_saveX .byte 0
|
|
|
|
}}
|
2020-09-16 21:04:18 +00:00
|
|
|
}
|
2020-08-27 17:47:50 +00:00
|
|
|
}
|