nhp 2 56 by parche negro

Sistema de conversor para archivos xex a audio, creado por Parche Negro Soft en los años 80 y uno de los más usados en su tiempo.

Parche Negro como ya todos lo conocemos, creo este sistema de conversior de archivos a cinta de casetes en los años 80.

HISTORIA

Uno de los precursores del sistema de recuperación de errores, mas conocido como «RETROCEDA 3 VUELTAS».

Un día me comento, que para realizar este copiador estuvo, por lo menos 6 meses de estudio del mapping de atari, para comprender el comportamiento de este.

Dentro de pruebas y fallos logro crear y armar el conocido NHP(No Hay Problema), que viene del comentario del personaje ALF de la televisión.

DESAMBLE

Este sistema, contiene en su interior un sistema de encriptación de código para cargar y grabar la data en la cinta, como medio de protección.

ANTIPIRATERÍA

Contaba con dos etapas, la de encriptar los bytes y la segunda, la protección de su nick para que no fuera cambiado y el sistema quedara con su nick.

CÓDIGOS FUENTES

El casete era de grabado de la siguiente forma:

a) 1er bloque pagina $2000, que contenía el display list que mostraba — PRISMA —

b) 2do bloque, pagina $0400, que contenía el largo de bytes que se necesitan para cargar el loader en memoria.

c) Loader, contiene la pantalla de carga para recuperar los bytes y almacenarlos en pantalla y también el sistema recuperador de errors.

PAGINA $2000

Este es el primer bloque en la cinta, con 131 bytes

	ORG $2000
START
	.BYTE $00,$01
	.WORD START,PANTALLA
	LDX $0230
	LDY $0231
	STX $BFFC
	STY $BFFD
	LDX # <DLIST
	LDY # >DLIST
	LDA #$00
	STX $0230
	STX $D402
	STY $0231
	STY $D403
	STA $41
	JMP $0400
	.BYTE "  Por Parche Negro Soft  "
DLIST
	.BYTE $70,$70,$70,$70,$70,$70,$70,$70
	.BYTE $70,$70,$70,$70,$70,$70,$47
	.WORD SHOW
	.BYTE $41
	.WORD DLIST
SHOW
	.SBYTE "  --   PRISMA   --  "
PANTALLA
	LDX $BFFC
	LDY $BFFD
	STX $0230
	STY $0231
	JMP ($0304)

PAGINA $0400

Este es el 2do bloque en la cinta, con 131 bytes

GENDAT = $47
;
	ORG $03FD
	.BYTE $55,$55,$FE
    LDA $D301
    AND #$02
    BEQ ERROR
    LDA FIN
    STA GENDAT
    LDX #$0B
MOVE
    LDA SIOV,X
    STA $0300,X
    DEX
    BPL MOVE
    JSR $E459
    BMI ERROR
    CLC
    RTS
ERROR
    LDX $BFFC
    LDY $BFFD
    STX $0230
    STY $0231
    LDY #$00
LER
    LDA TABLA,Y
    STA ($58),Y
    INY
    CPY #27
    BNE LER
    LDA #$3C
    STA $D302
LOOP
    BNE LOOP
TABLA
    .SBYTE "ERROR !!! CARGUE NUEVAMENTE"
SIOV
    .BYTE $60,$00,$52,$40
    .WORD $06FE
    .BYTE $23,$00
    .WORD $AAAA
    .BYTE $00,$80
FIN

LOAD

Este es el tercer y mas largo bloque en la cinta, con aproximadamente 860 bytes. En este caso, es el que se adjunta, en wudsn.

