Long standing assembler bugs fixed, new path system. Make compatibility update.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
; This program asks the user for input, then prints whatever they input back to the console again.
|
||||
; It stores the input string in a buffer in the Data Memory.
|
||||
|
||||
#Include ../Libraries/print.asm
|
||||
#Include print.asm
|
||||
|
||||
#Program
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
; A test for the new math subroutines.
|
||||
|
||||
#Include ../Libraries/print.asm
|
||||
#Include ../Libraries/int8.asm
|
||||
#Include ../Libraries/int16.asm
|
||||
#Include print.asm
|
||||
#Include int8.asm
|
||||
#Include int16.asm
|
||||
|
||||
#Program
|
||||
start:
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
; Tests LDD and STD, the instructions that move a Data Pointer through Data Memory.
|
||||
;
|
||||
; STD writes a pointer into memory, LDD reads one back out. Together they let a
|
||||
; program build and walk a table of addresses, which is the reason the CPU has
|
||||
; more than one Data Pointer to walk it with.
|
||||
;
|
||||
; Correct output is:
|
||||
; Hello
|
||||
; World
|
||||
; H
|
||||
|
||||
#Program
|
||||
|
||||
start:
|
||||
; Build a two entry address table at runtime.
|
||||
SETD.0 Slot0
|
||||
SETD.1 Hello
|
||||
STD.1.0 ; Write the address in DP1 to the memory addressed by DP0.
|
||||
SETD.0 Slot1
|
||||
SETD.1 World
|
||||
STD.1.0
|
||||
|
||||
; Walk the table, following each entry in turn.
|
||||
SETD.0 Slot0
|
||||
LDD.1.0 ; DP1 becomes the address stored at DP0.
|
||||
CALL printDP1
|
||||
DPUP.0 0d02 ; Step DP0 over the two byte entry.
|
||||
LDD.1.0
|
||||
CALL printDP1
|
||||
|
||||
; A pointer can also follow itself, which is what LDD with one pointer means.
|
||||
SETD.0 Slot0
|
||||
LDD.0.0 ; DP0 becomes the address it was pointing at.
|
||||
LDA.0
|
||||
OUTA 0x00
|
||||
INIA 0x0A
|
||||
OUTA 0x00
|
||||
HALT
|
||||
|
||||
printDP1:
|
||||
; Print the string addressed by DP1. DP1 is preserved across the CALL, so the
|
||||
; caller gets it back untouched.
|
||||
LDA.1
|
||||
BRA printDone
|
||||
OUTA 0x00
|
||||
INCD.1
|
||||
BRI printDP1
|
||||
printDone:
|
||||
INIA 0x0A
|
||||
OUTA 0x00
|
||||
RET
|
||||
|
||||
#Data
|
||||
|
||||
Hello:
|
||||
"Hello"
|
||||
|
||||
World:
|
||||
"World"
|
||||
|
||||
; The table itself. Two entries, two bytes each, filled in at run time.
|
||||
Slot0:
|
||||
0x00 0x00
|
||||
Slot1:
|
||||
0x00 0x00
|
||||
@@ -1,6 +1,6 @@
|
||||
; Tests for the printing subroutines provided by print.asm
|
||||
|
||||
#Include ../Libraries/print.asm
|
||||
#Include print.asm
|
||||
#Include printDigitTest.asm
|
||||
#Include printDecimalTest.asm
|
||||
#Include printHexTest.asm
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
; Tests address tables written down by the assembler.
|
||||
;
|
||||
; Naming a label in the Data Segment places its two byte address there. That is
|
||||
; what lets a program lay down a table of addresses ahead of time and walk it
|
||||
; with LDD, rather than having to build the table at run time with STD.
|
||||
;
|
||||
; The label after the table also checks that the assembler counts those two
|
||||
; bytes when it works out the addresses of everything that follows.
|
||||
;
|
||||
; Correct output is:
|
||||
; one
|
||||
; two
|
||||
; three
|
||||
; AFTER
|
||||
|
||||
#Program
|
||||
|
||||
start:
|
||||
SETD.0 Table
|
||||
INIB 0d3 ; Three entries in the table.
|
||||
|
||||
nextEntry:
|
||||
LDD.1.0 ; DP1 becomes the address held in this table slot.
|
||||
CALL printDP1
|
||||
DPUP.0 0d02 ; Step DP0 over the two byte slot.
|
||||
DECB
|
||||
BRB tableDone
|
||||
BRI nextEntry
|
||||
|
||||
tableDone:
|
||||
; Anything placed after the table has to be where the assembler said it was.
|
||||
SETD.2 After
|
||||
CALL printDP2
|
||||
HALT
|
||||
|
||||
printDP1:
|
||||
LDA.1
|
||||
BRA print1Done
|
||||
OUTA 0x00
|
||||
INCD.1
|
||||
BRI printDP1
|
||||
print1Done:
|
||||
INIA 0x0A
|
||||
OUTA 0x00
|
||||
RET
|
||||
|
||||
printDP2:
|
||||
LDA.2
|
||||
BRA print2Done
|
||||
OUTA 0x00
|
||||
INCD.2
|
||||
BRI printDP2
|
||||
print2Done:
|
||||
INIA 0x0A
|
||||
OUTA 0x00
|
||||
RET
|
||||
|
||||
#Data
|
||||
|
||||
One:
|
||||
"one"
|
||||
Two:
|
||||
"two"
|
||||
Three:
|
||||
"three"
|
||||
|
||||
; The table. Each of these names becomes the two byte address of that string.
|
||||
Table:
|
||||
One
|
||||
Two
|
||||
Three
|
||||
|
||||
After:
|
||||
"AFTER"
|
||||
Reference in New Issue
Block a user