home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 116
/
116.d81
/
japanese
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
9KB
|
244 lines
10 poke56,56:clr: a%=0 :ad=49152: rem a% must be the 1st variable!
20 dv=peek(186):if dv<8 then dv=8
30 poke 53280,0:poke 53281,0
50 rem load modules
60 sys 57812"toolbox c000",dv,0:poke780,0:poke781,0:poke782,192:sys65493
70 sys ad+30,"japan-font",dv,14336
80 rem sys ad+30,"obj.japan",dv,16384
90 rem preparation
100 print chr$(142):poke53272,30: rem no alt char set:show cust chars
200 rem table screen
210 print"[147][146][159] a i u e o
220 [153]"
230 print" [192] [193] [194] [195] [196]
240 [153]"open a i u e o
250 print"[159]k [197] [198] [199] [200] [201] [197][187] [198][187] [199][187] [200][187] [201][187]"
260 print"[159] ka ki ku ke ko ga gi gu ge go";
270 print"[159]s [202] [203] [204] [205] [206] [202][187] [203][187] [204][187] [205][187] [206][187]
280 [153]"open sa shi su se so za ji zu ze zo";
290 [153]"opent (NULL) (NULL) (NULL) (NULL) (NULL) (NULL)rnd (NULL)rnd (NULL)rnd (NULL)rnd (NULL)rnd
300 print"[159] ta chi tsu te to da ji zu de do";
310 print"[159]n [212] [213] [214] [215] [216]
320 [153]"open na ni nu ne no (NULL)rnd (NULL)rnd (NULL)rnd (NULL)rnd (NULL)rnd
330 print"[159]h [217] [218] [219] [220] [221] [159]ba bi bu be bo";
340 print"[159] ha hi fu he ho [217][188] [218][188] [219][188] [220][188] [221][188]
350 [153]"openm (NULL) (NULL) tab( to fn openpa pi pu pe po";
360 [153]"open ma mi mu me mo
370 print"[159]y [166] [167] [168]
380 [153]"open ya yu yo
390 print"[159]r [169] [170] [171] [172] [173]
400 [153]"open ra ri ru re ro
410 print"[159]w [174] [175] [176]
420 [153]"open wa n o"
430 [158]ad[170]27,24,"setting up..."
450 :
500 [143] read in words
510 [134] a$(133),b$(133),a(92),b(92):[129] i[178]1 [164] 130:[135] a$(i),b$(i):[130]
600 [143] highlight locs
610 r[178][171]4:[129] i[178]29 [164] 60:r[178](r[170]4)[172][171](r[179]16):a(i)[178]r[170]3:b(i)[178][181]((i[171]24)[173]5)[172]2:[130]
620 r[178][171]4:[129]i[178]0[164]13:r[178](r[170]4)[172][171](r[179]16)[172][171](i[179][177]6):a(i)[178]r[170]3:b(i)[178][181]((i[170]39)[173]5)[172]2:[130]
630 a(0)[178]11:b(0)[178]14:a(1)[178]15:b(1)[178]14:a(2)[178]19:b(2)[178]14:a(3)[178]3:b(3)[178]16
640 a(4)[178]11:b(4)[178]16:a(5)[178]19:b(5)[178]16:a(14)[178]3:b(14)[178]20:a(15)[178]11:b(15)[178]20
650 a(16)[178]19:b(16)[178]20:a(92)[178]3:b(92)[178]14:a(11)[178]3:a(12)[178]11:a(13)[178]19
660 :
670 [151]781,24:[158]59903:[158]ad[170]18,208
680 [151]646,1:[158]ad[170]24,3,24,"f sys- opentoggle font space sys- opencontinue
681 sysad+45,"f ":onf%goto682,710
682 sysad+57,16640,18688,14336:goto681
710 poke 53280,7:print"[147]"
720 wait 203,64:rem make sure no key is being pressed
730 poke 655,74:poke 656,64: rem input key-catcher
800 rem main display
810 sys ad+15,0,19,0,24,255,1+128
820 sys ad+24,6,3,"[177] [179][181] [183][185]": rem "japanese" in japanese
830 sys ad+24,6,4,"[178] [180][182] [184][186]"
840 sys ad+24,27,3,"[146]english"
850 :
860 sys ad+24,21,11,"[154][146]enter translation"
870 :
880 sys ad+24,23,17,"[156]f1 - table"
890 sys ad+24,23,18,"f3 - show answer"
900 sys ad+24,23,19,"f5 - quit"
910 :
920 sys ad+15,20,20,0,24,0,7: rem dividing-line
930 :
940 sys ad+24,12,23,"< = > ": rem "correct" in japanese
950 sys ad+24,30,23,"[146][153]correct"
960 :
970 sys ad+18,224:rem save plain screen in 224
990 rem loop
1000 sys 16384:rem randomize
1010 for s=0to24:poke 54272+s,0:next:rem clear sid chip
1100 for i=1 to 130:n=peek(20480+i):ta=0
1200 rem sound
1210 poke 54272,46: rem freq low 1
1220 poke 54273,253:rem freq high 1
1230 poke 54286,30: rem freq low 3
1240 poke 54287,134:rem freq high 3
1250 poke 54277,10: rem att/dec 1
1260 poke 54278,74: rem sus/rel 1
1270 poke 54276,16+4: rem wave 1 = tri+ring mod
1280 poke 54290,17: rem wave 3
1290 poke 54296,15+128: rem vol+3 off
1300 :
1310 sys ad+21,224: rem display plain screen
1400 rem numbers
1410 x=i:gosub 11000: rem 11000 = numeral conversion subroutine
1420 sys ad+24,0,0,""+i$+" "
1430 sys ad+24,21,0,"[146][159]"+str$(x)+""
1440 sys ad+24,0,12," "
1450 sys ad+24,0,12,""
1460 sp=10-(len(a$(n))/2)
1470 sys ad+24,sp,12,a$(n)
1480 :
1490 x=c:gosub 11000
1500 sys ad+24,2,23,right$(" "+i$,7)
1510 sys ad+24,24,23,"[146]"+right$(" [153]"+str$(x)+"",6)
1520 sys ad+24,21,13,"[146] "
1600 rem get guess
2000 sys ad+24,21,13,""
2010 wait 203,64:poke 198,0:a%=0: rem prepare for custom input
2020 input n$:poke212,0
2030 sys ad+18,232: rem save screen w/any input letters in 232
2040 if a%=3 then gosub 13000:on f% goto 40000,2000: rem quit?
2050 on a% goto 4000,5000: rem table or show answer
2100 rem check
3000 if n$=b$(n) then poke 54276,21:c=c+1:poke 54276,20:goto 6000: rem correct
3010 :
3020 sys ad+15,12,29,4,10,160,6
3030 sys ad+24,14,7,"that is not it"
3040 sys ad+15,13,28,5,9,255,14+128
3050 :
3060 sys ad+15,4,36,16,20,160,5
3070 sys ad+24,6,17,"c - continue s - show answer"
3080 sys ad+24,5,19," q - quit r - retry "
3090 sys ad+15,5,35,17,19,255,13+128
3100 :
3200 poke212,0:sys ad+45,"cqsr":on f% goto 6000,3300,5000,4500
3210 :
3300 gosub 13000: on f% goto 40000,3200: rem quit?
3400 rem table
4000 poke53280,0:if ta then sys ad+21,216:goto 4400: rem already highlighted
4010 sys ad+21,208: rem plain table
4020 for g=1 to len(a$(n)): rem a$(n) is the current japanese word
4030 h=asc(right$(a$(n),g))-163
4040 :
4050 if h<0 or h=26 then next :rem long vowel or space
4060 if hh then 4200 :rem maru or nigori mark was present
4070 if h=24 or h=25 then hh=h:next :rem maru or nigori
4080 :
4090 a=a(h):goto 4300: rem no maru or nigori
4100 :
4200 if h>53 then if h<59 then gg=(hh=24)-(hh=25): rem"h-line
4210 a[178][181](a(h)[172].75[170]23): [143] column offset
4220 :
4300 [158] ad[170]15,a,a[170]2[171](hh[178]0),b(h)[170]gg,b(h)[170]1[170]gg,0,13[170]128
4310 gg[178]0:hh[178]0:[130]
4320 [158] ad[170]18,216:ta[178]1: [143] save highlighted table in 216:ta is a flag
4330 :
4400 [151] 198,0:[146] 198,1:[151] 53280,7
4500 [158] ad[170]21,232:[137] 2000: [143] put back previous screen
4900 [143] show word
5000 [151]212,0:[158] ad[170]21,232: [143] block out any other windows
5010 [158] ad[170]15,12,28,5,11,160,6
5020 [158] ad[170]24,14,7,"this word is:"
5030 [158] ad[170]24,14,9,b$(n)
5040 [158] ad[170]15,13,27,6,10,255,14[170]128
5050 :
5100 [158] ad[170]15,13,27,16,20,160,5
5110 [158] ad[170]24,14,17," press space "
5120 [158] ad[170]24,14,18," "
5130 [158] ad[170]24,14,19," q -- quit "
5140 [158] ad[170]15,14,26,17,19,255,13[170]128
5150 :
5200 [158] ad[170]45," q":[139] f%[178]1 [167] 6000: [143] next word if "c"
5300 [141] 13000:[145] f% [137] 40000,6000: [143] quit?
5400 [143] next word
5410 :
6000 [130]
6010 :
6100 [143] end loop
6110 x[178]c:[141] 11000:c[178]0
6120 [158] ad[170]24,2,23,""[170][201](" "[170]i$,7)
6130 [158] ad[170]24,24,23,"wait"[170][201](" print"[170][196](x)[170]"",6)
6140 [158] ad[170]24,21,13,"wait "
6150 [158] ad[170]15,11,28,6,19,160,15
6160 [158] ad[170]72,13,25,9,17
6170 [158] ad[170]15,14,26,8,16,160,0
6180 [158] ad[170]24,16,10,"finished."
6190 [158] ad[170]24,16,12,"restart?"
6200 [158] ad[170]24,16,14," y/n "
6210 [158] ad[170]15,15,25,9,15,160,10[170]128
6220 :
6300 [158] ad[170]45,"yn":[145] f% [137] 1000,40000
10000 [159]15,8,15,"s0:japanese":[160]15:[148]"japanese",8:[128]
11000 i1[178][181](x[173]100):i2[178][181]((x[171]i1[172]100)[173]10):i3[178]x[171]100[172]i1[171]10[172]i2:i$[178]""
11010 [139] i3 [167] i$[178][196](i3)
11020 [139] i2 [167] i$[178]" 0"[170]i$:[139] i2[177]1 [167] i$[178][196](i2)[170]i$
11030 [139] i1 [167] i$[178]" cos"[170]i$:[139] i1[177]1 [167] i$[178][196](i1)[170]i$
11040 [142]
11900 [143] nippon number
12000 [143] quit query
13000 [158] ad[170]18,240: [143] save screen w/o "quit?" in 240
13010 [158] ad[170]15,11,27,8,16,160,2
13020 [158] ad[170]24,13,10," q u i t"
13030 [158] ad[170]24,13,12,"are you sure?"
13040 [158] ad[170]24,13,14," y / n"
13050 [158] ad[170]15