v8080: update for the rst changes
authorAlan Cox <alan@linux.intel.com>
Fri, 15 Feb 2019 00:32:56 +0000 (00:32 +0000)
committerAlan Cox <alan@linux.intel.com>
Fri, 15 Feb 2019 00:32:56 +0000 (00:32 +0000)
- Save BC
- Only install the vectors for kernel
- Use the rst routines from todays kernel

Kernel/platform-v8080/rst.s
Kernel/platform-v8080/v8080.s

index 28117b2..bec3466 100644 (file)
@@ -1,75 +1,31 @@
 #include "../kernel-8080.def"
+.sect .text
+
+! Which resets we install are determined by statistical analysis of Star
+! Trek. When changing these, make sure to update the i80 table to match.
+!     97 call .floadn2
+!     41 call .floadn4
+!     34 call .fload4
+!     28 call .fstoren2
 
-.sect .common
-!
-!      We need this in common because
-!      1. We need to use .rst_init to install the hooks in other banks
-!      2. User space also shares these rst handlers (why store them
-!      repeatedly). That does create an ABI concern but if it becomes a
-!      problem we just make user apps override
-!
 .define .rst_init
 .rst_init:
-    mvi a, 0xc3     ! jmp <a16>
-    sta 0x08
-    sta 0x10
-    sta 0x18
-    lxi h, rst1
-    shld 0x09
-    lxi h, rst2
-    shld 0x11
-    lxi h, rst3
-    shld 0x19
-    ret
-
-    ! de = [bc+const1] (remember bc is the frame pointer)
-rst1:
-    pop h
-    mov a, m
-    inx h
-    push h
-
-       mov l, a
-       ral
-       sbb a
-       mov h, a
-
-       dad b
-    mov e, m
-    inx h
-    mov d, m
-    ret
-
-    ! [bc+const1] = de (remember bc is the frame pointer)
-rst2:
-    pop h
+    lxi h, .floadn2
+    lxi d, 0x0008
+    call copy
+    lxi h, .floadn4
+    call copy
+    lxi h, .fload4
+    call copy
+    lxi h, .fstoren2
+! Copies eight bytes from HL to DE.
+copy:
+    mvi c, 8
+.1:
     mov a, m
+    stax d
     inx h
-    push h
-
-       mov l, a
-       ral
-       sbb a
-       mov h, a
-
-       dad b
-    mov m, e
-    inx h
-    mov m, d
-    ret
-
-    ! hl = bc+const1
-rst3:
-    pop h
-    mov a, m
-    inx h
-    push h
-
-    mov l, a
-    ral
-    sbb a
-    mov h, a
-
-    dad b
-    ret
-    
\ No newline at end of file
+    inr e
+    dcr c
+    jnz .1
+    ret
\ No newline at end of file
index 277480b..9ee5d62 100644 (file)
@@ -59,11 +59,15 @@ _program_vectors:
        push h
        push d
        call map_process
-       call _program_vectors_k
+       call _program_vectors_u
        call map_kernel_di
        ret
 
 _program_vectors_k:
+       push b
+       call .rst_init
+       pop b
+_program_vectors_u:
        mvi a,0xc3
        sta 0
        sta 0x30
@@ -77,7 +81,7 @@ _program_vectors_k:
        shld 0x39
        lxi h,nmi_handler
        shld 0x67
-       jmp .rst_init
+       ret
 
 !
 !      Memory mapping