50 lines
1.5 KiB
Plaintext
50 lines
1.5 KiB
Plaintext
1 rem hello world on graphics screen
|
|
2 rem commodore 64 version
|
|
|
|
10 print chr$(147): print " press c to clear bitmap area,"
|
|
15 print " any other key to continue"
|
|
20 get k$:if k$="" then 20
|
|
25 if k$<>"c" then goto 40
|
|
|
|
30 poke 53280,0:print chr$(147):print " clearing bitmap area... please wait..."
|
|
35 base=8192:for i=base to base+7999:poke i,0:next
|
|
|
|
40 print chr$(147);
|
|
45 poke 53272,peek(53272) or 8:rem set bitmap memory at 8192 ($2000)
|
|
50 poke 53265,peek(53265) or 32:rem enter bitmap mode
|
|
|
|
55 rem write text to graphics at tx,ty
|
|
60 t$="goodbye, world!":tx=10:ty=10
|
|
65 gosub 400
|
|
|
|
70 rem draw sine wave - prove we are in hi-res mode
|
|
75 for x=0 to 319:y=int(50*sin(x/10))+100:gosub 500:next
|
|
|
|
80 rem wait for keypress
|
|
85 get k$:if k$="" then 85
|
|
|
|
90 rem back to text mode, restore colors, end program
|
|
95 poke 53265,peek(53265) and 223:poke 53272,peek(53272) and 247
|
|
100 poke 53280,14:poke 53281,6:poke 646,14
|
|
200 end
|
|
|
|
400 rem write text to graphics routine
|
|
405 tx=tx+(40*ty):m=base+(tx*8)
|
|
410 poke 56334,peek(56334) and 254 : rem turn off keyscan
|
|
415 poke 1,peek(1) and 251 : rem switch in chargen rom
|
|
420 for i=1 to len(t$)
|
|
425 l=asc(mid$(t$,i,1))-64:if l<0 then l=l+64
|
|
430 for b=0 to 7
|
|
435 poke m,peek(53248+(l*8)+b)
|
|
440 m=m+1
|
|
445 next b, i
|
|
450 poke 1,peek(1) or 4 : rem switch in io
|
|
455 poke 56334,peek(56334) or 1 : rem restart keyscan
|
|
460 return
|
|
|
|
500 rem plot a single pixel at x,y
|
|
510 mem=base+int(y/8)*320+int(x/8)*8+(y and 7)
|
|
520 px=7-(x and 7)
|
|
530 poke mem,peek(mem) or 2^px
|
|
540 return
|