LOAD
	.BYTE $55,$55,162,$00,$9a,$8e,$44,$02
	.BYTE $e8,$86,$09,$20,$5f,$09,$4c,$e6
	.BYTE $08,$fc,$00,$00,$00,$60,$00,$52
	.BYTE $40,$5f,$09,$23,$00,$00,$01,$00
	.BYTE $80,$70,$70,$70,$47,$3e,$07,$70
	.BYTE $02,$70,$02,$70,$70,$70,$70,$70
	.BYTE $70,$70,$70,$70,$70,$70,$70,$70
	.BYTE $46,162,$07,$70,$02,$41,$1f,$07
	.BYTE $00,$00,$00,$00,$00,$00,$00,$f0
	.BYTE $f2,$e9,$f3,$ed,$e1,$00,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$00,$00
	.BYTE $30,$32,$2f,$27,$32,$21,$2d,$21
	.BYTE $33,$00,$30,$21,$32,$21,$00,$2d
	.BYTE $29,$23,$32,$2f,$23,$2f,$2d,$30
	.BYTE $35,$34,$21,$24,$2f,$32,$25,$33
	.BYTE $00,$00,$00,$00,$00,$00,$00,$00
	.BYTE $00,$00,$00,$21,$34,$21,$32,$29
	.BYTE $00,$23,$2f,$2e,$00,$33,$29,$33
	.BYTE $34,$25,$2d,$21,$00,$80,$ae,$8e
	.BYTE $a8,$8e,$b0,$8e,$80,$00,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$00,$00
	.BYTE $00,$00,$00,$00,$00,$23,$61,$72
	.BYTE $67,$61,$72,$61,$00,$64,$65,$6e
	.BYTE $74,$72,$6f,$00,$64,$65,$00,$00
	.BYTE $00,$00,$00,34,$6c,$6f,$71,$75
	.BYTE $65,$73,$0e,$00,$00,$00,$00,$00
	.BYTE $00,$00,$0d,$00,$00,$25,$00,$32
	.BYTE $00,$32,$00,$2f,$00,$32,$00,$00
	.BYTE $0d,$00,$00,$00,$00,$32,$65,$74
	.BYTE $72,$6f,$63,$65,$64,$61,$00,$13
	.BYTE $00,$76,$75,$65,$6c,$74,$61,$73
	.BYTE $00,$79,$00,$70,$72,$65,$73,$69
	.BYTE $6f,$6e,$65,$00,$80,$b3,$b4,$a1
	.BYTE $b2,$b4,$80,$00,162,$1f,$a0,$07
	.BYTE $ad,$c8,$02,$8e,$30,$02,$8e,$02
	.BYTE $d4,$8c,$31,$02,$8c,$03,$d4,$8d
	.BYTE $c6,$02,$8d,$18,$d0,$60,$a9,$3c
	.BYTE $8d,$02,$d3,$a9,$fd,$20,$b0,$f2
	.BYTE $20,$1a,$08,162,$de,$a0,$07,$8e
	.BYTE $37,$07,$8c,$38,$07,$ad,$1f,$d0
	.BYTE $c9,$06,$d0,$f9,$20,$62,$08,162
	.BYTE 162,$a0,$07,$8e,$37,$07,$8c,$38
	.BYTE $07,$4c,$90,$08,$a9,$34,$8d,$02
	.BYTE $d3,162,$10,$8e,$1c,$02,$ae,$1c
	.BYTE $02,$d0,$fb,162,$fd,$86,$14,$ad
	.BYTE $0f,$d2,$29,$10,$f0,$f5,$a6,$14
	.BYTE $d0,$f5,$60,$cc,$0f,$07,$f0,$0a
	.BYTE $98,$59,$62,$09,$45,$47,$e6,$47
	.BYTE $c8,$60,$ad,$0b,$d4,$d0,$fb,$ad
	.BYTE $54,$09,$f0,$41,162,$0b,$bd,$13
	.BYTE $07,$9d,$00,$03,$ca,$10,$f7,$20
	.BYTE $59,$e4,$30,$8a,$ad,$61,$09,$cd
	.BYTE $54,$09,$90,$82,$f0,$03,$4c,$9a
	.BYTE $08,$ad,$5e,$0a,$8d,$0f,$07,162
	.BYTE $02,$bd,$cd,$07,$c9,$10,$d0,$08
	.BYTE $a9,$19,$9d,$cd,$07,$ca,$10,$f1
	.BYTE $de,$cd,$07,$ce,$54,$09,$a0,$00
	.BYTE $84,$4d,$4c,$81,$08,162,$00,$9a
	.BYTE $a9,$3c,$8d,$02,$d3,$6c,$e0,$02
	.BYTE $ac,$0f,$07,$20,$81,$08,$8d,$0c
	.BYTE $09,$20,$81,$08,$8d,$0d,$09,$2d
	.BYTE $0c,$09,$c9,$ff,$f0,$ed,$20,$81
	.BYTE $08,$8d,$11,$07,$20,$81,$08,$8d
	.BYTE $12,$07,$20,$81,$08,$8d,$ff,$ff
	.BYTE $ad,$0c,$09,$cd,$11,$07,$d0,$08
	.BYTE $ad,$0d,$09,$cd,$12,$07,$f0,$0b
	.BYTE $ee,$0c,$09,$d0,$03,$ee,$0d,$09
	.BYTE $4c,$08,$09,$ad,$e2,$02,$0d,$e3
	.BYTE $02,$f0,$b8,162,$f0,$9a,$8c,$10
	.BYTE $07,$20,$4c,$09,$20,$62,$08,$ac
	.BYTE $10,$07,162,$00,$9a,$8e,$e2,$02
	.BYTE $8e,$e3,$02,$4c,$e9,$08,$a9,$3c
	.BYTE $8d,$02,$d3,$6c,$e2,$02,$00,$00
	.BYTE $00,$00,$00,$00,$00,$00,$00,$00
	.BYTE $00,162,$0b,$bd,$ac,$09,$9d,$00
	.BYTE $03,$ca,$10,$f7,$20,$59,$e4,$10
	.BYTE $03,$4c,$77,$e4,162,$13,$bd,$ae
	.BYTE $09,$9d,162,$07,$ca,$10,$f7,162
	.BYTE $02,$bd,$c2,$09,$9d,$cd,$07,$ca
	.BYTE $10,$f7,162,$03,$a0,34,$ad,$c5
	.BYTE $09,$86,$41,$8c,$2f,$02,$8c,$00
	.BYTE $d4,$8d,$54,$09,162,$00,$8a,$9d
	.BYTE $00,$04,$e8,$10,$fa,$8d,$fe,$06
	.BYTE $8d,$ff,$06,$4c,$1a,$08,$60,$00
	.BYTE $52,$40,$ac,$09,$23,$00,$1a,$00
	.BYTE $00,$80
