From cd6982e5da1f5facdc1e0154b3a27c01e8b076c9 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Wed, 27 Jan 2021 13:42:57 -0500 Subject: - Fixed some bugs in the emulator. - Started work on implementing the Super VIA emulation. - Added support for disabling disassembly per instruction, when in debug mode. - Did some more work on rewriting the SuB Suite to work with the new calling convention. - Rewrote the symbol handling code in the emulator's assembler, to make it both simpler, and to add support for arbitrarily deep symbol scopes. - Added support for arbitrarily deep local symbol scopes. For example, to declare a symbol of depth 2, you add two '@' characters to the start of the symbol name. In other words, the number of '@' characters before the symbol name is what determines the scope of that symbol. And to use a symbol thats outside the current scope, you would use the same syntax as using a struct member, so you would do `global.local`. --- programs/sub-suite/test-size.s | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 programs/sub-suite/test-size.s (limited to 'programs/sub-suite/test-size.s') diff --git a/programs/sub-suite/test-size.s b/programs/sub-suite/test-size.s new file mode 100644 index 0000000..b543a36 --- /dev/null +++ b/programs/sub-suite/test-size.s @@ -0,0 +1,59 @@ +MAGIC = $AA + + +.org 0 +findramend: + and #0 ; Reset A. +; lda #MAGIC ; Set A to a magic number. +@loop: + mov a, (d) ; Preserve the value. + mov (d), #MAGIC ; Write the magic number to the current end of RAM. + cmp (d), #MAGIC ; Is the value in RAM, the same as the magic number we wrote? + bne @moveback ; No, so move back until we find the last writable memory location. + mov (d), a ; Yes, so restore the previous value. + add.w d, #$4000 ; Increment the end of RAM pointer by 16K. + bra @loop ; Keep looping. +@moveback: + dec d ; Decrement the end of RAM pointer. + mov a, (d) ; Preserve the value. + mov (d), #MAGIC ; Write the magic number to the current end of RAM. + cmp (d), #MAGIC ; Is the value in RAM, the same as the magic number we wrote? + bne @moveback ; No, so keep looping. + mov (d), a ; Yes, so restore the previous value. +@end: + mov a, d ; Return the end of RAM pointer. +; ple.q ; Restore E. + rts ; End of findramend. + + +;findramend: +; phe.q ; Preserve E. +; phb.q ; Preserve B. +; mov e, d ; Set E to the RAM pointer. +; and #0 ; Reset A. +; lda #MAGIC ; Set A to a magic number. +;@loop: +; ldb (e) ; Preserve the value. +; sta (e) ; Write the magic number to the current end of RAM. +; cmp (e) ; Is the value in RAM, the same as the magic number we wrote? +; bne @moveback ; No, so move back until we find the last writable memory location. +; stb (e) ; Yes, so restore the previous value. +; ade.w #$4000 ; Increment the end of RAM pointer by 16K. +; bra @loop ; Keep looping. +;@moveback: +; dee ; Decrement the end of RAM pointer. +; ldb (e) ; Preserve the value. +; sta (e) ; Write the magic number to the current end of RAM. +; cmp (e) ; Is the value in RAM, the same as the magic number we wrote? +; bne @moveback ; No, so keep looping. +; stb (e) ; Yes, so restore the previous value. +;@end: +; mov a, e ; Return the end of RAM pointer. +; ple.q ; Restore E. +; plb.q ; Restore B. +; rts ; End of findramend. + +a +.org findramend +v +q -- cgit v1.2.3-13-gbd6f