;.include "../inc/common.i" ;.import cfg_get_configuration_ptr ;.include "../inc/commonprint.i" ; ;.include "../drivers/w5100.i" WIZNET_BASE=$DE04 WIZNET_MODE_REG = WIZNET_BASE WIZNET_ADDR_HI = WIZNET_BASE+1 WIZNET_ADDR_LO = WIZNET_BASE+2 WIZNET_DATA_REG = WIZNET_BASE+3 TEST_LOOPS=$FF TX_BUFFER_START_PAGE=$40 TIMER_POSITION_ROW=5 TIMER_POSITION_COL=15 TIMER_POSITION=$400+TIMER_POSITION_ROW*40+TIMER_POSITION_COL ; load A/X macro .macro ldax arg .if (.match (.left (1, arg), #)) ; immediate mode lda #<(.right (.tcount (arg)-1, arg)) ldx #>(.right (.tcount (arg)-1, arg)) .else ; assume absolute or zero page lda arg ldx 1+(arg) .endif .endmacro ; store A/X macro .macro stax arg sta arg stx 1+(arg) .endmacro .zeropage pptr: .res 2 .segment "STARTUP" ;this is what gets put at the start of the file on the C64 .word basicstub ; load address basicstub: .word @nextline .word 2003 .byte $9e .byte <(((init / 1000) .mod 10) + $30) .byte <(((init / 100 ) .mod 10) + $30) .byte <(((init / 10 ) .mod 10) + $30) .byte <(((init ) .mod 10) + $30) .byte 0 @nextline: .word 0 init: ;set funky colours lda #$06 ; sta $D020 ;border lda #$00 ;dark blue sta $D021 ;background ldax #banner jsr print lda #0 sta clockport_mode lda $de01 and #$fe ;turn off clockport sta $de01 lda #$80 ;reset sta WIZNET_MODE_REG lda WIZNET_MODE_REG bne @try_clockport ;writing a byte to the MODE register with bit 7 set should reset. ;after a reset, mode register is zero ;therefore, if there is a real W5100 at the specified address, ;we should be able to write a $80 and read back a $00 lda #$13 ;set indirect mode, with autoinc, no auto PING sta WIZNET_MODE_REG lda WIZNET_MODE_REG cmp #$13 beq @w5100_found @try_clockport: inc clockport_mode ;now try with clockport on lda $de01 ora #1 ;turn on clockport sta $de01 lda #$80 ;reset sta WIZNET_MODE_REG lda WIZNET_MODE_REG beq @reset_ok ;writing a byte to the MODE register with bit 7 set should reset. ;after a reset, mode register is zero ;therefore, if there is a real W5100 at the specified address, ;we should be able to write a $80 and read back a $00 @error: ldax #not_found jsr print lda #>WIZNET_MODE_REG jsr print_hex lda #WIZNET_MODE_REG jsr print_hex lda #