PAG7
	.BYTE $00,$01,$00,$20,$6a,$20,$ae,$30
	.BYTE $02,$ac,$31,$02,$8e,$fc,$bf,$8c
	.BYTE $fd,$bf,162,$42,$a0,$20,$a9,$00
	.BYTE $8e,$30,$02,$8e,$02,$d4,$8c,$31
	.BYTE $02,$8c,$03,$d4,$85,$41,$4c,$00
	.BYTE $04,$a0,$a0,$d0,$ef,$f2,$a0,$d0
	.BYTE $e1,$f2,$e3,$e8,$e5,$a0,$ce,$e5
	.BYTE $e7,$f2,$ef,$a0,$d3,$ef,$e6,$f4
	.BYTE $a0,$a0,$70,$70,$70,$70,$70,$70
	.BYTE $70,$70,$70,$70,$70,$70,$70,$70
	.BYTE $47,$56,$20,$41,$42,$20,$00,$00
	.BYTE $0d,$0d,$00,$00,$00,$30,$32,$29
	.BYTE $33,$2d,$21,$00,$00,$00,$0d,$0d
	.BYTE $00,$00,$ae,$fc,$bf,$ac,$fd,$bf
	.BYTE $8e,$30,$02,$8c,$31,$02,$6c,$04
	.BYTE $03
PAG4
	.BYTE $55,$55,$fe,$ad,$01,$d3,$29,$02
	.BYTE $f0,$17,$ad,$64,$04,$85,$47,162
	.BYTE $0b,$bd,$58,$04,$9d,$00,$03,$ca
	.BYTE $10,$f7,$20,$59,$e4,$30,$02,$18
	.BYTE $60,$ae,$fc,$bf,$ac,$fd,$bf,$8e
	.BYTE $30,$02,$8c,$31,$02,$a0,$00,$b9
	.BYTE $3d,$04,$91,$58,$c8,$c0,$1b,$d0
	.BYTE $f6,$a9,$3c,$8d,$02,$d3,$d0,$fe
	.BYTE $a5,$b2,$b2,$af,$b2,$80,$81,$81
	.BYTE $81,$00,$23,$21,$32,$27,$35,$25
	.BYTE $00,$2e,$35,$25,$36,$21,$2d,$25
	.BYTE $2e,$34,$25,$60,$00,$52,$40,$fe
	.BYTE $06,$23,$00
	.WORD LLOAD
	.BYTE $00,$80
@GENDAT
	.BYTE 0
ESPSIO
    .BYTE $55,$55
NME
    .BYTE "...................."
BLQ
    .BYTE "..."
PFIN
    .BYTE 0

Y este es el código fuente desamblado de load.

BAFER = PFIN+11
GENDAT = $47
;
	ORG $06FE
	.BYTE $55,$55
    LDX #$00
    TXS
    STX 580
    INX
    STX $09
    JSR ?PFIN
    JMP START
NBYTES
    .BYTE 252
FLAGY
    .BYTE 0
FINISH
    .BYTE 0,0
SIOV
    .BYTE $60,$00,$52,$40
    .WORD BAFER
    .BYTE $23,$00
    .WORD $0100
    .BYTE $00,$80
DLIST
    .BYTE "ppp",$47
    .WORD MENSAJE
    .BYTE $70,$02,$70,$02,"pp"
    .BYTE "pppppp"
    .BYTE "ppppp",$46
DLERR
    .WORD NAME
    .BYTE $70,$02,$41
    .WORD DLIST
MENSAJE
    .SBYTE "       prisma       "
    .SBYTE "    PROGRAMAS PARA MICROCOMPUTADORES    "
    .SBYTE "       ATARI CON SISTEMA  N.H.P.        "
NAME
    .SBYTE "                    "
    .SBYTE "     Cargara dentro de "
CONTADOR
    .SBYTE "    Bloques.     "
MERR
    .SBYTE "  -  E R R O R  -   "
    .SBYTE " Retroceda 3 vueltas y presione  START  "
CDL
    LDX # <DLIST
    LDY # >DLIST
    LDA $02C8
    STX $0230
    STX $D402
    STY $0231
    STY $D403
    STA $02C6
    STA $D018
    RTS
ERROR
    LDA #$3C
    STA $D302
    LDA #$FD
    JSR $F2B0
    JSR CDL
    LDX # <MERR
    LDY # >MERR
    STX DLERR
    STY DLERR+1
