]> cloudbase.mooo.com Git - avrcpm.git/commitdiff
* New macros sbiw and INTERRUPT:
authorLeo <erbl259-lmu@yahoo.de>
Fri, 1 Oct 2010 09:34:19 +0000 (09:34 +0000)
committerLeo <erbl259-lmu@yahoo.de>
Fri, 1 Oct 2010 09:34:19 +0000 (09:34 +0000)
  - The INTERRUPT  macro inserts the right jump instruction (rjmp/jmp) in the interrupt vector table.
* new functions: dram_read[w]_pp, dram_write[w]_pp
  - read/write byte/word with address autoincrement.

* Affected files:
  - avr/macros.inc
  - avr/hw-uart.asm
  - avr/sw-uart.asm
  - avr/remainders.asm
  - avr/init.asm
  - avr/dram-8bit.asm
  - avr/dram-8bit.asm
  - avr/avrcpm.asm
  - avr/config.inc

git-svn-id: svn://cu.loc/avr-cpm/trunk@108 57430480-672e-4586-8877-bcf8adbbf3b7

avrcpm/avr/avrcpm.asm
avrcpm/avr/config.inc
avrcpm/avr/dram-4bit.asm
avrcpm/avr/dram-8bit.asm
avrcpm/avr/hw-uart.asm
avrcpm/avr/init.asm
avrcpm/avr/macros.inc
avrcpm/avr/remainders.asm
avrcpm/avr/sw-uart.asm

index 4e666c99d76a70e6d892ff4daae843824817aa4a..238c28201f436a6f59434769cd20697b7f4da81b 100644 (file)
@@ -57,6 +57,7 @@
        .include "hw-uart.asm"
        .include "dram-4bit.asm"
 #endif
+;      .include "heap.asm"
        .include "remainders.asm"
 
 ; >>>-------------------------------------- Virtual Devices
@@ -72,9 +73,9 @@
 ; <<<-------------------------------------- File System Management
 ;      .include "z80int.asm"           ;Old 8080 interpreter.
 ;      .include "8080int.asm"          ;New 8080 interpreter.
-;      .include "8080int-t3.asm"
-;      .include "8080int-t3-jmp.asm"
-       .include "8080int-jmp.asm"
+;      .include "8080int-t3.asm"       ;Another 8080 interpreter
+;      .include "8080int-t3-jmp.asm"   ;Can't get enough
+       .include "8080int-jmp.asm"      ;
 
 
        .dseg
index 5818fa4a87effb07dd73bbc5fb8121ddd040df9e..9a1b933cbbe514bed988cce5762b420cb66abdc7 100644 (file)
@@ -69,6 +69,7 @@
 .equ MEMFILL     = 1
 .equ STACK_DBG   = 0
 .equ PRINT_PC    = 0
+.equ HEAP_DEBUG         = 1
 
 #define MMC_SPI2X  1           /* 0 = SPI CLK/4, 1 = SPI CLK/2 */
 
index e0d088a87ee8ad9f6a00a45d80730128ccf9423e..d8852262d14b309aa40eb2c6e559a22e6f3c0f27 100644 (file)
@@ -88,5 +88,35 @@ dram_write:
 ;      sei
        ret
 
+; -------------------------------------------------------------------
+
+dram_readw_pp:
+       rcall   dram_read
+       adiw    x,1
+       push    temp
+       rcall   dram_read
+       adiw    x,1
+       mov     temp2,temp
+       pop     temp
+       ret
+       
+dram_read_pp:
+       rcall   dram_read
+       adiw    x,1
+       ret
+
+; -------------------------------------------------------------------
+
+dram_writew_pp:
+       push    temp2
+       rcall   dram_write
+       adiw    x,1
+       pop     temp
+dram_write_pp:
+       rcall   dram_write
+       adiw    x,1
+       ret
+
+; -------------------------------------------------------------------
 ; vim:set ts=8 noet nowrap
 
index b335894007b07a03194042391c74d38113e89e20..466f9bb4660d6adb63380cf28ec99cc367d263a8 100644 (file)
@@ -61,4 +61,35 @@ dram_write:
        sei
        ret
 
+; -------------------------------------------------------------------
+
+dram_readw_pp:
+       rcall   dram_read
+       adiw    x,1
+       push    temp
+       rcall   dram_read
+       adiw    x,1
+       mov     temp2,temp
+       pop     temp
+       ret
+       
+dram_read_pp:
+       rcall   dram_read
+       adiw    x,1
+       ret
+
+; -------------------------------------------------------------------
+
+dram_writew_pp:
+       rcall   dram_write
+       adiw    x,1
+       mov     temp,temp2
+dram_write_pp:
+       rcall   dram_write
+       adiw    x,1
+       ret
+
+
+; -------------------------------------------------------------------
+; vim:set ts=8 noet nowrap
 
index e85721dc224f03f957483905d54cb3e47d9fbb6a..6fdb6db667ecbe8010fa626e301acaf82676bea4 100644 (file)
@@ -66,11 +66,10 @@ uart_init:
 
 ; Save received character in a circular buffer. Do nothing if buffer overflows.
 
-rxint:
-       .org URXCaddr   
-       rjmp rxint              ; USART receive int.
+; USART receive interrupt
+
+       INTERRUPT URXCaddr   
 
-       .org rxint
        push    temp
        in      temp,sreg
        push    temp
@@ -130,11 +129,10 @@ uartgetc:
        pop     zh
        ret
 
-txint: 
-       .org UDREaddr
-       rjmp txint              ; USART transmit int.
+; USART transmit interrupt
+
+       INTERRUPT UDREaddr
 
-       .org txint
        push    temp
        in      temp,sreg
        push    temp
