home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 4 #5
/
Commodore_Disk_User_Vol.4_5_1991_-.d64
/
viewscreens.asm
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
10KB
|
404 lines
10 *=$c000
20 ! **********************************
30 !
40 ! seuck extension block/screen
50 ! expansion routine by ian (NULL)ffe
60 ! october, 1989 for cdu.
70 !
80 ! source file compatible with:
90 !
100 !
110 ! > mikro assembler
120 ! > 6510+
130 ! > my macro assembler
140 !
150 ! (change asl a to asla
160 ! with macro assembler)
170 !
180 ! **********************************
190 !
200 ! this program takes the data
210 ! saved from the s.e.u.c.k extension
220 ! editor, and displays a given
230 ! screen.
240 !
250 ! we are using bank 0 (default)
260 ! with the following set of data:-
270 !
280 ! block colours at $2000-$2080
290 ! block definitions at $2100-$2d80
300 ! character set at $3000-$3800
310 ! screen data at $4000-$6000
320 ! screen at $0400>default
330 !
340 ! first give values to
350 ! labels refering to the above
360 !
370 blockbase=$2100
380 screendata=$4000
390 bb=blockbase ! a shorter label for
400 ! later on!!
410 colblock=$2000
420 sc=1024
430 !
440 ! used to find colour map
450 ! from screen address...
460 !
470 difference=55296-sc
480 !
490 ! init zero page locations to
500 ! hold the addresses to work on
510 !
520 blockad=$fe
530 colourad=$fc
540 screenad=$fa
550 sad=$f8
560 !
570 ! *****************************
580 !
590 ! this is all that is required
600 ! of you to print a screen!!!
610 !
620 sei
630 lda #28 ! move char set to 12288
640 sta 53272
650 lda #216
660 sta 53270 ! multicolour on
670 !
680 lda #0 ! set colours as you wish
690 sta 53281
700 sta 53282
710 ldx #6
720 stx 53282
730 inx
740 stx 53283
750 lda #0 ! load a with screen #
760 jsr expascr
770 cli
780 rts
790 ! *****************************
800 !
810 ! ----------------------------------
820 ! the routine below prints
830 ! a single block to the screen
840 ! at the given x and y coords.
850 ! call this routine with:
860 ! a=block number
870 ! "xinit" any "yinit"
880 ! holding the relevant coordinates.
890 !
900 ! ----------------------------------
910 expblock !
920 !
930 !
940 sta blocknum
950 tax
960 !
970 !
980 ! ! get y=block number*2
990 !
1000 asl a ! shift left ie. *2
1010 tay
1020 !
1030 ! get the colour of this block
1040 lda colblock,x
1050 sta colour
1060 !
1070 ! now we need to get the start
1080 ! addr. of this block's definition
1090 !
1100 ! to do this we need to get :-
1110 ! (block no.*25)+block base addr.
1120 ! this may take much processor
1130 ! time as "multiple-addition"
1140 ! techniques are required.
1150 !
1160 ! instead i have set up a 256-byte
1170 ! table holding each of the 128
1180 ! block addresses.
1190 ! to index a particular block def.
1200 ! index=block no. *2
1210 !
1220 ! as y=block no*2
1230 !
1240 !
1250 lda blocktabad,y ! get lo byte
1260 sta blockad
1270 lda blocktabad+1,y ! hi byte
1280 sta blockad+1
1290 !
1300 ! simple isn't it, now"?"
1310 !
1320 ! this time saving is required
1330 ! as this routine is called 32
1340 ! times for each screen - you will
1350 ! notice the time difference
1360 ! if the address wasn't tabulated!
1370 ! we need to bang data onto the
1380 ! screen like a bat out of hell,
1390 ! so it's well worth the 256 bytes!
1400 ! -------------------------------
1410 ! summary:-
1420 ! blockad holds block/char addr
1430 ! for block in "blocknum"
1440 ! -------------------------------
1450 !
1460 ! now get screenad to hold the
1470 ! screen address for the y coord.
1480 !
1490 ! ie. so as screenad holds the
1500 ! screen address for when x=0.
1510 !
1520 ! i am employing the same
1530 ! "get the address out of the
1540 ! table[171]quick" method again as
1550 ! it is in the main routine still!
1560 ! get y coordinate*2 for offset
1570 ! in the screen address table.
1580 !
1590 lda yinit
1600 asl a
1610 tay
1620 lda screentable,y
1630 sta screenad
1640 lda screentable+1,y
1650 sta screenad+1
1660 !
1670 !
1680 !
1690 !
1700 ! -----------------------------
1710 ! now screenad=the y coord address
1720 ! of the screen for x=0
1730 ! -----------------------------
1740 !
1750 lda #0
1760 sta blkread ! count through 0-24
1770 ! chars. in this block
1780 lda #5
1790 sta ycount ! height of block
1800 !
1810 do1y lda xinit ! each new y coord -
1820 ! give the x start
1830 ! index across the
1840 ! the screen ie.
1850 ! value from 0-39.
1860 sta xcoord
1870 ldy #5 ! width of block
1880 sty xcount
1890 !
1900 do1x ldy blkread ! index (0-24)
1910 ! through block
1920 ! definition.
1930 !
1940 ! read a char. to print
1950 ! from this block's base
1960 !
1970 readblock lda (blockad),y
1980 !
1990 ldy xcoord ! store on screen
2000 ! taking into account
2010 ! the column index
2020 !
2030 sta (screenad),y
2040 !
2050 ! create the colourmap address
2060 ! relative from the screen.
2070 !
2080 ! note that if a screen address
2090 ! is being used that is >55296
2100 ! then the label difference
2110 ! would need to be changed to:-
2120 ! difference=scr-55296
2130 !
2140 ! and the "adc" instructions
2150 ! below would need to be changed
2160 ! to "sbc" - making sure that you
2170 ! set carry (sec) first instead of
2180 ! "clc" - nuff said!
2190 !
2200 clc
2210 lda screenad
2220 adc #<difference
2230 sta colourad
2240 lda screenad+1
2250 adc #>difference
2260 sta colourad+1
2270 lda colour
2280 !
2290 ! y still holds column index
2300 ! so colour in that char on screen!
2310 sta (colourad),y
2320 !
2330 inc xcoord ! move along screen
2340 ! column
2350 inc blkread ! through 0-24 index
2360 ! in block
2370 !
2380 !
2390 dec xcount loop width
2400 bne do1x
2410 !
2420 !
2430 ! now move down one y coordinate -
2440 ! just add 40 to the screen addr.
2450 !
2460 clc
2470 lda screenad
2480 adc #40
2490 sta screenad
2500 bcc oke
2510 inc screenad+1
2520 !
2530 oke dec ycount ! loop height
2540 bne do1y
2550 rts
2560 xcoord byt 0
2570 blkread byt 0
2580 xinit byt 0
2590 yinit byt 0
2600 blocknum byt 0
2610 ycount byt 0
2620 xcount byt 0
2630 ! ------------------------------
2640 !
2650 ! this routine expands a complete
2660 ! screen by calling the "expand
2670 ! a block routine" for each of the
2680 ! 32 blocks on a screen..
2690 !
2700 !it is called with a=screen number
2710 ! - simplicity it'self for you!
2720 !
2730 ! ------------------------------
2740 expascr !
2750 !
2760 ! right - what we must do
2770 ! is find the screen data address.
2780 ! each data address for a screen
2790 ! is 32 bytes long - so we must
2800 ! get (32*screen)+base
2810 ! of data addresses - ok...
2820 !
2830 ldx #0
2840 sta sad
2850 stx sad+1 ! init multiply
2860 !
2870 clc
2880 asl sad
2890 rol sad+1 ! *2
2900 asl sad
2910 rol sad+1 ! *4
2920 asl sad
2930 rol sad+1 ! *8
2940 asl sad
2950 rol sad+1 ! *16
2960 asl sad
2970 rol sad+1 ! *32
2980 !
2990 ! now to add in the base
3000 ! address of the screen data
3010 !
3020 clc
3030 lda sad
3040 adc #<screendata
3050 sta sad
3060 lda sad+1
3070 adc #>screendata
3080 sta sad+1
3090 !
3100 ! --------------------------
3110 ! wicked! - scrad/+1 holds base
3120 ! address for the screen - phew!
3130 ! ---------------------------
3140 !
3150 !
3160 stx xinit ! x coord on screen
3170 stx yinit ! y " " "
3180 stx blokc ! index in screen [131]
3190 ! [164] [135] block numbers
3200 bka !
3210 ldy blokc
3220 lda (sad),y ! [135] block in
3230 ! this screen
3240 !
3250 inc blokc ! [130] block in screen
3260 !
3270 ! bang that block [145][164] the screen !
3280 jsr [189]block
3290 !
3300 lda xinit
3310 clc
3320 adc #5 ! start [130] block
3330 ! al[145]g by 5 characters
3340 sta xinit
3350 cmp #40 ! right[171]most column
3360 ! reached
3370 !
3380 bne noxreac
3390 !
3400 ! [171][171][177] [139] x reached last column
3410 ! [167] reset x [164] 0, [175] move
3420 ! down by 5 y co[176]dinates!!
3430 !
3440 lda #0
3450 sta xinit
3460 clc
3470 lda yinit
3480 adc #5 ! down 5 chars(y)
3490 sta yinit
3500 !
3510 !
3520 cmp #20 ! check for max y coord.
3530 ! (must be a multiple of 5
3540 ! - or else !!!!)
3550 !
3560 beq [142]
3570 noxreac jmp bka
3580 !
3590 ! finally the whole screen has
3600 ! been displayed [171] sit back &
3610 ! admire your w[176]k..........
3620 !
3630 [142] !
3640 rts
3650 blokc byt 0
3660 colour byt 0
3670 !
3680 !
3690 !the addresses of block definitions
3700 ! (all 128 of them!)
3710 !
3720 blocktabad !
3730 w[176] bb,bb[170]25,bb[170]50,bb[170]75,bb[170]100,bb[170]125,bb[170]150,bb[170]175,bb[170]200,bb[170]225
3740 w[176] bb[170]250,bb[170]275,bb[170]300,bb[170]325
3750 w[176] bb[170]350,bb[170]375,bb[170]400,bb[170]425
3760 w[176] bb[170]450,bb[170]475,bb[170]500,bb[170]525
3770 w[176] bb[170]550,bb[170]575,bb[170]600,bb[170]625
3780 w[176] bb[170]650,bb[170]675,bb[170]700,bb[170]725,bb[170]750,bb[170]775,bb[170]800,bb[170]825,bb[170]850,bb[170]875
3790 w[176] bb[170]900,bb[170]925,bb[170]950,bb[170]975,bb[170]1000,bb[170]1025
3800 w[176] bb[170]1050,bb[170]1075,bb[170]1100,bb[170]1125,bb[170]1150,bb[170]1175,bb[170]1200,bb[170]1225
3810 w[176] bb[170]1250,bb[170]1275,bb[170]1300,bb[170]1325,bb[170]1350,bb[170]1375,bb[170]1400,bb[170]1425
3820 w[176] bb[170]1450,bb[170]1475,bb[170]1500,bb[170]1525,bb[170]1550,bb[170]1575,bb[170]1600,bb[170]1625
3830 w[176] bb[170]1650,bb[170]1675,bb[170]1700,bb[170]1725,bb[170]1750,bb[170]1775,bb[170]1800,bb[170]1825
3840 w[176] bb[170]1850,bb[170]1875,bb[170]1900,bb[170]1925
3850 w[176] bb[170]1950,bb[170]1975,bb[170]2000,bb[170]2025,bb[170]2050,bb[170]2075,bb[170]2100,bb[170]2125
3860 w[176] bb[170]2150,bb[170]2175,bb[170]2200,bb[170]2225,bb[170]2250,bb[170]2275,bb[170]2300,bb[170]2325
3870 w[176] bb[170]2350,bb[170]2375,bb[170]2400,bb[170]2425,bb[170]2450,bb[170]2475,bb[170]2500,bb[170]2525
3880 w[176] bb[170]2550,bb[170]2575,bb[170]2600,bb[170]2625,bb[170]2650,bb[170]2675,bb[170]2700,bb[170]2725
3890 w[176] bb[170]2750,bb[170]2775,bb[170]2800,bb[170]2825,bb[170]2850,bb[170]2875,bb[170]2900,bb[170]2925
3900 w[176] bb[170]2950,bb[170]2975,bb[170]3000,bb[170]3025,bb[170]3050,bb[170]3075,bb[170]3100,bb[170]3125
3910 w[176] bb[170]3150,bb[170]3175
3920 !
3930 ! [175] the screen addresses.....
3940 !
3950 screentable w[176] sc,sc[170]40,sc[170]80,sc[170]120,sc[170]160,sc[170]200,sc[170]240,sc[170]280,sc[170]320
3960 w[176] sc[170]360,sc[170]400,sc[170]440,sc[170]480,sc[170]520,sc[170]560,sc[170]600,sc[170]640,sc[170]680,sc[170]720
3970 w[176] sc[170]760,sc[170]800
3980 !
3990 !
4000 ! ig'89
4010 !
4020 !
4030 !