VUELTA
    LDA 53279
    CMP #$06
    BNE VUELTA
    JSR SEARCH
    LDX # <NAME
    LDY # >NAME
    STX DLERR
    STY DLERR+1
    JMP GRAB
SEARCH
    LDA #$34
    STA $D302
    LDX #$10
    STX $021C
SPEED
    LDX $021C
    BNE SPEED
SIGUE
    LDX #$FD
    STX $14
BUSCA
    LDA $D20F
    AND #$10
    BEQ SIGUE
    LDX $14
    BNE BUSCA
    RTS
GBYTE
    CPY NBYTES
    BEQ GRAB
    TYA
    EOR BAFER+3,Y
    EOR GENDAT
    INC GENDAT
    INY
    RTS
GRAB
    LDA $D40B
    BNE GRAB
    LDA PFIN
    BEQ BYE
?GRAB
    LDX #$0B
MSIO
    LDA SIOV,X
    STA $0300,X
    DEX
    BPL MSIO
    JSR $E459
    BMI ERROR
    LDA BAFER+2
    CMP PFIN
    BCC ERROR
    BEQ RETURN
    JMP ?GRAB
RETURN
    LDA BAFER+255
    STA NBYTES
    LDX #$02
C01
    LDA CONTADOR,X
    CMP #$10
    BNE C02
    LDA #$19
    STA CONTADOR,X
    DEX
    BPL C01
C02
    DEC CONTADOR,X
    DEC PFIN
    LDY #$00
    STY 77
    JMP GBYTE
BYE
    LDX #$00
    TXS
    LDA #$3C
    STA $D302
    JMP ($02E0)
START
    LDY NBYTES
LOOP
    JSR GBYTE
    STA MEMORY+1
    JSR GBYTE
    STA MEMORY+2
    AND MEMORY+1
    CMP #$FF
    BEQ LOOP
    JSR GBYTE
    STA FINISH
    JSR GBYTE
    STA FINISH+1
MBTM
    JSR GBYTE
MEMORY
    STA $FFFF
    LDA MEMORY+1
    CMP FINISH
    BNE OK
    LDA MEMORY+2
    CMP FINISH+1
    BEQ VERFIN
OK
    INC MEMORY+1
    BNE NIM
    INC MEMORY+2
NIM
    JMP MBTM
VERFIN
    LDA $02E2
    ORA $02E3
    BEQ LOOP
    LDX #$F0
    TXS
    STY FLAGY
    JSR RINIT
    JSR SEARCH
    LDY FLAGY
    LDX #$00
    TXS
    STX $02E2
    STX $02E3
    JMP LOOP
RINIT
    LDA #$3C
    STA $D302
    JMP ($02E2)
PFIN
    .BYTE 0,0,0,0,0,0,0,0,0,0,0
?PFIN
    LDX #$0B
MNANB
    LDA DSIO,X
    STA $0300,X
    DEX
    BPL MNANB
    JSR $E459
    BPL POND
    JMP $E477
POND
    LDX #19
MNAME
    LDA DSIO+2,X
    STA NAME,X
    DEX
    BPL MNAME
    LDX #$02
MBLOQ
    LDA DSIO+22,X
    STA CONTADOR,X
    DEX
    BPL MBLOQ
    LDX #$03
    LDY #$22
    LDA DSIO+25
    STX 65
    STY 559
    STY $D400
    STA PFIN
    LDX #$00
    TXA
CLP4
    STA $0400,X
    INX
    BPL CLP4
    STA $06FE
    STA $06FF
    JMP CDL
DSIO
    .BYTE $60,$00,$52,$40
    .WORD DSIO
    .BYTE $23,$00
    .WORD 26
    .BYTE $00,$80

CODIGO FUENTE NHP 2.56

PCRSR 	= $CB
ORG 	= PCRSR
SVMSC 	= $58
POSXY 	= $54
BAFER 	= 16384
LENGHT 	= BAFER
FR0 	= $D4
CIX 	= $F2
AFP 	= $D800
IFP 	= $D9AA
FPI 	= $D9D2
FASC 	= $D8E6
ZFR0 	= $DA44
FDIV 	= $DB28
FMUL 	= $DADB
FMOVE 	= $DDB6
INBUFF 	= $F3
LBUFF 	= $0580
LLOAD 	= PAG7-LOAD
LAUTO 	= PAG4-PAG7
BL4 	= LAUTO/128
LAST 	= LAUTO-128*BL4
GENDAT 	= $47
MDAT 	= $44
;
	ORG $2000
@LLOAD
	.BYTE 0,0
RY
	.BYTE 0,0
LEN
	.BYTE 0,0
CONT
	.BYTE 0,0
STARTF
	.BYTE 0,0
FINISH
	.BYTE 0,0
@BL4
	.BYTE 0
?FILE
	.BYTE 'D:'
??FILE
	.BYTE '                    '
BBLQS
	.BYTE "000",$9B
