trs80m1: banking - measure size available
authorAlan Cox <alan@linux.intel.com>
Thu, 24 May 2018 23:24:49 +0000 (00:24 +0100)
committerAlan Cox <alan@linux.intel.com>
Thu, 24 May 2018 23:24:49 +0000 (00:24 +0100)
Needs more work: for some reason we are getting the RAM sizes wrong still

Kernel/platform-trs80m1/trs80-bank.s

index 51d60ff..d7b9749 100644 (file)
@@ -35,23 +35,25 @@ init_hardware:
             ; set system RAM size
            ld hl,#0xFFFF               ; FFFF is free in all our pages
            ld bc,#0xFF43               ; kernel included
+           xor a
 mark_pages:
            out (c),b
-           ld (hl),b
+           ld (hl),a
            djnz mark_pages
 scan_pages:
-           ld a,#2
+           ld b,#2
 scan_pages_l:
-           out (c),a
-           cp (hl)
+           out (c),b
+           cp (hl)                     ; still 0 ?
            jr nz, mismatch
-           inc a
+           ld (hl),b
+           inc b
            jr nz, scan_pages_l
-mismatch:                              ; A holds the first page above
+mismatch:                              ; B holds the first page above
                                        ; the limit (4 for 128K etc)
-           dec a
-           dec a                       ; remove kernel
-           ld h,a
+           dec b
+           dec b                       ; remove kernel
+           ld h,b
            ld l,#0                     ; effectively * 256
            srl h
            rr  l                       ; * 128