index 374bdd24bc785d9ff0014ca8c8bee838d4a8e670..f38883e824683db1d6a4f07315ec1d8e3b1bedf3 100644 (file)
@@ -1,5 +1,4 @@
 ;    Various functions: init, (RAM) disk, mmc, timer
-;    This file needs to get split up.
 ;
 ;    Copyright (C) 2010 Sprite_tm
 ;    Copyright (C) 2010 Leo C.
@@ -124,7 +123,7 @@ clr_l:
 
 .if BOOTWAIT
        ldi temp,10
-       rcall delay_ms
+       call delay_ms
 
 .endif
 
@@ -141,15 +140,14 @@ clr_l:
 ramtestw:
        mov temp,xh
        eor temp,xl
-       mem_write
-       adiw xl,1
+       rcall   dram_write_pp
        brcc ramtestw
        printstring "wait..."
 
        ldi     temp2,8
 ramtestwl:
        ldi     temp,255
-       rcall   delay_ms
+       call    delay_ms
        dec     temp2
        brne    ramtestwl
 
@@ -194,8 +192,7 @@ ramtestrok:
        ldiw    x,0
 ramfillw:
        ldi temp,MEMFILL_VAL
-       mem_write
-       adiw xl,1
+       rcall   dram_write_pp
        brcc ramfillw
 .endif
 
@@ -226,9 +223,9 @@ boot_ipl2:
        printnewline
        printstring "Partinit done."
 
-       rcall   dsk_cboot               ;init (de)blocking buffer\r
+       rcall   dsk_cboot               ;init (de)blocking buffer
 
-; Read first sector of first CP/M partition
+; Read first sector of first CP/M partition (ipl)
 
        lds     xl,hostparttbl+1
        lds     xh,hostparttbl+2
@@ -236,7 +233,7 @@ boot_ipl2:
        lds     yh,hostparttbl+4
        rcall   mmcReadSect
 
-       rcall   dsk_cboot               ;init (de)blocking buffer
+;      rcall   dsk_cboot               ;init (de)blocking buffer
 
 ;First sector of disk or first CP/M partition is in hostbuf.
 
@@ -245,8 +242,7 @@ boot_ipl2:
        ldiw x,IPLADDR
 iplwriteloop:
        ld temp,z+
-       mem_write
-       adiw xl,1
+       rcall   dram_write_pp
        cpi zl,low(hostbuf+128)
        brne iplwriteloop
        cpi zh,high(hostbuf+128)
index b1091655455e4eeff4c2a180e462357f5d2ea0ba..d1178b77642d2fae263f37cdfcf5de27d55b4eb4 100644 (file)
        sbci    @0h, high(-@1)
 .endm
 
+;------------------------------------------------
+; sub 16 bit constant from register pair
+
+.macro subiw
+       subi    @0l, low(@1)  
+       sbci    @0h, high(@1)
+.endm
+
 ;------------------------------------------------
 ; Move single bit between two registers
 ;
        bld     @0,@1
 .endm
 
+;------------------------------------------------
+; 
+;
+;
+.macro  INTERRUPT
+  .set pos_ = PC
+  .org @0                      ; vector address
+  .if abs(pos_ - PC) > 2048
+       jmp     pos_
+  .else
+       rjmp    pos_            ; jump to handler
+  .endif
+  .org pos_                    ; restore PC
+.endm
+
 ;------------------------------------------------
 ; Print string.
 ;      printstring "String"
index a1372a60f567280d09fcc67f7b353e5f911fb462..534b3e13872cd5da1a67404ad86a71b3dfea3443 100644 (file)
 ; ------------------- DRAM Refresh Interrupt --------------------
 
        .cseg
-; refresh interupt; exec 2 cbr cycles
-refrint:                       ;4
-       .org OC2Aaddr
-       rjmp refrint            ; tim2cmpa
 
-       .org refrint
+; Refresh interupt; exec 2 cbr cycles
+       
+       INTERRUPT OC2Aaddr
+
        sbis    P_RAS,ram_ras   ;2
        reti
                                ;       CAS  RAS  
@@ -182,16 +181,16 @@ printstr_end:
        pop     zl
        pop     zh
        ret
-\r
-       .dseg\r
+
+       .dseg
 
 
        .cseg
        
-
        
 
 
+
        
 ; ****************************************************************************
 
@@ -225,11 +224,11 @@ timer_top:
  
 
        .cseg   
-sysclockint:
-       .org OC1Baddr           ; Timer/Counter1 Compare Match B
-       rjmp sysclockint        ; 1ms system timer
 
-       .org sysclockint
+; Timer/Counter1 Compare Match B interrupt
+       
+       INTERRUPT OC1Baddr
+       
        push    zl
        in      zl,SREG
        push    zl
index 36d814cf57ea62b0c303079527dd4a4325255c62..5d57485a3f6299f9fcb61105193c9e4d19cf8113 100644 (file)
@@ -83,11 +83,10 @@ uart_init:
 ;------------------------------------------------------------------
 
        .cseg
-srxint:
-       .org    ICP1addr                ; Timer/Counter1 Input Capture
-       rjmp srxint                     ; Soft UART: RX
 
-       .org    srxint
+; Timer/Counter1 Input Capture interrupt
+       
+       INTERRUPT ICP1addr
        
        push    temp
        in      temp,sreg
@@ -316,11 +315,10 @@ srxi_end:
 ;----------------------------------------------------------------------
 
        .cseg
-stxint:
-       .org    OC1Aaddr                ; Timer/Counter1 Compare Match A
-       rjmp stxint                     ; Soft UART: TX
 
-       .org stxint
+; Timer/Counter1 Compare Match A interrupt
+       
+       INTERRUPT OC1Aaddr
        
        push    temp
        in      temp,sreg