ALL
	.BYTE 'D:*.*',$9B
DNHP
	.BYTE $60,$00,$50,$80
    .WORD ??DIR
    .BYTE $35,$00,$00,$01,$00,$80
BAKBYT
	.SB "00000"
BAKBLQ
	.SB "000"
RESTORE
	LDY #19
?RESTORE
	LDA #$20
    STA ??FILE,Y
    LDA #$00
    STA NAME,Y
    STA FILE,Y
    DEY
    BPL ?RESTORE
    LDY #23
??RESTORE
	LDA #$00
    STA CRSR,Y
    DEY
    BPL ??RESTORE
    LDY #34
???RESTORE
	LDA #$00
    STA FILE,Y
    DEY
    BPL ???RESTORE
    LDA #63
    STA CRSR
    STA FILE
    LDA #$10
    LDY #$04
RESNUM
	STA BYTES,Y
    DEY
    BPL RESNUM
    STA BLOQUES
    STA BLOQUES+1
    STA BLOQUES+2
    RTS
@PARCHE
	.SB +128,"by parche negro soft"
ASCINT
	CMP #32
    BCC ADD64
    CMP #96
    BCC SUB32
    CMP #128
    BCC REMAIN
    CMP #160
    BCC ADD64
    CMP #224
    BCC SUB32
    BCS REMAIN
ADD64
    CLC
    ADC #64
    BCC REMAIN
SUB32
    SEC
    SBC #32
REMAIN
	RTS
CLS
    LDX #<??DIR
    LDY #>??DIR
    STX PCRSR
    STY PCRSR+1
    LDY #$00
    LDX #$00
?CLS
    LDA #$00
    STA (PCRSR),Y
    INY
    BNE ??CLS
    INX
    INC PCRSR+1
??CLS
    CPY #104
    BNE ?CLS
    CPX #$01
    BNE ?CLS
    RTS
OPEN
    LDX #$10
    LDA #$03
    STA $0342,X
    LDA #<?FILE
    STA $0344,X
    LDA #>?FILE
    STA $0345,X
    LDA #$04
    STA $034A,X
    LDA #$80
    STA $034B,X
    JSR $E456
    DEY
    BNE DIR
    RTS
CLOSE
    LDX #$10
    LDA #$0C
    STA $0342,X
    JMP $E456
DIR
    JSR CLOSE
    JSR CLS
    LDX #<?DIR
    LDY #>?DIR
    STX $0230
    STY $0231
    LDX #<??DIR
    LDY #>??DIR
    STX PCRSR
    STY PCRSR+1
    LDX #$10
    LDA #$03
    STA $0342,X
    LDA #<ALL
    STA $0344,X
    LDA #>ALL
    STA $0345,X
    LDA #$06
    STA $034A,X
    LDA #$00
    STA $034B,X
    JSR $E456
    LDA #$07
    STA $0342,X
    LDA #$00
    STA $0348,X
    STA $0349,X
    STA RY
    STA RY+1
LEDIR
    JSR $E456
    BMI ?EXIT
    CMP #155
    BEQ EXIT
    JSR ASCINT
    LDY RY
    STA (PCRSR),Y
    INC RY
    BNE F0
    INC PCRSR+1
    INC RY+1
F0
    LDY RY+1
    CPY #$01
    BNE F1
    LDY RY
    CPY #104
    BCC F1
    JSR PAUSE
F1
    JMP LEDIR
EXIT
    INC RY
    INC RY
    INC RY
    JMP LEDIR
?EXIT
    JSR CLOSE
    JSR PAUSE
    JSR CLS
    PLA
    PLA
    JMP START
PAUSE
    LDA 53279
    CMP #$06
    BNE PAUSE
    JSR CLS
    LDA #$00
    STA RY
    STA RY+1
    LDA #<??DIR
    STA PCRSR
    LDA #>??DIR
    STA PCRSR+1
    LDX #$10
    RTS
FLSH
    LDY RY
    LDA (PCRSR),Y
    EOR #63
    STA (PCRSR),Y
    LDA #$10
    STA $021A
    RTS
OPENK
    LDA #255
    STA 764
    LDX #$10
    LDA #$03
    STA $0342,X
    STA $0345,X
    LDA #$26
    STA $0344,X
    LDA #$04
    STA $034A,X
    JSR $E456
    LDA #$07
    STA $0342,X
    LDA #$00
    STA $0348,X
    STA $0349,X
    STA RY
    RTS
RUTLEE
    LDX #<FLSH
    LDY #>FLSH
    LDA #$10
    STX $0228
    STY $0229
    STA $021A
    JSR OPENK
GETEC
    JSR $E456
    CMP #$7E
    BNE C0
    LDY RY
    BEQ GETEC
    LDA #$00
    STA (PCRSR),Y
    LDA #63
    DEY
    STA (PCRSR),Y
    DEC RY
    JMP GETEC
