Hello,
maybe somebody could help me to understand an disassembled code for creating a dither text pattern effect in BASIC.
I disassembled a binary (poked in hex numbers) which creates a dithering pattern text if you are in Basic Interpreter modus. The code seems to change the firmware calls to the own routine. It let you type a PEN 1,x command with a second parameter without having a syntax error. It overlays a seconds dither pattern over the first with the second colour number.
It works fine on an 464 but doesn't work on 6128 which I want to adapt to.
But obviously I don't understand the disassembly complete. I tried to change the addresses relevant for a 6128 but the pattern created is wrong or doesn't fit to outcome one of a 464.
Attached there's the disassembled code.
Any help in understanding or adapting to a 6128 is very appreciated.
ORG &A300
LD A,&C3 ;&C3 = JP <Adresse>
LD (&BB90),A ;Firmware Call (TXT SET PEN #BB90) will be replace by own routine
LD HL,LA314 ;on address #A314
LD (&BB91),HL
LD A,&FF ;looking for address of character / symbol matrix
CALL &BBA5 ;Firmware Call (TXT GET MATRIX) get address of matrix either user-defined or inside Lower ROM (464 &A6F4?)
LD (LA379),HL ;save address at the end of the code
RET
;if starting the routine with a PEN x,x command A = filled with pen number and in stack there's the return address to BASIC (Upper ROM enabled)
.LA314
LD DE,&134A ;no clue about this address?
LD (&BDD4),DE ;Firmware Call (TXT WRITE CHAR #BDD3)??
POP HL
EX (SP),HL
PUSH AF
LD A,(HL) ;
CP &2C ;is there a ','?
JR NZ,LA336 ;if no, then > #A336
CALL &DD3F ;BASIC Interpreter routine (=get next token skipping space) set programm pointer to next expression and surpresses blanks
;464 #DD3f / 6128 #DE2C
CALL &C24B ;BASIC Interpreter routine stores value to A
;464 #C24B / 6128 #C271
CALL &BC2C ;Firmware Call (SCR INK ENCODE #BC2C > convert INK colour in colour mask) with INPUT A = INK number / OUTPUT A = colour mask
LD (LA378),A ;save address at the end of the code
LD DE,LA33C
LD (&BDD4),DE ;Firmware Call (TXT WRITE CHAR #BDD3)??
.LA336
POP AF
EX (SP),HL
PUSH HL
RST &08 ;RST#8 > jumps to address #B982 = 464 / #B98A = 6128
XOR C ;Byte #A9 ??
SUB D ;Byte #92 ??
.LA33C
PUSH HL
PUSH AF
CALL &134A
POP AF
CALL &BBA5 ;Firmware Call (TXT GET MATRIX)
LD B,&08 ;8 character lines
LD C,&AA ;dither pattern &x1010 1010
LD DE,(LA379)
.LA34D
LD A,(HL) ;load character line byte
AND C
LD (DE),A ;save new pattern
RLC C ;change dither pattern (bit shift rotate)
INC HL
INC DE
DJNZ LA34D ;loop until 8 lines are through
LD IX,(&B291) ;address for the background (transparent o. opaque) 464 = #B291 / 6128 = #B731
LD A,&9F ;9F = transparent modus
LD (&B291),A
LD IY,(&B28F) ;address for colour mask 464 = #B28f / 6128 = #B72F
LD A,(LA378) ;get mask
LD (&B28F),A
POP HL
LD A,&FF
CALL &134A
LD (&B291),IX ;464 = #B291 / 6128 = #B731
LD (&B28F),IY ;464 = #B291 / 6128 = #B731
RET
.LA378
NOP ;colour mask encoding
.LA379
NOP ;storage for 8 lines dithered character
NOP
NOP
NOP
NOP
NOP
NOP
NOP
no ideas?
This is the outcome of a 464 (first image / "10" colors (with 6 dithered) in mode 1) and the next is the outcome of a 6128. Still wonder where I've got a mistake in transforming the code?
I think I've made it work ???
ORG &A300
LD A,&C3 ;&C3 = JP <Adresse>
LD (&BB90),A ;Firmware Call (TXT SET PEN #BB90) will be replace by own routine
LD HL,LA314 ;on address #A314
LD (&BB91),HL
LD A,&FF ;looking for address of character / symbol matrix
CALL &BBA5 ;Firmware Call (TXT GET MATRIX) get address of matrix either user-defined or inside Lower ROM (464 &A6F4?)
LD (LA379),HL ;save address at the end of the code
RET
;if starting the routine with a PEN x,x command A = filled with pen number and in stack there's the return address to BASIC (Upper ROM enabled)
.LA314
LD DE,&134B ;no clue about this address?
LD (&BDD4),DE ;Firmware Call (TXT WRITE CHAR #BDD3)??
POP HL
EX (SP),HL
PUSH AF
LD A,(HL) ;
CP &2C ;is there a ','?
JR NZ,LA336 ;if no, then > #A336
CALL &DE2C ;BASIC Interpreter routine (=get next token skipping space) set programm pointer to next expression and surpresses blanks
;464 #DD3f / 6128 #DE2C
CALL &C271 ;BASIC Interpreter routine stores value to A
;464 #C24B / 6128 #C271
CALL &BC2C ;Firmware Call (SCR INK ENCODE #BC2C > convert INK colour in colour mask) with INPUT A = INK number / OUTPUT A = colour mask
LD (LA378),A ;save address at the end of the code
LD DE,LA33C
LD (&BDD4),DE ;Firmware Call (TXT WRITE CHAR #BDD3)??
.LA336
POP AF
EX (SP),HL
PUSH HL
RST &08 ;RST#8 > jumps to address #B982 = 464 / #B98A = 6128
db &A6 ;Byte #A9 ??
db &92 ;Byte #92 ??
.LA33C
PUSH HL
PUSH AF
CALL &134B
POP AF
CALL &BBA5 ;Firmware Call (TXT GET MATRIX)
LD B,&08 ;8 character lines
LD C,&AA ;dither pattern &x1010 1010
LD DE,(LA379)
.LA34D
LD A,(HL) ;load character line byte
AND C
LD (DE),A ;save new pattern
RLC C ;change dither pattern (bit shift rotate)
INC HL
INC DE
DJNZ LA34D ;loop until 8 lines are through
LD IX,(&B731) ;address for the background (transparent o. opaque) 464 = #B291 / 6128 = #B731
LD A,&A0 ;9F = transparent modus
LD (&B731),A
LD IY,(&B72F) ;address for colour mask 464 = #B28f / 6128 = #B72F
LD A,(LA378) ;get mask
LD (&B72F),A
POP HL
LD A,&FF
CALL &134B
LD (&B731),IX ;464 = #B291 / 6128 = #B731
LD (&B72F),IY ;464 = #B291 / 6128 = #B731
RET
.LA378
NOP ;colour mask encoding
.LA379
NOP ;storage for 8 lines dithered character
NOP
NOP
NOP
NOP
NOP
NOP
NOP
Pen x,0 is also valid
Hey Urusergi,
[/size]I've seen that you have changed some values. [/size] [/size]I wasn't aware of the different transparence mode from 464 to 6128.
[/size]Now it works!!
[/size]Thank you very much for your help.
[/size]Merry christmas!