diff options
-rw-r--r-- | dla.s | 48 |
1 files changed, 42 insertions, 6 deletions
@@ -12,6 +12,7 @@ .include "nextpage.inc" loadaddr = $2000 + lowcode = $0600 ; memcheck and io.s screen = $4000 ; must be on a x000 (4K) boundary screen2 = screen + $1000 ; rest of screen RAM after 4K boundary pixarray = screen + $20 @@ -52,9 +53,39 @@ cloksav: .res 3 ; hold RTCLOK here while we convert to MM:SS.CC fptmp: .res 6 ; used in mmss.s .code - xex_org loadaddr + + ;;; init xex segment: check that there's enough memory. + xex_org lowcode .include "io.s" ; printchrx and getchrx .include "printint.s" + +memcheck: + lda RAMTOP + cmp #$c0 ; 48K + bcs mem_ok + lda #<memmsg + ldx #>memmsg + jsr printmsg + lda RAMTOP ; free RAM in pages, divide by 4 to get K + lsr + lsr + jsr printdecb + lda #<memmsg2 + ldx #>memmsg2 + jsr printmsg +mem_bad: + jmp mem_bad ; TODO: find a way to return to DOS from here +mem_ok: + rts + +memmsg: .byte "Need 48K, only have ",0 +memmsg2: .byte "K.",$9b,"Disable BASIC, remove cartridge?",$9b,0 + + xex_init memcheck + + ;;; main xex segment: the actual program. the functions in io.s + ;;; and printint.s are still in low memory. + xex_org loadaddr .include "mmss.s" ; init stuff gets done once, at startup @@ -453,6 +484,8 @@ plot: sta (pixptr),y rts + ; drunkwalk is less than a page long. nextpage macro starts it + ; on a page boundary, so branches don't cost an extra cycle. nextpage .include "drunkwalk.s" @@ -631,9 +664,10 @@ seeds_h: .byte >(seed_point-1),>(seed_plus-1),>(seed_4pt-1),>(seed_long-1) ; dlatbl.s is generated by perl script, mkdlatbl.pl .include "dlatbl.s" - ; table of addresses, for each line on the screen. bloats the - ; code by 384 bytes, but compared to calculating the address, is - ; twice as fast! + ; table of addresses, for each line on the screen. + ; these 2 tables (low and high bytes) are less than a page each. + ; nextpage macro guarantees they don't cross a page boundary (so + ; indexed addressing doesn't cost an extra cycle). nextpage lineaddrs_l: laddr .set pixarray @@ -653,6 +687,7 @@ lineaddrs_h: ;;; display list ; ANTIC opcodes blank8 = $70 + blank3 = $20 gr8 = $0f gr0 = $02 lms = $40 @@ -660,7 +695,7 @@ lineaddrs_h: xex_org dlist .byte blank8, blank8, blank8 - .byte blank8 + .byte blank8, blank3 .byte gr8 | lms .word screen .repeat 127 @@ -668,9 +703,10 @@ lineaddrs_h: .endrep .byte gr8 | lms .word screen2 - .repeat maxlines - 132 + .repeat maxlines - 129 .byte gr8 .endrep + .byte blank3 .byte gr0 | lms .word textbuf .byte jvb |