C0
    CMP #155
    BEQ C2
    JSR ASCINT
    LDY RY
    STA (PCRSR),Y
    CPY #20
    BEQ C1
    INC RY
C1
    JMP GETEC
C2
    JSR CLOSE
    LDA #$00
    STA $021A
    LDY RY
    STA (PCRSR),Y
    RTS
FGET
    LDA #$00
    STA LEN
    STA LEN+1
    LDA #221
    STA $D301
    LDX #$10
    LDA #$07
    STA $0342,X
    LDA #<BAFER
    STA $0344,X
    LDA #>BAFER
    STA $0345,X
    LDA #<LENGHT
    STA $0348,X
    LDA #>LENGHT
    STA $0349,X
??FGET
    JSR $E456
    LDA $0349,X
    CMP #>LENGHT
    BNE ?FGET
    LDA $0348,X
    CMP #<LENGHT
    BNE ?FGET
    CLC
    LDA $D301
    ADC #$04
    STA $D301
    CLC
    LDA #<LENGHT
    ADC LEN
    STA LEN
    LDA #>LENGHT
    ADC LEN+1
    STA LEN+1
    JMP ??FGET
?FGET
    JSR ZFR0
    LDA #252
    STA FR0
    JSR IFP
    JSR FMOVE
    LDX #$10
    CLC
    LDA $0348,X
    ADC LEN
    STA LEN
    STA FR0
    LDA $0349,X
    ADC LEN+1
    STA LEN+1
    STA FR0+1
    JSR IFP
    JSR PONBYTES
    JSR FDIV
    JSR PONBLOQUES
    JSR FPI
    LDA FR0
    PHA
    DEC FR0
    JSR IFP
    JSR FMOVE
    LDA #252
    STA FR0
    LDA #$00
    STA FR0+1
    JSR IFP
    JSR FMUL
    JSR FPI
    SEC
    LDA LEN
    SBC FR0
    STA CONT+1
    INC CONT+1
    PLA
    STA CONT
    LDX #$10
    RTS
PONBYTES
	JSR NBYTES
    STY RY
    LDY #$04
?PONBYTES
	LDA LBUFF,X
    AND #$5F
    STA BYTES,Y
    DEY
    DEX
    DEC RY
    BPL ?PONBYTES
    RTS
PONBLOQUES
	JSR NBYTES
    STY RY
    LDY #$02
?PONBLOQUES
	LDA LBUFF,X
    AND #$5F
    STA BLOQUES,Y
    DEY
    DEX
    DEC RY
    BPL ?PONBLOQUES
    LDA BLOQUES+2
	CMP #$19
    BEQ ??PP0
    INC BLOQUES+2
PP0
    LDY #$02
MVBLQ
    LDA BLOQUES,Y
    ORA #$20
    STA BBLQS,Y
    DEY
    BPL MVBLQ
    LDX #<BBLQS
    LDY #>BBLQS
    LDA #$00
    STX INBUFF
    STY INBUFF+1
    STA CIX
    JMP AFP
??PP0
    LDA #$10
    STA BLOQUES+2
    LDA BLOQUES+1
    CMP #$19
    BEQ ???PP0
    INC BLOQUES+1
    JMP PP0
???PP0
    LDA #$10
    STA BLOQUES+1
    INC BLOQUES
    JMP PP0
NBYTES
    JSR FASC
    LDX #$00
    LDY #$00
    LDA LBUFF
    CMP #$30
    BNE PL0
    INX
PL0
    LDA LBUFF,X
    CMP #$80
    BCS PL1
    CMP #$2E
    BEQ PL2
    INX
    INY
    JMP PL0
PL1
    RTS
PL2
    DEX
    LDA LBUFF,X
    ORA #$80
    STA LBUFF,X
    DEY
    RTS
    ICL 'LOADER.ASM'
ESIO
	.BYTE $60,$00,$50,$80
    .WORD ESPSIO
    .BYTE $23,$00
    .WORD 26
    .BYTE $00,$80
OPENC
    LDA $D40B
    BNE OPENC
    LDA #$FF
    STA 764
?OPENC
    LDA 764
    CMP #$FF
    BEQ ?OPENC
    LDA #$FF
    STA 764
    JMP $FD40
PONDATA
    LDY #$02
@ORBLOCK
    LDA BLOQUES,Y
    STA BLQ,Y
    DEY
    BPL @ORBLOCK
    LDY #19
?PONDATA
	LDA NAME,Y
    STA NME,Y
    DEY
    BPL ?PONDATA
    RTS
INITSIOV
    LDY #$0B
?INITSIOV
  	LDA DNHP,Y
    STA $0300,Y
    DEY
    BPL ?INITSIOV
    LDA #$00
    STA 77
    RTS
AUTORUN
	LDX #<PAG7
    LDY #>PAG7
    LDA #BL4
    STX MVPG7+1
    STY MVPG7+2
    STA @BL4
