base:reu_detect
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | base:reu_detect [2015-04-17 04:33] – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== REU Detect ====== | ||
+ | < | ||
+ | ; | ||
+ | ; REUDETECT v1.0a ( REU : 1700, 1764, 1750, 1024Kb and 2048Kb ) | ||
+ | ; --------------------------------------------------------------------------------------------------------------------- | ||
+ | ; Overview : Detection of REC and RAM-Type : 0 = 1700 (64Kbx1) or 16 = 1764/50 or bigger(256Kbx1). | ||
+ | ; Write to Registers 2-5 and compare. | ||
+ | ; Write 33 banks with "messy datas" | ||
+ | ; Fetch bank, inc bank-counter (banks $1500) if own dummy-bytes not found. | ||
+ | ; Stash bank, write own dummy bytes for later comparing and fetch next bank. | ||
+ | ; Skip bankcheck if dummy byte-chain found. Detection is finished. | ||
+ | ; Read available banks, evaluate and drop some text on the screen. | ||
+ | ; --------------------------------------------------------------------------------------------------------------------- | ||
+ | ; 21. Januar 2005 M. Sachse (cbmhardware/ | ||
+ | ; | ||
+ | ; E-Mail : info(at)cbmhardware.de | ||
+ | ; | ||
+ | ; 22. Januar 2005 : Bugfix, add ram-type detection 1764, Vice and C64 compatibility, | ||
+ | ; | ||
+ | ; ------------------------------------------------------------------------------------------------------------------ | ||
+ | ; GPL | ||
+ | ; | ||
+ | ; This program is free software; you can redistribute it and/or modify it under the terms of the | ||
+ | ; GNU General Public License as published by the Free Software Foundation; either version 2 of the | ||
+ | ; License, or (at your option) any later version. | ||
+ | ; | ||
+ | ; | ||
+ | ; Source Code for ACME Cross-Assembler : | ||
+ | ; | ||
+ | !to " | ||
+ | *= $0800 | ||
+ | |||
+ | !byte $00, | ||
+ | |||
+ | *= $080e | ||
+ | |||
+ | reubase | ||
+ | reucommand | ||
+ | banks = $1500 ; to store found banks and count | ||
+ | |||
+ | |||
+ | ; | ||
+ | ; Detect REU 1700, | ||
+ | ; | ||
+ | reudetect | ||
+ | sta $0286 ; textcolor white | ||
+ | lda #00 | ||
+ | sta $d020 | ||
+ | sta $d021 | ||
+ | sta banks | ||
+ | sta reubase | ||
+ | cmp reubase | ||
+ | beq noreu | ||
+ | bne unsafe | ||
+ | unsafe | ||
+ | and #16 ; check bit 4 for REU mem | ||
+ | cmp #16 ; 16 = 256Kbx1 | ||
+ | beq regcheck | ||
+ | bne l1 ; no, 1700 ? | ||
+ | l1 lda reubase | ||
+ | and #16 ; check bit 4 for REU mem | ||
+ | cmp #0 | ||
+ | beq r1700 ; reu 1700 found | ||
+ | bne noreu ; no ram-type, no reu, no fun ... | ||
+ | regcheck | ||
+ | ldx #2 | ||
+ | loop1 txa | ||
+ | sta $df00, | ||
+ | inx | ||
+ | cpx #5 | ||
+ | bne loop1 | ||
+ | ldx #02 | ||
+ | loop2 txa | ||
+ | cmp $df00, | ||
+ | bne noreu | ||
+ | inx | ||
+ | cpx #5 | ||
+ | bne loop2 | ||
+ | jmp rinit | ||
+ | r1700 lda #< | ||
+ | ldy #> | ||
+ | jmp $ab1e | ||
+ | ; | ||
+ | rinit ldx #00 ; 1764 wake up | ||
+ | rinit2 | ||
+ | sta config | ||
+ | lda #$12 ; write some crap in ... | ||
+ | sta c64hi+1 | ||
+ | stx bank+1 | ||
+ | jsr main | ||
+ | inx | ||
+ | cpx #33 ; ... 33 banks into somewhere | ||
+ | bne rinit2 | ||
+ | jmp action | ||
+ | noreu lda #<notext | ||
+ | ldy #> | ||
+ | jmp $ab1e | ||
+ | ; | ||
+ | ; Count banks | ||
+ | ; | ||
+ | action | ||
+ | ldx #$00 | ||
+ | stx bank+1 | ||
+ | check lda #129 ; fetch : transfer to C64 : $1300 | ||
+ | sta config | ||
+ | lda #$13 ; C64 : $1300 | ||
+ | sta c64hi+1 | ||
+ | jsr main | ||
+ | lda #128 ; stash | ||
+ | sta config | ||
+ | lda #$0A ; write dummy bytes from $0900 | ||
+ | sta c64hi+1 | ||
+ | jsr main | ||
+ | jsr bankcheck | ||
+ | | ||
+ | cpx #33 ; try 33 | ||
+ | stx bank+1 | ||
+ | bne check | ||
+ | ; | ||
+ | lda #0 ; restore bordercolor | ||
+ | sta $d020 | ||
+ | lda banks ; banks found ? | ||
+ | cmp #4 | ||
+ | beq r1764 | ||
+ | bne j1 | ||
+ | r1764 lda #4 | ||
+ | sta banks | ||
+ | lda #< | ||
+ | ldy #> | ||
+ | jmp $ab1e | ||
+ | j1 cmp #8 | ||
+ | beq r512 | ||
+ | bne j2 | ||
+ | r512 lda #< | ||
+ | ldy #> | ||
+ | jmp $ab1e | ||
+ | j2 cmp #16 | ||
+ | beq r1024 | ||
+ | bne j3 | ||
+ | r1024 lda #< | ||
+ | ldy #> | ||
+ | jmp $ab1e | ||
+ | j3 cmp #20 | ||
+ | beq r1764 | ||
+ | bne j4 | ||
+ | j4 cmp #32 | ||
+ | beq r2048 | ||
+ | bne j6 | ||
+ | r2048 lda #< | ||
+ | ldy #> | ||
+ | jmp $ab1e | ||
+ | j6 lda #<reuunk | ||
+ | ldy #> | ||
+ | jmp $ab1e | ||
+ | ; | ||
+ | ; Bank Check | ||
+ | ; | ||
+ | bankcheck | ||
+ | l2 lda $0A00,y | ||
+ | l6 cmp $1300, | ||
+ | bne l4 ; bank found ? | ||
+ | beq l3 ; no, check 16 Bytes | ||
+ | l3 | ||
+ | cpy #16 | ||
+ | bne l2 ; loop | ||
+ | end ldy #00 | ||
+ | lda #00 | ||
+ | delete | ||
+ | iny | ||
+ | cpy #16 | ||
+ | bne delete | ||
+ | rts | ||
+ | l4 jmp l5 | ||
+ | l5 inc banks ; bank found (inc), border color change and exit | ||
+ | inc $d020 | ||
+ | rts | ||
+ | config !byte 252 | ||
+ | ; | ||
+ | ; Bytes and text | ||
+ | ; | ||
+ | *=$0A00 | ||
+ | |||
+ | !scr " | ||
+ | |||
+ | reutext: | ||
+ | text1764: !text "REU 1764 : 256KB DETECTED", | ||
+ | reut512: | ||
+ | reut1024: !text "REU 1024KB DETECTED", | ||
+ | reut2048: !text "REU 2048KB DETECTED", | ||
+ | reuunk: | ||
+ | notext: | ||
+ | |||
+ | ; | ||
+ | ; REU TRANSFER ROUTINE | ||
+ | ; | ||
+ | |||
+ | main | ||
+ | lda config | ||
+ | sta reubase+1 | ||
+ | lda #$00 | ||
+ | sta reubase+2 | ||
+ | c64hi lda #$09 | ||
+ | sta reubase+3 | ||
+ | lda #$00 | ||
+ | sta reubase+4 | ||
+ | sta reubase+5 | ||
+ | bank lda #0 | ||
+ | sta reubase+6 | ||
+ | rbytes | ||
+ | sta reubase+7 | ||
+ | lda #$00 | ||
+ | sta reubase+8 | ||
+ | irq lda #$00 | ||
+ | sta reubase+9 | ||
+ | lda #$00 | ||
+ | sta reubase+10 | ||
+ | lda $1 | ||
+ | pha | ||
+ | lda #$30 ; RAM | ||
+ | sei | ||
+ | sta $1 | ||
+ | sta $ff00 | ||
+ | pla | ||
+ | sta $1 | ||
+ | cli | ||
+ | rts | ||
+ | </ |
base/reu_detect.txt · Last modified: 2023-10-26 20:24 by groepaz