home *** CD-ROM | disk | FTP | other *** search
- ; portable.a
- ;─────────────────────────────────────────────────────────────────────────────
- ; LHARC self extract code - Machine specific routines for C64 or C128
- ;─────────────────────────────────────────────────────────────────────────────
-
- INSTXT "sfx.i"
-
- PUBLIC Portable
- PUBLIC Prt
- PUBLIC Romin
- PUBLIC Romout
- PUBLIC Basic
-
- la EQU $00b8
- sa EQU $00b9
- dv EQU $00ba
- fnadr EQU $00bb
- fnlen EQU $00b7
- fnbank EQU $00c7
-
- Portable lda $ff00 ; Test for C64 or C128
- tax
- eor #$80
- sta $ff00
- cpx $ff00
- beq Adorable64 ; 64
- ldy #Jmp128-JmpOrg
- fcb $2c
- Adorable64 ldy #Jmp64-JmpOrg ; Fill in jumptable apropriately
- ldx #0
- JumpLoop lda JmpOrg,y
- sta JmpOrg,x
- iny
- inx
- cpx #Jmp128-Jmp64
- bcc JumpLoop
- lda #0 ; Black border and background
- sta $d020
- sta $d021
- rts
-
- JmpOrg
-
- Prt fcb 0,0,0
- Romin fcb 0,0,0
- Romout fcb 0,0,0
- Basic fcb 0,0,0
-
- Jmp64 jmp Prt64
- jmp Romin64
- jmp Romout64
- jmp $a474
-
- Jmp128 jmp Prt128
- jmp Romin128
- jmp Romout128
- jmp GoBasic128
-
- JmpEnd
-
- ;────────────────────────────────────────────────
- ; Exit the program. Go back to BASIC interpreter
- ;────────────────────────────────────────────────
- ; C128 can't just JMP there because we may be
- ; running underneath the BASIC ROMs
-
- GoBasic128 ldy #8
- Gblp lda JmpBasic,y
- sta $0b00,y
- dey
- bpl Gblp
- jmp $0b00
-
- JmpBasic lda #0
- sta $ff00
- jmp $4003
-
-
- ;─────────────────────────────────────────────
- ; RomIn enables the system ROMs,
- ; RomOut switches to an all RAM configuration
- ;─────────────────────────────────────────────
-
- Romin64 php
- pha
- lda #7
- sta 1
- pla
- plp
- cli
- rts
-
- Prt64 jsr Romin64
- jsr $e716
- Romout64 sei
- php
- pha
- lda #0
- sta 1
- pla
- plp
- rts
-
- Romin128 php
- pha
- lda #%00001110
- sta $ff00
- pla
- plp
- rts
-
- Prt128 jsr Romin128
- jsr $c00c
- Romout128 sta $ff01
- rts
-
-
-
- PUBLIC stop
- PUBLIC open
- PUBLIC close
- PUBLIC chrout
- PUBLIC chkout
- PUBLIC clrchn
- PUBLIC setnam
- PUBLIC setlfs
- PUBLIC chrin
- PUBLIC getin
-
- PUBLIC Message
-
- Message stx T10
- sty T10+1
- ldy #0
- Loop lda (T10),y
- beq MssgX
- jsr Prt
- iny
- bne Loop
- MssgX rts
-
-
- stop jsr Romin
- jsr $ffe1
- jmp Romout
-
- getin jsr Romin
- jsr $ffe4
- jmp Romout
-
- open jsr Romin
- jsr $ffc0
- jmp Romout
-
- close jsr Romin
- jsr $ffc3
- jmp Romout
-
- chrout jsr Romin
- jsr $ffd2
- jmp Romout
-
- chrin jsr Romin
- jsr $ffcf
- jmp Romout
-
- chkout jsr Romin
- jsr $ffc9
- jmp Romout
-
- clrchn jsr Romin
- jsr $ffcc
- jmp Romout
-
- setnam sta fnlen
- stx fnadr
- sty fnadr+1
- pha
- lda #0
- sta fnbank ; Does nothing except clear RVS on C64
- pla
- rts
-
- setlfs sta la
- stx dv
- sty sa
- rts
-
- ;──────────────────────────
- ; Convert ascii to Petscii
- ;──────────────────────────
-
- PUBLIC a2p
-
- a2p cmp #$41
- bcc a2px
- cmp #$5b
- bcs a2p2
- ora #$80
- a2px rts
-
- a2p2 cmp #$61
- bcc a2px
- cmp #$7b
- bcs a2px
- and #$df
- rts
-
- END
-
-
-
-