FALTA
    JSR INITSIOV
    LDX #<??DIR
    LDY #>??DIR
    STX $0304
    STY $0305
    LDX #131
    LDY #$00
    STX $0308
    STY $0309
    LDY #$00
    TYA
CLBUF
    STA ??DIR,Y
    INY
    CPY #131
    BNE CLBUF
    LDA #$55
    STA ??DIR
    STA ??DIR+1
    LDX #$FC
    LDY #127
    DEC @BL4
    BPL NOFIN
    LDX #$FA
    LDY #LAST
    STY ??DIR+130
NOFIN
    STX ??DIR+2
MVPG7
    LDA PAG7,Y
    STA ??DIR+3,Y
    DEY
    BPL MVPG7
    JSR $E459
    CLC
    LDA MVPG7+1
    ADC #$80
    STA MVPG7+1
    LDA MVPG7+2
    ADC #$00
    STA MVPG7+2
    LDA @BL4
    BPL FALTA
    RTS
GAUTO
    LDA 53770
    STA GENDAT
    STA @GENDAT
    JSR AUTORUN
    JSR INITSIOV
    LDX #<131
    LDY #>131
    STX $0308
    STY $0309
    LDX #<PAG4
    LDY #>PAG4
    STX $0304
    STY $0305
    JSR $E459
    JSR INITSIOV
    LDX #<LLOAD
    LDY #>LLOAD
    STX $0308
    STY $0309
    LDX #<LOAD
    LDY #>LOAD
    STX $0304
    STY $0305
    JSR $E459
    RTS
REST
    LDY #$04
??REST
    LDA BYTES,Y
    STA BAKBYT,Y
    DEY
    BPL ??REST
    LDY #$02
???REST
    LDA BLOQUES,Y
    STA BAKBLQ,Y
    DEY
    BPL ???REST
    RTS
?REST
    LDY #$04
????REST
	LDA BAKBYT,Y
    STA BYTES,Y
    DEY
    BPL ????REST
    LDY #$02
?????REST
	LDA BAKBLQ,Y
    STA BLOQUES,Y
    DEY
    BPL ?????REST
    LDA CONT
    STA PFIN
    RTS
SAVESIO
    LDX #$0B
?SAVESIO
	LDA ESIO,X
    STA $0300,X
    DEX
    BPL ?SAVESIO
    JMP $E459
EXNHPUT
    LDA #$80
    STA 77
    PLA
    PLA
    PLA
    PLA
    RTS
VERFPAR
    LDY #19
    STY $00
LVERFPAR
	LDA @PARCHE,Y
    STA PARCHE,Y
    DEY
    BPL LVERFPAR
    LDX #>RUTVERPAR
    LDY #<RUTVERPAR
    LDA #$07
    JSR $E45C
LVERINF
    BNE LVERINF
RUTVERPAR
	LDY $00
    LDA PARCHE,Y
    EOR #$80
    STA PARCHE,Y
    DEC $00
    BPL XRUTVERPAR
    LDY #19
    STY $00
XRUTVERPAR
	JMP $E462
NHPUT
    ADC PARCHE,Y
    DEY
    BPL NHPUT
    CMP #148
    BNE VERFPAR
    JSR SAVESIO
    LDA #$55
    STA ??DIR
    STA ??DIR+1
    LDA #252
    STA ??DIR+255
    LDA #221
    STA $D301
    LDA #$40
    STA M+2
    LDX #$00
    LDY #$00
    STY $02E2
    JSR GRABACION
    JMP ?MVBF
GRABACION
	LDA PFIN
    STA ??DIR+2
    BEQ EXNHPUT
    CMP #$01
    BNE RETURN
    LDA CONT+1
    STA ??DIR+255
RETURN
    RTS
?MVBF
    JSR GBYTE
    STA STARTF
    JSR GBYTE
    STA STARTF+1
    AND STARTF
    CMP #$FF
    BEQ ?MVBF
    JSR GBYTE
    STA FINISH
    JSR GBYTE
    STA FINISH+1
NHLOP
    JSR GBYTE
    LDA STARTF
    CMP #$E3
    BNE ?NHLOP
    LDA STARTF+1
    CMP #$02
    BNE ?NHLOP
    STA $02E2
?NHLOP
    LDA STARTF
    CMP FINISH
    BNE NHCONT
    LDA STARTF+1
    CMP FINISH+1
    BEQ ?MVBF
NHCONT
    INC STARTF
    BNE NOHI
    INC STARTF+1
NOHI
    JMP NHLOP
GBYTE
    CPY ??DIR+255
    BEQ EGRAB
M
    LDA $4000,X
    STA MDAT
    PHA
    TYA
    EOR MDAT
    EOR GENDAT
    STA ??DIR+3,Y
    INY
    INX
    BNE EXNHPIT
    INC M+2
    BPL EXNHPIT
    LDA #$40
    STA M+2
    CLC
    LDA $D301
    ADC #$04
    STA $D301
EXNHPIT
    PLA
    INC GENDAT
    RTS
