I am very new to assembly, and I’m trying to build a small program. I can’t figure out how to insert a line break in assembly using the Easy68k. For example, I am starting to write basic black jack simulator, and I need to do a line break after greeting the first player. I tried incorporating “\n” into the variable declaration, but it just prints out as if it were part of the text.
According to the Easy 68K Help I/O section, I can use
“LF EQU $0A New line (line feed)” but I have no idea how to implement this.
START ORG $400 ; Start of program area
CLR.L D0 ; Clear D0
CLR.L D1 ; Clear D1
CLR.L D2 ; Clear D2
CLR.L D3 ; Clear D3
CLR.L D4 ; Clear D4
CLR.L D5 ; Clear D5
CLR.L D6 ; Clear D6
MOVE.L playerTotal, D2 ; Store Player total in D1
MOVE.L card, D3 ; Store current card in D2
MOVE.B playerAce, D4 ; Store number of aces player has in D3
MOVE #14, D0
LEA playerGreeting, A1 ; Load Player Greeting in A1
TRAP #15 ; Display Player Greeting
* insert line break
STOP #$2700 ; Stop execution
ORG $1000 ;Start of data area
playerTotal DS.L 1 ; Save 1 byte of memory for playerTotal
dealerTotal DS.L 1 ; Save 1 byte of memory for dealerTotal
card DC.L 5 ; Save 1 byte of memory for card dealt
keepPlaying DS.B 1 ; Save 1 byte of memory for Play again value
playerAce DS.B 1 ; Save 1 byte of memory to track player Aces
playerGreeting DC.B 'Hello Player 1!', 0 ; Message
LF EQU $0A
END START ; End of program and entry point
Try this:
This will insert a carriage return (CR) and line feed (LF) after your message. Basically it tacks on two additional characters to your output string before the null terminator (0).