Both programs honor different principles, at least.KingTrode wrote:Though with only a few weeks experience under my belt, mine will likely fall far short of yours.
While yours surely is intended as standalone program, my implementation forms part of a batch suite surrounding MINIPAINT - this way the editor is already written, it "just" remains to implement the data transformation routines (i.e. between ROM font -> MG picture <-> charset binary).
Continuing on this, the next iteration (download):
Code: Select all
10 POKE55,0:POKE56,63:CLR:S=16128
11 FORT=STOS+113:READA:POKET,A:NEXT
12 @ON:@CLR
13 X1=15:Y1=31
14 X2=144:Y2=160
15 GOSUB21
16 SYSS
17 @SAVE"CHARSET",8
18 @RETURN
19 END
20 :
21 @1,X1,Y1TOX2,Y1
22 @1,X2,Y1TOX2,Y2
23 @1,X2,Y2TOX1,Y2
24 @1,X1,Y2TOX1,Y1
25 RETURN
26 :
27 DATA 169,128,44,169,136,133,252,169,0,133,251,169,97,141,248,2,169,63,141
28 DATA 249,2,32,30,63,32,39,63,76,39,63,169,160,133,253,169,18,133,254,96,160
29 DATA 8,152,72,162,16,160,8,32,94,63,230,253,208,2,230,254,136,208,244,24,165
30 DATA 253,105,184,133,253,165,254,105,0,133,254,202,208,226,104,168,56,165
31 DATA 253,233,248,133,253,165,254,233,11,133,254,136,208,204,96,108,248,2,152
32 DATA 72,160,0,177,251,145,253,104,168,230,251,208,2,230,252,96
So, what's within the DATA lines?
I've transferred the 3 FOR loops to ML. A "driver" routine generates the necessary (non-contiguous) addresses within the screen bitmap, as another pointer is simply increasing through the ROM data. A small client routine does the actual transfer of a single byte.
It might look a bit strange at first, but the same driver routine can be re-used when a charset binary is saved, or loaded to/from disc, or the reverse bottom half is generated from the top half - simply by providing another client routine, and putting another pointer to the new client in ($02F8).
Code: Select all
DIM code 4096
FOR pass=4 TO 7 STEP 3
P%=&3F00:O%=code
[OPT pass
.Upper
LDA #128
EQUB &2C
.Lower
LDA #136
STA &FC
LDA #0
STA &FB
LDA #ROMChars MOD 256
STA &02F8
LDA #ROMChars DIV 256
STA &02F9
JSR Init
JSR Driver
JMP Driver
.Init
LDA #(4352+192*2+32) MOD 256
STA &FD
LDA #(4352+192*2+32) DIV 256
STA &FE
RTS
.Driver
LDY #8
.Driver_00
TYA
PHA
LDX #16
.Driver_01
LDY #8
.Driver_02
JSR Xfer
INC &FD
BNE Driver_03
INC &FE
.Driver_03
DEY
BNE Driver_02
CLC
LDA &FD:ADC #(192-8) MOD 256:STA &FD
LDA &FE:ADC #(192-8) DIV 256:STA &FE
DEX
BNE Driver_01
PLA
TAY
SEC
LDA &FD:SBC #(16*192-8) MOD 256:STA &FD
LDA &FE:SBC #(16*192-8) DIV 256:STA &FE
DEY
BNE Driver_00
RTS
.Xfer
JMP (&02F8)
.ROMChars
TYA
PHA
LDY #0
LDA (&FB),Y
STA (&FD),Y
PLA
TAY
INC &FB
BNE ROMChars_00
INC &FC
.ROMChars_00
RTS
]
NEXT