EGRAB
    DEC PFIN
    TXA
    PHA
    JSR INITSIOV
    JSR $E459
    LDX #$02
DECBL01
    LDA BLOQUES,X
    CMP #$10
    BNE DECBL02
    LDA #$19
    STA BLOQUES,X
    DEX
    BPL DECBL01
DECBL02
    DEC BLOQUES,X
    PLA
    TAX
    LDA $02E2
    BNE SLOWB
SIGUE
    JSR GRABACION
    LDY #$00
    JMP GBYTE
SLOWB
    TXA
    PHA
    LDX #<350
    LDY #>350
    STX $021C
    STY $021D
IRG
	LDA $021D
    BNE IRG
    LDA $021C
    BNE IRG
    LDA #$00
    STA $02E2
    PLA
    TAX
    JMP SIGUE
DLS
    .BYTE $70,$70,$70,$46
    .WORD SHOW
    .BYTE $70,$06
    .BYTE "pp",$02,$02
    .BYTE "ppp",$06,"ppp",$02
    .BYTE "ppppppp",$02,$41
    .WORD DLS
; -------------------------
; DEFINICION DEL DISPLAY
; PARA DIRECTORIO
; -------------------------
?DIR
	.BYTE "pppppppp",$46
    .WORD ???DIR
    .BYTE $70,$02,$02,$02,$02
    .BYTE $02,$02,$02,$02,$02,$41
    .WORD ?DIR
SHOW
    .SB " COPIADOR NHP 2.56  "
PARCHE
	.SB +128,"by parche negro soft"
    .SB "               12345678901234567890     "
    .SB +128,"NOMBRE PORTADA:"
CRSR
	.SB "_                        "
NAME
    .SB "                    "
    .SB +128,"FILE:"
FILE
	.SB "_                                  "
	.SB +128,"BYTES LEIDOS:"
	.SB " "
BYTES
	.SB "*****       "
	.SB +128,"BLOQUES:"
	.SB " "
BLOQUES
    .SB "*** "
???DIR
	.SB "     DIRECTORIO     "
??DIR
    .SB "                                        "
    .SB "                                        "
    .SB "                                        "
    .SB "                                        "
    .SB "                                        "
    .SB "                                        "
    .SB "                                        "
    .SB "                                        "
    .SB "                                        "
    .SB "                                        "
JDOS?
    PHA
    LDY #$02
LJDOS?
    LDA CRSR,Y
    CMP TJDOS,Y
    BNE XJDOS
    DEY
    BPL LJDOS?
    PLA
    PLA
    JMP ($0A)
XJDOS
    PLA
    RTS
TJDOS
	.SB "DOS"
DOS
    JMP ($0C)
@START
    JSR DOS
START
    LDX #<DLS
    LDY #>DLS
    STX $0230
    STY $0231
    LDA #$CA
    STA $02C5
    LDA #$00
    STA $02C6
    JSR RESTORE
    LDX #<CRSR
    LDY #>CRSR
    STX PCRSR
    STY PCRSR+1
    JSR RUTLEE
    TYA
    BEQ NOTITLE
    JSR JDOS?
    LSR
    STA RY+1
    LDA #10
    SEC
    SBC RY+1
    STA RY+1
    LDX #$00
    LDY RY+1
WRITE
    LDA CRSR,X
    STA NAME,Y
    INY
    INX
    CPX RY
    BNE WRITE
NOTITLE
    LDX #<FILE
    LDY #>FILE
    STX PCRSR
    STY PCRSR+1
    JSR RUTLEE
    LDY #19
CONV
    LDA FILE,Y
    BEQ ?REMAIN
    AND #$7F
    CMP #64
    BCC ADD32
    CMP #96
    BCC SUB64
    BCS ?REMAIN
ADD32
    CLC
    ADC #32
    BCC OKLET
SUB64
    SEC
    SBC #64
?REMAIN
    LDA #$9B
OKLET
	STA ??FILE,Y
    DEY
    BPL CONV
    JSR OPEN
    JSR FGET
    JSR CLOSE
    JSR PONDATA
    JSR REST
OTRACOPIA
	JSR ?REST
    JSR OPENC
    JSR GAUTO
    LDY #39
    LDA #$00
    CLC
    JSR NHPUT
    LDX #$3C
    LDA #$03
    STA 53775
    STX $D302
WAIT
    LDA 53279
    CMP #$07
    BEQ WAIT
    CMP #$06
    BEQ OTRACOPIA
    CMP #$03
    BNE WAIT
    JMP START
PIRATAS
	JSR CLOSE
    LDX #<OPENK
    LDY #>OPENK
;    JSR $5000
    JSR CLOSE
    LDX #<@START
    LDY #>@START
    LDA #$03
    STX $02
    STY $03
    STA $09
    LDY #$FF
    STY $08
    INY
    STY 580
    JMP START
    RUN PIRATAS

Estos códigos pueden ensamblarlos en wudsn.

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *