Post by jmpff3d on Oct 26, 2018 13:03:48 GMT
It is the Era of Emulation, so we can play with the roms a little more these days without hoping a promenade c1 burner or cheap chinese usb burner falls onto our laps ... or hope that someone figures out how to do a proper flashrom replacement that can be programmed in-place from the Commodore itself !
HOWTO:
1) prepare and edit 155 characters of PETSCII for use as new EasterEgg (if someone wishes to create an editor for this, be my guest)
--- the easteregg decrypt routine in C-128 will display bytes inline through $FFD2 ..and NOT as a screen map or screen capture -- arrange your display bytes accordingly
2) convert the new PETSCII EasterEgg into raw hexbytes (C-128 BASIC / ML Monitor can be used for hexbyte generation), save hexbytes for conversion by nodeJS script
3) set up nodeJS on your system
4) run the nodeJS script in the pastebin link below
5) dump your raw EasterEgg hexbytes into the script, and it will generate a new basichi rom for you containing your new EasterEgg in crypted form
6) install new basichi rom or romfile (emu)
7) on C-128 (or emu), SYS 32800,123,45,6 as before and watch your new EasterEgg be displayed !
A new sample EasterEgg (using PETSCII graphics geared for reddit c128, where I first posted this) is included within the script, available by hitting X + ENTER
nodeJS: nodejs.org/en/download/
EasterEgg Replacement Script: pastebin.com/RG5hk6K5
Full easteregg zip package available at: csdb.dk/release/?id=170660
BASIC v7 program that will decrypt easteregg hexbytes from ROM to memory and screen, for 'somewhat easier' 'editing' in ML Monitor (and copy/paste with emulator):
Additional Documentation:
HOWTO:
1) prepare and edit 155 characters of PETSCII for use as new EasterEgg (if someone wishes to create an editor for this, be my guest)
--- the easteregg decrypt routine in C-128 will display bytes inline through $FFD2 ..and NOT as a screen map or screen capture -- arrange your display bytes accordingly
2) convert the new PETSCII EasterEgg into raw hexbytes (C-128 BASIC / ML Monitor can be used for hexbyte generation), save hexbytes for conversion by nodeJS script
3) set up nodeJS on your system
4) run the nodeJS script in the pastebin link below
5) dump your raw EasterEgg hexbytes into the script, and it will generate a new basichi rom for you containing your new EasterEgg in crypted form
6) install new basichi rom or romfile (emu)
7) on C-128 (or emu), SYS 32800,123,45,6 as before and watch your new EasterEgg be displayed !
A new sample EasterEgg (using PETSCII graphics geared for reddit c128, where I first posted this) is included within the script, available by hitting X + ENTER
nodeJS: nodejs.org/en/download/
EasterEgg Replacement Script: pastebin.com/RG5hk6K5
Full easteregg zip package available at: csdb.dk/release/?id=170660
BASIC v7 program that will decrypt easteregg hexbytes from ROM to memory and screen, for 'somewhat easier' 'editing' in ML Monitor (and copy/paste with emulator):
10 rem this program reads easteregg from ROM, decrypts to plaintext, saves to memory at $1300 and dumps egg as char/hexbyte strings
20 lc=4863:fori=1to155:x=i:y=peek(44643+i):x=xor(x,y):a=xor(y,x):y=123:x=xor(x,y):y=0:a=xor(y,x):rem y=0 for plaintext
30 printchr$(x);:pokelc+i,a:nexti:print:print
40 a$="":fori=1to155:cc=cc+1:x=peek(lc+i):x$=right$(hex$(x),2)
50 print using "##";x$;:next
60 print:end
Additional Documentation:
Original EasterEgg crypted PETSCII Character HexBytes -- easily available in c128 basichi romfile @ vice x128 emulator
E9776A5F5E5DBE213D24373F225520244A30273A4E2F354D4C4F404746686988151F0C081F0F19695F71960513117489051E0D01436D980610131967941C05753719EE70701DF96166667979733839E36F7B6C786F7F69192F01E26E6A05EC5E485D153FDA5C4A5632D9514E585C51062ACF5A4E40462CD3434D414E470809E936B0B6B4DEBCAEBEA1DDB4B8B8D2A0CBA7A8A3AACEB9A4A6AFCFED
; The Famous C-128 SYS 32800,123,45,6 EasterEgg Decrypt/Display code.
; One enters the code with parameters A = 123, X = 45, and Y = 6.
;
; EasterEgg Replacement Script reverse-engineered from here.
;
; 8020: STA $70 ; Save key #1 value (A = 123 decimal)
; 8022: TYA ; Transfer key #2 (Y = 6) to the accumulator
; 8023: SEC ; clear the carry flag, for new subtraction
; 8024: SBC #$05 ; subtract 5 from accumulator, so that key #2 becomes '1'
; 8026: STA $71 ; save key #2 back to accumulator
; 8028: LDA $71 ; get key #2 (Y = 1 at first, incremented later)
; 802A: EOR $AE37,X ; Generate first seed by 'EOR'ing key #2 with crypted 155 byte easteregg datablock in memory (X = 45)
; 802D: EOR $70 ; Generate decrypted petscii value by 'EOR'ing key #2 with key #1 (A = 123)
; 802F: BEQ $8075 ; if the petscii value is equal to zero, then branch to $8075 - routine is finished because $8075 holds RTS
; 8031: JSR $FFD2 ; print the decryped petscii character to screen
; 8034: INC $71 ; increment key #2 by one in zero page (so that Y = 2 .. 3 .. 4 .. 5 .. etc)
; 8036: INX ; continue until a value of zero is found or until the X register overflows
; 8037: BNE $8028 ; not zero yet, branch back to now-incremented key #2 value in zero page at #8028
; 8039: RTS ; return from subroutine
**
; 8075: RTS ; no clue why branch at $802f hits RTS here, instead of RTS at $8039