the program consists of 4 parts part 1 is the basic program which loads at address $1C01 part 2 is the setup routine which is at address $1D00 part 3 is the poke translation routine which is at address $1E00, and relocated to $0400 part 4 is the peek translation routine which is at address $2000, and relocated to $0600 basic part: 10 bank0 20 graphic5,1 30 fast 40 poke53280,0 50 color5,14 60 sys7424 70 print"PET EMULATOR FOR C128 BY BLACKY STARDUST" 80 clr 90 new start: (load $1D00, orig $1D00) sei ldx #$00 stx $2F stx $31 stx $33 stx $35 stx $39 ldx #$10 stx $30 stx $32 stx $34 ldx #$05 stx $D506 ldx #$00 transferloop: lda $1E00,x sta $0400,x lda $1F00,x sta $0500,x lda $2000,x sta $0600,x lda $2100,x sta $0700,x inx bne transferloop ldx #$4C stx $02B0 stx $02A2 ldx #$00 stx $02B1 stx $02A3 ldx #$04 stx $02B2 ldx #$06 stx $02A4 ldx #$4C stx $0380 ldx #$00 stx $0381 ldx #$07 stx $0382 ldx #$EA stx $0383 cli rts pokestart: (load $1E00, orig $0400) lda $FF00 sta tempmmu lda $7F beq otherbankpoke cpx #$3F beq checkpoke otherbankpoke: lda $FF00 jmp $02B3 tempa: .byte $00 tempx: .byte $00 tempy: .byte $00 tempmmu: .byte $00 checkpoke: sta tempa stx tempx sty tempy ldx 02B9 stx pokein+1 inx stx pokein2+1 pokein: ldy $00 pokein2: ldx $00 cpx #$80 bcc checknextpoke cpx #$88 bcc doscreenpoke checknextpoke: cpx #$00 beq checkzppoke cpx #$02 beq checkkeypoke cpx #$01 beq ignorepoke cpx #$03 beq ignorepoke cpx #$E8 beq checksoundpoke cpx #$E7 bcs ignorepoke normalpoke: lda #$3F sta $FF00 txa clc adc #$18 sta storeit+2 sty storeit+1 pla storeit: sta $0000 ldx tempmmu stx $FF00 rts doscreenpoke: jmp dorealscreenpoke checksoundpoke: jmp checkrealsoundpoke checkzppoke: cpy #$9E beq ndxpoke cpy #$C4 beq pnt1poke cpy #$C5 beq pnt2poke cpy #$C6 beq pntrpoke cpy #$D8 beq cursypoke ignorepoke: pla rts ndxpoke: pla sta $D0 rts pnt1poke: pla sta $E0 rts pnt2poke: pla sta $E1 rts pntrpoke: pla sta $EC rts cursypoke: pla sta $EB rts checkkeypoke: cpy #$6F bcc ignorepoke cpy #$79 bcs ignorepoke keypoke: tya sec sbc #$25 sta storekey+1 pla storekey: sta $034A rts dorealscreenpoke: txa sec sbc #$80 tax pla jsr pokevdcbyte ldx tempmmu stx $FF00 rts putvdcreg: stx $D600 putvdcregloop: bit $D600 bpl putvdcregloop sta $D601 rts getvdcreg: stx $D600 getvdcregloop: bit $D600 bpl getvdcregloop lda $D601 rts pokevdcbyte: pha lda #$3E sta $FF00 txa ldx #$12 jsr putvdcreg tya ldx #$13 jsr putvdcreg pla ldx #$1F jmp putvdcreg soundon: .byte $00 checkrealsoundpoke: cpy #$4B beq checksoundonvalue cpy #$48 beq checkfrequency jmp normalpoke checksoundonvalue: pla cmp #$10 beq turnonsound cmp #$00 beq turnoffsound rts turnonsound: ldx #$3E stx $FF00 ldx #$FF stx $D400 ldx #$08 stx $D403 ldx #$00 stx $D405 ldx #$F0 stx $D406 ldx #$41 stx $D404 ldx #$0F stx $D418 ldx #$01 stx soundon back: ldx tempmmu stx $FF00 rts turnoffsound: ldx #$3E stx $FF00 ldx #$00 stx $D418 stx soundon jmp back checkfrequency: ldx #$3E stx $FF00 pla cmp #$00 bne pokefreq sta $D418 jmp back pokefreq: sta freqvalue+1 lda #$FF sec freqvalue: sbc #$00 sta $D401 ldx soundon cpx #$01 bne back ldx #$0F stx $D418 jmp back peekstart: (load $2000, orig $0600) lda $FF00 sta tempmmu lda $7F beq otherbankpeek cpx #$3F beq checkpeek otherbankpeek: lda $FF00 jmp $02A5 tempa: .byte $00 tempx: .byte $00 tempy: .byte $00 tempmmu: .byte $00 checkpeek: sta tempa stx tempx sty tempy ldx $02AA stx peekin+1 inx stx peekin2+1 peekin: ldy $00 peekin2: ldx $00 cpx #$80 bcc checknextpeek cpx #$88 bcc doscreenpeek checknextpeek: cpx #$00 beq checkzppeek cpx #$02 beq checkkeypeek normalpeek: txa clc adc #$18 sta peekit+2 sty peekit+1 lda #$3F sta $FF00 peekit: lda $0000 ldx tempmmu stx $FF00 rts doscreenpeek: jmp dorealscreenpeek checkzppeek: cpy #$34 beq memsiz1peek cpy #$35 beq memsiz2peek cpy #$8D beq time1peek cpy #$8E beq time2peek cpy #$8F beq time3peek cpy #$9E beq ndxpeek cpy #$C4 beq pnt1peek cpy #$C5 beq pnt2peek cpy #$C6 beq pntrpeek cpy #$D5 beq linelenpeek cpy #$D8 beq cursypeek jmp normalpeek memsiz1peek: lda #$00 rts memsiz2peek: lda #$80 rts time1peek: lda $A0 rts time2peek: lda $A1 rts time3peek: lda $A2 rts ndxpeek: lda $D0 rts pnt1peek: lda $E0 rts pnt2peek: lda $E1 rts pntrpeek: lda $EC rts linelenpeek: lda #$4F rts cursypeek: lda $EB rts checkkeypeek: cpy #$6F bcc jmpnormalpeek cpy #$79 bcc keypeek jmpnormalpeek: jmp normalpeek keypeek: tya sec sbc #$25 sta dokey+1 dokey: lda $034A rts dorealscreenpeek: txa sec sbc #$80 tax jsr peekvdcbyte ldx tempmmu stx $FF00 rts peekvdcbyte: lda #$3E sta $FF00 txa ldx #$12 jsr putvdcreg tya ldx #$13 jsr putvdcreg ldx #$1f jmp getvdcreg